threejs升级了

This commit is contained in:
2024-07-10 02:04:54 +08:00
parent bf1b275dec
commit 13da1d8e16

View File

@@ -183,6 +183,7 @@ export default {
const mesh = new THREE.Mesh(areaGeometry, blockMaterial); const mesh = new THREE.Mesh(areaGeometry, blockMaterial);
that.mapGroup.add(mesh) that.mapGroup.add(mesh)
that.mapGroup.scale.set(scale, scale, scale) that.mapGroup.scale.set(scale, scale, scale)
that.mapGroup.position.set(-3, 0, 0)
that.scene.add(that.mapGroup); that.scene.add(that.mapGroup);
} }
@@ -399,19 +400,19 @@ export default {
bevelOffset: 0, bevelOffset: 0,
bevelSegments: 5 bevelSegments: 5
}); });
textGeometry.translate(1, 2, -3.2) textGeometry.translate(1, 0, 3.2)
textGeometry.rotateX(Math.PI / 3) textGeometry.rotateX(Math.PI / 2)
textGeometry.rotateZ(Math.PI / 2) textGeometry.rotateZ(Math.PI / 2)
textGeometry.computeTangents() textGeometry.computeTangents()
const textMaterial = new THREE.MeshPhongMaterial({color: '#fff'}); const textMaterial = new THREE.MeshPhongMaterial({color: '#fff'});
const text = new THREE.Mesh(textGeometry, textMaterial); const text = new THREE.Mesh(textGeometry, textMaterial);
this.scene.add(text); this.scene.add(text);
const planeGeometry = new THREE.PlaneGeometry(textGeometry.boundingBox.max.x, textGeometry.boundingBox.max.y); // const planeGeometry = new THREE.PlaneGeometry(textGeometry.boundingBox.max.x, textGeometry.boundingBox.max.y);
const planeMaterial = new THREE.MeshBasicMaterial({color: '#07193D', side: THREE.DoubleSide}); // const planeMaterial = new THREE.MeshBasicMaterial({color: '#07193D', side: THREE.DoubleSide});
const plane = new THREE.Mesh(planeGeometry, planeMaterial); // const plane = new THREE.Mesh(planeGeometry, planeMaterial);
plane.position.copy(text.position).add(new THREE.Vector3(0, -textGeometry.boundingBox.max.y, 0)); // plane.position.copy(text.position).add(new THREE.Vector3(0, -textGeometry.boundingBox.max.y, 0));
plane.position.set(0, 0, 0); // plane.position.set(0, 0, 0);
this.scene.add(plane); // this.scene.add(plane);
}) })
// const div = document.createElement("div"); // const div = document.createElement("div");
// div.style.color = "#fff"; // div.style.color = "#fff";