11<script lang="ts" setup>
22import { vue3dLoader } from " vue-3d-loader" ;
3- import { ref } from " vue" ;
4- const filePath = ref ();
5- filePath .value = [
6- " ./model3d/fbx/Samba Dancing.fbx" ,
7- " ./model3d/collada/pump/pump.dae" ,
8- " ./model3d/ply/Lucy100k.ply" ,
9- ];
10- const position = ref ();
11- position .value = [
12- { x: 100 , y: 100 , z: 100 },
13- { x: 300 , y: 300 , z: 300 },
14- ];
15- const rotation = ref ();
16- rotation .value = [
17- { x: 0 , y: 0 , z: 0 },
18- { x: 10 , y: 1 , z: 1 },
19- ];
20- const scale = ref ();
21- scale .value = [
22- { x: 5 , y: 5 , z: 5 },
23- { x: 3 , y: 3 , z: 3 },
24- ];
3+
254 </script >
265
276<template >
@@ -39,26 +18,32 @@ scale.value = [
3918 <a href =" https://github.com/king2088/vue-3d-loader" target =" _blank" >vue-3d-loader</a >,
4019 we can visualize these 3D models here. It supports dae, fbx, gltf(glb), obj, ply, stl models.
4120 </p >
42- <el-row justify =" center" >
43- <el-col :xs =" 20" :sm =" 12" >
44- <vue3dLoader
45- filePath =" ./model3d/collada/stormtrooper/stormtrooper.dae"
46- :cameraPosition =" { x: -8, y: 10, z: -10 }"
47- :height =" 350"
21+ <el-row justify =" space-evenly" >
22+ <el-col :xs =" 16" :sm =" 10" >
23+ <div class =" threed-container" >
24+ <vue3dLoader
25+ filePath =" ./model3d/obj/male02.obj"
26+ mtlPath =" ./model3d/obj/male02.mtl"
27+ outputEncoding =" sRGB"
28+ :cameraPosition =" { x: 0, y: 0, z: 300 }"
29+ :scale =" { x: 1, y: 1, z: 1 }"
30+ :position =" { x: 0, y: 0, z: 0 }"
31+ :rotation =" { x: 0, y: 0, z: 0 }"
4832 :enableDamping =" true"
4933 :dampingFactor =" 0.05"
50- :backgroundColor =" 0xccddff "
34+ :backgroundColor =" '#f2f2f2' "
5135 />
36+ </div >
5237 </el-col >
53- <el-col :xs =" 20 " :sm =" 12 " >
38+ <el-col :xs =" 16 " :sm =" 10 " >
5439 <vue3dLoader
55- :filePath =" filePath"
56- :scale =" scale"
57- :position =" position"
58- :rotation =" rotation"
40+ filePath =" ./model3d/ply/Lucy100k.ply"
5941 :cameraPosition =" { x: 100, y: 200, z: 3000 }"
60- :parallelLoad =" true"
61- :height =" 350"
42+ :scale =" { x: 1, y: 1, z: 1 }"
43+ :position =" { x: 100, y: 100, z: 100 }"
44+ :rotation =" { x: 0, y: 3, z: 0 }"
45+ :enableDamping =" true"
46+ :dampingFactor =" 0.05"
6247 :backgroundColor =" 0xeeeeee"
6348 ></vue3dLoader >
6449 </el-col >
@@ -70,6 +55,10 @@ scale.value = [
7055 </div >
7156</template >
7257
73- <style scoped>
74-
58+ <style >
59+ .viewer-canvas {
60+ width : 100% !important ;
61+ height : auto !important ;
62+ aspect-ratio : 1 / 1 !important ;
63+ }
7564 </style >
0 commit comments