@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,11 +1,10 @@
|
|
|
1
|
-
import { Asset,
|
|
1
|
+
import { Asset, Graphics, InteractionNode, Scriptable, ScriptableArgs } from "@vyr/engine"
|
|
2
2
|
import { language } from '../../../locale'
|
|
3
3
|
import { GeoMapDescriptor } from "../../../descriptor"
|
|
4
4
|
|
|
5
5
|
const scriptable = Asset.createVirtualUrl('preset/GeoMap/drilldown.ts')
|
|
6
|
-
class
|
|
7
|
-
async execute(
|
|
8
|
-
//@ts-ignore
|
|
6
|
+
class InteractionScriptable extends Scriptable {
|
|
7
|
+
async execute(graphics: Graphics, args: ScriptableArgs) {
|
|
9
8
|
const { dataset, geoMap } = args.input.user
|
|
10
9
|
|
|
11
10
|
const data = dataset.value.getData()
|
|
@@ -29,7 +28,7 @@ class RoutineScriptable extends Scriptable {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
Asset.provider(scriptable, async () => ({ default:
|
|
31
|
+
Asset.provider(scriptable, async () => ({ default: InteractionScriptable }))
|
|
33
32
|
|
|
34
33
|
const createExecuteInput = (args: any = {}) => {
|
|
35
34
|
const input = {
|
|
@@ -41,11 +40,11 @@ const createExecuteInput = (args: any = {}) => {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
44
|
-
const executeNode:
|
|
43
|
+
const executeNode: InteractionNode = {
|
|
45
44
|
id: options.id,
|
|
46
45
|
label: language.get(scriptable as any),
|
|
47
46
|
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
48
|
-
|
|
47
|
+
interaction: 'Execute',
|
|
49
48
|
url: scriptable,
|
|
50
49
|
input: createExecuteInput(options.input)
|
|
51
50
|
}
|
package/src/preset/index.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Asset, InteractionDescriptor } from "@vyr/engine"
|
|
2
|
+
import { GeoMap } from "../../execute"
|
|
3
|
+
|
|
4
|
+
const url = Asset.createVirtualUrl('preset/GeoMap/drilldown.interaction.json')
|
|
5
|
+
const nodes = {
|
|
6
|
+
drilldown: 'drilldown',
|
|
7
|
+
}
|
|
8
|
+
let _currentInteraction: InteractionDescriptor | null = null
|
|
9
|
+
const interactionProvider = async () => {
|
|
10
|
+
if (_currentInteraction === null) {
|
|
11
|
+
_currentInteraction = new InteractionDescriptor()
|
|
12
|
+
const drilldownNode = GeoMap.drilldown.createExecuteNode({ id: nodes.drilldown })
|
|
13
|
+
_currentInteraction.addNode([drilldownNode])
|
|
14
|
+
_currentInteraction.roots.push(drilldownNode.id)
|
|
15
|
+
}
|
|
16
|
+
return _currentInteraction
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Asset.provider(url, interactionProvider)
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
url,
|
|
23
|
+
nodes,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Box3, BufferGeometry, Vector2, Vector3 } from 'three'
|
|
2
|
-
import { Asset, Graphics, JsonAsset,
|
|
2
|
+
import { Asset, Graphics, JsonAsset, Vector2 as V2 } from '@vyr/engine'
|
|
3
3
|
import { ExtrudeGeometryDescriptor } from '../../descriptor'
|
|
4
4
|
import { GeometryActor } from '../../actor'
|
|
5
5
|
|
|
@@ -63,12 +63,12 @@ const defaultGeometry = () => {
|
|
|
63
63
|
return _geometry
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const getGeometry = (geometry: string, graphics: Graphics
|
|
66
|
+
const getGeometry = (geometry: string, graphics: Graphics) => {
|
|
67
67
|
const geometryDescriptor = Asset.get(geometry)
|
|
68
68
|
if (geometryDescriptor === null) return defaultGeometry()
|
|
69
69
|
|
|
70
70
|
const interpreter = graphics.getInterpreter(geometryDescriptor)
|
|
71
|
-
const actor = interpreter.getActor<GeometryActor<BufferGeometry>>(geometryDescriptor
|
|
71
|
+
const actor = interpreter.getActor<GeometryActor<BufferGeometry>>(geometryDescriptor)
|
|
72
72
|
return actor.object instanceof BufferGeometry ? actor.object : defaultGeometry()
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Material, MeshBasicMaterial } from 'three'
|
|
2
|
-
import { Asset, AssetPropertyCollection, Category, Graphics, Port
|
|
2
|
+
import { Asset, AssetPropertyCollection, Category, Graphics, Port } from '@vyr/engine'
|
|
3
3
|
import { MaterialActor } from '../../actor'
|
|
4
4
|
|
|
5
5
|
let _material: Material | null = null
|
|
@@ -10,22 +10,22 @@ const defaultMaterial = () => {
|
|
|
10
10
|
return _material
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const useMaterial = (material: string, graphics: Graphics
|
|
13
|
+
const useMaterial = (material: string, graphics: Graphics) => {
|
|
14
14
|
const materialDescriptor = Asset.get(material)
|
|
15
15
|
if (materialDescriptor === null) return defaultMaterial()
|
|
16
16
|
|
|
17
17
|
const interpreter = graphics.getInterpreter(materialDescriptor)
|
|
18
|
-
const actor = interpreter.getActor<MaterialActor<Material>>(materialDescriptor
|
|
18
|
+
const actor = interpreter.getActor<MaterialActor<Material>>(materialDescriptor)
|
|
19
19
|
return actor.object instanceof Material ? actor.object : defaultMaterial()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const getMaterial = (materialValue: string | AssetPropertyCollection, graphics: Graphics
|
|
22
|
+
const getMaterial = (materialValue: string | AssetPropertyCollection, graphics: Graphics) => {
|
|
23
23
|
if (typeof materialValue === 'string') {
|
|
24
|
-
return useMaterial(materialValue, graphics
|
|
24
|
+
return useMaterial(materialValue, graphics)
|
|
25
25
|
} else {
|
|
26
26
|
const materials: Material[] = []
|
|
27
27
|
for (const material of materialValue) {
|
|
28
|
-
const actor = useMaterial(material.url, graphics
|
|
28
|
+
const actor = useMaterial(material.url, graphics)
|
|
29
29
|
materials.push(actor)
|
|
30
30
|
}
|
|
31
31
|
return materials
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Material } from 'three'
|
|
2
|
-
import { Asset, Descriptor, Graphics
|
|
2
|
+
import { Asset, Descriptor, Graphics } from '@vyr/engine'
|
|
3
3
|
import { TextureDescriptor } from '../../descriptor'
|
|
4
4
|
import { TextureActor } from '../../actor'
|
|
5
5
|
|
|
6
|
-
const setMap = <T extends Descriptor = Descriptor>(material: Material, key: keyof T, descriptor: T, graphics: Graphics
|
|
6
|
+
const setMap = <T extends Descriptor = Descriptor>(material: Material, key: keyof T, descriptor: T, graphics: Graphics) => {
|
|
7
7
|
const value = descriptor[key] as string
|
|
8
8
|
const texture = Asset.get(value)
|
|
9
9
|
if (texture instanceof TextureDescriptor) {
|
|
10
|
-
const textureActor = graphics.getActor<TextureActor>(texture
|
|
10
|
+
const textureActor = graphics.getActor<TextureActor>(texture)
|
|
11
11
|
//@ts-ignore
|
|
12
12
|
material[key] = textureActor.object
|
|
13
13
|
} else {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Asset, RoutineDescriptor } from "@vyr/engine"
|
|
2
|
-
import { GeoMap } from "../../execute"
|
|
3
|
-
|
|
4
|
-
const url = Asset.createVirtualUrl('preset/GeoMap/drilldown.routine.json')
|
|
5
|
-
const nodes = {
|
|
6
|
-
drilldown: 'drilldown',
|
|
7
|
-
}
|
|
8
|
-
let _currentRoutine: RoutineDescriptor | null = null
|
|
9
|
-
const routineProvider = async () => {
|
|
10
|
-
if (_currentRoutine === null) {
|
|
11
|
-
_currentRoutine = new RoutineDescriptor()
|
|
12
|
-
const drilldownNode = GeoMap.drilldown.createExecuteNode({ id: nodes.drilldown })
|
|
13
|
-
_currentRoutine.addNode([drilldownNode])
|
|
14
|
-
_currentRoutine.roots.push(drilldownNode.id)
|
|
15
|
-
}
|
|
16
|
-
return _currentRoutine
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
Asset.provider(url, routineProvider)
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
url,
|
|
23
|
-
nodes,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
File without changes
|
|
File without changes
|