|
@@ -1006,6 +1006,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
if ( material.visible === false ) return;
|
|
if ( material.visible === false ) return;
|
|
|
|
|
|
|
|
+ setMaterial( material );
|
|
|
|
+
|
|
var geometry = objects.geometries.get( object );
|
|
var geometry = objects.geometries.get( object );
|
|
var program = setProgram( camera, lights, fog, material, object );
|
|
var program = setProgram( camera, lights, fog, material, object );
|
|
|
|
|
|
@@ -1606,8 +1608,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
var overrideMaterial = scene.overrideMaterial;
|
|
var overrideMaterial = scene.overrideMaterial;
|
|
|
|
|
|
- setMaterial( overrideMaterial );
|
|
|
|
-
|
|
|
|
renderObjects( opaqueObjects, camera, lights, fog, overrideMaterial );
|
|
renderObjects( opaqueObjects, camera, lights, fog, overrideMaterial );
|
|
renderObjects( transparentObjects, camera, lights, fog, overrideMaterial );
|
|
renderObjects( transparentObjects, camera, lights, fog, overrideMaterial );
|
|
renderObjectsImmediate( objects.objectsImmediate, '', camera, lights, fog, overrideMaterial );
|
|
renderObjectsImmediate( objects.objectsImmediate, '', camera, lights, fog, overrideMaterial );
|
|
@@ -1727,7 +1727,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
function renderObjects( renderList, camera, lights, fog, overrideMaterial ) {
|
|
function renderObjects( renderList, camera, lights, fog, overrideMaterial ) {
|
|
|
|
|
|
- var material;
|
|
|
|
|
|
+ var material = overrideMaterial;
|
|
|
|
|
|
for ( var i = 0, l = renderList.length; i < l; i ++ ) {
|
|
for ( var i = 0, l = renderList.length; i < l; i ++ ) {
|
|
|
|
|
|
@@ -1737,21 +1737,22 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
setupMatrices( object, camera );
|
|
setupMatrices( object, camera );
|
|
|
|
|
|
- if ( overrideMaterial ) {
|
|
|
|
|
|
+ if ( overrideMaterial === null ) material = object.material;
|
|
|
|
|
|
- material = overrideMaterial;
|
|
|
|
|
|
+ if ( material instanceof THREE.MeshFaceMaterial ) {
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ var materials = material.materials;
|
|
|
|
|
|
- material = object.material;
|
|
|
|
|
|
+ for ( var j = 0, jl = materials.length; j < jl; j ++ ) {
|
|
|
|
|
|
- if ( ! material ) continue;
|
|
|
|
|
|
+ _this.renderBufferDirect( camera, lights, fog, materials[ j ], object );
|
|
|
|
|
|
- setMaterial( material );
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ continue;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- _this.setMaterialFaces( material );
|
|
|
|
_this.renderBufferDirect( camera, lights, fog, material, object );
|
|
_this.renderBufferDirect( camera, lights, fog, material, object );
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1760,7 +1761,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) {
|
|
function renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) {
|
|
|
|
|
|
- var material;
|
|
|
|
|
|
+ var material = overrideMaterial;
|
|
|
|
|
|
for ( var i = 0, l = renderList.length; i < l; i ++ ) {
|
|
for ( var i = 0, l = renderList.length; i < l; i ++ ) {
|
|
|
|
|
|
@@ -1769,19 +1770,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
if ( object.visible === true ) {
|
|
if ( object.visible === true ) {
|
|
|
|
|
|
- if ( overrideMaterial ) {
|
|
|
|
-
|
|
|
|
- material = overrideMaterial;
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- material = webglObject[ materialType ];
|
|
|
|
-
|
|
|
|
- if ( ! material ) continue;
|
|
|
|
-
|
|
|
|
- setMaterial( material );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ if ( overrideMaterial === null ) material = webglObject[ materialType ];
|
|
|
|
|
|
_this.renderImmediateObject( camera, lights, fog, material, object );
|
|
_this.renderImmediateObject( camera, lights, fog, material, object );
|
|
|
|
|
|
@@ -1793,12 +1782,12 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
this.renderImmediateObject = function ( camera, lights, fog, material, object ) {
|
|
this.renderImmediateObject = function ( camera, lights, fog, material, object ) {
|
|
|
|
|
|
|
|
+ setMaterial( material );
|
|
|
|
+
|
|
var program = setProgram( camera, lights, fog, material, object );
|
|
var program = setProgram( camera, lights, fog, material, object );
|
|
|
|
|
|
_currentGeometryProgram = '';
|
|
_currentGeometryProgram = '';
|
|
|
|
|
|
- _this.setMaterialFaces( material );
|
|
|
|
-
|
|
|
|
if ( object.immediateRenderCallback ) {
|
|
if ( object.immediateRenderCallback ) {
|
|
|
|
|
|
object.immediateRenderCallback( program, _gl, _frustum );
|
|
object.immediateRenderCallback( program, _gl, _frustum );
|
|
@@ -2048,6 +2037,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
function setMaterial( material ) {
|
|
function setMaterial( material ) {
|
|
|
|
|
|
|
|
+ setMaterialFaces( material );
|
|
|
|
+
|
|
if ( material.transparent === true ) {
|
|
if ( material.transparent === true ) {
|
|
|
|
|
|
state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
|
|
state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );
|
|
@@ -2066,6 +2057,13 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function setMaterialFaces( material ) {
|
|
|
|
+
|
|
|
|
+ state.setDoubleSided( material.side === THREE.DoubleSide );
|
|
|
|
+ state.setFlipSided( material.side === THREE.BackSide );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
function setProgram( camera, lights, fog, material, object ) {
|
|
function setProgram( camera, lights, fog, material, object ) {
|
|
|
|
|
|
_usedTextureUnits = 0;
|
|
_usedTextureUnits = 0;
|
|
@@ -3150,12 +3148,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- this.setMaterialFaces = function ( material ) {
|
|
|
|
-
|
|
|
|
- state.setDoubleSided( material.side === THREE.DoubleSide );
|
|
|
|
- state.setFlipSided( material.side === THREE.BackSide );
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
|
|
+ this.setMaterialFaces = setMaterialFaces;
|
|
|
|
|
|
// Textures
|
|
// Textures
|
|
|
|
|