From c087c4b39244d8da62aa4119258500b411b79ffc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 17 十二月 2021 14:58:38 +0800
Subject: [PATCH] #

---
 static/js/app.js                         |    6 ++-
 /dev/null                                |   17 --------
 static/img/floor/hardwood2_diffuse.jpg   |    0 
 static/img/floor/hardwood2_roughness.jpg |    0 
 views/index.html                         |    2 
 static/img/floor/hardwood2_bump.jpg      |    0 
 static/js/object/Floor.js                |   95 +++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 100 insertions(+), 20 deletions(-)

diff --git a/static/img/floor/hardwood2_bump.jpg b/static/img/floor/hardwood2_bump.jpg
new file mode 100644
index 0000000..ef37fd3
--- /dev/null
+++ b/static/img/floor/hardwood2_bump.jpg
Binary files differ
diff --git a/static/img/floor/hardwood2_diffuse.jpg b/static/img/floor/hardwood2_diffuse.jpg
new file mode 100644
index 0000000..7cc171b
--- /dev/null
+++ b/static/img/floor/hardwood2_diffuse.jpg
Binary files differ
diff --git a/static/img/floor/hardwood2_roughness.jpg b/static/img/floor/hardwood2_roughness.jpg
new file mode 100644
index 0000000..6ce0af2
--- /dev/null
+++ b/static/img/floor/hardwood2_roughness.jpg
Binary files differ
diff --git a/static/js/app.js b/static/js/app.js
index ed4eedc..9911ce3 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -179,13 +179,16 @@
 			// plane.position.y = - 200;
 			// plane.receiveShadow = true;
 			// this.addObject(plane);
-			//
+
 			// const helper = new THREE.PolarGridHelper( 2000, 100 );
+
 			const helper = new THREE.GridHelper( 8000, 300 );
 			helper.position.y = - 0;
 			helper.material.opacity = 0.25;
 			helper.material.transparent = true;
 			this.addObject( helper );
+
+			// this.addObject(new Floor({position: {}}))
 		}
 		this.initStoreObjects = function (object) {
 			if (this.firstTime === 1) {
@@ -212,7 +215,6 @@
 
 						}
 					}
-
 				}
 			}
 		}
