[3d] some general improvement (#2714)

This commit is contained in:
Terry Jia
2025-02-24 14:57:36 -05:00
committed by GitHub
parent 1a9d6aca7d
commit 7f98342492
5 changed files with 17 additions and 5 deletions

View File

@@ -559,6 +559,6 @@ onUnmounted(() => {
})
const getCameraIcon = computed(() => {
return props.cameraType === 'perspective' ? 'pi-camera' : 'pi-th-large'
return props.cameraType === 'perspective' ? 'pi-camera' : 'pi-camera'
})
</script>

View File

@@ -29,7 +29,7 @@ export class CameraManager implements CameraManagerInterface {
}
DEFAULT_PERSPECTIVE_CAMERA = {
fov: 75,
fov: 35,
aspect: 1
}
@@ -99,6 +99,11 @@ export class CameraManager implements CameraManagerInterface {
const rotation = oldCamera.rotation.clone()
const target = this.controls?.target.clone() || new THREE.Vector3()
const oldZoom =
oldCamera instanceof THREE.OrthographicCamera
? oldCamera.zoom
: (oldCamera as THREE.PerspectiveCamera).zoom
if (!cameraType) {
this.activeCamera =
oldCamera === this.perspectiveCamera
@@ -118,6 +123,14 @@ export class CameraManager implements CameraManagerInterface {
this.activeCamera.position.copy(position)
this.activeCamera.rotation.copy(rotation)
if (this.activeCamera instanceof THREE.OrthographicCamera) {
this.activeCamera.zoom = oldZoom
this.activeCamera.updateProjectionMatrix()
} else if (this.activeCamera instanceof THREE.PerspectiveCamera) {
this.activeCamera.zoom = oldZoom
this.activeCamera.updateProjectionMatrix()
}
if (this.controls) {
this.controls.object = this.activeCamera
this.controls.target.copy(target)

View File

@@ -72,7 +72,7 @@ class Load3DConfiguration {
this.load3d.setLightIntensity(lightIntensity)
const fov = this.load3d.loadNodeProperty('FOV', 75)
const fov = this.load3d.loadNodeProperty('FOV', 35)
this.load3d.setFOV(fov)

View File

@@ -152,7 +152,6 @@ export class ModelManager implements ModelManagerInterface {
transparent: false,
opacity: 1.0
})
child.geometry.computeVertexNormals()
break
case 'wireframe':

View File

@@ -32,7 +32,7 @@ export class SceneManager implements SceneManagerInterface {
this.getActiveCamera = getActiveCamera
this.getControls = getControls
this.gridHelper = new THREE.GridHelper(10, 10)
this.gridHelper = new THREE.GridHelper(20, 20)
this.gridHelper.position.set(0, 0, 0)
this.scene.add(this.gridHelper)