#
luxiaotao1123
2024-03-27 1cfc5cd86a16e3092a72b287b77f5bb509325cab
#
1个文件已修改
50 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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的lookAt
    controls.target = new THREE.Vector3(0, 0, 0)  // 平替 camera的lookAt
    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;
}