diff --git a/src/components/load3d/Load3D.vue b/src/components/load3d/Load3D.vue index ce6f83bc2..75635f1b8 100644 --- a/src/components/load3d/Load3D.vue +++ b/src/components/load3d/Load3D.vue @@ -10,6 +10,8 @@ :cameraType="cameraType" :showPreview="showPreview" :backgroundImage="backgroundImage" + :upDirection="upDirection" + :materialMode="materialMode" @materialModeChange="listenMaterialModeChange" @backgroundColorChange="listenBackgroundColorChange" @lightIntensityChange="listenLightIntensityChange" @@ -18,6 +20,7 @@ @showGridChange="listenShowGridChange" @showPreviewChange="listenShowPreviewChange" @backgroundImageChange="listenBackgroundImageChange" + @upDirectionChange="listenUpDirectionChange" /> @@ -47,6 +54,11 @@ import { computed, ref } from 'vue' import Load3DControls from '@/components/load3d/Load3DControls.vue' import Load3DScene from '@/components/load3d/Load3DScene.vue' import Load3dUtils from '@/extensions/core/load3d/Load3dUtils' +import { + CameraType, + MaterialMode, + UpDirection +} from '@/extensions/core/load3d/interfaces' const props = defineProps<{ node: any @@ -61,9 +73,11 @@ const lightIntensity = ref(5) const showLightIntensityButton = ref(true) const fov = ref(75) const showFOVButton = ref(true) -const cameraType = ref<'perspective' | 'orthographic'>('perspective') +const cameraType = ref('perspective') const hasBackgroundImage = ref(false) const backgroundImage = ref('') +const upDirection = ref('original') +const materialMode = ref('original') const showPreviewButton = computed(() => { return !props.type.includes('Preview') @@ -115,24 +129,34 @@ const handleUpdateFOV = (value: number) => { node.value.properties['FOV'] = fov.value } -const materialMode = ref<'original' | 'normal' | 'wireframe' | 'depth'>( - 'original' -) - const handleBackgroundColorChange = (value: string) => { backgroundColor.value = value node.value.properties['Background Color'] = value } -const listenMaterialModeChange = ( - mode: 'original' | 'normal' | 'wireframe' | 'depth' -) => { +const handleUpdateUpDirection = (value: UpDirection) => { + upDirection.value = value + + node.value.properties['Up Direction'] = value +} + +const handleUpdateMaterialMode = (value: MaterialMode) => { + materialMode.value = value + + node.value.properties['Material Mode'] = value +} + +const listenMaterialModeChange = (mode: MaterialMode) => { materialMode.value = mode showLightIntensityButton.value = mode === 'original' } +const listenUpDirectionChange = (value: UpDirection) => { + upDirection.value = value +} + const listenBackgroundColorChange = (value: string) => { backgroundColor.value = value } @@ -145,7 +169,7 @@ const listenFOVChange = (value: number) => { fov.value = value } -const listenCameraTypeChange = (value: 'perspective' | 'orthographic') => { +const listenCameraTypeChange = (value: CameraType) => { cameraType.value = value showFOVButton.value = cameraType.value === 'perspective' } diff --git a/src/components/load3d/Load3DAnimation.vue b/src/components/load3d/Load3DAnimation.vue index 753226df3..bd3d03af5 100644 --- a/src/components/load3d/Load3DAnimation.vue +++ b/src/components/load3d/Load3DAnimation.vue @@ -9,13 +9,14 @@ :fov="fov" :cameraType="cameraType" :showPreview="showPreview" - :materialMode="materialMode" :showFOVButton="showFOVButton" :showLightIntensityButton="showLightIntensityButton" :playing="playing" :selectedSpeed="selectedSpeed" :selectedAnimation="selectedAnimation" :backgroundImage="backgroundImage" + :upDirection="upDirection" + :materialMode="materialMode" @materialModeChange="listenMaterialModeChange" @backgroundColorChange="listenBackgroundColorChange" @lightIntensityChange="listenLightIntensityChange" @@ -25,6 +26,7 @@ @showPreviewChange="listenShowPreviewChange" @backgroundImageChange="listenBackgroundImageChange" @animationListChange="animationListChange" + @upDirectionChange="listenUpDirectionChange" />
{ node.value.properties['FOV'] = fov.value } -const materialMode = ref<'original' | 'normal' | 'wireframe' | 'depth'>( - 'original' -) +const materialMode = ref('original') +const upDirection = ref('original') + +const handleUpdateUpDirection = (value: UpDirection) => { + upDirection.value = value + + node.value.properties['Up Direction'] = value +} + +const handleUpdateMaterialMode = (value: MaterialMode) => { + materialMode.value = value + + node.value.properties['Material Mode'] = value +} const handleBackgroundColorChange = (value: string) => { backgroundColor.value = value @@ -164,14 +186,16 @@ const animationListChange = (value: any) => { animations.value = value } -const listenMaterialModeChange = ( - mode: 'original' | 'normal' | 'wireframe' | 'depth' -) => { +const listenMaterialModeChange = (mode: MaterialMode) => { materialMode.value = mode showLightIntensityButton.value = mode === 'original' } +const listenUpDirectionChange = (value: UpDirection) => { + upDirection.value = value +} + const listenBackgroundColorChange = (value: string) => { backgroundColor.value = value } @@ -184,7 +208,7 @@ const listenFOVChange = (value: number) => { fov.value = value } -const listenCameraTypeChange = (value: 'perspective' | 'orthographic') => { +const listenCameraTypeChange = (value: CameraType) => { cameraType.value = value showFOVButton.value = cameraType.value === 'perspective' diff --git a/src/components/load3d/Load3DAnimationScene.vue b/src/components/load3d/Load3DAnimationScene.vue index 687213d3f..5d85f58b8 100644 --- a/src/components/load3d/Load3DAnimationScene.vue +++ b/src/components/load3d/Load3DAnimationScene.vue @@ -10,6 +10,8 @@ :showPreview="showPreview" :extraListeners="animationListeners" :backgroundImage="backgroundImage" + :upDirection="upDirection" + :materialMode="materialMode" @materialModeChange="listenMaterialModeChange" @backgroundColorChange="listenBackgroundColorChange" @lightIntensityChange="listenLightIntensityChange" @@ -24,6 +26,11 @@ import { ref, watch } from 'vue' import Load3DScene from '@/components/load3d/Load3DScene.vue' +import { + CameraType, + MaterialMode, + UpDirection +} from '@/extensions/core/load3d/interfaces' const props = defineProps<{ node: any @@ -32,9 +39,10 @@ const props = defineProps<{ showGrid: boolean lightIntensity: number fov: number - cameraType: 'perspective' | 'orthographic' + cameraType: CameraType showPreview: boolean - materialMode: 'original' | 'normal' | 'wireframe' | 'depth' + materialMode: MaterialMode + upDirection: UpDirection showFOVButton: boolean showLightIntensityButton: boolean playing: boolean @@ -50,6 +58,7 @@ const fov = ref(props.fov) const lightIntensity = ref(props.lightIntensity) const cameraType = ref(props.cameraType) const showGrid = ref(props.showGrid) +const upDirection = ref(props.upDirection) const materialMode = ref(props.materialMode) const showFOVButton = ref(props.showFOVButton) const showLightIntensityButton = ref(props.showLightIntensityButton) @@ -90,6 +99,20 @@ watch( } ) +watch( + () => props.upDirection, + (newValue) => { + upDirection.value = newValue + } +) + +watch( + () => props.materialMode, + (newValue) => { + materialMode.value = newValue + } +) + watch( () => props.showPreview, (newValue) => { @@ -122,9 +145,7 @@ const emit = defineEmits<{ (e: 'animationListChange', animationList: string): void }>() -const listenMaterialModeChange = ( - mode: 'original' | 'normal' | 'wireframe' | 'depth' -) => { +const listenMaterialModeChange = (mode: MaterialMode) => { materialMode.value = mode showLightIntensityButton.value = mode === 'original' @@ -142,7 +163,7 @@ const listenFOVChange = (value: number) => { fov.value = value } -const listenCameraTypeChange = (value: 'perspective' | 'orthographic') => { +const listenCameraTypeChange = (value: CameraType) => { cameraType.value = value showFOVButton.value = cameraType.value === 'perspective' diff --git a/src/components/load3d/Load3DControls.vue b/src/components/load3d/Load3DControls.vue index c0a59c5ec..ceba5dd92 100644 --- a/src/components/load3d/Load3DControls.vue +++ b/src/components/load3d/Load3DControls.vue @@ -1,132 +1,240 @@