@vyr/three 0.0.1 → 0.0.3
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
package/package.json
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vyr/three",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./src/index.ts",
|
|
6
|
-
"author": "",
|
|
7
|
-
"sideEffects": true,
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@vyr/locale": "0.0.1",
|
|
11
|
-
"@vyr/engine": "0.0.1",
|
|
12
|
-
"postprocessing": "^6.38.0",
|
|
13
|
-
"three": "0.175.0"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@types/three": "0.175.0"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"package.json",
|
|
20
|
-
"src/"
|
|
21
|
-
],
|
|
22
|
-
"vyr": {
|
|
23
|
-
"type": "universal",
|
|
24
|
-
"order": 10
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
{"name":"@vyr/three","version":"0.0.3","description":"","main":"./src/index.ts","author":"","sideEffects":true,"license":"MIT","dependencies":{"@vyr/locale":"0.0.3","@vyr/engine":"0.0.3","postprocessing":"^6.38.0","three":"0.175.0"},"devDependencies":{"@types/three":"0.175.0"},"files":["package.json","src/"],"vyr":{"type":"universal","order":10}}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EffectComposer, RenderPass, EffectPass, SMAAEffect, SMAAPreset, EdgeDetectionMode, PredicationMode } from 'postprocessing'
|
|
2
|
-
import { Actor, ArrayUtils, Descriptor
|
|
2
|
+
import { Actor, ArrayUtils, Descriptor } from '@vyr/engine';
|
|
3
3
|
import { ComposerServiceDescriptor } from '../descriptor/ComposerServiceDescriptor';
|
|
4
4
|
import { SceneServiceActor } from "./SceneServiceActor";
|
|
5
5
|
import { PassActor } from './PassActor';
|
|
@@ -65,12 +65,12 @@ class ComposerServiceActor extends SceneServiceActor {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
update(descriptor: ComposerServiceDescriptor
|
|
69
|
-
super.update(descriptor
|
|
68
|
+
update(descriptor: ComposerServiceDescriptor) {
|
|
69
|
+
super.update(descriptor)
|
|
70
70
|
|
|
71
71
|
const graphics = Actor.getGraphics(this)
|
|
72
72
|
const camera = Descriptor.get<Descriptor>(graphics.scheduler.camera)
|
|
73
|
-
const cameraActor = graphics.getActor<NodeActor<Camera>>(camera
|
|
73
|
+
const cameraActor = graphics.getActor<NodeActor<Camera>>(camera)
|
|
74
74
|
|
|
75
75
|
const composer = this.getEffectComposer(descriptor)
|
|
76
76
|
composer.addPass(this._renderPass)
|
|
@@ -83,9 +83,10 @@ class ComposerServiceActor extends SceneServiceActor {
|
|
|
83
83
|
composer.setMainCamera(cameraActor.object)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
render(service: ComposerServiceDescriptor, camera: NodeActor<Camera
|
|
86
|
+
render(service: ComposerServiceDescriptor, camera: NodeActor<Camera>) {
|
|
87
|
+
const graphics = SceneServiceActor.getGraphics(this)
|
|
87
88
|
const composer = this.getEffectComposer(service)
|
|
88
|
-
composer.render(args.delta)
|
|
89
|
+
composer.render(graphics.args.delta)
|
|
89
90
|
this.screenPipeline.render(this.scene, camera.object)
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Object3D } from 'three'
|
|
2
2
|
import { CSS3DSprite } from 'three/examples/jsm/renderers/CSS3DRenderer.js'
|
|
3
|
-
import { Actor, ArrayUtils, Descriptor, HTMLActor, Interpreter
|
|
3
|
+
import { Actor, ArrayUtils, Descriptor, HTMLActor, Interpreter } from "@vyr/engine"
|
|
4
4
|
import { NodeActor } from "./NodeActor"
|
|
5
5
|
|
|
6
6
|
class HTMLConvertActor extends NodeActor {
|
|
@@ -9,9 +9,9 @@ class HTMLConvertActor extends NodeActor {
|
|
|
9
9
|
private _sprite: CSS3DSprite | null = null
|
|
10
10
|
private _collection: Actor[] = []
|
|
11
11
|
|
|
12
|
-
overrideUpdate = (descriptor: Descriptor, interpreter: Interpreter
|
|
13
|
-
interpreter.update(descriptor
|
|
14
|
-
const actor = interpreter.getActor<HTMLActor>(descriptor
|
|
12
|
+
overrideUpdate = (descriptor: Descriptor, interpreter: Interpreter) => {
|
|
13
|
+
interpreter.update(descriptor)
|
|
14
|
+
const actor = interpreter.getActor<HTMLActor>(descriptor)
|
|
15
15
|
const wrapper = actor.getWrapper()
|
|
16
16
|
if (wrapper === null) return
|
|
17
17
|
wrapper.style.position = ''
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Object3D } from "three";
|
|
2
|
-
import { Actor, CameraDescriptor, Graphics,
|
|
2
|
+
import { Actor, CameraDescriptor, Graphics, TickArgs } from "@vyr/engine"
|
|
3
3
|
import { OrbitControllerDescriptor, SceneServiceDescriptor } from "../descriptor";
|
|
4
4
|
import { CameraControls } from '../controls'
|
|
5
5
|
import { SceneServiceActor } from "./SceneServiceActor";
|
|
@@ -17,25 +17,25 @@ class OrbitControllerActor extends Actor {
|
|
|
17
17
|
this.controls.addEventListener('update', this._onUpdate)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
private _getCameraDescriptor(uuid: string, graphics: Graphics
|
|
21
|
-
return graphics.variableProxy.get<CameraDescriptor>(uuid, graphics
|
|
20
|
+
private _getCameraDescriptor(uuid: string, graphics: Graphics) {
|
|
21
|
+
return graphics.variableProxy.get<CameraDescriptor>(uuid, graphics)
|
|
22
22
|
}
|
|
23
|
-
private _getWrapper(descriptor: OrbitControllerDescriptor, graphics: Graphics
|
|
23
|
+
private _getWrapper(descriptor: OrbitControllerDescriptor, graphics: Graphics) {
|
|
24
24
|
let wrapper
|
|
25
25
|
const service = graphics.traceService(descriptor)
|
|
26
26
|
if (service instanceof SceneServiceDescriptor) {
|
|
27
27
|
const interpreter = graphics.getInterpreter(service)
|
|
28
|
-
const actor = interpreter.getActor<SceneServiceActor>(service
|
|
28
|
+
const actor = interpreter.getActor<SceneServiceActor>(service)
|
|
29
29
|
wrapper = actor.getWrapper()
|
|
30
30
|
}
|
|
31
31
|
return wrapper as HTMLElement
|
|
32
32
|
}
|
|
33
|
-
private _onBeforeRender = (args:
|
|
33
|
+
private _onBeforeRender = (args: TickArgs) => {
|
|
34
34
|
this.controls.update(args.delta)
|
|
35
35
|
}
|
|
36
|
-
private _onUpdate = (
|
|
36
|
+
private _onUpdate = () => {
|
|
37
37
|
const graphics = Actor.getGraphics(this)
|
|
38
|
-
const camera = this._getCameraDescriptor(graphics.scheduler.camera, graphics
|
|
38
|
+
const camera = this._getCameraDescriptor(graphics.scheduler.camera, graphics)
|
|
39
39
|
if (camera === null) return
|
|
40
40
|
camera.position.x = this.controls.camera.position.x
|
|
41
41
|
camera.position.y = this.controls.camera.position.y
|
|
@@ -47,15 +47,15 @@ class OrbitControllerActor extends Actor {
|
|
|
47
47
|
camera.scale.y = this.controls.camera.scale.y
|
|
48
48
|
camera.scale.z = this.controls.camera.scale.z
|
|
49
49
|
}
|
|
50
|
-
getCamera(graphics: Graphics
|
|
51
|
-
const camera = this._getCameraDescriptor(graphics.scheduler.camera, graphics
|
|
50
|
+
getCamera(graphics: Graphics) {
|
|
51
|
+
const camera = this._getCameraDescriptor(graphics.scheduler.camera, graphics)
|
|
52
52
|
const interpreter = graphics.getInterpreter(camera)
|
|
53
|
-
interpreter.update(camera
|
|
54
|
-
const actor = interpreter.getActor<NodeActor<any>>(camera
|
|
53
|
+
interpreter.update(camera)
|
|
54
|
+
const actor = interpreter.getActor<NodeActor<any>>(camera)
|
|
55
55
|
return actor.object
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
listen(descriptor: OrbitControllerDescriptor, graphics: Graphics
|
|
58
|
+
listen(descriptor: OrbitControllerDescriptor, graphics: Graphics) {
|
|
59
59
|
this.controls.minZoom = descriptor.minZoom
|
|
60
60
|
this.controls.maxZoom = descriptor.maxZoom
|
|
61
61
|
this.controls.minPolarAngle = descriptor.minPolarAngle
|
|
@@ -83,21 +83,21 @@ class OrbitControllerActor extends Actor {
|
|
|
83
83
|
this.controls.infinityDolly = descriptor.infinityDolly
|
|
84
84
|
this.controls.restThreshold = descriptor.restThreshold
|
|
85
85
|
|
|
86
|
-
const camera = this.getCamera(graphics
|
|
86
|
+
const camera = this.getCamera(graphics)
|
|
87
87
|
if (this.controls.camera !== camera) this.controls.listen(camera)
|
|
88
|
-
this.controls.connect(this._getWrapper(descriptor, graphics
|
|
88
|
+
this.controls.connect(this._getWrapper(descriptor, graphics))
|
|
89
89
|
graphics.engine.listen('beforeRender', this._onBeforeRender)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
unlisten(descriptor: OrbitControllerDescriptor, graphics: Graphics
|
|
92
|
+
unlisten(descriptor: OrbitControllerDescriptor, graphics: Graphics) {
|
|
93
93
|
this.controls.disconnect()
|
|
94
94
|
graphics.engine.unlisten('beforeRender', this._onBeforeRender)
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
update(descriptor: OrbitControllerDescriptor, graphics: Graphics
|
|
98
|
-
this.unlisten(descriptor, graphics
|
|
97
|
+
update(descriptor: OrbitControllerDescriptor, graphics: Graphics) {
|
|
98
|
+
this.unlisten(descriptor, graphics)
|
|
99
99
|
if (descriptor.enabled === false) return
|
|
100
|
-
this.listen(descriptor, graphics
|
|
100
|
+
this.listen(descriptor, graphics)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
dispose() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Camera, LinearToneMapping, Object3D, Scene, SRGBColorSpace, WebGLRenderer } from "three"
|
|
2
2
|
import { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer.js'
|
|
3
|
-
import { HTMLActor,
|
|
3
|
+
import { HTMLActor, Actor, Asset } from "@vyr/engine"
|
|
4
4
|
import { SceneServiceDescriptor, TextureDescriptor } from "../descriptor"
|
|
5
5
|
import { TextureActor } from "./TextureActor"
|
|
6
6
|
import { NodeActor } from "./NodeActor"
|
|
@@ -90,26 +90,26 @@ class SceneServiceActor extends HTMLActor {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
setBackground(descriptor: SceneServiceDescriptor
|
|
93
|
+
setBackground(descriptor: SceneServiceDescriptor) {
|
|
94
94
|
if (descriptor.background) {
|
|
95
95
|
const graphics = Actor.getGraphics(this)
|
|
96
96
|
const texture = Asset.get<TextureDescriptor>(descriptor.background)
|
|
97
|
-
const actor = graphics.getActor<TextureActor>(texture
|
|
97
|
+
const actor = graphics.getActor<TextureActor>(texture)
|
|
98
98
|
this.scene.background = texture instanceof TextureDescriptor ? actor.object : null
|
|
99
99
|
} else {
|
|
100
100
|
this.scene.background = null
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
update(descriptor: SceneServiceDescriptor
|
|
104
|
+
update(descriptor: SceneServiceDescriptor) {
|
|
105
105
|
const wrapper = this.getWrapper()
|
|
106
|
-
this.setHTMLStyle(wrapper, this.getWrapperStyle(descriptor
|
|
107
|
-
this.setHTMLStyle(this.pipeline.domElement, this.getLayoutStyle(descriptor
|
|
108
|
-
this.setStyleClass(this.pipeline.domElement, this.getStyleClass(descriptor
|
|
109
|
-
this.setBackground(descriptor
|
|
106
|
+
this.setHTMLStyle(wrapper, this.getWrapperStyle(descriptor))
|
|
107
|
+
this.setHTMLStyle(this.pipeline.domElement, this.getLayoutStyle(descriptor))
|
|
108
|
+
this.setStyleClass(this.pipeline.domElement, this.getStyleClass(descriptor))
|
|
109
|
+
this.setBackground(descriptor)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
render(service: SceneServiceDescriptor, camera: NodeActor<Camera
|
|
112
|
+
render(service: SceneServiceDescriptor, camera: NodeActor<Camera>) {
|
|
113
113
|
this.pipeline.render(this.scene, camera.object)
|
|
114
114
|
this.screenPipeline.render(this.scene, camera.object)
|
|
115
115
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Actor, Graphics
|
|
1
|
+
import { Actor, Graphics } from "@vyr/engine"
|
|
2
2
|
import { TransformControllerDescriptor } from "../descriptor"
|
|
3
3
|
import { TransformControls } from "../controls"
|
|
4
4
|
|
|
5
5
|
class TransformControllerActor extends Actor {
|
|
6
6
|
readonly object = new TransformControls()
|
|
7
7
|
|
|
8
|
-
update(descriptor: TransformControllerDescriptor, graphics: Graphics
|
|
8
|
+
update(descriptor: TransformControllerDescriptor, graphics: Graphics) {
|
|
9
9
|
this.object.unlisten(graphics)
|
|
10
10
|
if (descriptor.enabled === false) return
|
|
11
|
-
this.object.listen(descriptor, graphics
|
|
11
|
+
this.object.listen(descriptor, graphics)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
unlisten(graphics: Graphics) {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
TorusGeometry,
|
|
22
22
|
Vector3,
|
|
23
23
|
} from 'three'
|
|
24
|
-
import { Asset, NodeDescriptor,
|
|
24
|
+
import { Asset, NodeDescriptor, ServiceDescriptor, Graphics, Scriptable, Descriptor } from '@vyr/engine'
|
|
25
25
|
import { TransformControllerChangeArgs, TransformControllerDescriptor, SceneServiceDescriptor, OrbitControllerDescriptor } from '../descriptor'
|
|
26
26
|
import { NodeActor, SceneServiceActor } from '../actor'
|
|
27
27
|
|
|
@@ -1255,24 +1255,24 @@ class TransformControls extends Object3D {
|
|
|
1255
1255
|
this.sourceTarget.rotation.y = this.object.rotation.y
|
|
1256
1256
|
this.sourceTarget.rotation.z = this.object.rotation.z
|
|
1257
1257
|
|
|
1258
|
-
const _args: TransformControllerChangeArgs = {
|
|
1259
|
-
this.scriptable.execute(this.
|
|
1258
|
+
const _args: TransformControllerChangeArgs = { event: { type, target: this.descriptor.target }, trigger: this.sourceTarget }
|
|
1259
|
+
this.scriptable.execute(this.graphics, _args)
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
|
-
listen(descriptor: TransformControllerDescriptor, graphics: Graphics
|
|
1262
|
+
listen(descriptor: TransformControllerDescriptor, graphics: Graphics) {
|
|
1263
1263
|
this.unlisten(graphics)
|
|
1264
1264
|
|
|
1265
|
-
const sourceTarget = graphics.variableProxy.get<NodeDescriptor>(descriptor.target, graphics
|
|
1265
|
+
const sourceTarget = graphics.variableProxy.get<NodeDescriptor>(descriptor.target, graphics)
|
|
1266
1266
|
if (sourceTarget === null) return
|
|
1267
|
-
const sourceTargetActor = graphics.getActor(sourceTarget
|
|
1267
|
+
const sourceTargetActor = graphics.getActor(sourceTarget)
|
|
1268
1268
|
if (sourceTargetActor instanceof NodeActor) {
|
|
1269
|
-
const camera = graphics.variableProxy.get<NodeDescriptor>(graphics.scheduler.camera, graphics
|
|
1270
|
-
const actor = graphics.getActor(camera
|
|
1269
|
+
const camera = graphics.variableProxy.get<NodeDescriptor>(graphics.scheduler.camera, graphics)
|
|
1270
|
+
const actor = graphics.getActor(camera) as NodeActor
|
|
1271
1271
|
const scriptable = Asset.get(descriptor.event)
|
|
1272
1272
|
|
|
1273
1273
|
this.setCustomProperty('camera', actor.object)
|
|
1274
1274
|
this.setCustomProperty('graphics', graphics)
|
|
1275
|
-
this.setCustomProperty('args'
|
|
1275
|
+
this.setCustomProperty('args')
|
|
1276
1276
|
this.setCustomProperty('descriptor', descriptor)
|
|
1277
1277
|
this.setCustomProperty('mode', descriptor.mode)
|
|
1278
1278
|
this.setCustomProperty('scriptable', scriptable)
|
|
@@ -1281,7 +1281,7 @@ class TransformControls extends Object3D {
|
|
|
1281
1281
|
|
|
1282
1282
|
this.attach(sourceTargetActor.object)
|
|
1283
1283
|
|
|
1284
|
-
this.domElement = this.getWrapper(descriptor, graphics
|
|
1284
|
+
this.domElement = this.getWrapper(descriptor, graphics)
|
|
1285
1285
|
|
|
1286
1286
|
this.events.push(graphics.engine.inputSystem.listen('pointerdown', this._onPointerDown, { target: this.domElement }))
|
|
1287
1287
|
this.events.push(graphics.engine.inputSystem.listen('pointerdown', this._onPointerDown, { target: this.domElement }))
|
|
@@ -1300,10 +1300,6 @@ class TransformControls extends Object3D {
|
|
|
1300
1300
|
this.setCustomProperty('enabled', false)
|
|
1301
1301
|
}
|
|
1302
1302
|
|
|
1303
|
-
// update(descriptor: TransformControllerDescriptor, graphics: Graphics, args: UpdateArgs) {
|
|
1304
|
-
// this.listen(descriptor, graphics, args)
|
|
1305
|
-
// }
|
|
1306
|
-
|
|
1307
1303
|
unbind(graphics: Graphics) {
|
|
1308
1304
|
for (const e of this.events) graphics.engine.inputSystem.unlisten(e)
|
|
1309
1305
|
this.events.length = 0
|
|
@@ -1320,12 +1316,12 @@ class TransformControls extends Object3D {
|
|
|
1320
1316
|
})
|
|
1321
1317
|
}
|
|
1322
1318
|
|
|
1323
|
-
private getWrapper(descriptor: TransformControllerDescriptor, graphics: Graphics
|
|
1319
|
+
private getWrapper(descriptor: TransformControllerDescriptor, graphics: Graphics) {
|
|
1324
1320
|
let wrapper
|
|
1325
1321
|
const service = graphics.traceService(descriptor)
|
|
1326
1322
|
if (service instanceof SceneServiceDescriptor) {
|
|
1327
1323
|
const interpreter = graphics.getInterpreter(service)
|
|
1328
|
-
const actor = interpreter.getActor<SceneServiceActor>(service
|
|
1324
|
+
const actor = interpreter.getActor<SceneServiceActor>(service)
|
|
1329
1325
|
wrapper = actor.getWrapper()
|
|
1330
1326
|
}
|
|
1331
1327
|
return wrapper as HTMLElement
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ControllerDescriptor, DeserializationObject,
|
|
1
|
+
import { ControllerDescriptor, DeserializationObject, ScriptableArgs } from "@vyr/engine";
|
|
2
2
|
|
|
3
|
-
interface OrbitControllerChangeArgs extends
|
|
3
|
+
interface OrbitControllerChangeArgs extends ScriptableArgs<undefined, undefined, undefined> {
|
|
4
4
|
event: {
|
|
5
5
|
type: string,
|
|
6
6
|
target: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ControllerDescriptor, DeserializationObject,
|
|
1
|
+
import { ControllerDescriptor, DeserializationObject, ScriptableArgs } from "@vyr/engine";
|
|
2
2
|
|
|
3
|
-
interface TransformControllerChangeArgs extends
|
|
3
|
+
interface TransformControllerChangeArgs extends ScriptableArgs {
|
|
4
4
|
event: {
|
|
5
5
|
type: string,
|
|
6
6
|
target: string
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// class ComposerServiceInterpreter extends SceneServiceInterpreter {
|
|
7
7
|
// static type = ComposerServiceDescriptor.type
|
|
8
8
|
|
|
9
|
-
// protected createActor(descriptor: ComposerServiceDescriptor
|
|
9
|
+
// protected createActor(descriptor: ComposerServiceDescriptor) {
|
|
10
10
|
// const actor = new ComposerServiceActor(descriptor)
|
|
11
11
|
// return actor
|
|
12
12
|
// }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Material, Mesh, Object3D, Vector2 as _V2, BufferGeometry } from "three";
|
|
2
|
-
import { Asset, AsyncTask, Category, Data, DatasetDescriptor, Descriptor, Generate, Graphics, Interpreter, JsonAsset, observer, PrefabeDescriptor, PrefabInstanceDescriptor, Queue,
|
|
2
|
+
import { Asset, AsyncTask, Category, Data, DatasetDescriptor, Descriptor, Generate, Graphics, Interpreter, JsonAsset, observer, PrefabeDescriptor, PrefabInstanceDescriptor, Queue, InteractionDescriptor, InteractionNode, Unit, Vector2 } from "@vyr/engine";
|
|
3
3
|
import { ExtrudeGeometryDescriptor, GeoMapDescriptor, GeometryDescriptor, HTMLConvertDescriptor, PlaneGeometryDescriptor, TubeGeometryDescriptor } from '../descriptor'
|
|
4
4
|
import { NodeInterpreter, PickupNode } from "./NodeInterpreter";
|
|
5
5
|
import { material, diaposeObject3D, collectionPickupResult } from "../utils";
|
|
6
6
|
import { NodeActor } from "../actor";
|
|
7
|
-
import { executePreset,
|
|
7
|
+
import { executePreset, interactionPreset } from "../preset";
|
|
8
8
|
|
|
9
9
|
interface GeoFeature<T extends BufferGeometry = BufferGeometry> {
|
|
10
10
|
url: string
|
|
@@ -71,9 +71,9 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
71
71
|
readonly wrapper = new Object3D()
|
|
72
72
|
readonly features: GeoFeature[] = []
|
|
73
73
|
readonly labels: HTMLConvertDescriptor[] = []
|
|
74
|
-
readonly
|
|
74
|
+
readonly interactions: InteractionDescriptor[] = []
|
|
75
75
|
|
|
76
|
-
protected createActor(descriptor: Descriptor
|
|
76
|
+
protected createActor(descriptor: Descriptor) {
|
|
77
77
|
const actor = new NodeActor(new Object3D())
|
|
78
78
|
actor.object.add(this.wrapper)
|
|
79
79
|
return actor
|
|
@@ -100,7 +100,7 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
100
100
|
Asset.set(datasetUrl, dataset)
|
|
101
101
|
|
|
102
102
|
const inputs = {
|
|
103
|
-
[
|
|
103
|
+
[interactionPreset.GeoMap.drilldown.nodes.drilldown]: executePreset.GeoMap.drilldown.createExecuteInput({
|
|
104
104
|
dataset,
|
|
105
105
|
geoMap: descriptor,
|
|
106
106
|
})
|
|
@@ -110,7 +110,7 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
110
110
|
sub.interactions.push({
|
|
111
111
|
uuid: Generate.uuid(),
|
|
112
112
|
type: "click",
|
|
113
|
-
url:
|
|
113
|
+
url: interactionPreset.GeoMap.drilldown.url,
|
|
114
114
|
inputs,
|
|
115
115
|
})
|
|
116
116
|
})
|
|
@@ -124,7 +124,7 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
124
124
|
}
|
|
125
125
|
return data
|
|
126
126
|
}
|
|
127
|
-
buildLabel(descriptor: GeoMapDescriptor, fullJson: JsonAsset, offset: Vector2
|
|
127
|
+
buildLabel(descriptor: GeoMapDescriptor, fullJson: JsonAsset, offset: Vector2) {
|
|
128
128
|
const prefab = Asset.get<PrefabeDescriptor>(descriptor.label)
|
|
129
129
|
if (prefab === null) return
|
|
130
130
|
const dataset = Asset.get<DatasetDescriptor>(descriptor.dataset)
|
|
@@ -139,7 +139,7 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
buildFeature(feature: JsonAsset, materials: Material | Material[], offset: Vector2, factory: GeometryFactory,
|
|
142
|
+
buildFeature(feature: JsonAsset, materials: Material | Material[], offset: Vector2, factory: GeometryFactory, flag: string) {
|
|
143
143
|
const geometryUrl = Asset.createVirtualUrl(`GeoMap/geometry/${flag}/${feature.properties.adcode}${Category.geometrySuffix}`)
|
|
144
144
|
const datasetUrl = Asset.createVirtualUrl(`GeoMap/dataset/${flag}/${feature.properties.adcode}${Category.datasetSuffix}`)
|
|
145
145
|
|
|
@@ -150,8 +150,8 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
150
150
|
const interpreter = Graphics.createInterpreter(geometry, this.graphics)
|
|
151
151
|
//@ts-ignore
|
|
152
152
|
interpreter.unit = new Unit(geometry.uuid, '', this.unit.queue)
|
|
153
|
-
interpreter.update(geometry
|
|
154
|
-
const actor = interpreter.getActor(geometry
|
|
153
|
+
interpreter.update(geometry)
|
|
154
|
+
const actor = interpreter.getActor(geometry)
|
|
155
155
|
|
|
156
156
|
const mesh = new Mesh(actor.object, materials)
|
|
157
157
|
|
|
@@ -162,48 +162,48 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
162
162
|
return item
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
buildBorder(fullJson: JsonAsset, materials: Material | Material[], offset: Vector2, features: GeoFeature[]
|
|
165
|
+
buildBorder(fullJson: JsonAsset, materials: Material | Material[], offset: Vector2, features: GeoFeature[]) {
|
|
166
166
|
for (const feature of fullJson.features) {
|
|
167
|
-
const item = this.buildFeature(feature, materials, offset, tubeFactory,
|
|
167
|
+
const item = this.buildFeature(feature, materials, offset, tubeFactory, 'border')
|
|
168
168
|
item.mesh.position.z = 1.22
|
|
169
169
|
features.push(item)
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
buildShadow(feature: JsonAsset, materials: Material | Material[], offset: Vector2
|
|
174
|
-
const region = this.buildFeature(feature, materials, offset, shadowFactory,
|
|
173
|
+
buildShadow(feature: JsonAsset, materials: Material | Material[], offset: Vector2) {
|
|
174
|
+
const region = this.buildFeature(feature, materials, offset, shadowFactory, 'shadow')
|
|
175
175
|
this.features.push(region)
|
|
176
176
|
return region
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
buildRegion(feature: JsonAsset, materials: Material | Material[], offset: Vector2
|
|
180
|
-
const region = this.buildFeature(feature, materials, offset, extrudeFactory,
|
|
179
|
+
buildRegion(feature: JsonAsset, materials: Material | Material[], offset: Vector2) {
|
|
180
|
+
const region = this.buildFeature(feature, materials, offset, extrudeFactory, 'region')
|
|
181
181
|
this.features.push(region)
|
|
182
182
|
return region
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
async build(descriptor: GeoMapDescriptor
|
|
185
|
+
async build(descriptor: GeoMapDescriptor) {
|
|
186
186
|
const geojson = Asset.get<JsonAsset>(descriptor.geojsonRegion)
|
|
187
187
|
if (Array.isArray(geojson.features) === false || geojson.features.length === 0) return
|
|
188
188
|
|
|
189
|
-
const regionMaterials = material.getMaterial(descriptor.material, this.graphics
|
|
190
|
-
const borderMaterial = descriptor.borderMaterial ? material.getMaterial(descriptor.borderMaterial, this.graphics
|
|
189
|
+
const regionMaterials = material.getMaterial(descriptor.material, this.graphics)
|
|
190
|
+
const borderMaterial = descriptor.borderMaterial ? material.getMaterial(descriptor.borderMaterial, this.graphics) : regionMaterials
|
|
191
191
|
|
|
192
192
|
const regionJson = geojson.features[0]
|
|
193
193
|
const offset = new Vector2(-regionJson.properties.centroid[0], -regionJson.properties.centroid[1])
|
|
194
|
-
const region = this.buildRegion(regionJson, regionMaterials, offset
|
|
194
|
+
const region = this.buildRegion(regionJson, regionMaterials, offset)
|
|
195
195
|
region.mesh.castShadow = descriptor.castShadow
|
|
196
196
|
|
|
197
197
|
if (descriptor.shadowMaterial) {
|
|
198
|
-
const shadowMaterials = material.getMaterial(descriptor.shadowMaterial, this.graphics
|
|
199
|
-
const shadow = this.buildShadow(regionJson, shadowMaterials, offset
|
|
198
|
+
const shadowMaterials = material.getMaterial(descriptor.shadowMaterial, this.graphics)
|
|
199
|
+
const shadow = this.buildShadow(regionJson, shadowMaterials, offset)
|
|
200
200
|
shadow.mesh.receiveShadow = descriptor.castShadow
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
const fullJson = Asset.get<JsonAsset>(descriptor.geojsonBorder)
|
|
204
204
|
if (fullJson !== null && Array.isArray(fullJson.features)) {
|
|
205
|
-
if (descriptor.label) this.buildLabel(descriptor, fullJson, offset
|
|
206
|
-
this.buildBorder(fullJson, borderMaterial, offset, this.features
|
|
205
|
+
if (descriptor.label) this.buildLabel(descriptor, fullJson, offset)
|
|
206
|
+
this.buildBorder(fullJson, borderMaterial, offset, this.features)
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -223,27 +223,27 @@ class GeoMapInterpreter extends NodeInterpreter {
|
|
|
223
223
|
if (this._task !== null) this._task.cancel()
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
update(descriptor: GeoMapDescriptor
|
|
227
|
-
super.update(descriptor
|
|
226
|
+
update(descriptor: GeoMapDescriptor) {
|
|
227
|
+
super.update(descriptor)
|
|
228
228
|
|
|
229
229
|
this.wrapper.layers.set(descriptor.layer)
|
|
230
230
|
this.wrapper.visible = descriptor.visible
|
|
231
231
|
|
|
232
232
|
this.clear()
|
|
233
|
-
if (descriptor.geojsonRegion) this.build(descriptor
|
|
233
|
+
if (descriptor.geojsonRegion) this.build(descriptor)
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
unmount(descriptor: GeoMapDescriptor,
|
|
236
|
+
unmount(descriptor: GeoMapDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
237
237
|
this.clear()
|
|
238
|
-
super.unmount(descriptor,
|
|
238
|
+
super.unmount(descriptor, parentInterpreter, parentDescriptor)
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
free(descriptor: GeoMapDescriptor
|
|
241
|
+
free(descriptor: GeoMapDescriptor) {
|
|
242
242
|
this.clear()
|
|
243
|
-
super.free(descriptor
|
|
243
|
+
super.free(descriptor)
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
pickup(descriptor: GeoMapDescriptor,
|
|
246
|
+
pickup(descriptor: GeoMapDescriptor, result: PickupNode[]) {
|
|
247
247
|
if (descriptor.visible === false) return
|
|
248
248
|
collectionPickupResult(this.wrapper, true, descriptor, result)
|
|
249
249
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Object3D } from 'three'
|
|
2
|
-
import { Descriptor, Interpreter, PickupObject
|
|
2
|
+
import { Descriptor, Interpreter, PickupObject } from "@vyr/engine";
|
|
3
3
|
import { HTMLConvertDescriptor } from "../descriptor";
|
|
4
4
|
import { NodeInterpreter } from "./NodeInterpreter";
|
|
5
5
|
import { HTMLConvertActor } from '../actor';
|
|
@@ -7,24 +7,24 @@ import { HTMLConvertActor } from '../actor';
|
|
|
7
7
|
class HTMLConvertInterpreter extends NodeInterpreter {
|
|
8
8
|
static type = HTMLConvertDescriptor.type
|
|
9
9
|
|
|
10
|
-
protected createActor(descriptor: Descriptor
|
|
10
|
+
protected createActor(descriptor: Descriptor) {
|
|
11
11
|
const actor = new HTMLConvertActor(new Object3D())
|
|
12
12
|
return actor
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
unmount(descriptor: HTMLConvertDescriptor,
|
|
16
|
-
const actor = this.getActor<HTMLConvertActor>(descriptor
|
|
15
|
+
unmount(descriptor: HTMLConvertDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
16
|
+
const actor = this.getActor<HTMLConvertActor>(descriptor)
|
|
17
17
|
actor.clear()
|
|
18
|
-
super.unmount(descriptor,
|
|
18
|
+
super.unmount(descriptor, parentInterpreter, parentDescriptor)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
free(descriptor: HTMLConvertDescriptor
|
|
22
|
-
const actor = this.getActor<HTMLConvertActor>(descriptor
|
|
21
|
+
free(descriptor: HTMLConvertDescriptor) {
|
|
22
|
+
const actor = this.getActor<HTMLConvertActor>(descriptor)
|
|
23
23
|
actor.clear()
|
|
24
|
-
super.free(descriptor
|
|
24
|
+
super.free(descriptor)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
pickup(descriptor: HTMLConvertDescriptor,
|
|
27
|
+
pickup(descriptor: HTMLConvertDescriptor, result: PickupObject[]) { }
|
|
28
28
|
}
|
|
29
29
|
NodeInterpreter.register(HTMLConvertInterpreter)
|
|
30
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Color, InstancedMesh, Matrix4, Object3D } from 'three'
|
|
2
|
-
import { DatasetDescriptor
|
|
2
|
+
import { DatasetDescriptor } from "@vyr/engine";
|
|
3
3
|
import { InstancedMeshDescriptor, InstancedSetting } from "../descriptor";
|
|
4
4
|
import { PickupNode } from './NodeInterpreter';
|
|
5
5
|
import { MeshInterpreter } from "./MeshInterpreter";
|
|
@@ -13,7 +13,7 @@ class InstancedMeshInterpreter extends MeshInterpreter {
|
|
|
13
13
|
instancedMesh!: InstancedMesh
|
|
14
14
|
count = -1
|
|
15
15
|
|
|
16
|
-
createActor(descriptor: InstancedMeshDescriptor
|
|
16
|
+
createActor(descriptor: InstancedMeshDescriptor) {
|
|
17
17
|
const actor = new NodeActor(new Object3D())
|
|
18
18
|
//@ts-ignore
|
|
19
19
|
this.wrapper = new Object3D()
|
|
@@ -37,36 +37,36 @@ class InstancedMeshInterpreter extends MeshInterpreter {
|
|
|
37
37
|
if (instance.instanceColor) instance.instanceColor.needsUpdate = true
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
getInstancedMesh(descriptor: InstancedMeshDescriptor,
|
|
40
|
+
getInstancedMesh(descriptor: InstancedMeshDescriptor, setting: InstancedSetting[]) {
|
|
41
41
|
const instancedMesh = new InstancedMesh(geometry.defaultGeometry(), material.defaultMaterial(), setting.length)
|
|
42
42
|
return instancedMesh
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
setInstancedMesh(descriptor: InstancedMeshDescriptor
|
|
45
|
+
setInstancedMesh(descriptor: InstancedMeshDescriptor) {
|
|
46
46
|
const setting = DatasetDescriptor.getCollection<InstancedSetting>(descriptor.setting)
|
|
47
47
|
if (this.count !== setting.length) {
|
|
48
48
|
this.count = setting.length
|
|
49
49
|
this.wrapper.clear()
|
|
50
50
|
if (this.instancedMesh) this.instancedMesh.dispose()
|
|
51
|
-
this.instancedMesh = this.getInstancedMesh(descriptor,
|
|
51
|
+
this.instancedMesh = this.getInstancedMesh(descriptor, setting)
|
|
52
52
|
this.wrapper.add(this.instancedMesh)
|
|
53
53
|
}
|
|
54
54
|
this.updateInstanceMesh(setting, this.instancedMesh)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
update(descriptor: InstancedMeshDescriptor
|
|
58
|
-
super.update(descriptor
|
|
59
|
-
this.setInstancedMesh(descriptor
|
|
60
|
-
this.instancedMesh.geometry = geometry.getGeometry(descriptor.geometry, this.graphics
|
|
61
|
-
this.instancedMesh.material = material.getMaterial(descriptor.material, this.graphics
|
|
57
|
+
update(descriptor: InstancedMeshDescriptor) {
|
|
58
|
+
super.update(descriptor)
|
|
59
|
+
this.setInstancedMesh(descriptor)
|
|
60
|
+
this.instancedMesh.geometry = geometry.getGeometry(descriptor.geometry, this.graphics)
|
|
61
|
+
this.instancedMesh.material = material.getMaterial(descriptor.material, this.graphics)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
free(descriptor: InstancedMeshDescriptor
|
|
64
|
+
free(descriptor: InstancedMeshDescriptor) {
|
|
65
65
|
this.instancedMesh.dispose()
|
|
66
|
-
super.free(descriptor
|
|
66
|
+
super.free(descriptor)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
pickup(descriptor: InstancedMeshDescriptor,
|
|
69
|
+
pickup(descriptor: InstancedMeshDescriptor, result: PickupNode[]) {
|
|
70
70
|
if (descriptor.visible === false) return
|
|
71
71
|
collectionPickupResult(this.wrapper, true, descriptor, result)
|
|
72
72
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Mesh } from "three";
|
|
2
|
-
import { UpdateArgs } from "@vyr/engine";
|
|
3
2
|
import { MeshDescriptor } from "../descriptor";
|
|
4
3
|
import { NodeInterpreter } from "./NodeInterpreter";
|
|
5
4
|
import { NodeActor } from "../actor";
|
|
@@ -8,16 +7,16 @@ import { geometry, material } from "../utils";
|
|
|
8
7
|
class MeshInterpreter extends NodeInterpreter {
|
|
9
8
|
static type = MeshDescriptor.type
|
|
10
9
|
|
|
11
|
-
protected createActor(descriptor: MeshDescriptor
|
|
10
|
+
protected createActor(descriptor: MeshDescriptor): NodeActor {
|
|
12
11
|
const actor = new NodeActor(new Mesh(geometry.defaultGeometry(), material.defaultMaterial()))
|
|
13
12
|
return actor
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
update(descriptor: MeshDescriptor
|
|
17
|
-
super.update(descriptor
|
|
18
|
-
const actor = this.getActor<NodeActor<Mesh>>(descriptor
|
|
19
|
-
actor.object.geometry = geometry.getGeometry(descriptor.geometry, this.graphics
|
|
20
|
-
actor.object.material = material.getMaterial(descriptor.material, this.graphics
|
|
15
|
+
update(descriptor: MeshDescriptor) {
|
|
16
|
+
super.update(descriptor)
|
|
17
|
+
const actor = this.getActor<NodeActor<Mesh>>(descriptor)
|
|
18
|
+
actor.object.geometry = geometry.getGeometry(descriptor.geometry, this.graphics)
|
|
19
|
+
actor.object.material = material.getMaterial(descriptor.material, this.graphics)
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
NodeInterpreter.register(MeshInterpreter)
|