Closed alexcasalboni closed 11 years ago
i would say the bug is in three.js :) because i think all material should inherit from THREE.Material but it would not help you much.
i will simply change the assert
there tell me if it fit your need
Thank you very much, but actually the main benefit would come from editing here so that it will work simply using tQuery.createCube(multipleMaterial)
.
By the way, you're right: the problem seems to be about THREE.MeshFaceMaterial prototype definition, since there is no prototype inheritance:
THREE.MeshFaceMaterial = function ( materials ) {
this.materials = materials instanceof Array ? materials : [];
};
THREE.MeshFaceMaterial.prototype.clone = function () {
return new THREE.MeshFaceMaterial( this.materials.slice( 0 ) );
};
There should be something similar to THREE.MeshFaceMaterial.prototype = Object.create( THREE.Material.prototype );
.
I know that adding multiple inheritance checks all around the library is not very elegant, I will report this issue asap.
Thank you again
i did it this way to reduce the 'spreading bug workaround' effect you talked about
If you check the issue I've opened, it looks like it is an intended behaviour, since THREE.MeshFaceMaterial
is just a container for multiple materials.
I don't think they're going to make it inherit from THREE.Material
.
This check doesn't allow me to use THREE.MeshFaceMaterial with a cube instance:
And actually the same happens here: without it I could directly call
createCube(multipleMaterial)
.It looks like
instanceof
does not work well as a check here. Is it a bug or an intended limitation? Thank you