@vyr/three 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -26
- package/src/actor/ComposerServiceActor.ts +7 -6
- package/src/actor/HTMLConvertActor.ts +4 -4
- package/src/actor/OrbitControllerActor.ts +19 -19
- package/src/actor/SceneServiceActor.ts +9 -9
- package/src/actor/TransformControllerActor.ts +3 -3
- package/src/controls/TransformControls.ts +12 -16
- package/src/descriptor/OrbitControllerDescriptor.ts +2 -2
- package/src/descriptor/TransformControllerDescriptor.ts +2 -2
- package/src/interpreter/ComposerServiceInterpreter.ts +1 -1
- package/src/interpreter/GeoMapInterpreter.ts +32 -32
- package/src/interpreter/HTMLConvertInterpreter.ts +9 -9
- package/src/interpreter/InstancedMeshInterpreter.ts +13 -13
- package/src/interpreter/MeshInterpreter.ts +6 -7
- package/src/interpreter/ModelInterpreter.ts +10 -10
- package/src/interpreter/NodeInterpreter.ts +19 -19
- package/src/interpreter/OrbitControllerInterpreter.ts +20 -20
- package/src/interpreter/OrthographicCameraInterpreter.ts +2 -2
- package/src/interpreter/ParticleInterpreter.ts +13 -13
- package/src/interpreter/PassInterpreter.ts +16 -16
- package/src/interpreter/PerspectiveCameraInterpreter.ts +8 -8
- package/src/interpreter/PointsInterpreter.ts +13 -13
- package/src/interpreter/SceneServiceInterpreter.ts +28 -28
- package/src/interpreter/ServiceSchedulerInterpreter.ts +6 -6
- package/src/interpreter/SpriteInterpreter.ts +10 -10
- package/src/interpreter/TextInterpreter.ts +10 -10
- package/src/interpreter/TransformControllerInterpreter.ts +17 -17
- package/src/interpreter/animation/AnimationActionInterpreter.ts +10 -10
- package/src/interpreter/geometry/BoxGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/BufferGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/CircleGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/CylinderGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/ExtrudeGeometryInterpreter.ts +10 -10
- package/src/interpreter/geometry/PlaneGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/RingGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/SphereGeometryInterpreter.ts +8 -8
- package/src/interpreter/geometry/SurfaceGeometryInterpreter.ts +2 -3
- package/src/interpreter/geometry/TubeGeometryInterpreter.ts +10 -10
- package/src/interpreter/helper/AxesHelperInterpreter.ts +7 -8
- package/src/interpreter/light/AmbientLightInterpreter.ts +8 -8
- package/src/interpreter/light/DirectionalLightInterpreter.ts +14 -14
- package/src/interpreter/light/HemisphereLightInterpreter.ts +8 -8
- package/src/interpreter/light/PointLightInterpreter.ts +11 -11
- package/src/interpreter/light/RectAreaLightInterpreter.ts +8 -8
- package/src/interpreter/light/SpotLightInterpreter.ts +14 -14
- package/src/interpreter/material/MaterialInterpreter.ts +4 -4
- package/src/interpreter/material/MeshBasicMaterialInterpreter.ts +9 -10
- package/src/interpreter/material/MeshPhongMaterialInterpreter.ts +13 -14
- package/src/interpreter/material/MeshStandardMaterialInterpreter.ts +14 -15
- package/src/interpreter/material/PointsMaterialInterpreter.ts +6 -7
- package/src/interpreter/material/ShaderMaterialInterpreter.ts +9 -9
- package/src/interpreter/material/ShadowMaterialInterpreter.ts +4 -5
- package/src/interpreter/material/SpriteMaterialInterpreter.ts +6 -7
- package/src/interpreter/texture/TextureInterpreter.ts +8 -8
- package/src/preset/execute/GeoMap/drilldown.ts +6 -7
- package/src/preset/index.ts +2 -2
- package/src/preset/interaction/GeoMap/drilldown.ts +26 -0
- package/src/utils/geometry/index.ts +3 -3
- package/src/utils/material/index.ts +6 -6
- package/src/utils/texture/index.ts +3 -3
- package/src/preset/routine/GeoMap/drilldown.ts +0 -26
- /package/src/preset/{routine → interaction}/GeoMap/index.ts +0 -0
- /package/src/preset/{routine → interaction}/index.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BufferGeometry, Mesh } from "three";
|
|
2
2
|
import { Font } from 'three/examples/jsm/loaders/FontLoader.js'
|
|
3
|
-
import { Asset
|
|
3
|
+
import { Asset } from "@vyr/engine";
|
|
4
4
|
import { TextDescriptor } from "../descriptor";
|
|
5
5
|
import { NodeInterpreter } from "./NodeInterpreter";
|
|
6
6
|
import { NodeActor } from "../actor";
|
|
@@ -11,7 +11,7 @@ class TextInterpreter extends NodeInterpreter {
|
|
|
11
11
|
private _geometry = new BufferGeometry()
|
|
12
12
|
private _cacheKey = ''
|
|
13
13
|
|
|
14
|
-
protected createActor(descriptor: TextDescriptor
|
|
14
|
+
protected createActor(descriptor: TextDescriptor) {
|
|
15
15
|
const actor = new NodeActor(new Mesh(this._geometry, material.defaultMaterial()))
|
|
16
16
|
return actor
|
|
17
17
|
}
|
|
@@ -34,7 +34,7 @@ class TextInterpreter extends NodeInterpreter {
|
|
|
34
34
|
return `${this._fastHash(descriptor.text)}_${descriptor.size}_${descriptor.lineHeight}_${descriptor.maxWidth}_${descriptor.letterSpacing}`
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
setAttribute(descriptor: TextDescriptor
|
|
37
|
+
setAttribute(descriptor: TextDescriptor) {
|
|
38
38
|
const font = Asset.get<Font>(descriptor.font)
|
|
39
39
|
if (font instanceof Font) {
|
|
40
40
|
const options = {
|
|
@@ -55,20 +55,20 @@ class TextInterpreter extends NodeInterpreter {
|
|
|
55
55
|
if (descriptor.flattenUVsToPlane) geometry.flattenUVsToPlane(this._geometry)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
update(descriptor: TextDescriptor
|
|
59
|
-
super.update(descriptor
|
|
60
|
-
const actor = this.getActor<NodeActor<Mesh>>(descriptor
|
|
58
|
+
update(descriptor: TextDescriptor) {
|
|
59
|
+
super.update(descriptor)
|
|
60
|
+
const actor = this.getActor<NodeActor<Mesh>>(descriptor)
|
|
61
61
|
const cacheKey = this.getCacheKey(descriptor)
|
|
62
62
|
if (this._cacheKey !== cacheKey) {
|
|
63
|
-
this.setAttribute(descriptor
|
|
63
|
+
this.setAttribute(descriptor)
|
|
64
64
|
this._cacheKey = cacheKey
|
|
65
65
|
}
|
|
66
|
-
actor.object.material = material.getMaterial(descriptor.material, this.graphics
|
|
66
|
+
actor.object.material = material.getMaterial(descriptor.material, this.graphics)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
free(descriptor: TextDescriptor
|
|
69
|
+
free(descriptor: TextDescriptor) {
|
|
70
70
|
this._geometry.dispose()
|
|
71
|
-
super.free(descriptor
|
|
71
|
+
super.free(descriptor)
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
NodeInterpreter.register(TextInterpreter)
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Descriptor, Interpreter
|
|
1
|
+
import { Descriptor, Interpreter } from "@vyr/engine";
|
|
2
2
|
import { TransformControllerDescriptor } from '../descriptor'
|
|
3
3
|
import { NodeActor, TransformControllerActor } from "../actor"
|
|
4
4
|
|
|
5
5
|
class TransformControllerInterpreter extends Interpreter {
|
|
6
6
|
static type = TransformControllerDescriptor.type
|
|
7
7
|
|
|
8
|
-
protected createActor(descriptor: TransformControllerDescriptor
|
|
8
|
+
protected createActor(descriptor: TransformControllerDescriptor) {
|
|
9
9
|
const actor = new TransformControllerActor()
|
|
10
10
|
return actor
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
update(descriptor: TransformControllerDescriptor
|
|
14
|
-
super.update(descriptor
|
|
15
|
-
const actor = this.getActor<TransformControllerActor>(descriptor
|
|
16
|
-
actor.update(descriptor, this.graphics
|
|
13
|
+
update(descriptor: TransformControllerDescriptor) {
|
|
14
|
+
super.update(descriptor)
|
|
15
|
+
const actor = this.getActor<TransformControllerActor>(descriptor)
|
|
16
|
+
actor.update(descriptor, this.graphics)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
mount(descriptor: TransformControllerDescriptor,
|
|
20
|
-
super.mount(descriptor,
|
|
21
|
-
const parenActor = parentInterpreter.getActor<NodeActor>(parentDescriptor
|
|
22
|
-
const actor = this.getActor<TransformControllerActor>(descriptor
|
|
19
|
+
mount(descriptor: TransformControllerDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
20
|
+
super.mount(descriptor, parentInterpreter, parentDescriptor)
|
|
21
|
+
const parenActor = parentInterpreter.getActor<NodeActor>(parentDescriptor)
|
|
22
|
+
const actor = this.getActor<TransformControllerActor>(descriptor)
|
|
23
23
|
parenActor.add(actor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
unmount(descriptor: TransformControllerDescriptor,
|
|
27
|
-
const parenActor = parentInterpreter.getActor<NodeActor>(parentDescriptor
|
|
28
|
-
const actor = this.getActor<TransformControllerActor>(descriptor
|
|
26
|
+
unmount(descriptor: TransformControllerDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
27
|
+
const parenActor = parentInterpreter.getActor<NodeActor>(parentDescriptor)
|
|
28
|
+
const actor = this.getActor<TransformControllerActor>(descriptor)
|
|
29
29
|
parenActor.remove(actor)
|
|
30
30
|
actor.unlisten(this.graphics)
|
|
31
31
|
|
|
32
|
-
super.unmount(descriptor,
|
|
32
|
+
super.unmount(descriptor, parentInterpreter, parentDescriptor)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
free(descriptor: TransformControllerDescriptor
|
|
36
|
-
const actor = this.getActor<TransformControllerActor>(descriptor
|
|
35
|
+
free(descriptor: TransformControllerDescriptor) {
|
|
36
|
+
const actor = this.getActor<TransformControllerActor>(descriptor)
|
|
37
37
|
actor.dispose(this.graphics)
|
|
38
|
-
super.free(descriptor
|
|
38
|
+
super.free(descriptor)
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
Interpreter.register(TransformControllerInterpreter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnimationAction, AnimationMixer } from 'three'
|
|
2
|
-
import { Descriptor, Interpreter
|
|
2
|
+
import { Descriptor, Interpreter } from "@vyr/engine"
|
|
3
3
|
import { AnimationActionDescriptor, ModelDescriptor } from "../../descriptor"
|
|
4
4
|
import { ModelInterpreter } from '../ModelInterpreter'
|
|
5
5
|
import { ServiceSchedulerInterpreter } from '../ServiceSchedulerInterpreter'
|
|
@@ -17,7 +17,7 @@ class AnimationActionInterpreter extends Interpreter {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
setProperty(action: AnimationAction, descriptor: AnimationActionDescriptor
|
|
20
|
+
setProperty(action: AnimationAction, descriptor: AnimationActionDescriptor) {
|
|
21
21
|
action.enabled = descriptor.enabled
|
|
22
22
|
action.timeScale = descriptor.timeScale
|
|
23
23
|
action.weight = descriptor.weight
|
|
@@ -29,8 +29,8 @@ class AnimationActionInterpreter extends Interpreter {
|
|
|
29
29
|
descriptor.play ? action.play() : action.stop()
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
update(descriptor: AnimationActionDescriptor
|
|
33
|
-
super.update(descriptor
|
|
32
|
+
update(descriptor: AnimationActionDescriptor) {
|
|
33
|
+
super.update(descriptor)
|
|
34
34
|
const scheduler = this.graphics.getInterpreter<ServiceSchedulerInterpreter>(this.graphics.scheduler)
|
|
35
35
|
this.freeAction(scheduler.mixer)
|
|
36
36
|
|
|
@@ -44,21 +44,21 @@ class AnimationActionInterpreter extends Interpreter {
|
|
|
44
44
|
if (clip.name === descriptor.clip) {
|
|
45
45
|
this.animationAction = scheduler.mixer.clipAction(clip, model)
|
|
46
46
|
this.animationAction.clampWhenFinished = true
|
|
47
|
-
this.setProperty(this.animationAction, descriptor
|
|
47
|
+
this.setProperty(this.animationAction, descriptor)
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
mount(descriptor: AnimationActionDescriptor,
|
|
54
|
-
super.mount(descriptor,
|
|
55
|
-
this.getActor(descriptor
|
|
53
|
+
mount(descriptor: AnimationActionDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
54
|
+
super.mount(descriptor, parentInterpreter, parentDescriptor)
|
|
55
|
+
this.getActor(descriptor)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
unmount(descriptor: AnimationActionDescriptor,
|
|
58
|
+
unmount(descriptor: AnimationActionDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
59
59
|
const scheduler = this.graphics.getInterpreter<ServiceSchedulerInterpreter>(this.graphics.scheduler)
|
|
60
60
|
this.freeAction(scheduler.mixer)
|
|
61
|
-
super.unmount(descriptor,
|
|
61
|
+
super.unmount(descriptor, parentInterpreter, parentDescriptor)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
Interpreter.register(AnimationActionInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, BoxGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { BoxGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class BoxGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = BoxGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: BoxGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: BoxGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class BoxGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: BoxGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<BoxGeometry>>(descriptor
|
|
20
|
+
update(descriptor: BoxGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<BoxGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: BoxGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<BoxGeometry>>(descriptor
|
|
26
|
+
free(descriptor: BoxGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<BoxGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(BoxGeometryInterpreter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferGeometry, BufferGeometryLoader } from "three";
|
|
2
|
-
import { DatasetDescriptor, Interpreter
|
|
2
|
+
import { DatasetDescriptor, Interpreter } from "@vyr/engine";
|
|
3
3
|
import { BufferGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ class BufferGeometryInterpreter extends Interpreter {
|
|
|
13
13
|
return _loader
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
protected createActor(descriptor: BufferGeometryDescriptor
|
|
16
|
+
protected createActor(descriptor: BufferGeometryDescriptor) {
|
|
17
17
|
const actor = new GeometryActor(new BufferGeometry())
|
|
18
18
|
return actor
|
|
19
19
|
}
|
|
@@ -30,16 +30,16 @@ class BufferGeometryInterpreter extends Interpreter {
|
|
|
30
30
|
source.dispose()
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
update(descriptor: BufferGeometryDescriptor
|
|
34
|
-
super.update(descriptor
|
|
35
|
-
const actor = this.getActor<GeometryActor<BufferGeometry>>(descriptor
|
|
33
|
+
update(descriptor: BufferGeometryDescriptor) {
|
|
34
|
+
super.update(descriptor)
|
|
35
|
+
const actor = this.getActor<GeometryActor<BufferGeometry>>(descriptor)
|
|
36
36
|
this.setAttribute(actor, descriptor)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
free(descriptor: BufferGeometryDescriptor
|
|
40
|
-
const actor = this.getActor<GeometryActor<BufferGeometry>>(descriptor
|
|
39
|
+
free(descriptor: BufferGeometryDescriptor) {
|
|
40
|
+
const actor = this.getActor<GeometryActor<BufferGeometry>>(descriptor)
|
|
41
41
|
actor.object.dispose()
|
|
42
|
-
super.free(descriptor
|
|
42
|
+
super.free(descriptor)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
Interpreter.register(BufferGeometryInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, CircleGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { CircleGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class CircleGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = CircleGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: CircleGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: CircleGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class CircleGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: CircleGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<CircleGeometry>>(descriptor
|
|
20
|
+
update(descriptor: CircleGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<CircleGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: CircleGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<CircleGeometry>>(descriptor
|
|
26
|
+
free(descriptor: CircleGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<CircleGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(CircleGeometryInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, CylinderGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { CylinderGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class CylinderGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = CylinderGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: CylinderGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: CylinderGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class CylinderGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: CylinderGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<CylinderGeometry>>(descriptor
|
|
20
|
+
update(descriptor: CylinderGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<CylinderGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: CylinderGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<CylinderGeometry>>(descriptor
|
|
26
|
+
free(descriptor: CylinderGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<CylinderGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(CylinderGeometryInterpreter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferGeometry, ExtrudeGeometry, Path, Shape, } from "three";
|
|
2
|
-
import { DatasetDescriptor, Interpreter, JsonAsset
|
|
2
|
+
import { DatasetDescriptor, Interpreter, JsonAsset } from "@vyr/engine";
|
|
3
3
|
import { ExtrudeGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
import { geometry } from "../../utils";
|
|
@@ -7,7 +7,7 @@ import { geometry } from "../../utils";
|
|
|
7
7
|
class ExtrudeGeometryInterpreter extends Interpreter {
|
|
8
8
|
static type = ExtrudeGeometryDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: ExtrudeGeometryDescriptor
|
|
10
|
+
protected createActor(descriptor: ExtrudeGeometryDescriptor) {
|
|
11
11
|
const actor = new GeometryActor(new BufferGeometry())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
@@ -26,7 +26,7 @@ class ExtrudeGeometryInterpreter extends Interpreter {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
setAttribute(actor: GeometryActor<ExtrudeGeometry>, descriptor: ExtrudeGeometryDescriptor
|
|
29
|
+
setAttribute(actor: GeometryActor<ExtrudeGeometry>, descriptor: ExtrudeGeometryDescriptor) {
|
|
30
30
|
const collection = DatasetDescriptor.getCollection<JsonAsset>(descriptor.shapes)
|
|
31
31
|
const shapes: Shape[] = []
|
|
32
32
|
this.createShapes(collection, shapes, descriptor)
|
|
@@ -38,16 +38,16 @@ class ExtrudeGeometryInterpreter extends Interpreter {
|
|
|
38
38
|
if (descriptor.flattenUVsToPlane) geometry.flattenUVsToPlane(actor.object)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
update(descriptor: ExtrudeGeometryDescriptor
|
|
42
|
-
super.update(descriptor
|
|
43
|
-
const actor = this.getActor<GeometryActor<ExtrudeGeometry>>(descriptor
|
|
44
|
-
this.setAttribute(actor, descriptor
|
|
41
|
+
update(descriptor: ExtrudeGeometryDescriptor) {
|
|
42
|
+
super.update(descriptor)
|
|
43
|
+
const actor = this.getActor<GeometryActor<ExtrudeGeometry>>(descriptor)
|
|
44
|
+
this.setAttribute(actor, descriptor)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
free(descriptor: ExtrudeGeometryDescriptor
|
|
48
|
-
const actor = this.getActor<GeometryActor<ExtrudeGeometry>>(descriptor
|
|
47
|
+
free(descriptor: ExtrudeGeometryDescriptor) {
|
|
48
|
+
const actor = this.getActor<GeometryActor<ExtrudeGeometry>>(descriptor)
|
|
49
49
|
actor.object.dispose()
|
|
50
|
-
super.free(descriptor
|
|
50
|
+
super.free(descriptor)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
Interpreter.register(ExtrudeGeometryInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, PlaneGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { PlaneGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class PlaneGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = PlaneGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: PlaneGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: PlaneGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class PlaneGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: PlaneGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<PlaneGeometry>>(descriptor
|
|
20
|
+
update(descriptor: PlaneGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<PlaneGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: PlaneGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<PlaneGeometry>>(descriptor
|
|
26
|
+
free(descriptor: PlaneGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<PlaneGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(PlaneGeometryInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, RingGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { RingGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class RingGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = RingGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: RingGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: RingGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class RingGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: RingGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<RingGeometry>>(descriptor
|
|
20
|
+
update(descriptor: RingGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<RingGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: RingGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<RingGeometry>>(descriptor
|
|
26
|
+
free(descriptor: RingGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<RingGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(RingGeometryInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BufferGeometry, SphereGeometry } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { SphereGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class SphereGeometryInterpreter extends Interpreter {
|
|
7
7
|
static type = SphereGeometryDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: SphereGeometryDescriptor
|
|
9
|
+
protected createActor(descriptor: SphereGeometryDescriptor) {
|
|
10
10
|
const actor = new GeometryActor(new BufferGeometry())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -17,16 +17,16 @@ class SphereGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
source.dispose()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: SphereGeometryDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<GeometryActor<SphereGeometry>>(descriptor
|
|
20
|
+
update(descriptor: SphereGeometryDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<GeometryActor<SphereGeometry>>(descriptor)
|
|
23
23
|
this.setAttribute(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: SphereGeometryDescriptor
|
|
27
|
-
const actor = this.getActor<GeometryActor<SphereGeometry>>(descriptor
|
|
26
|
+
free(descriptor: SphereGeometryDescriptor) {
|
|
27
|
+
const actor = this.getActor<GeometryActor<SphereGeometry>>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(SphereGeometryInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ExtrudeGeometry, Spherical, Vector3 } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { SurfaceGeometryDescriptor } from "../../descriptor";
|
|
4
3
|
import { GeometryActor } from "../../actor";
|
|
5
4
|
import { ExtrudeGeometryInterpreter } from "./ExtrudeGeometryInterpreter";
|
|
@@ -20,8 +19,8 @@ class SurfaceGeometryInterpreter extends ExtrudeGeometryInterpreter {
|
|
|
20
19
|
return new Vector3().setFromSpherical(new Spherical(radius, phi, theta))
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
setAttribute(actor: GeometryActor<ExtrudeGeometry>, descriptor: SurfaceGeometryDescriptor
|
|
24
|
-
super.setAttribute(actor, descriptor
|
|
22
|
+
setAttribute(actor: GeometryActor<ExtrudeGeometry>, descriptor: SurfaceGeometryDescriptor) {
|
|
23
|
+
super.setAttribute(actor, descriptor)
|
|
25
24
|
const position = actor.object.getAttribute('position')
|
|
26
25
|
for (let i = 0; i < position.count; i++) {
|
|
27
26
|
const v = SurfaceGeometryInterpreter.lnglatToV3(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BufferGeometry, CatmullRomCurve3, TubeGeometry, Vector3, } from "three";
|
|
2
|
-
import { DatasetDescriptor, Interpreter, JsonAsset
|
|
2
|
+
import { DatasetDescriptor, Interpreter, JsonAsset } from "@vyr/engine";
|
|
3
3
|
import { TubeGeometryDescriptor } from "../../descriptor";
|
|
4
4
|
import { GeometryActor } from "../../actor";
|
|
5
5
|
import { geometry } from "../../utils";
|
|
@@ -7,7 +7,7 @@ import { geometry } from "../../utils";
|
|
|
7
7
|
class TubeGeometryInterpreter extends Interpreter {
|
|
8
8
|
static type = TubeGeometryDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: TubeGeometryDescriptor
|
|
10
|
+
protected createActor(descriptor: TubeGeometryDescriptor) {
|
|
11
11
|
const actor = new GeometryActor(new BufferGeometry())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ class TubeGeometryInterpreter extends Interpreter {
|
|
|
17
17
|
return new CatmullRomCurve3(points, false)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
setAttribute(actor: GeometryActor<TubeGeometry>, descriptor: TubeGeometryDescriptor
|
|
20
|
+
setAttribute(actor: GeometryActor<TubeGeometry>, descriptor: TubeGeometryDescriptor) {
|
|
21
21
|
const data = DatasetDescriptor.getCollection<number[]>(descriptor.track)
|
|
22
22
|
const path = data.length === 0 ? new CatmullRomCurve3([new Vector3(), new Vector3()]) : this.createPath(data, descriptor)
|
|
23
23
|
const source = new TubeGeometry(path, descriptor.tubularSegments, descriptor.radius, descriptor.radialSegments, descriptor.closed)
|
|
@@ -25,16 +25,16 @@ class TubeGeometryInterpreter extends Interpreter {
|
|
|
25
25
|
source.dispose()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
update(descriptor: TubeGeometryDescriptor
|
|
29
|
-
super.update(descriptor
|
|
30
|
-
const actor = this.getActor<GeometryActor<TubeGeometry>>(descriptor
|
|
31
|
-
this.setAttribute(actor, descriptor
|
|
28
|
+
update(descriptor: TubeGeometryDescriptor) {
|
|
29
|
+
super.update(descriptor)
|
|
30
|
+
const actor = this.getActor<GeometryActor<TubeGeometry>>(descriptor)
|
|
31
|
+
this.setAttribute(actor, descriptor)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
free(descriptor: TubeGeometryDescriptor
|
|
35
|
-
const actor = this.getActor<GeometryActor<TubeGeometry>>(descriptor
|
|
34
|
+
free(descriptor: TubeGeometryDescriptor) {
|
|
35
|
+
const actor = this.getActor<GeometryActor<TubeGeometry>>(descriptor)
|
|
36
36
|
actor.object.dispose()
|
|
37
|
-
super.free(descriptor
|
|
37
|
+
super.free(descriptor)
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
Interpreter.register(TubeGeometryInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AxesHelper } from 'three'
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { AxesHelperDescriptor } from "../../descriptor";
|
|
4
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
5
4
|
import { NodeActor } from '../../actor';
|
|
@@ -7,7 +6,7 @@ import { NodeActor } from '../../actor';
|
|
|
7
6
|
class AxesHelperInterpreter extends NodeInterpreter {
|
|
8
7
|
static type = AxesHelperDescriptor.type
|
|
9
8
|
|
|
10
|
-
protected createActor(descriptor: AxesHelperDescriptor
|
|
9
|
+
protected createActor(descriptor: AxesHelperDescriptor) {
|
|
11
10
|
const actor = new NodeActor(new AxesHelper())
|
|
12
11
|
return actor
|
|
13
12
|
}
|
|
@@ -21,16 +20,16 @@ class AxesHelperInterpreter extends NodeInterpreter {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
update(descriptor: AxesHelperDescriptor
|
|
25
|
-
super.update(descriptor
|
|
26
|
-
const actor = this.getActor<NodeActor<AxesHelper>>(descriptor
|
|
23
|
+
update(descriptor: AxesHelperDescriptor) {
|
|
24
|
+
super.update(descriptor)
|
|
25
|
+
const actor = this.getActor<NodeActor<AxesHelper>>(descriptor)
|
|
27
26
|
this.setAxesHelper(actor, descriptor)
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
free(descriptor: AxesHelperDescriptor
|
|
31
|
-
const actor = this.getActor<NodeActor<AxesHelper>>(descriptor
|
|
29
|
+
free(descriptor: AxesHelperDescriptor) {
|
|
30
|
+
const actor = this.getActor<NodeActor<AxesHelper>>(descriptor)
|
|
32
31
|
actor.object.dispose()
|
|
33
|
-
super.free(descriptor
|
|
32
|
+
super.free(descriptor)
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
NodeInterpreter.register(AxesHelperInterpreter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AmbientLight } from "three";
|
|
2
|
-
import { PickupObject
|
|
2
|
+
import { PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { AmbientLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -7,23 +7,23 @@ import { NodeActor } from "../../actor";
|
|
|
7
7
|
class AmbientLightInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = AmbientLightDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: AmbientLightDescriptor
|
|
10
|
+
protected createActor(descriptor: AmbientLightDescriptor) {
|
|
11
11
|
const actor = new NodeActor(new AmbientLight())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
setLight(actor: NodeActor<AmbientLight>, descriptor: AmbientLightDescriptor
|
|
15
|
+
setLight(actor: NodeActor<AmbientLight>, descriptor: AmbientLightDescriptor) {
|
|
16
16
|
actor.object.color.set(descriptor.color)
|
|
17
17
|
actor.object.intensity = descriptor.intensity
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
update(descriptor: AmbientLightDescriptor
|
|
21
|
-
super.update(descriptor
|
|
22
|
-
const actor = this.getActor<NodeActor<AmbientLight>>(descriptor
|
|
23
|
-
this.setLight(actor, descriptor
|
|
20
|
+
update(descriptor: AmbientLightDescriptor) {
|
|
21
|
+
super.update(descriptor)
|
|
22
|
+
const actor = this.getActor<NodeActor<AmbientLight>>(descriptor)
|
|
23
|
+
this.setLight(actor, descriptor)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
pickup(descriptor: AmbientLightDescriptor,
|
|
26
|
+
pickup(descriptor: AmbientLightDescriptor, result: PickupObject[]) { }
|
|
27
27
|
}
|
|
28
28
|
NodeInterpreter.register(AmbientLightInterpreter)
|
|
29
29
|
|