文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
材质及纹理
OBJ+MTL
FBX+JPG
<template>
<div>
<div v-for="item in loaderList" :key="item.title">
<h1>{{ item.title }}</h1>
<vue3dLoader
:height="item.height"
:showFps="item.showFps"
:filePath="item.filePath"
:mtlPath="item.mtlPath"
:textureImage="item.textureImage"
:backgroundColor="item.backgroundColor"
:outputEncoding="item.outputEncoding"
:cameraPosition="item.cameraPosition"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { vue3dLoader } from "vue-3d-loader";
import { ref } from "vue";
const object = ref(null);
const loaderList = ref();
loaderList.value = [
{
title: "OBJ+MTL",
filePath: "/models/obj/male02.obj",
mtlPath: "/models/obj/male02.mtl",
showFps: false,
height: 400,
backgroundColor: "#f2f2f2",
outputEncoding: "sRGB",
cameraPosition: { x: -100, y: 100, z: 200 },
},
{
title: "FBX+JPG",
filePath: "/models/fbx/stanford-bunny.fbx",
textureImage: "/models/fbx/brick.png",
height: 400,
},
];
function onMouseMove(event: MouseEvent, intersected: any) {
// console.log('event', event);
if (object.value) {
(object.value as any).material.color.setStyle("#fff");
}
if (intersected) {
object.value = intersected.object;
(object.value as any).material.color.setStyle("#13ce66");
}
}
</script>
<style>
h1 {
font-size: 20px;
}
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论