|
@@ -259,54 +259,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
|
|
|
|
|
|
},
|
|
|
|
|
|
- setFromObject: function ( object ) {
|
|
|
-
|
|
|
- // console.log( 'THREE.BufferGeometry.setFromObject(). Converting', object, this );
|
|
|
-
|
|
|
- const geometry = object.geometry;
|
|
|
-
|
|
|
- if ( object.isPoints || object.isLine ) {
|
|
|
-
|
|
|
- const positions = new Float32BufferAttribute( geometry.vertices.length * 3, 3 );
|
|
|
- const colors = new Float32BufferAttribute( geometry.colors.length * 3, 3 );
|
|
|
-
|
|
|
- this.setAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );
|
|
|
- this.setAttribute( 'color', colors.copyColorsArray( geometry.colors ) );
|
|
|
-
|
|
|
- if ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {
|
|
|
-
|
|
|
- const lineDistances = new Float32BufferAttribute( geometry.lineDistances.length, 1 );
|
|
|
-
|
|
|
- this.setAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.boundingSphere !== null ) {
|
|
|
-
|
|
|
- this.boundingSphere = geometry.boundingSphere.clone();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.boundingBox !== null ) {
|
|
|
-
|
|
|
- this.boundingBox = geometry.boundingBox.clone();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } else if ( object.isMesh ) {
|
|
|
-
|
|
|
- if ( geometry && geometry.isGeometry ) {
|
|
|
-
|
|
|
- this.fromGeometry( geometry );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
setFromPoints: function ( points ) {
|
|
|
|
|
|
const position = [];
|
|
@@ -324,131 +276,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
|
|
|
|
|
|
},
|
|
|
|
|
|
- updateFromObject: function ( object ) {
|
|
|
-
|
|
|
- let geometry = object.geometry;
|
|
|
-
|
|
|
- if ( object.isMesh ) {
|
|
|
-
|
|
|
- let direct = geometry.__directGeometry;
|
|
|
-
|
|
|
- if ( geometry.elementsNeedUpdate === true ) {
|
|
|
-
|
|
|
- direct = undefined;
|
|
|
- geometry.elementsNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( direct === undefined ) {
|
|
|
-
|
|
|
- return this.fromGeometry( geometry );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- direct.verticesNeedUpdate = geometry.verticesNeedUpdate;
|
|
|
- direct.normalsNeedUpdate = geometry.normalsNeedUpdate;
|
|
|
- direct.colorsNeedUpdate = geometry.colorsNeedUpdate;
|
|
|
- direct.uvsNeedUpdate = geometry.uvsNeedUpdate;
|
|
|
- direct.groupsNeedUpdate = geometry.groupsNeedUpdate;
|
|
|
-
|
|
|
- geometry.verticesNeedUpdate = false;
|
|
|
- geometry.normalsNeedUpdate = false;
|
|
|
- geometry.colorsNeedUpdate = false;
|
|
|
- geometry.uvsNeedUpdate = false;
|
|
|
- geometry.groupsNeedUpdate = false;
|
|
|
-
|
|
|
- geometry = direct;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.verticesNeedUpdate === true ) {
|
|
|
-
|
|
|
- const attribute = this.attributes.position;
|
|
|
-
|
|
|
- if ( attribute !== undefined ) {
|
|
|
-
|
|
|
- attribute.copyVector3sArray( geometry.vertices );
|
|
|
- attribute.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.verticesNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.normalsNeedUpdate === true ) {
|
|
|
-
|
|
|
- const attribute = this.attributes.normal;
|
|
|
-
|
|
|
- if ( attribute !== undefined ) {
|
|
|
-
|
|
|
- attribute.copyVector3sArray( geometry.normals );
|
|
|
- attribute.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.normalsNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.colorsNeedUpdate === true ) {
|
|
|
-
|
|
|
- const attribute = this.attributes.color;
|
|
|
-
|
|
|
- if ( attribute !== undefined ) {
|
|
|
-
|
|
|
- attribute.copyColorsArray( geometry.colors );
|
|
|
- attribute.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.colorsNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.uvsNeedUpdate ) {
|
|
|
-
|
|
|
- const attribute = this.attributes.uv;
|
|
|
-
|
|
|
- if ( attribute !== undefined ) {
|
|
|
-
|
|
|
- attribute.copyVector2sArray( geometry.uvs );
|
|
|
- attribute.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.uvsNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.lineDistancesNeedUpdate ) {
|
|
|
-
|
|
|
- const attribute = this.attributes.lineDistance;
|
|
|
-
|
|
|
- if ( attribute !== undefined ) {
|
|
|
-
|
|
|
- attribute.copyArray( geometry.lineDistances );
|
|
|
- attribute.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.lineDistancesNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.groupsNeedUpdate ) {
|
|
|
-
|
|
|
- geometry.computeGroups( object.geometry );
|
|
|
- this.groups = geometry.groups;
|
|
|
-
|
|
|
- geometry.groupsNeedUpdate = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
computeBoundingBox: function () {
|
|
|
|
|
|
if ( this.boundingBox === null ) {
|