@lukekaalim/act-three 5.2.0 → 5.3.0
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/components.js +16 -1
- package/hooks.js +4 -4
- package/objects.js +18 -1
- package/package.json +2 -2
- package/renderer.js +2 -0
package/components.js
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
Scene,
|
|
17
17
|
CubeTexture,
|
|
18
18
|
Fog,
|
|
19
|
+
Line,
|
|
20
|
+
LineSegments,
|
|
19
21
|
WebGLRenderer,
|
|
20
22
|
} from "three"; */
|
|
21
23
|
/*:: import * as Three from 'three'; */
|
|
@@ -110,9 +112,22 @@ export const orthographicCamera = ('orthographicCamera'/*: Component<Orthographi
|
|
|
110
112
|
|
|
111
113
|
export const mesh = ('mesh'/*: Component<MeshProps>*/);
|
|
112
114
|
export const sprite = ('sprite'/*: Component<SpriteProps>*/);
|
|
113
|
-
export const points = ('points'/*: Component<PointsProps>*/);
|
|
114
115
|
export const instancedMesh = ('instancedMesh'/*: Component<InstancedMeshProps>*/);
|
|
115
116
|
|
|
117
|
+
|
|
118
|
+
export const points = ('points'/*: Component<PointsProps>*/);
|
|
119
|
+
|
|
120
|
+
/*::
|
|
121
|
+
export type LineProps = {
|
|
122
|
+
...Object3DProps<Line>,
|
|
123
|
+
geometry?: BufferGeometry,
|
|
124
|
+
material?: Material,
|
|
125
|
+
}
|
|
126
|
+
*/
|
|
127
|
+
export const line = ('line'/*: Component<LineProps>*/);
|
|
128
|
+
export const lineLoop = ('lineLoop'/*: Component<LineProps>*/);
|
|
129
|
+
export const lineSegments = ('lineSegments'/*: Component<LineProps>*/);
|
|
130
|
+
|
|
116
131
|
export const pointLight = ('pointLight'/*: Component<PointLightsProps>*/);
|
|
117
132
|
export const ambientLight = ('ambientLight'/*: Component<AmbientLightProps>*/);
|
|
118
133
|
export const hemisphereLight = ('hemisphereLight'/*: Component<PointLightsProps>*/);
|
package/hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
/*:: import type { Ref } from '@lukekaalim/act'; */
|
|
3
|
-
/*:: import type { Camera, Scene, Texture } from "three"; */
|
|
3
|
+
/*:: import type { Camera, Scene, Texture, Object3D } from "three"; */
|
|
4
4
|
import { TextureLoader, Vector2, WebGLRenderer } from "three";
|
|
5
5
|
|
|
6
6
|
import { useEffect, useState } from "@lukekaalim/act";
|
|
@@ -102,10 +102,10 @@ export const useAnimationFrame = (
|
|
|
102
102
|
}, deps);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export const useRenderLoop = (
|
|
105
|
+
export const useRenderLoop = /*:: <TCamera: Camera, TScene: Object3D>*/(
|
|
106
106
|
renderer/*: ?WebGLRenderer*/,
|
|
107
|
-
camera/*: Ref<?
|
|
108
|
-
scene/*: Ref<?
|
|
107
|
+
camera/*: Ref<?TCamera>*/,
|
|
108
|
+
scene/*: Ref<?TScene>*/,
|
|
109
109
|
onAnimate/*: (now: DOMHighResTimeStamp, delta: number) => mixed*/ = (_, __) => {},
|
|
110
110
|
deps/*: mixed[]*/ = []
|
|
111
111
|
) => {
|
package/objects.js
CHANGED
|
@@ -13,9 +13,16 @@ import {
|
|
|
13
13
|
DirectionalLight,
|
|
14
14
|
HemisphereLight,
|
|
15
15
|
AmbientLight,
|
|
16
|
+
Skeleton,
|
|
17
|
+
LineSegments,
|
|
18
|
+
Line,
|
|
19
|
+
LineLoop,
|
|
20
|
+
Bone,
|
|
21
|
+
Sprite,
|
|
22
|
+
LOD,
|
|
16
23
|
} from "three";
|
|
17
24
|
|
|
18
|
-
const threeObjectClasses/*: { [string]: Class<Object3D> }*/ = Object.fromEntries(Object.entries({
|
|
25
|
+
export const threeObjectClasses/*: { [string]: Class<Object3D> }*/ = Object.fromEntries(Object.entries({
|
|
19
26
|
// grouping
|
|
20
27
|
Scene,
|
|
21
28
|
Group,
|
|
@@ -32,10 +39,20 @@ const threeObjectClasses/*: { [string]: Class<Object3D> }*/ = Object.fromEntries
|
|
|
32
39
|
|
|
33
40
|
// lines
|
|
34
41
|
Points,
|
|
42
|
+
LineSegments,
|
|
43
|
+
Line,
|
|
44
|
+
LineLoop,
|
|
45
|
+
|
|
46
|
+
// skinning
|
|
47
|
+
Skeleton,
|
|
48
|
+
Bone,
|
|
49
|
+
|
|
50
|
+
Sprite,
|
|
35
51
|
|
|
36
52
|
// mesh
|
|
37
53
|
Mesh,
|
|
38
54
|
InstancedMesh,
|
|
55
|
+
LOD,
|
|
39
56
|
}).map(([key, value]) => [key.toLowerCase(), (value/*: any*/)]));
|
|
40
57
|
|
|
41
58
|
export const createObject = (type/*: string*/)/*: null | Object3D*/ => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukekaalim/act-three",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Render threejs content using act",
|
|
5
5
|
"main": "entry.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@lukekaalim/act": "^2.2.0",
|
|
19
19
|
"@lukekaalim/act-renderer-core": "^3.1.1",
|
|
20
|
-
"@lukekaalim/act-reconciler": "^3.0.
|
|
20
|
+
"@lukekaalim/act-reconciler": "^3.0.1",
|
|
21
21
|
"@lukekaalim/act-web": "^1.2.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/renderer.js
CHANGED
|
@@ -21,6 +21,8 @@ export const createObjectRenderer = ()/*: Renderer<Object3D>*/ => {
|
|
|
21
21
|
add(diff) {
|
|
22
22
|
if (typeof diff.next.element.type === 'function')
|
|
23
23
|
return null;
|
|
24
|
+
if (diff.next.element.type === 'act:context')
|
|
25
|
+
return null;
|
|
24
26
|
return createObject(diff.next.element.type);
|
|
25
27
|
}
|
|
26
28
|
});
|