浏览代码

Mesh: Added serialization/deserialization support for .drawMode

Mugen87 6 年之前
父节点
当前提交
c41d62639c
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 5 0
      src/core/Object3D.js
  2. 2 0
      src/loaders/ObjectLoader.js

+ 5 - 0
src/core/Object3D.js

@@ -6,6 +6,7 @@ import { Euler } from '../math/Euler.js';
 import { Layers } from './Layers.js';
 import { Matrix3 } from '../math/Matrix3.js';
 import { _Math } from '../math/Math.js';
+import { TrianglesDrawMode } from '../constants.js';
 
 /**
  * @author mrdoob / http://mrdoob.com/
@@ -718,6 +719,10 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 		if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
 
+		// object specific properties
+
+		if ( this.isMesh && this.drawMode !== TrianglesDrawMode ) object.drawMode = this.drawMode;
+
 		//
 
 		function serialize( library, element ) {

+ 2 - 0
src/loaders/ObjectLoader.js

@@ -845,6 +845,8 @@ Object.assign( ObjectLoader.prototype, {
 
 				}
 
+				if ( data.drawMode !== undefined ) object.setDrawMode( data.drawMode );
+
 				break;
 
 			case 'LOD':