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 CHANGED
@@ -38,19 +38,7 @@ IE11 is not supported.
38
38
 
39
39
  ## Install
40
40
 
41
- You can install the esm version of Rhodonite easily.
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
- async function load() {
73
- // All Rhodonite classes you need are in window.Rn object.
74
- await Rn.System.init({
75
- approach: Rn.ProcessApproach.Uniform,
76
- canvas: document.getElementById('world')
77
- });
78
- const entityRepository = Rn.EntityRepository.getInstance();
79
- ...
80
- (After that, please refer to the sample codes.)
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
- async function load() {
99
- await Rn.System.init({
100
- approach: Rn.ProcessApproach.Uniform,
101
- canvas: document.getElementById('world') as HTMLCanvasElement
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
- // Camera
105
- const cameraEntity = Rn.EntityHelper.createCameraControllerEntity();
106
- const cameraComponent: Rn.CameraComponent = cameraEntity.getCamera();
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
- (After that, please refer to the sample codes.)
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
- async function load() {
127
- await Rn.System.init({
128
- approach: Rn.ProcessApproach.Uniform,
129
- canvas: document.getElementById('world') as HTMLCanvasElement
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
- // Camera
133
- const cameraEntity = Rn.EntityHelper.createCameraControllerEntity();
134
- const cameraComponent: Rn.CameraComponent = cameraEntity.getCamera();
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
- (After that, please refer to the sample codes.)
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.10.2-0-g60c1e628-dirty
2
- master
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
- worldMatrix: IMatrix44;
6
- worldMatrixInner: IMatrix44;
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 worldMatrixInner(): MutableMatrix44;
86
- get worldMatrix(): MutableMatrix44;
87
- get worldMatrixRestInner(): MutableMatrix44;
88
- get worldMatrixRest(): MutableMatrix44;
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: Boolean): SceneGraphComponent[];
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 translate(vec: IVector3);
136
- get translate(): IVector3;
137
- get translateRest(): IVector3;
138
- set rotate(vec: IVector3);
139
- get rotate(): IVector3;
140
- set quaternion(quat: IQuaternion);
141
- get quaternion(): IQuaternion;
142
- get quaternionRest(): IQuaternion;
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(): IVector3;
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
- translate: IVector3;
8
- scale: IVector3;
9
- rotate: IVector3;
10
- quaternion: IQuaternion;
11
- matrix: IMatrix22;
12
- translateInner: IVector3;
13
- scaleInner: IVector3;
14
- rotateInner: IVector3;
15
- quaternionInner: IQuaternion;
16
- matrixInner: IMatrix22;
17
- translateRest: IVector3;
18
- scaleRest: IVector3;
19
- rotateRest: IVector3;
20
- quaternionRest: IQuaternion;
21
- matrixRest: IMatrix22;
22
- translateRestInner: IVector3;
23
- scaleRestInner: IVector3;
24
- rotateRestInner: IVector3;
25
- quaternionRestInner: IQuaternion;
26
- matrixRestInner: IMatrix22;
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 transform(): Transform3D;
24
- get transformRest(): Transform3D;
25
- set translate(vec: IVector3);
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 translate(): IVector3;
29
+ get localPosition(): IVector3;
30
30
  /**
31
31
  * return a local translate vector
32
32
  */
33
- get translateInner(): MutableVector3;
33
+ get localPositionInner(): MutableVector3;
34
34
  /**
35
35
  * return a copy of a local translate vector
36
36
  */
37
- get translateRest(): IVector3;
37
+ get localPositionRest(): MutableVector3;
38
38
  /**
39
39
  * return a local translate vector
40
40
  */
41
- get translateRestInner(): MutableVector3;
42
- set rotate(vec: IVector3);
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 rotate(): IVector3;
46
+ get localEulerAngles(): IVector3;
47
47
  /**
48
48
  * return a local rotation (XYZ euler) vector
49
49
  */
50
- get rotateInner(): import("../../math").Vector3;
50
+ get localEulerAnglesInner(): import("../../math").Vector3;
51
51
  /**
52
52
  * return a copy of a local rotation (XYZ euler) vector
53
53
  */
54
- get rotateRest(): IVector3;
54
+ get localEulerAnglesRest(): IVector3;
55
55
  /**
56
56
  * return a local rotation (XYZ euler) vector
57
57
  */
58
- get rotateRestInner(): import("../../math").Vector3;
59
- set scale(vec: IVector3);
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 scale(): IVector3;
63
+ get localScale(): IVector3;
64
64
  /**
65
65
  * return a local scale vector
66
66
  */
67
- get scaleInner(): MutableVector3;
67
+ get localScaleInner(): MutableVector3;
68
68
  /**
69
69
  * return a copy of a local scale vector
70
70
  */
71
- get scaleRest(): IVector3;
71
+ get localScaleRest(): IVector3;
72
72
  /**
73
73
  * return a local scale vector
74
74
  */
75
75
  get scaleRestInner(): MutableVector3;
76
- set quaternion(quat: IQuaternion);
76
+ set localRotation(quat: IQuaternion);
77
77
  /**
78
78
  * return a copy of a local quaternion vector
79
79
  */
80
- get quaternion(): IQuaternion;
80
+ get localRotation(): IQuaternion;
81
81
  /**
82
82
  * return a local quaternion vector
83
83
  */
84
- get quaternionInner(): Quaternion;
84
+ get localRotationInner(): Quaternion;
85
85
  /**
86
86
  * return a copy of a local quaternion vector
87
87
  */
88
- get quaternionRest(): IQuaternion;
88
+ get localRotationRest(): IQuaternion;
89
89
  /**
90
90
  * return a local quaternion vector
91
91
  */
92
- get quaternionRestInner(): Quaternion;
93
- set matrix(mat: IMatrix44);
92
+ get localRotationRestInner(): Quaternion;
93
+ set localMatrix(mat: IMatrix44);
94
94
  /**
95
95
  * return a copy of local transform matrix
96
96
  */
97
- get matrix(): IMatrix44;
97
+ get localMatrix(): IMatrix44;
98
98
  /**
99
99
  * return a local transform matrix
100
100
  */
101
- get matrixInner(): import("../../math").MutableMatrix44;
101
+ get localMatrixInner(): import("../../math").MutableMatrix44;
102
102
  /**
103
103
  * return a copy of local transform matrix
104
104
  */
105
- get matrixRest(): IMatrix44;
105
+ get localMatrixRest(): IMatrix44;
106
106
  /**
107
107
  * return a local transform matrix
108
108
  */
109
- get matrixRestInner(): import("../../math").MutableMatrix44;
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 __translate;
6
+ private __position;
7
7
  private __scale;
8
- private __quaternion;
8
+ private __rotation;
9
9
  private __matrix;
10
- private __is_translate_updated;
10
+ private __is_position_updated;
11
11
  private __is_scale_updated;
12
- private __is_quaternion_updated;
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 translate(vec: IVector3);
23
+ set position(vec: IVector3);
24
24
  /**
25
- * return a copy of a local translate vector
25
+ * return a copy of a local position vector
26
26
  */
27
- get translate(): IVector3;
27
+ get position(): MutableVector3;
28
28
  /**
29
- * return a local translate vector
29
+ * return a local position vector
30
30
  */
31
- get translateInner(): MutableVector3;
32
- set rotate(vec: IVector3);
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 rotate(): IVector3;
36
+ get eulerAngles(): IVector3;
37
37
  /**
38
38
  * return a local rotation (XYZ euler) vector
39
39
  */
40
- get rotateInner(): Vector3;
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 quaternion(quat: IQuaternion);
50
+ set rotation(quat: IQuaternion);
51
51
  /**
52
52
  * return a copy of a local quaternion vector
53
53
  */
54
- get quaternion(): IQuaternion;
54
+ get rotation(): IQuaternion;
55
55
  /**
56
56
  * return a local quaternion vector
57
57
  */
58
- get quaternionInner(): Quaternion;
58
+ get rotationInner(): Quaternion;
59
59
  __updateTransform(): void;
60
- __updateRotation(): void;
61
- __updateTranslate(): void;
60
+ __updateEulerAngles(): void;
61
+ __updatePosition(): void;
62
62
  __updateScale(): void;
63
63
  __updateMatrix(): void;
64
64
  set matrix(mat: IMatrix44);