diff --git a/static/js/object/Floor.js b/static/js/object/Floor.js
new file mode 100644
index 0000000..3167c0b
--- /dev/null
+++ b/static/js/object/Floor.js
@@ -0,0 +1,95 @@
+/**
+ * 鍦版澘
+ * @param option
+ * @constructor
+ */
+function Floor(option) {
+    this.length = option.length || 5000;
+    this.width = option.width || 5000;
+    this.height = option.height || 1;
+    this.Name = option.objName;
+
+    this.positionX = option.position.x || 0;
+    this.positionY = option.position.y || 0;
+    this.positionZ = option.position.z || 0;
+    this.style = option.style || {color: 0xFF0000};
+
+    // 鏉愯川
+    // var texture = null;
+    // var material = new THREE.MeshPhongMaterial({map: texture, color: option.style.color});
+    // if (option.style.image != null) {
+    //     texture = new THREE.TextureLoader().load(option.style.image);
+    //     if (option.style.allowRepeat === 1) {
+    //         texture.repeat.x = option.length / 128;
+    //         texture.repeat.y = option.width / 128;
+    //         texture.repeat.y = 5;
+    //         texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
+    //
+    //     }
+    //     material = new THREE.MeshPhongMaterial({map: texture});
+    // }
+
+
+    var floorMat = new THREE.MeshStandardMaterial( {
+        roughness: 0.8,
+        color: 0xffffff,
+        metalness: 0.2,
+        bumpScale: 0.0005
+    } );
+    const textureLoader = new THREE.TextureLoader();
+    textureLoader.load( "../static/img/floor/hardwood2_diffuse.jpg", function ( map ) {
+
+        map.wrapS = THREE.RepeatWrapping;
+        map.wrapT = THREE.RepeatWrapping;
+        map.anisotropy = 4;
+        map.repeat.set( 10, 24 );
+        map.encoding = THREE.sRGBEncoding;
+        floorMat.map = map;
+        floorMat.needsUpdate = true;
+
+    } );
+    textureLoader.load( "../static/img/floor/hardwood2_bump.jpg", function ( map ) {
+
+        map.wrapS = THREE.RepeatWrapping;
+        map.wrapT = THREE.RepeatWrapping;
+        map.anisotropy = 4;
+        map.repeat.set( 10, 24 );
+        floorMat.bumpMap = map;
+        floorMat.needsUpdate = true;
+
+    } );
+    textureLoader.load( "../static/img/floor/hardwood2_roughness.jpg", function ( map ) {
+
+        map.wrapS = THREE.RepeatWrapping;
+        map.wrapT = THREE.RepeatWrapping;
+        map.anisotropy = 4;
+        map.repeat.set( 10, 24 );
+        floorMat.roughnessMap = map;
+        floorMat.needsUpdate = true;
+
+    } );
+
+    const floorGeometry = new THREE.PlaneGeometry( this.length, this.width );
+    const floorMesh = new THREE.Mesh( floorGeometry, floorMat );
+    floorMesh.receiveShadow = true;
+    floorMesh.rotation.x = - Math.PI / 2.0;
+    return floorMesh;
+
+
+    // if (option.style.transparent === 1) {
+    //     material.transparent = true;
+    // }
+    // if (option.style.depthTest === 0) {
+    //     material.depthTest = false;
+    // }
+    // material.opacity = option.style.opacity;
+    // // 妯″瀷
+    // let cubeGeometry = new THREE.BoxGeometry(this.length, this.height, this.width);
+    //
+    // let cube = new THREE.Mesh(cubeGeometry, material);
+    // cube.name = this.Name;
+    // cube.position.x = this.positionX;
+    // cube.position.y = this.positionY;
+    // cube.position.z = this.positionZ;
+    // return cube;
+}
diff --git a/static/js/object/RouteLine.js b/static/js/object/RouteLine.js
deleted file mode 100644
index 4056340..0000000
--- a/static/js/object/RouteLine.js
+++ /dev/null
@@ -1,17 +0,0 @@
-
-// 灏嗘洸绾挎樉绀哄嚭鏉�
-function RouteLine(curve,option) {
-    let points = curve.getPoints(100);
-    let geometry = new THREE.Geometry();
-    //geometry.vertices = curve.getSpacedPoints(100);
-    // 鎶婁粠鏇茬嚎杞ㄨ抗涓婅幏寰楃殑椤剁偣鍧愭爣璧嬪�肩粰鍑犱綍浣�
-    geometry.vertices = points;
-    var material = new THREE.LineBasicMaterial({
-        color: 0x4488ff
-    });
-    let line = new THREE.Line(geometry, material);
-    line.uuid=option.No;
-    line.name=option.Name;
-    line.type="Route";
-    return line;
-}
diff --git a/views/index.html b/views/index.html
index 92ba2f6..45002a5 100644
--- a/views/index.html
+++ b/views/index.html
@@ -20,8 +20,8 @@
 <!--		<script type="text/javascript" src="../static/js/object/StoreShelf.js"></script>-->
 		<script type="text/javascript" src="../static/js/object/StoreGoods.js"></script>
 		<script type="text/javascript" src="../static/js/object/Route.js"></script>
-		<script type="text/javascript" src="../static/js/object/RouteLine.js"></script>
 		<script type="text/javascript" src="../static/js/object/CrnTask.js"></script>
+		<script type="text/javascript" src="../static/js/object/Floor.js"></script>
 		<script type="text/javascript" src="../static/js/lib/btnHide.js"></script>
 	</head>
 	<body style="position: relative">

--
Gitblit v1.9.1