packages icon indicating copy to clipboard operation
packages copied to clipboard

three.js has functions missing in externs file

Open Odinodin opened this issue 9 years ago • 3 comments

I think the three.js library has some missing functions in the externs file, but I´ve yet to understand the proper way to encode the functions that are missing in the externs file. Here is what I am experiencing:

I have the following Three.js code:

(let [r (THREE.WebGLRenderer. #js {"canvas" canvas-el
                                     "antialias" true
                                     "alpha" true})]
    (.setClearColor r 0xffffff 0)
    (.setSize r width height)
    r)

This works fine in non-advanced compilation but fails when using :advanced.

This is what is generated with :advanced

{var pp,qp=new THREE.WebGLRenderer({canvas:gp,antialias:!0,alpha:!0});qp.zd(16777215,0);qp.Ad(hp,ip);pp=qp}

This is the error in the browser console:

Uncaught TypeError: qp.zd is not a function

The three.ext.js file contains the following:

"WebGLRenderer": function () {},

The three.js file contains the following:

THREE.WebGLRenderer = function ( parameters ) {
     // Lots of stuff

    this.setClearColor = function ( color, alpha ) { ... }

}

How is the externs file supposed to look like in order to keep the setClearColor function?

Odinodin avatar Nov 10 '15 20:11 Odinodin

I figured it out, there are indeed lots of functions and variables missing in the three.js externs file. I'll submit a pull request once I find a way to automatically identify the missing elements.

Odinodin avatar Nov 11 '15 18:11 Odinodin

Three.js has was updated recently and the externs re-generated. But looks like for example setClearColor is still missing: https://github.com/cljsjs/packages/commit/3993894ef2635cdf29adae438b30a142cbf54b37

@harrio Have you had problems with the generated externs?

Deraen avatar May 11 '16 08:05 Deraen

No. So probably didn't use the affected stuff. Three.js seems to be problematic for extern generators: issue Even if I didn't use that generator here. Maybe the missing stuff has to be added manually.

harrio avatar May 11 '16 12:05 harrio