part of exp
This commit is contained in:
parent
6f45cbc0b3
commit
3d39c6bf3b
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useGLTF } from '@tresjs/cientos'
|
import { useGLTF } from '@tresjs/cientos'
|
||||||
import { Box3, Color, DoubleSide, MeshStandardMaterial, Vector3 } from 'three';
|
import { Box3, CanvasTexture, Color, DoubleSide, MeshStandardMaterial, Vector3 } from 'three';
|
||||||
const props = defineProps(['modelUrl', 'model', 'position', 'removePos', 'target', 'color', 'map'])
|
const props = defineProps(['modelUrl', 'model', 'position', 'removePos', 'target', 'color', 'map'])
|
||||||
|
|
||||||
let scene
|
let scene
|
||||||
|
@ -19,14 +19,14 @@ box.expandByObject(scene.children[0]);
|
||||||
let size = new Vector3();
|
let size = new Vector3();
|
||||||
box.getSize(size)
|
box.getSize(size)
|
||||||
|
|
||||||
const getMaterial = () => {
|
const getMaterial = async () => {
|
||||||
return new MeshStandardMaterial({
|
return new MeshStandardMaterial({
|
||||||
color: new Color(props.color || '#9c9c9c'),
|
color: new Color(props.color || '#9c9c9c'),
|
||||||
roughness: 0.3,
|
roughness: 0.3,
|
||||||
metalness: 0.3,
|
metalness: 0.3
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const material = getMaterial()
|
const material = await getMaterial()
|
||||||
function shadows_and_pos(scene: any) {
|
function shadows_and_pos(scene: any) {
|
||||||
scene.children.forEach((el: any) => {
|
scene.children.forEach((el: any) => {
|
||||||
if (el.isMesh) {
|
if (el.isMesh) {
|
||||||
|
@ -81,7 +81,7 @@ watch(props, () => {
|
||||||
set_material(model.value)
|
set_material(model.value)
|
||||||
}
|
}
|
||||||
if (props.target) {
|
if (props.target) {
|
||||||
target.value = new Vector3(...props.target)
|
target.value = new Vector3(...props.target)
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Loading…
Reference in New Issue