rhodonite 0.10.2 → 0.11.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/README.md +40 -49
- package/VERSION-FILE +2 -2
- package/dist/cjs/foundation/components/SceneGraph/ISceneGraphEntity.d.ts +10 -2
- package/dist/cjs/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -16
- package/dist/cjs/foundation/components/Transform/ITransformEntity.d.ts +20 -20
- package/dist/cjs/foundation/components/Transform/TransformComponent.d.ts +26 -26
- package/dist/cjs/foundation/math/Transform3D.d.ts +17 -17
- package/dist/cjs/index.cjs +379 -344
- package/dist/esm/foundation/components/SceneGraph/ISceneGraphEntity.d.ts +10 -2
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -16
- package/dist/esm/foundation/components/Transform/ITransformEntity.d.ts +20 -20
- package/dist/esm/foundation/components/Transform/TransformComponent.d.ts +26 -26
- package/dist/esm/foundation/math/Transform3D.d.ts +17 -17
- package/dist/esm/index.js +379 -344
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,19 +38,7 @@ IE11 is not supported.
|
|
|
38
38
|
|
|
39
39
|
## Install
|
|
40
40
|
|
|
41
|
-
You can install
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
$ yarn add rhodonite
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
You can install yarn as follows,
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
$ npm install -g yarn
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can use npm of course, but we recommend yarn because we usually use it.
|
|
41
|
+
You can install Rhodonite easily.
|
|
54
42
|
|
|
55
43
|
```bash
|
|
56
44
|
$ npm install rhodonite
|
|
@@ -58,7 +46,7 @@ $ npm install rhodonite
|
|
|
58
46
|
|
|
59
47
|
### Note
|
|
60
48
|
|
|
61
|
-
If you get an error like "webxr-input-profiles not found" when building a project using Rhodonite, Try "npm install" or "yarn install again.
|
|
49
|
+
If you get an error like "webxr-input-profiles not found" when building a project using Rhodonite, Try "npm install" or "yarn install" again.
|
|
62
50
|
|
|
63
51
|
## Coding with Rhodonite
|
|
64
52
|
|
|
@@ -69,17 +57,20 @@ If you get an error like "webxr-input-profiles not found" when building a projec
|
|
|
69
57
|
<canvas id="world"></canvas>
|
|
70
58
|
<script src="../../../dist/umd/rhodonite.min.js"></script>
|
|
71
59
|
<script>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
// Init Rhodonite
|
|
61
|
+
await Rn.System.init({
|
|
62
|
+
approach: Rn.ProcessApproach.DataTexture,
|
|
63
|
+
canvas: document.getElementById('world'),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// create a Plane mesh
|
|
67
|
+
Rn.MeshHelper.createPlane();
|
|
68
|
+
planeEntity.eulerAngles = Rn.Vector3.fromCopy3(Math.PI * 0.5, 0, 0);
|
|
69
|
+
|
|
70
|
+
// Render Loop
|
|
71
|
+
Rn.System.startRenderLoop(() => {
|
|
72
|
+
Rn.System.processAuto();
|
|
73
|
+
});
|
|
83
74
|
</script>
|
|
84
75
|
</body>
|
|
85
76
|
```
|
|
@@ -95,20 +86,20 @@ You need a bundler (e.g., Webpack) to import the Rhodonite CommonJS package.
|
|
|
95
86
|
```typescript
|
|
96
87
|
import Rn from 'rhodonite';
|
|
97
88
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
89
|
+
// Init Rhodonite
|
|
90
|
+
await Rn.System.init({
|
|
91
|
+
approach: Rn.ProcessApproach.DataTexture,
|
|
92
|
+
canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
93
|
+
});
|
|
103
94
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
// create a Plane mesh
|
|
96
|
+
Rn.MeshHelper.createPlane();
|
|
97
|
+
planeEntity.eulerAngles = Rn.Vector3.fromCopy3(Math.PI * 0.5, 0, 0);
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
99
|
+
// Render Loop
|
|
100
|
+
Rn.System.startRenderLoop(() => {
|
|
101
|
+
Rn.System.processAuto();
|
|
102
|
+
});
|
|
112
103
|
```
|
|
113
104
|
|
|
114
105
|
#### Using ESModule package
|
|
@@ -123,20 +114,20 @@ You don't need any bundler.
|
|
|
123
114
|
// main.ts
|
|
124
115
|
import Rn from 'rhodonite/dist/esm/index.js';
|
|
125
116
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
// Init Rhodonite
|
|
118
|
+
await Rn.System.init({
|
|
119
|
+
approach: Rn.ProcessApproach.DataTexture,
|
|
120
|
+
canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
121
|
+
});
|
|
131
122
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
// create a Plane mesh
|
|
124
|
+
Rn.MeshHelper.createPlane();
|
|
125
|
+
planeEntity.eulerAngles = Rn.Vector3.fromCopy3(Math.PI * 0.5, 0, 0);
|
|
135
126
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
127
|
+
// Render Loop
|
|
128
|
+
Rn.System.startRenderLoop(() => {
|
|
129
|
+
Rn.System.processAuto();
|
|
130
|
+
});
|
|
140
131
|
```
|
|
141
132
|
|
|
142
133
|
```
|
package/VERSION-FILE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
v0.
|
|
2
|
-
|
|
1
|
+
v0.11.0-0-g24474f4e-dirty
|
|
2
|
+
main
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { SceneGraphComponent } from './SceneGraphComponent';
|
|
2
2
|
import { IMatrix44 } from '../../math/IMatrix';
|
|
3
|
+
import { IVector3 } from '../../math/IVector';
|
|
4
|
+
import { IQuaternion } from '../../math/IQuaternion';
|
|
3
5
|
export interface ISceneGraphEntityMethods {
|
|
4
6
|
getSceneGraph(): SceneGraphComponent;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
matrix: IMatrix44;
|
|
8
|
+
matrixInner: IMatrix44;
|
|
9
|
+
position: IVector3;
|
|
10
|
+
positionRest: IVector3;
|
|
11
|
+
scale: IVector3;
|
|
12
|
+
eulerAngles: IVector3;
|
|
13
|
+
rotation: IQuaternion;
|
|
14
|
+
rotationRest: IQuaternion;
|
|
7
15
|
addChild(sg: SceneGraphComponent): void;
|
|
8
16
|
children: SceneGraphComponent[];
|
|
9
17
|
removeChild(sg: SceneGraphComponent): void;
|
|
@@ -4,6 +4,7 @@ import { MutableMatrix44 } from '../../math/MutableMatrix44';
|
|
|
4
4
|
import { MutableMatrix33 } from '../../math/MutableMatrix33';
|
|
5
5
|
import { Vector3 } from '../../math/Vector3';
|
|
6
6
|
import { AABB } from '../../math/AABB';
|
|
7
|
+
import { MutableVector3 } from '../../math/MutableVector3';
|
|
7
8
|
import { MeshComponent } from '../Mesh/MeshComponent';
|
|
8
9
|
import { ComponentTID, ComponentSID, EntityUID } from '../../../types/CommonTypes';
|
|
9
10
|
import { CameraComponent } from '../Camera/CameraComponent';
|
|
@@ -11,7 +12,7 @@ import { Vector4 } from '../../math/Vector4';
|
|
|
11
12
|
import { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
12
13
|
import { IEntity } from '../../core/Entity';
|
|
13
14
|
import { RaycastResultEx2 } from '../../geometry/types/GeometryTypes';
|
|
14
|
-
import { IQuaternion, IVector3 } from '../../math';
|
|
15
|
+
import { IQuaternion, IVector3, Quaternion } from '../../math';
|
|
15
16
|
export declare class SceneGraphComponent extends Component {
|
|
16
17
|
private __parent?;
|
|
17
18
|
private static __sceneGraphs;
|
|
@@ -82,11 +83,10 @@ export declare class SceneGraphComponent extends Component {
|
|
|
82
83
|
get isTopLevel(): boolean;
|
|
83
84
|
get children(): SceneGraphComponent[];
|
|
84
85
|
get parent(): SceneGraphComponent | undefined;
|
|
85
|
-
get
|
|
86
|
-
get
|
|
87
|
-
get
|
|
88
|
-
get
|
|
89
|
-
get worldQuaternionRest(): IQuaternion;
|
|
86
|
+
get matrixInner(): MutableMatrix44;
|
|
87
|
+
get matrix(): MutableMatrix44;
|
|
88
|
+
get matrixRestInner(): MutableMatrix44;
|
|
89
|
+
get matrixRest(): MutableMatrix44;
|
|
90
90
|
get normalMatrixInner(): MutableMatrix33;
|
|
91
91
|
get entityWorldMatrix(): MutableMatrix44;
|
|
92
92
|
get entityWorldMatrixInner(): MutableMatrix44;
|
|
@@ -100,7 +100,7 @@ export declare class SceneGraphComponent extends Component {
|
|
|
100
100
|
* @param sceneGraphComponent collects children and itself from the sceneGraphComponent
|
|
101
101
|
* @param isJointMode collects joints only
|
|
102
102
|
*/
|
|
103
|
-
static flattenHierarchy(sceneGraphComponent: SceneGraphComponent, isJointMode:
|
|
103
|
+
static flattenHierarchy(sceneGraphComponent: SceneGraphComponent, isJointMode: boolean): SceneGraphComponent[];
|
|
104
104
|
get worldPosition(): Vector3;
|
|
105
105
|
getWorldPositionOf(localPosition: Vector3): IVector3;
|
|
106
106
|
getLocalPositionOf(worldPosition: Vector3): Vector3;
|
|
@@ -132,16 +132,16 @@ export declare class SceneGraphComponent extends Component {
|
|
|
132
132
|
$create(): void;
|
|
133
133
|
$logic(): void;
|
|
134
134
|
private __updateGizmos;
|
|
135
|
-
set
|
|
136
|
-
get
|
|
137
|
-
get
|
|
138
|
-
set
|
|
139
|
-
get
|
|
140
|
-
set
|
|
141
|
-
get
|
|
142
|
-
get
|
|
135
|
+
set position(vec: IVector3);
|
|
136
|
+
get position(): MutableVector3;
|
|
137
|
+
get positionRest(): MutableVector3;
|
|
138
|
+
set eulerAngles(vec: IVector3);
|
|
139
|
+
get eulerAngles(): Vector3;
|
|
140
|
+
set rotation(quat: IQuaternion);
|
|
141
|
+
get rotation(): Quaternion;
|
|
142
|
+
get rotationRest(): Quaternion;
|
|
143
143
|
set scale(vec: IVector3);
|
|
144
|
-
get scale():
|
|
144
|
+
get scale(): MutableVector3;
|
|
145
145
|
/**
|
|
146
146
|
* get the entity which has this component.
|
|
147
147
|
* @returns the entity which has this component
|
|
@@ -4,24 +4,24 @@ import { IMatrix22 } from '../../math/IMatrix';
|
|
|
4
4
|
import { TransformComponent } from './TransformComponent';
|
|
5
5
|
export interface ITransformEntityMethods {
|
|
6
6
|
getTransform(): TransformComponent;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
localPosition: IVector3;
|
|
8
|
+
localScale: IVector3;
|
|
9
|
+
localEulerAngles: IVector3;
|
|
10
|
+
localRotation: IQuaternion;
|
|
11
|
+
localMatrix: IMatrix22;
|
|
12
|
+
localPositionInner: IVector3;
|
|
13
|
+
localScaleInner: IVector3;
|
|
14
|
+
localEulerAnglesInner: IVector3;
|
|
15
|
+
localRotationInner: IQuaternion;
|
|
16
|
+
localMatrixInner: IMatrix22;
|
|
17
|
+
localPositionRest: IVector3;
|
|
18
|
+
localScaleRest: IVector3;
|
|
19
|
+
localEulerAnglesRest: IVector3;
|
|
20
|
+
localRotationRest: IQuaternion;
|
|
21
|
+
localMatrixRest: IMatrix22;
|
|
22
|
+
localPositionRestInner: IVector3;
|
|
23
|
+
localScaleRestInner: IVector3;
|
|
24
|
+
localEulerAnglesRestInner: IVector3;
|
|
25
|
+
localRotationRestInner: IQuaternion;
|
|
26
|
+
localMatrixRestInner: IMatrix22;
|
|
27
27
|
}
|
|
@@ -20,93 +20,93 @@ export declare class TransformComponent extends Component {
|
|
|
20
20
|
get restOrPose(): Transform3D;
|
|
21
21
|
_backupTransformAsRest(): void;
|
|
22
22
|
_restoreTransformFromRest(): void;
|
|
23
|
-
get
|
|
24
|
-
get
|
|
25
|
-
set
|
|
23
|
+
get localTransform(): Transform3D;
|
|
24
|
+
get localTransformRest(): Transform3D;
|
|
25
|
+
set localPosition(vec: IVector3);
|
|
26
26
|
/**
|
|
27
27
|
* return a copy of a local translate vector
|
|
28
28
|
*/
|
|
29
|
-
get
|
|
29
|
+
get localPosition(): IVector3;
|
|
30
30
|
/**
|
|
31
31
|
* return a local translate vector
|
|
32
32
|
*/
|
|
33
|
-
get
|
|
33
|
+
get localPositionInner(): MutableVector3;
|
|
34
34
|
/**
|
|
35
35
|
* return a copy of a local translate vector
|
|
36
36
|
*/
|
|
37
|
-
get
|
|
37
|
+
get localPositionRest(): MutableVector3;
|
|
38
38
|
/**
|
|
39
39
|
* return a local translate vector
|
|
40
40
|
*/
|
|
41
|
-
get
|
|
42
|
-
set
|
|
41
|
+
get localPositionRestInner(): MutableVector3;
|
|
42
|
+
set localEulerAngles(vec: IVector3);
|
|
43
43
|
/**
|
|
44
44
|
* return a copy of a local rotation (XYZ euler) vector
|
|
45
45
|
*/
|
|
46
|
-
get
|
|
46
|
+
get localEulerAngles(): IVector3;
|
|
47
47
|
/**
|
|
48
48
|
* return a local rotation (XYZ euler) vector
|
|
49
49
|
*/
|
|
50
|
-
get
|
|
50
|
+
get localEulerAnglesInner(): import("../../math").Vector3;
|
|
51
51
|
/**
|
|
52
52
|
* return a copy of a local rotation (XYZ euler) vector
|
|
53
53
|
*/
|
|
54
|
-
get
|
|
54
|
+
get localEulerAnglesRest(): IVector3;
|
|
55
55
|
/**
|
|
56
56
|
* return a local rotation (XYZ euler) vector
|
|
57
57
|
*/
|
|
58
|
-
get
|
|
59
|
-
set
|
|
58
|
+
get localEulerAnglesRestInner(): import("../../math").Vector3;
|
|
59
|
+
set localScale(vec: IVector3);
|
|
60
60
|
/**
|
|
61
61
|
* return a copy of a local scale vector
|
|
62
62
|
*/
|
|
63
|
-
get
|
|
63
|
+
get localScale(): IVector3;
|
|
64
64
|
/**
|
|
65
65
|
* return a local scale vector
|
|
66
66
|
*/
|
|
67
|
-
get
|
|
67
|
+
get localScaleInner(): MutableVector3;
|
|
68
68
|
/**
|
|
69
69
|
* return a copy of a local scale vector
|
|
70
70
|
*/
|
|
71
|
-
get
|
|
71
|
+
get localScaleRest(): IVector3;
|
|
72
72
|
/**
|
|
73
73
|
* return a local scale vector
|
|
74
74
|
*/
|
|
75
75
|
get scaleRestInner(): MutableVector3;
|
|
76
|
-
set
|
|
76
|
+
set localRotation(quat: IQuaternion);
|
|
77
77
|
/**
|
|
78
78
|
* return a copy of a local quaternion vector
|
|
79
79
|
*/
|
|
80
|
-
get
|
|
80
|
+
get localRotation(): IQuaternion;
|
|
81
81
|
/**
|
|
82
82
|
* return a local quaternion vector
|
|
83
83
|
*/
|
|
84
|
-
get
|
|
84
|
+
get localRotationInner(): Quaternion;
|
|
85
85
|
/**
|
|
86
86
|
* return a copy of a local quaternion vector
|
|
87
87
|
*/
|
|
88
|
-
get
|
|
88
|
+
get localRotationRest(): IQuaternion;
|
|
89
89
|
/**
|
|
90
90
|
* return a local quaternion vector
|
|
91
91
|
*/
|
|
92
|
-
get
|
|
93
|
-
set
|
|
92
|
+
get localRotationRestInner(): Quaternion;
|
|
93
|
+
set localMatrix(mat: IMatrix44);
|
|
94
94
|
/**
|
|
95
95
|
* return a copy of local transform matrix
|
|
96
96
|
*/
|
|
97
|
-
get
|
|
97
|
+
get localMatrix(): IMatrix44;
|
|
98
98
|
/**
|
|
99
99
|
* return a local transform matrix
|
|
100
100
|
*/
|
|
101
|
-
get
|
|
101
|
+
get localMatrixInner(): import("../../math").MutableMatrix44;
|
|
102
102
|
/**
|
|
103
103
|
* return a copy of local transform matrix
|
|
104
104
|
*/
|
|
105
|
-
get
|
|
105
|
+
get localMatrixRest(): IMatrix44;
|
|
106
106
|
/**
|
|
107
107
|
* return a local transform matrix
|
|
108
108
|
*/
|
|
109
|
-
get
|
|
109
|
+
get localMatrixRestInner(): import("../../math").MutableMatrix44;
|
|
110
110
|
$logic(): void;
|
|
111
111
|
/**
|
|
112
112
|
* get the entity which has this component.
|
|
@@ -3,13 +3,13 @@ import { MutableMatrix44 } from './MutableMatrix44';
|
|
|
3
3
|
import { MutableQuaternion } from './MutableQuaternion';
|
|
4
4
|
import { MutableVector3 } from './MutableVector3';
|
|
5
5
|
export declare class Transform3D {
|
|
6
|
-
private
|
|
6
|
+
private __position;
|
|
7
7
|
private __scale;
|
|
8
|
-
private
|
|
8
|
+
private __rotation;
|
|
9
9
|
private __matrix;
|
|
10
|
-
private
|
|
10
|
+
private __is_position_updated;
|
|
11
11
|
private __is_scale_updated;
|
|
12
|
-
private
|
|
12
|
+
private __is_rotation_updated;
|
|
13
13
|
private __is_trs_matrix_updated;
|
|
14
14
|
private __updateCount;
|
|
15
15
|
private static __tmpMatrix44_0;
|
|
@@ -20,24 +20,24 @@ export declare class Transform3D {
|
|
|
20
20
|
constructor();
|
|
21
21
|
constructor(Transform3D: Transform3D);
|
|
22
22
|
clone(): Transform3D;
|
|
23
|
-
set
|
|
23
|
+
set position(vec: IVector3);
|
|
24
24
|
/**
|
|
25
|
-
* return a copy of a local
|
|
25
|
+
* return a copy of a local position vector
|
|
26
26
|
*/
|
|
27
|
-
get
|
|
27
|
+
get position(): MutableVector3;
|
|
28
28
|
/**
|
|
29
|
-
* return a local
|
|
29
|
+
* return a local position vector
|
|
30
30
|
*/
|
|
31
|
-
get
|
|
32
|
-
set
|
|
31
|
+
get positionInner(): MutableVector3;
|
|
32
|
+
set eulerAngles(vec: IVector3);
|
|
33
33
|
/**
|
|
34
34
|
* return a copy of a local rotation (XYZ euler) vector
|
|
35
35
|
*/
|
|
36
|
-
get
|
|
36
|
+
get eulerAngles(): IVector3;
|
|
37
37
|
/**
|
|
38
38
|
* return a local rotation (XYZ euler) vector
|
|
39
39
|
*/
|
|
40
|
-
get
|
|
40
|
+
get eulerAnglesInner(): Vector3;
|
|
41
41
|
set scale(vec: IVector3);
|
|
42
42
|
/**
|
|
43
43
|
* return a copy of a local scale vector
|
|
@@ -47,18 +47,18 @@ export declare class Transform3D {
|
|
|
47
47
|
* return a local scale vector
|
|
48
48
|
*/
|
|
49
49
|
get scaleInner(): MutableVector3;
|
|
50
|
-
set
|
|
50
|
+
set rotation(quat: IQuaternion);
|
|
51
51
|
/**
|
|
52
52
|
* return a copy of a local quaternion vector
|
|
53
53
|
*/
|
|
54
|
-
get
|
|
54
|
+
get rotation(): IQuaternion;
|
|
55
55
|
/**
|
|
56
56
|
* return a local quaternion vector
|
|
57
57
|
*/
|
|
58
|
-
get
|
|
58
|
+
get rotationInner(): Quaternion;
|
|
59
59
|
__updateTransform(): void;
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
__updateEulerAngles(): void;
|
|
61
|
+
__updatePosition(): void;
|
|
62
62
|
__updateScale(): void;
|
|
63
63
|
__updateMatrix(): void;
|
|
64
64
|
set matrix(mat: IMatrix44);
|