|
@@ -4485,7 +4485,23 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) {
|
|
for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) {
|
|
|
|
|
|
- updateObject( scene.__webglObjects[ o ].object );
|
|
|
|
|
|
+ var object = scene.__webglObjects[ o ].object;
|
|
|
|
+
|
|
|
|
+ // TODO: Remove this hack (WebGLRenderer refactoring)
|
|
|
|
+
|
|
|
|
+ if ( object.__webglInit === undefined ) {
|
|
|
|
+
|
|
|
|
+ if ( object.__webglActive !== undefined ) {
|
|
|
|
+
|
|
|
|
+ removeObject( object, scene );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ addObject( object, scene );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ updateObject( object );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4493,11 +4509,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
// Objects adding
|
|
// Objects adding
|
|
|
|
|
|
- function addObject ( object, scene ) {
|
|
|
|
|
|
+ function addObject( object, scene ) {
|
|
|
|
|
|
var g, geometry, material, geometryGroup;
|
|
var g, geometry, material, geometryGroup;
|
|
|
|
|
|
- if ( ! object.__webglInit ) {
|
|
|
|
|
|
+ if ( object.__webglInit === undefined ) {
|
|
|
|
|
|
object.__webglInit = true;
|
|
object.__webglInit = true;
|
|
|
|
|
|
@@ -4598,7 +4614,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( ! object.__webglActive ) {
|
|
|
|
|
|
+ if ( object.__webglActive === undefined ) {
|
|
|
|
|
|
if ( object instanceof THREE.Mesh ) {
|
|
if ( object instanceof THREE.Mesh ) {
|
|
|
|
|
|
@@ -4647,7 +4663,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- function addBuffer ( objlist, buffer, object ) {
|
|
|
|
|
|
+ function addBuffer( objlist, buffer, object ) {
|
|
|
|
|
|
objlist.push(
|
|
objlist.push(
|
|
{
|
|
{
|
|
@@ -4660,7 +4676,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- function addBufferImmediate ( objlist, object ) {
|
|
|
|
|
|
+ function addBufferImmediate( objlist, object ) {
|
|
|
|
|
|
objlist.push(
|
|
objlist.push(
|
|
{
|
|
{
|
|
@@ -4674,7 +4690,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
// Objects updates
|
|
// Objects updates
|
|
|
|
|
|
- function updateObject ( object ) {
|
|
|
|
|
|
+ function updateObject( object ) {
|
|
|
|
|
|
var geometry = object.geometry,
|
|
var geometry = object.geometry,
|
|
geometryGroup, customAttributesDirty, material;
|
|
geometryGroup, customAttributesDirty, material;
|
|
@@ -4783,7 +4799,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
// Objects updates - custom attributes check
|
|
// Objects updates - custom attributes check
|
|
|
|
|
|
- function areCustomAttributesDirty ( material ) {
|
|
|
|
|
|
+ function areCustomAttributesDirty( material ) {
|
|
|
|
|
|
for ( var a in material.attributes ) {
|
|
for ( var a in material.attributes ) {
|
|
|
|
|
|
@@ -4795,7 +4811,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- function clearCustomAttributes ( material ) {
|
|
|
|
|
|
+ function clearCustomAttributes( material ) {
|
|
|
|
|
|
for ( var a in material.attributes ) {
|
|
for ( var a in material.attributes ) {
|
|
|
|
|
|
@@ -4807,7 +4823,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
// Objects removal
|
|
// Objects removal
|
|
|
|
|
|
- function removeObject ( object, scene ) {
|
|
|
|
|
|
+ function removeObject( object, scene ) {
|
|
|
|
|
|
if ( object instanceof THREE.Mesh ||
|
|
if ( object instanceof THREE.Mesh ||
|
|
object instanceof THREE.ParticleSystem ||
|
|
object instanceof THREE.ParticleSystem ||
|
|
@@ -4830,11 +4846,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- object.__webglActive = false;
|
|
|
|
|
|
+ delete object.__webglActive;
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- function removeInstances ( objlist, object ) {
|
|
|
|
|
|
+ function removeInstances( objlist, object ) {
|
|
|
|
|
|
for ( var o = objlist.length - 1; o >= 0; o -- ) {
|
|
for ( var o = objlist.length - 1; o >= 0; o -- ) {
|
|
|
|
|
|
@@ -4848,7 +4864,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- function removeInstancesDirect ( objlist, object ) {
|
|
|
|
|
|
+ function removeInstancesDirect( objlist, object ) {
|
|
|
|
|
|
for ( var o = objlist.length - 1; o >= 0; o -- ) {
|
|
for ( var o = objlist.length - 1; o >= 0; o -- ) {
|
|
|
|
|