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