提交 8360b2ec 编写于 作者: M Mr.doob

Updated builds.

上级 ce14abbf
......@@ -12739,10 +12739,21 @@ THREE.Mesh = function ( geometry, material ) {
THREE.Object3D.call( this );
this.geometry = geometry;
this.material = ( material !== undefined ) ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
this.geometry = null;
this.material = null;
this.setGeometry( geometry );
this.setMaterial( material );
};
THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
THREE.Mesh.prototype.setGeometry = function ( geometry ) {
if ( this.geometry !== undefined ) {
if ( geometry !== undefined ) {
this.geometry = geometry;
if ( this.geometry.boundingSphere === null ) {
......@@ -12756,7 +12767,19 @@ THREE.Mesh = function ( geometry, material ) {
};
THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
THREE.Mesh.prototype.setMaterial = function ( material ) {
if ( material !== undefined ) {
this.material = material;
} else {
this.material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: true } );
}
};
THREE.Mesh.prototype.updateMorphTargets = function () {
......@@ -22579,7 +22602,23 @@ THREE.WebGLRenderer = function ( parameters ) {
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 );
}
......@@ -22587,11 +22626,11 @@ THREE.WebGLRenderer = function ( parameters ) {
// Objects adding
function addObject ( object, scene ) {
function addObject( object, scene ) {
var g, geometry, material, geometryGroup;
if ( ! object.__webglInit ) {
if ( object.__webglInit === undefined ) {
object.__webglInit = true;
......@@ -22692,7 +22731,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if ( ! object.__webglActive ) {
if ( object.__webglActive === undefined ) {
if ( object instanceof THREE.Mesh ) {
......@@ -22741,7 +22780,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function addBuffer ( objlist, buffer, object ) {
function addBuffer( objlist, buffer, object ) {
objlist.push(
{
......@@ -22754,7 +22793,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function addBufferImmediate ( objlist, object ) {
function addBufferImmediate( objlist, object ) {
objlist.push(
{
......@@ -22768,7 +22807,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// Objects updates
function updateObject ( object ) {
function updateObject( object ) {
var geometry = object.geometry,
geometryGroup, customAttributesDirty, material;
......@@ -22877,7 +22916,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// Objects updates - custom attributes check
function areCustomAttributesDirty ( material ) {
function areCustomAttributesDirty( material ) {
for ( var a in material.attributes ) {
......@@ -22889,7 +22928,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function clearCustomAttributes ( material ) {
function clearCustomAttributes( material ) {
for ( var a in material.attributes ) {
......@@ -22901,7 +22940,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// Objects removal
function removeObject ( object, scene ) {
function removeObject( object, scene ) {
if ( object instanceof THREE.Mesh ||
object instanceof THREE.ParticleSystem ||
......@@ -22924,11 +22963,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 -- ) {
......@@ -22942,7 +22981,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function removeInstancesDirect ( objlist, object ) {
function removeInstancesDirect( objlist, object ) {
for ( var o = objlist.length - 1; o >= 0; o -- ) {
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册