提交 8a20620a 编写于 作者: O OpenShift guest

update the meshfacematerial to allow materialdefinition in material

上级 8b047873
......@@ -2,7 +2,12 @@
* @author mrdoob / http://mrdoob.com/
*/
THREE.MeshFaceMaterial = function () {};
THREE.MeshFaceMaterial = function (materials) {
this.useGeometryMaterial = !materials;
this.materials = materials !== undefined ? materials : [];
};
THREE.MeshFaceMaterial.prototype.clone = function () {
......
......@@ -894,9 +894,17 @@ THREE.WebGLRenderer = function ( parameters ) {
return object.material;
} else if ( geometryGroup.materialIndex >= 0 ) {
} else if ( geometryGroup.materialIndex >= 0 ) { // what does this line prevent??
return object.geometry.materials[ geometryGroup.materialIndex ];
if (object.material instanceof THREE.MeshFaceMaterial && !object.material.useGeometryMaterial){
return object.material.materials[ geometryGroup.materialIndex ];
} else {
return object.geometry.materials[ geometryGroup.materialIndex ];
}
}
......@@ -4159,9 +4167,16 @@ THREE.WebGLRenderer = function ( parameters ) {
materialIndex = buffer.materialIndex;
if ( materialIndex >= 0 ) {
material = object.geometry.materials[ materialIndex ];
if (meshMaterial.useGeometryMaterial){
material = object.geometry.materials[ materialIndex ];
} else {
material = meshMaterial.materials[ materialIndex ];
}
if ( material.transparent ) {
globject.transparent = material;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册