Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3d] some general improvement #2714

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/load3d/Load3DControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
15 changes: 14 additions & 1 deletion src/extensions/core/load3d/CameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class CameraManager implements CameraManagerInterface {
}

DEFAULT_PERSPECTIVE_CAMERA = {
fov: 75,
fov: 35,
aspect: 1
}

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/core/load3d/Load3DConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion src/extensions/core/load3d/ModelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export class ModelManager implements ModelManagerInterface {
transparent: false,
opacity: 1.0
})
child.geometry.computeVertexNormals()
break

case 'wireframe':
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/core/load3d/SceneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading