File tree 3 files changed +30
-18
lines changed
3 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ Vue.use(VueThreejs)
18
18
<renderer :size="{ w: 600, h: 400 }">
19
19
<scene>
20
20
<camera :position="{ z: 15 }"></camera>
21
- <object3d :obj="mesh" :position="{ y: -200 }"></object3d >
21
+ <mesh :obj="mesh" :position="{ y: -200 }"></mesh >
22
22
<animation :fn="animate" :speed="3"></animation>
23
23
</scene>
24
24
</renderer>
@@ -40,15 +40,27 @@ Vue.use(VueThreejs)
40
40
</movement-system>
41
41
```
42
42
43
+ ``` vue
44
+ <oimo-world :options="{ gravity: [0, -9.8, 0] }">
45
+ <space-system :m-scale="10 ** 4">
46
+ <space-object v-for="t in textures" :key="t">
47
+ <oimo-body :options="{ move: true, density: 1 }">
48
+ <cube :texture="t" :size="1"></cube>
49
+ </oimo-body>
50
+ </space-object>
51
+ </space-system>
52
+ </oimo-world>
53
+ ```
54
+
43
55
** Roadmap**
44
56
45
- - [ ] Basic components
57
+ - [x ] Basic components
46
58
- [x] renderer/scene/camera/listener
47
59
- [x] object3d/light/audio/controls/animation
48
- - [ ] mesh/more
60
+ - [x ] mesh/geometry/material/texture/obj-mtl
49
61
- [ ] Watch for props change
50
- - [x] position/rotation
51
- - [ ] obj/ more
62
+ - [x] position/rotation/obj
63
+ - [ ] more
52
64
- [ ] Animation
53
65
- [x] component/animate/speed/paused/blocked
54
66
- [ ] global-control
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <mesh name =" Ocean" >
4
- <geometry type =" Plane" :args =" [10000, 10000, 40, 40]"
5
- :obj.sync =" geom" ></geometry >
3
+ <mesh name =" Ocean" @update:obj =" handleMesh" >
4
+ <geometry type =" Plane" :args =" [10000, 10000, 40, 40]" ></geometry >
6
5
<material type =" MeshBasic" :color =" 0x0044ff" >
7
6
<texture :options =" txtOpts" ></texture >
8
7
</material >
9
8
</mesh >
10
- <animation v-if =" geomReady " :fn =" animate" :speed =" 5" ></animation >
9
+ <animation v-if =" geom " :fn =" animate" :speed =" 5" ></animation >
11
10
</div >
12
11
</template >
13
12
@@ -28,23 +27,21 @@ export default {
28
27
wrapT: RepeatWrapping,
29
28
repeat: [5 , 5 ]
30
29
},
31
- geomReady: false ,
32
- geom: null ,
33
- ocean: null
30
+ geom: null
34
31
}
35
32
},
36
33
37
- watch: {
38
- geom (g ) {
34
+ methods: {
35
+ handleMesh (mesh ) {
36
+ if (! mesh) return
37
+ let g = mesh .geometry
39
38
g .rotateX (- Math .PI / 2 )
40
39
for (let i = 0 , l = g .vertices .length ; i < l; i++ ) {
41
40
g .vertices [ i ].y = 10 * Math .sin (i / 2 )
42
41
}
43
- this .geomReady = true
44
- }
45
- },
42
+ this .geom = g
43
+ },
46
44
47
- methods: {
48
45
animate (tt ) {
49
46
let g = this .geom
50
47
for (let i = 0 , l = g .vertices .length ; i < l; i++ ) {
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ export default {
41
41
Object .assign (this .curObj .rotation , v)
42
42
}
43
43
},
44
+ obj (obj ) {
45
+ this .curObj = obj
46
+ },
44
47
curObj (obj , oldObj ) {
45
48
this .unsetObj (oldObj)
46
49
this .setObj (obj)
You can’t perform that action at this time.
0 commit comments