[3d] support output normal and lineart at once (#3122)

This commit is contained in:
Terry Jia
2025-03-18 10:51:53 -04:00
committed by GitHub
parent e8997a7653
commit 52bad3d0d1
8 changed files with 194 additions and 13 deletions

View File

@@ -1,6 +1,11 @@
<template>
<div class="relative w-full h-full">
<div
class="relative w-full h-full"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
>
<Load3DScene
ref="load3DSceneRef"
:node="node"
:type="type"
:backgroundColor="backgroundColor"
@@ -90,11 +95,24 @@ const backgroundImage = ref('')
const upDirection = ref<UpDirection>('original')
const materialMode = ref<MaterialMode>('original')
const edgeThreshold = ref(85)
const load3DSceneRef = ref(null)
const showPreviewButton = computed(() => {
return !type.includes('Preview')
})
const handleMouseEnter = () => {
if (load3DSceneRef.value?.load3d) {
load3DSceneRef.value.load3d.updateStatusMouseOnScene(true)
}
}
const handleMouseLeave = () => {
if (load3DSceneRef.value?.load3d) {
load3DSceneRef.value.load3d.updateStatusMouseOnScene(false)
}
}
const switchCamera = () => {
cameraType.value =
cameraType.value === 'perspective' ? 'orthographic' : 'perspective'

View File

@@ -1,6 +1,11 @@
<template>
<div class="relative w-full h-full">
<div
class="relative w-full h-full"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
>
<Load3DAnimationScene
ref="load3DAnimationSceneRef"
:node="node"
:type="type"
:backgroundColor="backgroundColor"
@@ -110,6 +115,22 @@ const showPreviewButton = computed(() => {
return !type.includes('Preview')
})
const load3DAnimationSceneRef = ref(null)
const handleMouseEnter = () => {
const sceneRef = load3DAnimationSceneRef.value?.load3DSceneRef
if (sceneRef?.load3d) {
sceneRef.load3d.updateStatusMouseOnScene(true)
}
}
const handleMouseLeave = () => {
const sceneRef = load3DAnimationSceneRef.value?.load3DSceneRef
if (sceneRef?.load3d) {
sceneRef.load3d.updateStatusMouseOnScene(false)
}
}
const switchCamera = () => {
cameraType.value =
cameraType.value === 'perspective' ? 'orthographic' : 'perspective'

View File

@@ -183,4 +183,8 @@ const animationListeners = {
emit('animationListChange', newValue)
}
}
defineExpose({
load3DSceneRef
})
</script>