@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,5 +1,5 @@
|
|
|
1
1
|
import { DirectionalLight, Object3D } from "three";
|
|
2
|
-
import { Descriptor, PickupObject
|
|
2
|
+
import { Descriptor, PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { DirectionalLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -9,12 +9,12 @@ class DirectionalLightInterpreter extends NodeInterpreter {
|
|
|
9
9
|
|
|
10
10
|
target: Object3D | null = null
|
|
11
11
|
|
|
12
|
-
protected createActor(descriptor: DirectionalLightDescriptor
|
|
12
|
+
protected createActor(descriptor: DirectionalLightDescriptor) {
|
|
13
13
|
const actor = new NodeActor(new DirectionalLight())
|
|
14
14
|
return actor
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
setLight(actor: NodeActor<DirectionalLight>, descriptor: DirectionalLightDescriptor
|
|
17
|
+
setLight(actor: NodeActor<DirectionalLight>, descriptor: DirectionalLightDescriptor) {
|
|
18
18
|
actor.object.color.set(descriptor.color)
|
|
19
19
|
actor.object.intensity = descriptor.intensity
|
|
20
20
|
actor.object.shadow.bias = descriptor.bias
|
|
@@ -41,7 +41,7 @@ class DirectionalLightInterpreter extends NodeInterpreter {
|
|
|
41
41
|
actor.object.shadow.camera.updateProjectionMatrix()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
setTarget(actor: NodeActor<DirectionalLight>, descriptor: DirectionalLightDescriptor
|
|
44
|
+
setTarget(actor: NodeActor<DirectionalLight>, descriptor: DirectionalLightDescriptor) {
|
|
45
45
|
let targetValue = descriptor.target
|
|
46
46
|
if (targetValue === '') {
|
|
47
47
|
const target = new Object3D()
|
|
@@ -50,7 +50,7 @@ class DirectionalLightInterpreter extends NodeInterpreter {
|
|
|
50
50
|
} else {
|
|
51
51
|
const target = Descriptor.get<Descriptor>(targetValue)
|
|
52
52
|
if (target !== null) {
|
|
53
|
-
const targetActor = this.graphics.getActor<NodeActor>(target
|
|
53
|
+
const targetActor = this.graphics.getActor<NodeActor>(target)
|
|
54
54
|
if (targetActor instanceof NodeActor) {
|
|
55
55
|
actor.object.target = targetActor.object
|
|
56
56
|
} else {
|
|
@@ -64,20 +64,20 @@ class DirectionalLightInterpreter extends NodeInterpreter {
|
|
|
64
64
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
update(descriptor: DirectionalLightDescriptor
|
|
68
|
-
super.update(descriptor
|
|
69
|
-
const actor = this.getActor<NodeActor<DirectionalLight>>(descriptor
|
|
70
|
-
this.setLight(actor, descriptor
|
|
71
|
-
this.setTarget(actor, descriptor
|
|
67
|
+
update(descriptor: DirectionalLightDescriptor) {
|
|
68
|
+
super.update(descriptor)
|
|
69
|
+
const actor = this.getActor<NodeActor<DirectionalLight>>(descriptor)
|
|
70
|
+
this.setLight(actor, descriptor)
|
|
71
|
+
this.setTarget(actor, descriptor)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
free(descriptor: DirectionalLightDescriptor
|
|
75
|
-
const actor = this.getActor<NodeActor<DirectionalLight>>(descriptor
|
|
74
|
+
free(descriptor: DirectionalLightDescriptor) {
|
|
75
|
+
const actor = this.getActor<NodeActor<DirectionalLight>>(descriptor)
|
|
76
76
|
actor.object.dispose()
|
|
77
|
-
super.free(descriptor
|
|
77
|
+
super.free(descriptor)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
pickup(descriptor: DirectionalLightDescriptor,
|
|
80
|
+
pickup(descriptor: DirectionalLightDescriptor, result: PickupObject[]) { }
|
|
81
81
|
}
|
|
82
82
|
NodeInterpreter.register(DirectionalLightInterpreter)
|
|
83
83
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HemisphereLight } from "three";
|
|
2
|
-
import { PickupObject
|
|
2
|
+
import { PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { HemisphereLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -7,24 +7,24 @@ import { NodeActor } from "../../actor";
|
|
|
7
7
|
class HemisphereLightInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = HemisphereLightDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: HemisphereLightDescriptor
|
|
10
|
+
protected createActor(descriptor: HemisphereLightDescriptor) {
|
|
11
11
|
const actor = new NodeActor(new HemisphereLight())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
setLight(actor: NodeActor<HemisphereLight>, descriptor: HemisphereLightDescriptor
|
|
15
|
+
setLight(actor: NodeActor<HemisphereLight>, descriptor: HemisphereLightDescriptor) {
|
|
16
16
|
actor.object.color.set(descriptor.color)
|
|
17
17
|
actor.object.intensity = descriptor.intensity
|
|
18
18
|
actor.object.groundColor.set(descriptor.groundColor)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
update(descriptor: HemisphereLightDescriptor
|
|
22
|
-
super.update(descriptor
|
|
23
|
-
const actor = this.getActor<NodeActor<HemisphereLight>>(descriptor
|
|
24
|
-
this.setLight(actor, descriptor
|
|
21
|
+
update(descriptor: HemisphereLightDescriptor) {
|
|
22
|
+
super.update(descriptor)
|
|
23
|
+
const actor = this.getActor<NodeActor<HemisphereLight>>(descriptor)
|
|
24
|
+
this.setLight(actor, descriptor)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
pickup(descriptor: HemisphereLightDescriptor,
|
|
27
|
+
pickup(descriptor: HemisphereLightDescriptor, result: PickupObject[]) { }
|
|
28
28
|
}
|
|
29
29
|
NodeInterpreter.register(HemisphereLightInterpreter)
|
|
30
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PointLight } from "three";
|
|
2
|
-
import { PickupObject
|
|
2
|
+
import { PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { PointLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -7,12 +7,12 @@ import { NodeActor } from "../../actor";
|
|
|
7
7
|
class PointLightInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = PointLightDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: PointLightDescriptor
|
|
10
|
+
protected createActor(descriptor: PointLightDescriptor) {
|
|
11
11
|
const actor = new NodeActor(new PointLight())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
setLight(actor: NodeActor<PointLight>, descriptor: PointLightDescriptor
|
|
15
|
+
setLight(actor: NodeActor<PointLight>, descriptor: PointLightDescriptor) {
|
|
16
16
|
actor.object.color.set(descriptor.color)
|
|
17
17
|
actor.object.intensity = descriptor.intensity
|
|
18
18
|
actor.object.decay = descriptor.decay
|
|
@@ -26,19 +26,19 @@ class PointLightInterpreter extends NodeInterpreter {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
update(descriptor: PointLightDescriptor
|
|
30
|
-
super.update(descriptor
|
|
31
|
-
const actor = this.getActor<NodeActor<PointLight>>(descriptor
|
|
32
|
-
this.setLight(actor, descriptor
|
|
29
|
+
update(descriptor: PointLightDescriptor) {
|
|
30
|
+
super.update(descriptor)
|
|
31
|
+
const actor = this.getActor<NodeActor<PointLight>>(descriptor)
|
|
32
|
+
this.setLight(actor, descriptor)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
free(descriptor: PointLightDescriptor
|
|
36
|
-
const actor = this.getActor<NodeActor<PointLight>>(descriptor
|
|
35
|
+
free(descriptor: PointLightDescriptor) {
|
|
36
|
+
const actor = this.getActor<NodeActor<PointLight>>(descriptor)
|
|
37
37
|
actor.object.dispose()
|
|
38
|
-
super.free(descriptor
|
|
38
|
+
super.free(descriptor)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
pickup(descriptor: PointLightDescriptor,
|
|
41
|
+
pickup(descriptor: PointLightDescriptor, result: PickupObject[]) { }
|
|
42
42
|
}
|
|
43
43
|
NodeInterpreter.register(PointLightInterpreter)
|
|
44
44
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RectAreaLight } from "three";
|
|
2
|
-
import { PickupObject
|
|
2
|
+
import { PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { RectAreaLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -7,12 +7,12 @@ import { NodeActor } from "../../actor";
|
|
|
7
7
|
class RectAreaLightInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = RectAreaLightDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: RectAreaLightDescriptor
|
|
10
|
+
protected createActor(descriptor: RectAreaLightDescriptor) {
|
|
11
11
|
const actor = new NodeActor(new RectAreaLight())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
setLight(actor: NodeActor<RectAreaLight>, descriptor: RectAreaLightDescriptor
|
|
15
|
+
setLight(actor: NodeActor<RectAreaLight>, descriptor: RectAreaLightDescriptor) {
|
|
16
16
|
actor.object.color.set(descriptor.color)
|
|
17
17
|
actor.object.intensity = descriptor.intensity
|
|
18
18
|
actor.object.width = descriptor.width
|
|
@@ -20,13 +20,13 @@ class RectAreaLightInterpreter extends NodeInterpreter {
|
|
|
20
20
|
actor.object.power = descriptor.power
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
update(descriptor: RectAreaLightDescriptor
|
|
24
|
-
super.update(descriptor
|
|
25
|
-
const actor = this.getActor<NodeActor<RectAreaLight>>(descriptor
|
|
26
|
-
this.setLight(actor, descriptor
|
|
23
|
+
update(descriptor: RectAreaLightDescriptor) {
|
|
24
|
+
super.update(descriptor)
|
|
25
|
+
const actor = this.getActor<NodeActor<RectAreaLight>>(descriptor)
|
|
26
|
+
this.setLight(actor, descriptor)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
pickup(descriptor: RectAreaLightDescriptor,
|
|
29
|
+
pickup(descriptor: RectAreaLightDescriptor, result: PickupObject[]) { }
|
|
30
30
|
}
|
|
31
31
|
NodeInterpreter.register(RectAreaLightInterpreter)
|
|
32
32
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Object3D, SpotLight } from "three";
|
|
2
|
-
import { Descriptor, PickupObject
|
|
2
|
+
import { Descriptor, PickupObject } from "@vyr/engine";
|
|
3
3
|
import { NodeInterpreter } from "../NodeInterpreter";
|
|
4
4
|
import { SpotLightDescriptor } from "../../descriptor";
|
|
5
5
|
import { NodeActor } from "../../actor";
|
|
@@ -7,12 +7,12 @@ import { NodeActor } from "../../actor";
|
|
|
7
7
|
class SpotLightInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = SpotLightDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: SpotLightDescriptor
|
|
10
|
+
protected createActor(descriptor: SpotLightDescriptor) {
|
|
11
11
|
const actor = new NodeActor(new SpotLight())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
setLight(actor: NodeActor<SpotLight>, descriptor: SpotLightDescriptor
|
|
15
|
+
setLight(actor: NodeActor<SpotLight>, descriptor: SpotLightDescriptor) {
|
|
16
16
|
actor.object.color.set(descriptor.color)
|
|
17
17
|
actor.object.intensity = descriptor.intensity
|
|
18
18
|
actor.object.angle = descriptor.angle
|
|
@@ -27,7 +27,7 @@ class SpotLightInterpreter extends NodeInterpreter {
|
|
|
27
27
|
actor.object.shadow.camera.far = camera.far
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
setTarget(actor: NodeActor<SpotLight>, descriptor: SpotLightDescriptor
|
|
30
|
+
setTarget(actor: NodeActor<SpotLight>, descriptor: SpotLightDescriptor) {
|
|
31
31
|
if (descriptor.target === '') {
|
|
32
32
|
const target = new Object3D()
|
|
33
33
|
target.position.copy(actor.object.target.position)
|
|
@@ -35,7 +35,7 @@ class SpotLightInterpreter extends NodeInterpreter {
|
|
|
35
35
|
} else {
|
|
36
36
|
const target = Descriptor.get<Descriptor>(descriptor.target)
|
|
37
37
|
if (target !== null) {
|
|
38
|
-
const targetActor = this.graphics.getActor<NodeActor>(target
|
|
38
|
+
const targetActor = this.graphics.getActor<NodeActor>(target)
|
|
39
39
|
if (targetActor instanceof NodeActor) {
|
|
40
40
|
actor.object.target = targetActor.object
|
|
41
41
|
} else {
|
|
@@ -47,20 +47,20 @@ class SpotLightInterpreter extends NodeInterpreter {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
update(descriptor: SpotLightDescriptor
|
|
51
|
-
super.update(descriptor
|
|
52
|
-
const actor = this.getActor<NodeActor<SpotLight>>(descriptor
|
|
53
|
-
this.setLight(actor, descriptor
|
|
54
|
-
this.setTarget(actor, descriptor
|
|
50
|
+
update(descriptor: SpotLightDescriptor) {
|
|
51
|
+
super.update(descriptor)
|
|
52
|
+
const actor = this.getActor<NodeActor<SpotLight>>(descriptor)
|
|
53
|
+
this.setLight(actor, descriptor)
|
|
54
|
+
this.setTarget(actor, descriptor)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
free(descriptor: SpotLightDescriptor
|
|
58
|
-
const actor = this.getActor<NodeActor<SpotLight>>(descriptor
|
|
57
|
+
free(descriptor: SpotLightDescriptor) {
|
|
58
|
+
const actor = this.getActor<NodeActor<SpotLight>>(descriptor)
|
|
59
59
|
actor.object.dispose()
|
|
60
|
-
super.free(descriptor
|
|
60
|
+
super.free(descriptor)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
pickup(descriptor: SpotLightDescriptor,
|
|
63
|
+
pickup(descriptor: SpotLightDescriptor, result: PickupObject[]) { }
|
|
64
64
|
}
|
|
65
65
|
NodeInterpreter.register(SpotLightInterpreter)
|
|
66
66
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Material } from "three";
|
|
2
|
-
import { Interpreter
|
|
2
|
+
import { Interpreter } from "@vyr/engine";
|
|
3
3
|
import { MaterialDescriptor } from "../../descriptor";
|
|
4
4
|
import { MaterialActor } from "../../actor";
|
|
5
5
|
import { material as _material } from "../../utils";
|
|
@@ -23,10 +23,10 @@ class MaterialInterpreter extends Interpreter {
|
|
|
23
23
|
material.needsUpdate = true
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
free(descriptor: MaterialDescriptor
|
|
27
|
-
const actor = this.getActor<MaterialActor>(descriptor
|
|
26
|
+
free(descriptor: MaterialDescriptor) {
|
|
27
|
+
const actor = this.getActor<MaterialActor>(descriptor)
|
|
28
28
|
actor.object.dispose()
|
|
29
|
-
super.free(descriptor
|
|
29
|
+
super.free(descriptor)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
Interpreter.register(MaterialInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MeshBasicMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from './MaterialInterpreter'
|
|
4
3
|
import { MeshBasicMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -8,7 +7,7 @@ import { texture } from "../../utils";
|
|
|
8
7
|
class MeshBasicMaterialInterpreter extends MaterialInterpreter {
|
|
9
8
|
static type = MeshBasicMaterialDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: MeshBasicMaterialDescriptor
|
|
10
|
+
protected createActor(descriptor: MeshBasicMaterialDescriptor) {
|
|
12
11
|
const actor = new MaterialActor(new MeshBasicMaterial())
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
@@ -27,15 +26,15 @@ class MeshBasicMaterialInterpreter extends MaterialInterpreter {
|
|
|
27
26
|
material.wireframe = descriptor.wireframe
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
update(descriptor: MeshBasicMaterialDescriptor
|
|
31
|
-
super.update(descriptor
|
|
32
|
-
const actor = this.getActor<MaterialActor<MeshBasicMaterial>>(descriptor
|
|
29
|
+
update(descriptor: MeshBasicMaterialDescriptor) {
|
|
30
|
+
super.update(descriptor)
|
|
31
|
+
const actor = this.getActor<MaterialActor<MeshBasicMaterial>>(descriptor)
|
|
33
32
|
this.setProperty(actor.object, descriptor)
|
|
34
|
-
texture.setMap(actor.object, 'map', descriptor, this.graphics
|
|
35
|
-
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics
|
|
36
|
-
texture.setMap(actor.object, 'envMap', descriptor, this.graphics
|
|
37
|
-
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics
|
|
38
|
-
texture.setMap(actor.object, 'specularMap', descriptor, this.graphics
|
|
33
|
+
texture.setMap(actor.object, 'map', descriptor, this.graphics)
|
|
34
|
+
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics)
|
|
35
|
+
texture.setMap(actor.object, 'envMap', descriptor, this.graphics)
|
|
36
|
+
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics)
|
|
37
|
+
texture.setMap(actor.object, 'specularMap', descriptor, this.graphics)
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
MaterialInterpreter.register(MeshBasicMaterialInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MeshPhongMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from "./MaterialInterpreter";
|
|
4
3
|
import { MeshPhongMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -8,7 +7,7 @@ import { texture } from "../../utils";
|
|
|
8
7
|
class MeshPhongMaterialInterpreter extends MaterialInterpreter {
|
|
9
8
|
static type = MeshPhongMaterialDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: MeshPhongMaterialDescriptor
|
|
10
|
+
protected createActor(descriptor: MeshPhongMaterialDescriptor) {
|
|
12
11
|
const actor = new MaterialActor(new MeshPhongMaterial())
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
@@ -43,19 +42,19 @@ class MeshPhongMaterialInterpreter extends MaterialInterpreter {
|
|
|
43
42
|
material.wireframe = descriptor.wireframe
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
update(descriptor: MeshPhongMaterialDescriptor
|
|
47
|
-
super.update(descriptor
|
|
48
|
-
const actor = this.getActor<MaterialActor<MeshPhongMaterial>>(descriptor
|
|
45
|
+
update(descriptor: MeshPhongMaterialDescriptor) {
|
|
46
|
+
super.update(descriptor)
|
|
47
|
+
const actor = this.getActor<MaterialActor<MeshPhongMaterial>>(descriptor)
|
|
49
48
|
this.setProperty(actor.object, descriptor)
|
|
50
|
-
texture.setMap(actor.object, 'map', descriptor, this.graphics
|
|
51
|
-
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics
|
|
52
|
-
texture.setMap(actor.object, 'envMap', descriptor, this.graphics
|
|
53
|
-
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics
|
|
54
|
-
texture.setMap(actor.object, 'specularMap', descriptor, this.graphics
|
|
55
|
-
texture.setMap(actor.object, 'aoMap', descriptor, this.graphics
|
|
56
|
-
texture.setMap(actor.object, 'bumpMap', descriptor, this.graphics
|
|
57
|
-
texture.setMap(actor.object, 'emissiveMap', descriptor, this.graphics
|
|
58
|
-
texture.setMap(actor.object, 'normalMap', descriptor, this.graphics
|
|
49
|
+
texture.setMap(actor.object, 'map', descriptor, this.graphics)
|
|
50
|
+
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics)
|
|
51
|
+
texture.setMap(actor.object, 'envMap', descriptor, this.graphics)
|
|
52
|
+
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics)
|
|
53
|
+
texture.setMap(actor.object, 'specularMap', descriptor, this.graphics)
|
|
54
|
+
texture.setMap(actor.object, 'aoMap', descriptor, this.graphics)
|
|
55
|
+
texture.setMap(actor.object, 'bumpMap', descriptor, this.graphics)
|
|
56
|
+
texture.setMap(actor.object, 'emissiveMap', descriptor, this.graphics)
|
|
57
|
+
texture.setMap(actor.object, 'normalMap', descriptor, this.graphics)
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
MaterialInterpreter.register(MeshPhongMaterialInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MeshStandardMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from "./MaterialInterpreter";
|
|
4
3
|
import { MeshStandardMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -8,7 +7,7 @@ import { texture } from "../../utils";
|
|
|
8
7
|
class MeshStandardMaterialInterpreter extends MaterialInterpreter {
|
|
9
8
|
static type = MeshStandardMaterialDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: MeshStandardMaterialDescriptor
|
|
10
|
+
protected createActor(descriptor: MeshStandardMaterialDescriptor) {
|
|
12
11
|
const actor = new MaterialActor(new MeshStandardMaterial())
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
@@ -37,20 +36,20 @@ class MeshStandardMaterialInterpreter extends MaterialInterpreter {
|
|
|
37
36
|
material.wireframe = descriptor.wireframe
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
update(descriptor: MeshStandardMaterialDescriptor
|
|
41
|
-
super.update(descriptor
|
|
42
|
-
const actor = this.getActor<MaterialActor<MeshStandardMaterial>>(descriptor
|
|
39
|
+
update(descriptor: MeshStandardMaterialDescriptor) {
|
|
40
|
+
super.update(descriptor)
|
|
41
|
+
const actor = this.getActor<MaterialActor<MeshStandardMaterial>>(descriptor)
|
|
43
42
|
this.setProperty(actor.object, descriptor)
|
|
44
|
-
texture.setMap(actor.object, 'map', descriptor, this.graphics
|
|
45
|
-
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics
|
|
46
|
-
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics
|
|
47
|
-
texture.setMap(actor.object, 'aoMap', descriptor, this.graphics
|
|
48
|
-
texture.setMap(actor.object, 'bumpMap', descriptor, this.graphics
|
|
49
|
-
texture.setMap(actor.object, 'displacementMap', descriptor, this.graphics
|
|
50
|
-
texture.setMap(actor.object, 'emissiveMap', descriptor, this.graphics
|
|
51
|
-
texture.setMap(actor.object, 'metalnessMap', descriptor, this.graphics
|
|
52
|
-
texture.setMap(actor.object, 'normalMap', descriptor, this.graphics
|
|
53
|
-
texture.setMap(actor.object, 'roughnessMap', descriptor, this.graphics
|
|
43
|
+
texture.setMap(actor.object, 'map', descriptor, this.graphics)
|
|
44
|
+
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics)
|
|
45
|
+
texture.setMap(actor.object, 'lightMap', descriptor, this.graphics)
|
|
46
|
+
texture.setMap(actor.object, 'aoMap', descriptor, this.graphics)
|
|
47
|
+
texture.setMap(actor.object, 'bumpMap', descriptor, this.graphics)
|
|
48
|
+
texture.setMap(actor.object, 'displacementMap', descriptor, this.graphics)
|
|
49
|
+
texture.setMap(actor.object, 'emissiveMap', descriptor, this.graphics)
|
|
50
|
+
texture.setMap(actor.object, 'metalnessMap', descriptor, this.graphics)
|
|
51
|
+
texture.setMap(actor.object, 'normalMap', descriptor, this.graphics)
|
|
52
|
+
texture.setMap(actor.object, 'roughnessMap', descriptor, this.graphics)
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
MaterialInterpreter.register(MeshStandardMaterialInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PointsMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from './MaterialInterpreter'
|
|
4
3
|
import { PointsMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -8,7 +7,7 @@ import { texture } from "../../utils";
|
|
|
8
7
|
class PointsMaterialInterpreter extends MaterialInterpreter {
|
|
9
8
|
static type = PointsMaterialDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: PointsMaterialDescriptor
|
|
10
|
+
protected createActor(descriptor: PointsMaterialDescriptor) {
|
|
12
11
|
const actor = new MaterialActor(new PointsMaterial())
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
@@ -23,12 +22,12 @@ class PointsMaterialInterpreter extends MaterialInterpreter {
|
|
|
23
22
|
material.fog = descriptor.fog
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
update(descriptor: PointsMaterialDescriptor
|
|
27
|
-
super.update(descriptor
|
|
28
|
-
const actor = this.getActor<MaterialActor<PointsMaterial>>(descriptor
|
|
25
|
+
update(descriptor: PointsMaterialDescriptor) {
|
|
26
|
+
super.update(descriptor)
|
|
27
|
+
const actor = this.getActor<MaterialActor<PointsMaterial>>(descriptor)
|
|
29
28
|
this.setProperty(actor.object, descriptor)
|
|
30
|
-
texture.setMap(actor.object, 'map', descriptor, this.graphics
|
|
31
|
-
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics
|
|
29
|
+
texture.setMap(actor.object, 'map', descriptor, this.graphics)
|
|
30
|
+
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics)
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
MaterialInterpreter.register(PointsMaterialInterpreter)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShaderMaterial } from "three";
|
|
2
|
-
import { Asset, Scriptable,
|
|
2
|
+
import { Asset, Scriptable, ScriptableArgs } from "@vyr/engine";
|
|
3
3
|
import { MaterialInterpreter } from './MaterialInterpreter'
|
|
4
4
|
import { MaterialActor } from "../../actor";
|
|
5
5
|
import { ShaderMaterialAttribute, ShaderMaterialDescriptor } from "../../descriptor";
|
|
@@ -9,7 +9,7 @@ class ShaderMaterialInterpreter extends MaterialInterpreter {
|
|
|
9
9
|
static defaultVertexShader = 'void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}'
|
|
10
10
|
static defaultFragmentShader = 'void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );}'
|
|
11
11
|
|
|
12
|
-
protected createActor(descriptor: ShaderMaterialDescriptor
|
|
12
|
+
protected createActor(descriptor: ShaderMaterialDescriptor) {
|
|
13
13
|
const actor = new MaterialActor(new ShaderMaterial())
|
|
14
14
|
return actor
|
|
15
15
|
}
|
|
@@ -23,27 +23,27 @@ class ShaderMaterialInterpreter extends MaterialInterpreter {
|
|
|
23
23
|
material.wireframe = descriptor.wireframe
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
setShaderAsset(material: ShaderMaterial, descriptor: ShaderMaterialDescriptor
|
|
26
|
+
setShaderAsset(material: ShaderMaterial, descriptor: ShaderMaterialDescriptor) {
|
|
27
27
|
material.uniforms = {}
|
|
28
28
|
material.vertexShader = ShaderMaterialInterpreter.defaultVertexShader
|
|
29
29
|
material.fragmentShader = ShaderMaterialInterpreter.defaultFragmentShader
|
|
30
30
|
material.uniformsNeedUpdate = true
|
|
31
31
|
|
|
32
32
|
if (descriptor.shader) {
|
|
33
|
-
const shaderAsset = Asset.get<Scriptable
|
|
33
|
+
const shaderAsset = Asset.get<Scriptable<ScriptableArgs<undefined, undefined, undefined>>>(descriptor.shader)
|
|
34
34
|
if (shaderAsset === null) return
|
|
35
|
-
const attribute: ShaderMaterialAttribute = shaderAsset.execute(
|
|
35
|
+
const attribute: ShaderMaterialAttribute = shaderAsset.execute(this.graphics, { input: undefined, result: undefined, trigger: descriptor })
|
|
36
36
|
material.uniforms = attribute.uniforms
|
|
37
37
|
material.fragmentShader = attribute.fragmentShader
|
|
38
38
|
material.vertexShader = attribute.vertexShader
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
update(descriptor: ShaderMaterialDescriptor
|
|
43
|
-
super.update(descriptor
|
|
44
|
-
const actor = this.getActor<MaterialActor<ShaderMaterial>>(descriptor
|
|
42
|
+
update(descriptor: ShaderMaterialDescriptor) {
|
|
43
|
+
super.update(descriptor)
|
|
44
|
+
const actor = this.getActor<MaterialActor<ShaderMaterial>>(descriptor)
|
|
45
45
|
this.setProperty(actor.object, descriptor)
|
|
46
|
-
this.setShaderAsset(actor.object, descriptor
|
|
46
|
+
this.setShaderAsset(actor.object, descriptor)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
MaterialInterpreter.register(ShaderMaterialInterpreter)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ShadowMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from './MaterialInterpreter'
|
|
4
3
|
import { ShadowMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -7,7 +6,7 @@ import { MaterialActor } from "../../actor";
|
|
|
7
6
|
class ShadowMaterialInterpreter extends MaterialInterpreter {
|
|
8
7
|
static type = ShadowMaterialDescriptor.type
|
|
9
8
|
|
|
10
|
-
protected createActor(descriptor: ShadowMaterialDescriptor
|
|
9
|
+
protected createActor(descriptor: ShadowMaterialDescriptor) {
|
|
11
10
|
const actor = new MaterialActor(new ShadowMaterial())
|
|
12
11
|
return actor
|
|
13
12
|
}
|
|
@@ -20,9 +19,9 @@ class ShadowMaterialInterpreter extends MaterialInterpreter {
|
|
|
20
19
|
material.fog = descriptor.fog
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
update(descriptor: ShadowMaterialDescriptor
|
|
24
|
-
super.update(descriptor
|
|
25
|
-
const actor = this.getActor<MaterialActor<ShadowMaterial>>(descriptor
|
|
22
|
+
update(descriptor: ShadowMaterialDescriptor) {
|
|
23
|
+
super.update(descriptor)
|
|
24
|
+
const actor = this.getActor<MaterialActor<ShadowMaterial>>(descriptor)
|
|
26
25
|
this.setProperty(actor.object, descriptor)
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SpriteMaterial } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MaterialInterpreter } from './MaterialInterpreter'
|
|
4
3
|
import { SpriteMaterialDescriptor } from "../../descriptor";
|
|
5
4
|
import { MaterialActor } from "../../actor";
|
|
@@ -8,7 +7,7 @@ import { texture } from "../../utils";
|
|
|
8
7
|
class SpriteMaterialInterpreter extends MaterialInterpreter {
|
|
9
8
|
static type = SpriteMaterialDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: SpriteMaterialDescriptor
|
|
10
|
+
protected createActor(descriptor: SpriteMaterialDescriptor) {
|
|
12
11
|
const actor = new MaterialActor(new SpriteMaterial())
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
@@ -23,12 +22,12 @@ class SpriteMaterialInterpreter extends MaterialInterpreter {
|
|
|
23
22
|
material.fog = descriptor.fog
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
update(descriptor: SpriteMaterialDescriptor
|
|
27
|
-
super.update(descriptor
|
|
28
|
-
const actor = this.getActor<MaterialActor<SpriteMaterial>>(descriptor
|
|
25
|
+
update(descriptor: SpriteMaterialDescriptor) {
|
|
26
|
+
super.update(descriptor)
|
|
27
|
+
const actor = this.getActor<MaterialActor<SpriteMaterial>>(descriptor)
|
|
29
28
|
this.setProperty(actor.object, descriptor)
|
|
30
|
-
texture.setMap(actor.object, 'map', descriptor, this.graphics
|
|
31
|
-
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics
|
|
29
|
+
texture.setMap(actor.object, 'map', descriptor, this.graphics)
|
|
30
|
+
texture.setMap(actor.object, 'alphaMap', descriptor, this.graphics)
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
MaterialInterpreter.register(SpriteMaterialInterpreter)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Texture } from "three";
|
|
2
|
-
import { Asset, Interpreter
|
|
2
|
+
import { Asset, Interpreter } from "@vyr/engine";
|
|
3
3
|
import { TextureDescriptor } from '../../descriptor'
|
|
4
4
|
import { TextureActor } from "../../actor";
|
|
5
5
|
|
|
6
6
|
class TextureInterpreter extends Interpreter {
|
|
7
7
|
static type = TextureDescriptor.type
|
|
8
8
|
|
|
9
|
-
protected createActor(descriptor: TextureDescriptor
|
|
9
|
+
protected createActor(descriptor: TextureDescriptor) {
|
|
10
10
|
const actor = new TextureActor(new Texture())
|
|
11
11
|
return actor
|
|
12
12
|
}
|
|
@@ -40,18 +40,18 @@ class TextureInterpreter extends Interpreter {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
update(descriptor: TextureDescriptor
|
|
44
|
-
super.update(descriptor
|
|
45
|
-
let actor = this.getActor<TextureActor>(descriptor
|
|
43
|
+
update(descriptor: TextureDescriptor) {
|
|
44
|
+
super.update(descriptor)
|
|
45
|
+
let actor = this.getActor<TextureActor>(descriptor)
|
|
46
46
|
this.setProperty(actor, descriptor)
|
|
47
47
|
this.setImage(actor, descriptor)
|
|
48
48
|
if (actor.object.image) actor.object.needsUpdate = true
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
free(descriptor: TextureDescriptor
|
|
52
|
-
const actor = this.getActor<TextureActor>(descriptor
|
|
51
|
+
free(descriptor: TextureDescriptor) {
|
|
52
|
+
const actor = this.getActor<TextureActor>(descriptor)
|
|
53
53
|
actor.object.dispose()
|
|
54
|
-
super.free(descriptor
|
|
54
|
+
super.free(descriptor)
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
Interpreter.register(TextureInterpreter)
|