-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: model-fbx and update three.js (#167)
Add the model-fbx component and update the three.js version to v0.115 with update dds LoadingManager
- Loading branch information
Showing
9 changed files
with
124 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<demo-block :vue-code="code" :html-code="htmlCode"> | ||
<template slot="preview"> | ||
<model-fbx :backgroundAlpha="0" @on-load="onLoad" @on-error="onError" | ||
src="static/models/fbx/dancing.fbx"></model-fbx> | ||
<div class="example-loading" v-show="loading"></div> | ||
</template> | ||
</demo-block> | ||
</template> | ||
|
||
<script> | ||
import DemoBlock from '../components/demo-block.vue'; | ||
import ModelFbx from '../../src/model-fbx.vue'; | ||
const code = ` | ||
<template> | ||
<model-obj src="static/models/fbx/dancing.fbx"></model-obj> | ||
</template> | ||
<script> | ||
import { modelFbx } from 'vue-3d-model' | ||
export default { | ||
components: { | ||
ModelFbx | ||
} | ||
} | ||
<\/script> | ||
`; | ||
const htmlCode = ` | ||
<body> | ||
<div id="app"> | ||
<model-fbx src="static/models/fbx/dancing.fbx"></model-fbx> | ||
</div> | ||
#scripts# | ||
<script> | ||
new Vue({ | ||
el: '#app' | ||
}) | ||
<\/script> | ||
</body> | ||
`; | ||
export default { | ||
name: 'demo-fbx', | ||
data() { | ||
return { | ||
code, | ||
htmlCode, | ||
loading: true, | ||
}; | ||
}, | ||
methods: { | ||
onLoad() { | ||
this.loading = false; | ||
}, | ||
onError(e) { | ||
console.error(e); | ||
}, | ||
}, | ||
components: { | ||
ModelFbx, | ||
DemoBlock, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script> | ||
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader'; | ||
import mixin from './model-mixin.vue'; | ||
export default { | ||
name: 'model-fbx', | ||
mixins: [mixin], | ||
props: { | ||
lights: { | ||
type: Array, | ||
default() { | ||
return [ | ||
{ | ||
type: 'HemisphereLight', | ||
position: { x: 0, y: 1, z: 0 }, | ||
skyColor: 0xffffff, | ||
groundColor: 0xffffff, | ||
intensity: 0.8, | ||
}, | ||
{ | ||
type: 'DirectionalLight', | ||
position: { x: 1, y: 1, z: 1 }, | ||
color: 0xffffff, | ||
intensity: 0.8, | ||
}, | ||
]; | ||
}, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
loader: new FBXLoader(), | ||
}; | ||
}, | ||
methods: { | ||
getObject(geometry) { | ||
this.animations = geometry.animations; | ||
return geometry; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters