From a62854c555528aea050bbbc53273acbca7b483a7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 26 十一月 2021 11:14:22 +0800
Subject: [PATCH] #

---
 static/js/app.js |  149 +++++++++++++++++++++++++------------------------
 1 files changed, 76 insertions(+), 73 deletions(-)

diff --git a/static/js/app.js b/static/js/app.js
index 70f8577..b5d9039 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -36,6 +36,7 @@
 			this.renderer.render(this.scene, this.camera);
 			this.stats.end();
 			this.initStoreObjects(this);
+			this.modelMove();
 		}
 		this.initScene = function () {
 			this.scene = new THREE.Scene();
@@ -131,7 +132,7 @@
 				"posy.jpg", "negy.jpg",
 				"posz.jpg", "negz.jpg"
 			]);
-			this.scene.background = new THREE.Color( 0xf0f0f0 );
+			// this.scene.background = new THREE.Color( 0xf0f0f0 );
 		}
 		this.removeObject = function (nameorid) {
 			for (let i = 0; i < this.objects.length; i++) {
@@ -161,78 +162,6 @@
 			helper.material.opacity = 0.25;
 			helper.material.transparent = true;
 			this.addObject( helper );
-		}
-		this.initModel = function () {
-			let that = this;
-			// let object;
-			// const onProgress = function ( xhr ) {
-			// 	if ( xhr.lengthComputable ) {
-			// 		const percentComplete = xhr.loaded / xhr.total * 100;
-			// 		console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
-			// 	}
-			// };
-			// const onError = function () { };
-			// function loadModel() {
-			// 	object.traverse( function ( child ) {
-			// 		if ( child.isMesh ) child.material.map = texture;
-			// 	} );
-			// 	object.position.y = 195;
-			// 	that.addObject( object );
-			// }
-			// const manager = new THREE.LoadingManager(loadModel);
-			// const textureLoader = new THREE.TextureLoader( manager );
-			// const texture = textureLoader.load( '../static/model/obj/uv_grid_opengl.jpg' );
-			// const loader = new OBJLoader( manager );
-			// loader.load( '../static/model/obj/AGV.obj', function ( obj ) {
-			// 	object = obj;
-			// }, onProgress, onError );
-			const manager = new THREE.LoadingManager();
-			// manager.addHandler( /\.dds$/i, new DDSLoader() );
-			new MTLLoader(manager)
-				.setPath( '../static/model/obj/' )
-				.load( '璐у弶.mtl', function ( materials ) {
-					materials.preload();
-					new OBJLoader( manager )
-						.setMaterials( materials )
-						.setPath( '../static/model/obj/' )
-						.load( '璐у弶.obj', function ( object ) {
-							object.position.z = -500;
-							object.position.x = -1560;
-							object.scale.set(0.025, 0.025, 0.025);
-							object.rotateY(- Math.PI / 2)
-							that.addObject( object );
-						}, null, null );
-			});
-			new MTLLoader(manager)
-				.setPath( '../static/model/obj/' )
-				.load( '杞借揣鍙�.mtl', function ( materials ) {
-					materials.preload();
-					new OBJLoader( manager )
-						.setMaterials( materials )
-						.setPath( '../static/model/obj/' )
-						.load( '杞借揣鍙�.obj', function ( object ) {
-							object.position.z = -500;
-							object.position.x = -1560;
-							object.scale.set(0.025, 0.025, 0.025);
-							object.rotateY(- Math.PI / 2)
-							that.addObject( object );
-						}, null, null );
-				});
-			new MTLLoader(manager)
-				.setPath( '../static/model/obj/' )
-				.load( '鍫嗗灈鏈烘湰浣�.mtl', function ( materials ) {
-					materials.preload();
-					new OBJLoader( manager )
-						.setMaterials( materials )
-						.setPath( '../static/model/obj/' )
-						.load( '鍫嗗灈鏈烘湰浣�.obj', function ( object ) {
-							object.position.z = -500;
-							object.position.x = -1560;
-							object.scale.set(0.025, 0.025, 0.025);
-							object.rotateY(- Math.PI / 2)
-							that.addObject( object );
-						}, null, null );
-				});
 		}
 		this.initStoreObjects = function (object) {
 			if (this.firstTime === 1) {
@@ -286,6 +215,80 @@
 				}
 			}
 			return null;
+		}
+		this.initModel = function () {
+			let that = this;
+			// let object;
+			// const onProgress = function ( xhr ) {
+			// 	if ( xhr.lengthComputable ) {
+			// 		const percentComplete = xhr.loaded / xhr.total * 100;
+			// 		console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
+			// 	}
+			// };
+			// const onError = function () { };
+			// function loadModel() {
+			// 	object.traverse( function ( child ) {
+			// 		if ( child.isMesh ) child.material.map = texture;
+			// 	} );
+			// 	object.position.y = 195;
+			// 	that.addObject( object );
+			// }
+			// const manager = new THREE.LoadingManager(loadModel);
+			// const textureLoader = new THREE.TextureLoader( manager );
+			// const texture = textureLoader.load( '../static/model/obj/uv_grid_opengl.jpg' );
+			// const loader = new OBJLoader( manager );
+			// loader.load( '../static/model/obj/AGV.obj', function ( obj ) {
+			// 	object = obj;
+			// }, onProgress, onError );
+			const manager = new THREE.LoadingManager();
+			// manager.addHandler( /\.dds$/i, new DDSLoader() );
+			new MTLLoader(manager)
+				.setPath( '../static/model/obj/' )
+				.load( '璐у弶.mtl', function ( materials ) {
+					materials.preload();
+					new OBJLoader( manager )
+						.setMaterials( materials )
+						.setPath( '../static/model/obj/' )
+						.load( '璐у弶.obj', function ( object ) {
+							object.position.z = -500;
+							object.position.x = -2060;
+							object.scale.set(0.025, 0.025, 0.025);
+							object.rotateY(- Math.PI / 2)
+							that.addObject( object );
+						}, null, null );
+				});
+			new MTLLoader(manager)
+				.setPath( '../static/model/obj/' )
+				.load( '杞借揣鍙�.mtl', function ( materials ) {
+					materials.preload();
+					new OBJLoader( manager )
+						.setMaterials( materials )
+						.setPath( '../static/model/obj/' )
+						.load( '杞借揣鍙�.obj', function ( object ) {
+							object.position.z = -500;
+							object.position.x = -2060;
+							object.scale.set(0.025, 0.025, 0.025);
+							object.rotateY(- Math.PI / 2)
+							that.addObject( object );
+						}, null, null );
+				});
+			new MTLLoader(manager)
+				.setPath( '../static/model/obj/' )
+				.load( '鍫嗗灈鏈烘湰浣�.mtl', function ( materials ) {
+					materials.preload();
+					new OBJLoader( manager )
+						.setMaterials( materials )
+						.setPath( '../static/model/obj/' )
+						.load( '鍫嗗灈鏈烘湰浣�.obj', function ( object ) {
+							object.position.z = -500;
+							object.position.x = -2060;
+							object.scale.set(0.025, 0.025, 0.025);
+							object.rotateY(- Math.PI / 2)
+							that.addObject( object );
+						}, null, null );
+				});
+		}
+		this.modelMove = function () {
 
 		}
 	},

--
Gitblit v1.9.1