From fcd729614d47565ec968f9f5205c0d69c52f88c6 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期三, 08 十二月 2021 08:39:28 +0800
Subject: [PATCH] #
---
static/js/app.js | 120 +++++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 78 insertions(+), 42 deletions(-)
diff --git a/static/js/app.js b/static/js/app.js
index 88fc6cb..b5d9039 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -28,7 +28,7 @@
this.initStats();
this.initLight();
this.initFloor();
- // this.initModel();
+ this.initModel();
}
this.animate = function () {
requestAnimationFrame(this.animate.bind(this));
@@ -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();
@@ -46,7 +47,7 @@
// 绾垫í姣攁spect:鍏ㄥ睆锛屼娇鐢ㄧ殑鏄祻瑙堝櫒鐨勫搴�/楂樺害
//杩戝钩闈ear锛�0.1
//杩滃钩闈㈣瑙抐ar:10000
- this.camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 10000);
+ this.camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 50000);
/*
璁剧疆鐩告満浣嶇疆锛屾敞鎰弔hreejs涓殑鍧愭爣绯婚噰鐢ㄧ殑鏄彸鎵嬪潗鏍囩郴
*/
@@ -162,45 +163,6 @@
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( 'AGV.obj', function ( object ) {
- object.position.y = 0;
- that.addObject( object );
- }, null, null );
- });
- }
this.initStoreObjects = function (object) {
if (this.firstTime === 1) {
if (Store3DData !== null) {
@@ -214,7 +176,7 @@
let optionStore = optionArea.Stores[j];
optionStore.Position = CommonFunction.transPosition(optionStore.Position, optionArea.Position);
let store = new Store(optionStore);
- object.addObject(store);
+ // object.addObject(store);
//鏄剧ず姣忚淇℃伅
for (let k = 0; k < optionStore.Groups.length; k++) {
let optionGroup = optionStore.Groups[k];
@@ -253,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