提交 22205eff 编写于 作者: A alteredq

Fixed handling of MeshFaceMaterial when material indices were not set in faces.

This happens when you use MeshFaceMaterial for a single material model (that's what was going on in Lucy example).

Alternatively, we could set face.materialIndex by default to 0 instead of "undefined". This kinda makes sense, just would need to be checked if it wouldn't break things.
上级 d951fcbc
......@@ -292,11 +292,7 @@ THREE.Clock.prototype.getDelta = function () {
THREE.Color = function ( value ) {
if ( value !== undefined ) {
this.set( value );
}
if ( value !== undefined ) this.set( value );
return this;
......@@ -509,6 +505,30 @@ THREE.Color.prototype = {
}
// #ff0000
if ( /^\#([0-9a-f]{6})$/i.test( style ) ) {
var color = /^\#([0-9a-f]{6})$/i.exec( style );
this.setHex( parseInt( color[ 1 ], 16 ) );
return this;
}
// #f00
if ( /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test( style ) ) {
var color = /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec( style );
this.setHex( parseInt( color[ 1 ] + color[ 1 ] + color[ 2 ] + color[ 2 ] + color[ 3 ] + color[ 3 ], 16 ) );
return this;
}
// red
if ( /^(\w+)$/i.test( style ) ) {
......@@ -16577,7 +16597,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function getBufferMaterial( object, geometryGroup ) {
return object.material instanceof THREE.MeshFaceMaterial
? object.material.materials[ geometryGroup.materialIndex ]
? object.material.materials[ geometryGroup.materialIndex !== undefined ? geometryGroup.materialIndex : 0 ]
: object.material;
};
......@@ -19950,23 +19970,19 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( meshMaterial instanceof THREE.MeshFaceMaterial ) {
materialIndex = buffer.materialIndex;
materialIndex = buffer.materialIndex !== undefined ? buffer.materialIndex : 0;
if ( materialIndex >= 0 ) {
material = meshMaterial.materials[ materialIndex ];
if ( material.transparent ) {
material = meshMaterial.materials[ materialIndex ];
globject.transparent = material;
globject.opaque = null;
if ( material.transparent ) {
} else {
globject.transparent = material;
globject.opaque = null;
globject.opaque = material;
globject.transparent = null;
} else {
}
globject.opaque = material;
globject.transparent = null;
}
......
此差异已折叠。
......@@ -901,7 +901,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function getBufferMaterial( object, geometryGroup ) {
return object.material instanceof THREE.MeshFaceMaterial
? object.material.materials[ geometryGroup.materialIndex ]
? object.material.materials[ geometryGroup.materialIndex !== undefined ? geometryGroup.materialIndex : 0 ]
: object.material;
};
......@@ -4274,23 +4274,19 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( meshMaterial instanceof THREE.MeshFaceMaterial ) {
materialIndex = buffer.materialIndex;
materialIndex = buffer.materialIndex !== undefined ? buffer.materialIndex : 0;
if ( materialIndex >= 0 ) {
material = meshMaterial.materials[ materialIndex ];
material = meshMaterial.materials[ materialIndex ];
if ( material.transparent ) {
if ( material.transparent ) {
globject.transparent = material;
globject.opaque = null;
} else {
globject.transparent = material;
globject.opaque = null;
globject.opaque = material;
globject.transparent = null;
} else {
}
globject.opaque = material;
globject.transparent = null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册