From 49a91016f3da4a779cbbc3f7b18571cf4472c5ae Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 28 三月 2024 08:36:26 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js | 50 ++++++++++++++++++++++----------------------------
1 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
index b3f856f..6d463f6 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -5,8 +5,8 @@
const help = false;
const debugCamera = {
- x: 100,
- y: 300,
+ x: 200,
+ y: 200,
z: 200
}
@@ -14,6 +14,7 @@
constructor(dom) {
const { current: container } = dom;
+ console.log(container);
this.scene = initScene();
this.camera = initCamera(this.scene);
this.renderer = initRenderer(container);
@@ -108,7 +109,7 @@
const initScene = () => {
const scene = new THREE.Scene();
// scene.background = new THREE.Color(0xf0f0f0);
- scene.background = new THREE.Color(0x333333);
+ // scene.background = new THREE.Color(0x333333);
if (help) {
scene.add(new THREE.AxesHelper(1000));
}
@@ -161,7 +162,7 @@
// this.renderer.toneMapping = THREE.ReinhardToneMapping;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.setPixelRatio(window.devicePixelRatio);
- renderer.setSize(window.innerWidth, window.innerHeight);
+ renderer.setSize(300, 500);
container.appendChild(renderer.domElement);
return renderer;
}
@@ -180,7 +181,7 @@
controls.rotateSpeed = 0.6; // 瑙嗚绉诲姩閫熷害鍑忔參
// controls.autoRotate = true; // 鑷姩鏃嬭浆
- controls.target = new THREE.Vector3(debugCamera.x, 0, debugCamera.z) // 骞虫浛 camera鐨刲ookAt
+ controls.target = new THREE.Vector3(0, 0, 0) // 骞虫浛 camera鐨刲ookAt
return controls;
}
@@ -188,7 +189,7 @@
window.addEventListener('resize', function () {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
- renderer.setSize(window.innerWidth, window.innerHeight);
+ renderer.setSize(100, 500);
}, false);
}
@@ -202,27 +203,20 @@
}
const buildFloor = (scene) => {
- // const size = 10000;
- // const divisions = 100;
- // const helper = new THREE.GridHelper(size, divisions);
- // helper.position.x = size / 2;
- // helper.position.z = size / 2;
- // helper.material.opacity = 0.25;
- // helper.material.transparent = true;
- // scene.add(helper);
- // return helper;
+ const boxGeometry = new THREE.BoxGeometry(100, 100, 100); // 216涓洪暱搴︼紝10涓哄搴︼紝10涓洪珮搴�
+ const boxMaterial = new THREE.MeshBasicMaterial({ color: 0x40739e });
+ const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
+ boxMesh.position.set(0, 0, 0); // 鏍规嵁浣犵殑闇�姹傝缃綅缃�
+ scene.add(boxMesh)
+ return boxMesh;
- const width = 3500;
- const length = 7500;
- const floorGeometry = new THREE.BoxGeometry(width, 1, length); // 216涓洪暱搴︼紝10涓哄搴︼紝10涓洪珮搴�
- const floorMaterial = new THREE.MeshBasicMaterial({
- color: 0xffffff,
- transparent: true,
- opacity: 0.1,
- });
- const floorMesh = new THREE.Mesh(floorGeometry, floorMaterial);
- floorMesh.position.set(width / 2, -1, length / 2); // 鏍规嵁浣犵殑闇�姹傝缃綅缃�
- floorMesh.name = 'floor';
- scene.add(floorMesh);
- return floorMesh;
+ const size = 100;
+ const divisions = 100;
+ const helper = new THREE.GridHelper(size, divisions);
+ helper.position.x = size / 2;
+ helper.position.z = size / 2;
+ helper.material.opacity = 0.25;
+ helper.material.transparent = true;
+ scene.add(helper);
+ return helper;
}
\ No newline at end of file
--
Gitblit v1.9.1