@gg-web-engine/core 0.0.40 → 0.0.48
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 +0 -0
- package/blender_exporter/build_blender_scene.py +0 -1
- package/blender_exporter/spherical_to_cube_texture.py +0 -0
- package/dist/2d/components/physics/i-physics-world-2d.component.d.ts +0 -0
- package/dist/2d/components/physics/i-physics-world-2d.component.js +0 -0
- package/dist/2d/components/physics/i-rigid-body-2d.component.d.ts +0 -0
- package/dist/2d/components/physics/i-rigid-body-2d.component.js +0 -0
- package/dist/2d/components/physics/i-trigger-2d.component.d.ts +0 -0
- package/dist/2d/components/physics/i-trigger-2d.component.js +0 -0
- package/dist/2d/components/rendering/i-display-object-2d.component.d.ts +0 -0
- package/dist/2d/components/rendering/i-display-object-2d.component.js +0 -0
- package/dist/2d/components/rendering/i-renderer-2d.component.d.ts +0 -0
- package/dist/2d/components/rendering/i-renderer-2d.component.js +0 -0
- package/dist/2d/components/rendering/i-visual-scene-2d.component.d.ts +0 -0
- package/dist/2d/components/rendering/i-visual-scene-2d.component.js +0 -0
- package/dist/2d/entities/controllers/entity-2d-positioning.animator.d.ts +1 -1
- package/dist/2d/entities/controllers/entity-2d-positioning.animator.js +0 -0
- package/dist/2d/entities/entity-2d.d.ts +0 -0
- package/dist/2d/entities/entity-2d.js +25 -25
- package/dist/2d/entities/i-renderable-2d.entity.d.ts +0 -0
- package/dist/2d/entities/i-renderable-2d.entity.js +0 -0
- package/dist/2d/entities/renderer-2d.entity.d.ts +0 -0
- package/dist/2d/entities/renderer-2d.entity.js +0 -0
- package/dist/2d/entities/trigger-2d.entity.d.ts +0 -0
- package/dist/2d/entities/trigger-2d.entity.js +11 -11
- package/dist/2d/factories.d.ts +1 -1
- package/dist/2d/factories.js +0 -0
- package/dist/2d/gg-2d-world.d.ts +3 -3
- package/dist/2d/gg-2d-world.js +0 -0
- package/dist/2d/index.d.ts +0 -0
- package/dist/2d/index.js +0 -0
- package/dist/2d/interfaces/i-positionable-2d.d.ts +0 -0
- package/dist/2d/interfaces/i-positionable-2d.js +0 -0
- package/dist/2d/models/body-options.d.ts +1 -1
- package/dist/2d/models/body-options.js +0 -0
- package/dist/2d/models/shapes.d.ts +2 -2
- package/dist/2d/models/shapes.js +0 -0
- package/dist/3d/components/physics/i-physics-world-3d.component.d.ts +0 -0
- package/dist/3d/components/physics/i-physics-world-3d.component.js +0 -0
- package/dist/3d/components/physics/i-raycast-vehicle.component.d.ts +2 -2
- package/dist/3d/components/physics/i-raycast-vehicle.component.js +0 -0
- package/dist/3d/components/physics/i-rigid-body-3d.component.d.ts +0 -0
- package/dist/3d/components/physics/i-rigid-body-3d.component.js +0 -0
- package/dist/3d/components/physics/i-trigger-3d.component.d.ts +0 -0
- package/dist/3d/components/physics/i-trigger-3d.component.js +0 -0
- package/dist/3d/components/rendering/i-camera.component.d.ts +0 -0
- package/dist/3d/components/rendering/i-camera.component.js +0 -0
- package/dist/3d/components/rendering/i-display-object-3d.component.d.ts +0 -0
- package/dist/3d/components/rendering/i-display-object-3d.component.js +0 -0
- package/dist/3d/components/rendering/i-renderer-3d.component.d.ts +0 -0
- package/dist/3d/components/rendering/i-renderer-3d.component.js +0 -0
- package/dist/3d/components/rendering/i-visual-scene-3d.component.d.ts +0 -0
- package/dist/3d/components/rendering/i-visual-scene-3d.component.js +0 -0
- package/dist/3d/entities/controllers/animators/camera-3d.animator.d.ts +1 -1
- package/dist/3d/entities/controllers/animators/camera-3d.animator.js +0 -0
- package/dist/3d/entities/controllers/animators/entity-3d-positioning.animator.d.ts +1 -1
- package/dist/3d/entities/controllers/animators/entity-3d-positioning.animator.js +0 -0
- package/dist/3d/entities/controllers/input/car-keyboard-handling.controller.d.ts +2 -2
- package/dist/3d/entities/controllers/input/car-keyboard-handling.controller.js +3 -3
- package/dist/3d/entities/controllers/input/free-camera.controller.d.ts +1 -1
- package/dist/3d/entities/controllers/input/free-camera.controller.js +0 -0
- package/dist/3d/entities/controllers/input/gg-car-keyboard-handling.controller.d.ts +1 -1
- package/dist/3d/entities/controllers/input/gg-car-keyboard-handling.controller.js +0 -0
- package/dist/3d/entities/controllers/input/orbit-camera.controller.d.ts +1 -1
- package/dist/3d/entities/controllers/input/orbit-camera.controller.js +10 -10
- package/dist/3d/entities/entity-3d.d.ts +0 -0
- package/dist/3d/entities/entity-3d.js +25 -25
- package/dist/3d/entities/gg-car/gg-car.entity.d.ts +1 -1
- package/dist/3d/entities/gg-car/gg-car.entity.js +16 -16
- package/dist/3d/entities/i-renderable-3d.entity.d.ts +0 -0
- package/dist/3d/entities/i-renderable-3d.entity.js +0 -0
- package/dist/3d/entities/map-graph-3d.entity.d.ts +7 -3
- package/dist/3d/entities/map-graph-3d.entity.js +63 -22
- package/dist/3d/entities/raycast-vehicle-3d.entity.d.ts +4 -4
- package/dist/3d/entities/raycast-vehicle-3d.entity.js +41 -41
- package/dist/3d/entities/renderer-3d.entity.d.ts +0 -0
- package/dist/3d/entities/renderer-3d.entity.js +0 -0
- package/dist/3d/entities/trigger-3d.entity.d.ts +0 -0
- package/dist/3d/entities/trigger-3d.entity.js +11 -11
- package/dist/3d/factories.d.ts +1 -1
- package/dist/3d/factories.js +0 -0
- package/dist/3d/gg-3d-world.d.ts +3 -3
- package/dist/3d/gg-3d-world.js +0 -0
- package/dist/3d/index.d.ts +0 -0
- package/dist/3d/index.js +0 -0
- package/dist/3d/interfaces/i-positionable-3d.d.ts +0 -0
- package/dist/3d/interfaces/i-positionable-3d.js +0 -0
- package/dist/3d/loader.d.ts +4 -4
- package/dist/3d/loader.js +7 -7
- package/dist/3d/loaders.d.ts +0 -0
- package/dist/3d/loaders.js +0 -0
- package/dist/3d/models/body-options.d.ts +1 -1
- package/dist/3d/models/body-options.js +0 -0
- package/dist/3d/models/gg-meta.d.ts +4 -4
- package/dist/3d/models/gg-meta.js +0 -0
- package/dist/3d/models/shapes.d.ts +3 -3
- package/dist/3d/models/shapes.js +0 -0
- package/dist/base/clock/global-clock.d.ts +0 -0
- package/dist/base/clock/global-clock.js +8 -8
- package/dist/base/clock/i-clock.d.ts +0 -0
- package/dist/base/clock/i-clock.js +0 -0
- package/dist/base/clock/pausable-clock.d.ts +2 -1
- package/dist/base/clock/pausable-clock.js +35 -31
- package/dist/base/components/i-component.d.ts +0 -0
- package/dist/base/components/i-component.js +0 -0
- package/dist/base/components/i-world-component.d.ts +0 -0
- package/dist/base/components/i-world-component.js +0 -0
- package/dist/base/components/physics/i-body.component.d.ts +0 -0
- package/dist/base/components/physics/i-body.component.js +0 -0
- package/dist/base/components/physics/i-physics-world.component.d.ts +0 -0
- package/dist/base/components/physics/i-physics-world.component.js +0 -0
- package/dist/base/components/physics/i-rigid-body.component.d.ts +0 -0
- package/dist/base/components/physics/i-rigid-body.component.js +0 -0
- package/dist/base/components/physics/i-trigger.component.d.ts +0 -0
- package/dist/base/components/physics/i-trigger.component.js +0 -0
- package/dist/base/components/rendering/i-display-object.component.d.ts +0 -0
- package/dist/base/components/rendering/i-display-object.component.js +0 -0
- package/dist/base/components/rendering/i-renderer.component.d.ts +1 -1
- package/dist/base/components/rendering/i-renderer.component.js +0 -0
- package/dist/base/components/rendering/i-visual-scene.component.d.ts +0 -0
- package/dist/base/components/rendering/i-visual-scene.component.js +0 -0
- package/dist/base/data-structures/bitmask.d.ts +0 -0
- package/dist/base/data-structures/bitmask.js +0 -0
- package/dist/base/data-structures/graph.d.ts +0 -0
- package/dist/base/data-structures/graph.js +4 -4
- package/dist/base/entities/controllers/animation-mixer.d.ts +1 -1
- package/dist/base/entities/controllers/animation-mixer.js +27 -27
- package/dist/base/entities/controllers/inline-controller.d.ts +0 -0
- package/dist/base/entities/controllers/inline-controller.js +0 -0
- package/dist/base/entities/i-entity.d.ts +0 -0
- package/dist/base/entities/i-entity.js +0 -0
- package/dist/base/entities/i-renderable.entity.d.ts +0 -0
- package/dist/base/entities/i-renderable.entity.js +0 -0
- package/dist/base/entities/i-renderer.entity.d.ts +0 -0
- package/dist/base/entities/i-renderer.entity.js +15 -15
- package/dist/base/gg-world.d.ts +3 -2
- package/dist/base/gg-world.js +5 -3
- package/dist/base/index.d.ts +0 -0
- package/dist/base/index.js +0 -0
- package/dist/base/inputs/direction.keyboard.input.d.ts +2 -2
- package/dist/base/inputs/direction.keyboard.input.js +6 -6
- package/dist/base/inputs/i-input.d.ts +0 -0
- package/dist/base/inputs/i-input.js +0 -0
- package/dist/base/inputs/keyboard.input.d.ts +0 -0
- package/dist/base/inputs/keyboard.input.js +0 -0
- package/dist/base/inputs/mouse.input.d.ts +1 -1
- package/dist/base/inputs/mouse.input.js +18 -18
- package/dist/base/interfaces/i-positionable.d.ts +0 -0
- package/dist/base/interfaces/i-positionable.js +0 -0
- package/dist/base/math/box.d.ts +0 -0
- package/dist/base/math/box.js +0 -0
- package/dist/base/math/matrix4.d.ts +0 -0
- package/dist/base/math/matrix4.js +0 -0
- package/dist/base/math/numbers.d.ts +0 -0
- package/dist/base/math/numbers.js +0 -0
- package/dist/base/math/point2.d.ts +0 -0
- package/dist/base/math/point2.js +0 -0
- package/dist/base/math/point3.d.ts +0 -0
- package/dist/base/math/point3.js +0 -0
- package/dist/base/math/quaternion.d.ts +6 -0
- package/dist/base/math/quaternion.js +38 -0
- package/dist/base/math/splines.d.ts +0 -0
- package/dist/base/math/splines.js +0 -0
- package/dist/base/models/axis-directions.d.ts +3 -3
- package/dist/base/models/axis-directions.js +0 -0
- package/dist/base/models/body-options.d.ts +2 -2
- package/dist/base/models/body-options.js +0 -0
- package/dist/base/models/geometry-nodes.d.ts +3 -3
- package/dist/base/models/geometry-nodes.js +0 -0
- package/dist/base/models/points.d.ts +5 -5
- package/dist/base/models/points.js +0 -0
- package/dist/dev/gg-console.ui.d.ts +0 -0
- package/dist/dev/gg-console.ui.js +0 -0
- package/dist/dev/gg-debugger.ui.d.ts +0 -0
- package/dist/dev/gg-debugger.ui.js +0 -0
- package/dist/dev/gg-static.d.ts +0 -0
- package/dist/dev/gg-static.js +46 -46
- package/dist/dev/index.d.ts +0 -0
- package/dist/dev/index.js +0 -0
- package/dist/dev/performance-meter.entity.d.ts +0 -0
- package/dist/dev/performance-meter.entity.js +6 -6
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/package.json +7 -7
- package/tsconfig.json +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,7 +13,7 @@ import { IVisualSceneComponent } from './i-visual-scene.component';
|
|
|
13
13
|
* @property {number} [forceResolution] - Specifies the pixel resolution. Not set by default, which means "use device resolution".
|
|
14
14
|
* @property {boolean} antialias - Specifies whether antialiasing is turned on/off. true by default.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type RendererOptions = {
|
|
17
17
|
transparent: boolean;
|
|
18
18
|
background: number;
|
|
19
19
|
size: Point2 | 'fullscreen' | ((pageSize: Point2) => Point2) | Observable<Point2>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export class Graph {
|
|
2
|
-
constructor(data) {
|
|
3
|
-
this.data = data;
|
|
4
|
-
this.adjacent = new Set();
|
|
5
|
-
}
|
|
6
2
|
/**
|
|
7
3
|
* Creates a new Graph instance from an array of elements, where each element in the array is a node in the graph.
|
|
8
4
|
* The first element of the array is used as the root node of the graph.
|
|
@@ -47,6 +43,10 @@ export class Graph {
|
|
|
47
43
|
}
|
|
48
44
|
return nodes[0][0];
|
|
49
45
|
}
|
|
46
|
+
constructor(data) {
|
|
47
|
+
this.data = data;
|
|
48
|
+
this.adjacent = new Set();
|
|
49
|
+
}
|
|
50
50
|
addAdjacent(node) {
|
|
51
51
|
if (this.adjacent.has(node)) {
|
|
52
52
|
return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEntity } from '../i-entity';
|
|
2
2
|
import { Observable, Subject } from 'rxjs';
|
|
3
3
|
import { GgWorld, PhysicsTypeDocRepo, VisualTypeDocRepo } from '../../gg-world';
|
|
4
|
-
export
|
|
4
|
+
export type AnimationFunction<T> = (elapsed: number, delta: number) => T;
|
|
5
5
|
/**
|
|
6
6
|
* A class that performs property animations for a specific type `T` by using provided animation function.
|
|
7
7
|
* Supports smooth transition between animation function by interpolating between values over time.
|
|
@@ -8,33 +8,6 @@ import { map, tap } from 'rxjs/operators';
|
|
|
8
8
|
* The animation function can be changed with `transitAnimationFunction` or `transitFromStaticState`.
|
|
9
9
|
*/
|
|
10
10
|
export class AnimationMixer extends IEntity {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new `AnimationMixer` entity.
|
|
13
|
-
* @param _animationFunction The initial motion control function that determines the animation.
|
|
14
|
-
* @param _lerp The linear interpolation between two values of type `T`.
|
|
15
|
-
*/
|
|
16
|
-
constructor(_animationFunction, _lerp = (a, b, t) => b) {
|
|
17
|
-
super();
|
|
18
|
-
this._animationFunction = _animationFunction;
|
|
19
|
-
this._lerp = _lerp;
|
|
20
|
-
this.tickOrder = TickOrder.ANIMATION_MIXERS;
|
|
21
|
-
/**
|
|
22
|
-
* A subject that emits the current value of the animation on every tick.
|
|
23
|
-
*/
|
|
24
|
-
this._value$ = new Subject();
|
|
25
|
-
/**
|
|
26
|
-
* The current transition time reference `[elapsed, delta]` that interpolates between the old and new functions.
|
|
27
|
-
*/
|
|
28
|
-
this._currentTransitionK = [0, 0];
|
|
29
|
-
/**
|
|
30
|
-
* The current transition subscription, which is null if no transition is currently active.
|
|
31
|
-
*/
|
|
32
|
-
this._currentTransition = null;
|
|
33
|
-
/**
|
|
34
|
-
* A behavior subject that emits whether the animator is currently in a transition.
|
|
35
|
-
*/
|
|
36
|
-
this._isInTransition$ = new BehaviorSubject(false);
|
|
37
|
-
}
|
|
38
11
|
/**
|
|
39
12
|
* Gets an observable of the current value of the animation.
|
|
40
13
|
*/
|
|
@@ -76,6 +49,33 @@ export class AnimationMixer extends IEntity {
|
|
|
76
49
|
this._currentTransition = value;
|
|
77
50
|
this._isInTransition$.next(!!value);
|
|
78
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new `AnimationMixer` entity.
|
|
54
|
+
* @param _animationFunction The initial motion control function that determines the animation.
|
|
55
|
+
* @param _lerp The linear interpolation between two values of type `T`.
|
|
56
|
+
*/
|
|
57
|
+
constructor(_animationFunction, _lerp = (a, b, t) => b) {
|
|
58
|
+
super();
|
|
59
|
+
this._animationFunction = _animationFunction;
|
|
60
|
+
this._lerp = _lerp;
|
|
61
|
+
this.tickOrder = TickOrder.ANIMATION_MIXERS;
|
|
62
|
+
/**
|
|
63
|
+
* A subject that emits the current value of the animation on every tick.
|
|
64
|
+
*/
|
|
65
|
+
this._value$ = new Subject();
|
|
66
|
+
/**
|
|
67
|
+
* The current transition time reference `[elapsed, delta]` that interpolates between the old and new functions.
|
|
68
|
+
*/
|
|
69
|
+
this._currentTransitionK = [0, 0];
|
|
70
|
+
/**
|
|
71
|
+
* The current transition subscription, which is null if no transition is currently active.
|
|
72
|
+
*/
|
|
73
|
+
this._currentTransition = null;
|
|
74
|
+
/**
|
|
75
|
+
* A behavior subject that emits whether the animator is currently in a transition.
|
|
76
|
+
*/
|
|
77
|
+
this._isInTransition$ = new BehaviorSubject(false);
|
|
78
|
+
}
|
|
79
79
|
/**
|
|
80
80
|
* Set output to static value and smoothly transit to new control function
|
|
81
81
|
* @param newFunc a new function
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,21 +6,6 @@ import { distinctUntilChanged, map } from 'rxjs/operators';
|
|
|
6
6
|
* @class
|
|
7
7
|
*/
|
|
8
8
|
export class IRendererEntity extends IEntity {
|
|
9
|
-
/**
|
|
10
|
-
Initializes a new instance of the BaseGgRenderer class.
|
|
11
|
-
* @param renderer
|
|
12
|
-
*/
|
|
13
|
-
constructor(renderer) {
|
|
14
|
-
super();
|
|
15
|
-
this.renderer = renderer;
|
|
16
|
-
this.tickOrder = TickOrder.RENDERING;
|
|
17
|
-
/** Represents the current size of the renderer. */
|
|
18
|
-
this._rendererSize$ = new BehaviorSubject(null);
|
|
19
|
-
this.addComponents(renderer);
|
|
20
|
-
this.tick$.subscribe(() => {
|
|
21
|
-
this.renderer.render();
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
9
|
/**
|
|
25
10
|
* Gets the observable that represents the current size of the renderer.
|
|
26
11
|
* @returns {Observable<Point2 | null>} - An observable that represents the size of the renderer.
|
|
@@ -46,6 +31,21 @@ export class IRendererEntity extends IEntity {
|
|
|
46
31
|
set physicsDebugViewActive(value) {
|
|
47
32
|
this.renderer.physicsDebugViewActive = value;
|
|
48
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
Initializes a new instance of the BaseGgRenderer class.
|
|
36
|
+
* @param renderer
|
|
37
|
+
*/
|
|
38
|
+
constructor(renderer) {
|
|
39
|
+
super();
|
|
40
|
+
this.renderer = renderer;
|
|
41
|
+
this.tickOrder = TickOrder.RENDERING;
|
|
42
|
+
/** Represents the current size of the renderer. */
|
|
43
|
+
this._rendererSize$ = new BehaviorSubject(null);
|
|
44
|
+
this.addComponents(renderer);
|
|
45
|
+
this.tick$.subscribe(() => {
|
|
46
|
+
this.renderer.render();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
49
|
onSpawned(world) {
|
|
50
50
|
this._rendererSize$.next(null);
|
|
51
51
|
if (this.rendererOptions.size == 'fullscreen' || typeof this.rendererOptions.size === 'function') {
|
package/dist/base/gg-world.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IDisplayObjectComponent, IEntity, IPhysicsWorldComponent, IPositionable, IRenderableEntity, IRendererComponent, IRigidBodyComponent, ITriggerComponent, IVisualSceneComponent, KeyboardInput, PausableClock } from '../base';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
|
-
export
|
|
3
|
+
export type VisualTypeDocRepo<D, R> = {
|
|
4
4
|
factory: unknown;
|
|
5
5
|
displayObject: IDisplayObjectComponent<D, R>;
|
|
6
6
|
renderer: IRendererComponent<D, R>;
|
|
7
7
|
rendererExtraOpts: {};
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type PhysicsTypeDocRepo<D, R> = {
|
|
10
10
|
factory: unknown;
|
|
11
11
|
rigidBody: IRigidBodyComponent<D, R>;
|
|
12
12
|
trigger: ITriggerComponent<D, R>;
|
|
@@ -25,6 +25,7 @@ export declare abstract class GgWorld<D, R, VTypeDoc extends VisualTypeDocRepo<D
|
|
|
25
25
|
readonly tickStarted$: Subject<void>;
|
|
26
26
|
readonly tickForwardTo$: Subject<IEntity | 'PHYSICS_WORLD'>;
|
|
27
27
|
readonly tickForwardedTo$: Subject<IEntity | 'PHYSICS_WORLD'>;
|
|
28
|
+
readonly paused$: Subject<boolean>;
|
|
28
29
|
protected constructor(visualScene: VS, physicsWorld: PW);
|
|
29
30
|
init(): Promise<void>;
|
|
30
31
|
start(): void;
|
package/dist/base/gg-world.js
CHANGED
|
@@ -11,6 +11,9 @@ import { GgGlobalClock, IRendererEntity, KeyboardInput, TickOrder, } from '../ba
|
|
|
11
11
|
import { lastValueFrom, Subject, take } from 'rxjs';
|
|
12
12
|
import { PerformanceMeterEntity } from '../dev';
|
|
13
13
|
export class GgWorld {
|
|
14
|
+
static get documentWorlds() {
|
|
15
|
+
return [...GgWorld._documentWorlds];
|
|
16
|
+
}
|
|
14
17
|
constructor(visualScene, physicsWorld) {
|
|
15
18
|
this.visualScene = visualScene;
|
|
16
19
|
this.physicsWorld = physicsWorld;
|
|
@@ -24,6 +27,7 @@ export class GgWorld {
|
|
|
24
27
|
this.tickStarted$ = new Subject();
|
|
25
28
|
this.tickForwardTo$ = new Subject();
|
|
26
29
|
this.tickForwardedTo$ = new Subject();
|
|
30
|
+
this.paused$ = new Subject();
|
|
27
31
|
GgWorld._documentWorlds.push(this);
|
|
28
32
|
this.keyboardInput.start();
|
|
29
33
|
if (window.ggstatic) {
|
|
@@ -89,9 +93,7 @@ export class GgWorld {
|
|
|
89
93
|
'entity in world. Arguments are samples amount (20 by default) and "peak" or "avg" choice, both arguments are ' +
|
|
90
94
|
'optional. "avg" report sorts entities by average time consumed, "peak" records highest value for each entity');
|
|
91
95
|
}
|
|
92
|
-
|
|
93
|
-
static get documentWorlds() {
|
|
94
|
-
return [...GgWorld._documentWorlds];
|
|
96
|
+
this.worldClock.paused$.subscribe(this.paused$);
|
|
95
97
|
}
|
|
96
98
|
init() {
|
|
97
99
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/base/index.d.ts
CHANGED
|
File without changes
|
package/dist/base/index.js
CHANGED
|
File without changes
|
|
@@ -4,11 +4,11 @@ import { IInput } from './i-input';
|
|
|
4
4
|
/**
|
|
5
5
|
* The type representing desired keymap for DirectionKeyboardInput
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type DirectionKeyboardKeymap = 'arrows' | 'wasd' | 'wasd+arrows';
|
|
8
8
|
/**
|
|
9
9
|
* The type of DirectionKeyboardInput output value
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type DirectionKeyboardOutput = {
|
|
12
12
|
upDown?: boolean;
|
|
13
13
|
leftRight?: boolean;
|
|
14
14
|
};
|
|
@@ -6,6 +6,12 @@ import { IInput } from './i-input';
|
|
|
6
6
|
* Supports two the most popular keyboard layouts: WASD and arrows.
|
|
7
7
|
*/
|
|
8
8
|
export class DirectionKeyboardInput extends IInput {
|
|
9
|
+
/**
|
|
10
|
+
* Returns an observable that emits `DirectionKeyboardOutput` objects whenever the input changes.
|
|
11
|
+
*/
|
|
12
|
+
get output$() {
|
|
13
|
+
return this._output$.asObservable();
|
|
14
|
+
}
|
|
9
15
|
/**
|
|
10
16
|
* Creates a new instance of the `DirectionKeyboardInput` class.
|
|
11
17
|
*
|
|
@@ -21,12 +27,6 @@ export class DirectionKeyboardInput extends IInput {
|
|
|
21
27
|
*/
|
|
22
28
|
this._output$ = new Subject();
|
|
23
29
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns an observable that emits `DirectionKeyboardOutput` objects whenever the input changes.
|
|
26
|
-
*/
|
|
27
|
-
get output$() {
|
|
28
|
-
return this._output$.asObservable();
|
|
29
|
-
}
|
|
30
30
|
/**
|
|
31
31
|
* Called when the input handling should start.
|
|
32
32
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ import { Point2 } from '../models/points';
|
|
|
7
7
|
* canvas?: Canvas element. If not provided, mouse events will be listened on the whole window
|
|
8
8
|
* pointerLock: The flag to enable pointer lock when clicking on canvas
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type MouseInputOptions = {
|
|
11
11
|
canvas?: HTMLCanvasElement;
|
|
12
12
|
pointerLock: boolean;
|
|
13
13
|
};
|
|
@@ -35,24 +35,6 @@ export var MouseInputState;
|
|
|
35
35
|
* A class representing mouse input.
|
|
36
36
|
*/
|
|
37
37
|
export class MouseInput extends IInput {
|
|
38
|
-
/**
|
|
39
|
-
Creates an instance of MouseInput.
|
|
40
|
-
@param {MouseInputOptions} options - The options for the MouseInput.
|
|
41
|
-
*/
|
|
42
|
-
constructor(options = {}) {
|
|
43
|
-
super();
|
|
44
|
-
/**
|
|
45
|
-
An observable of the wheel scrolling.
|
|
46
|
-
*/
|
|
47
|
-
this._wheel$ = null;
|
|
48
|
-
this._delta$ = new Subject();
|
|
49
|
-
this._position$ = new BehaviorSubject(Pnt2.O);
|
|
50
|
-
this._multiTouchPositions$ = new BehaviorSubject([]);
|
|
51
|
-
this.stopped$ = new Subject();
|
|
52
|
-
this._state$ = new BehaviorSubject(MouseInputState.NONE);
|
|
53
|
-
this.options = Object.assign(Object.assign({}, DEFAULT_MOUSE_INPUT_OPTIONS), options);
|
|
54
|
-
this.canvasClickListener = this.canvasClickListener.bind(this);
|
|
55
|
-
}
|
|
56
38
|
static isTouchDevice() {
|
|
57
39
|
return ('createTouch' in document ||
|
|
58
40
|
!!navigator.userAgent.match(/(iPhone|iPod|iPad)/) ||
|
|
@@ -104,6 +86,24 @@ export class MouseInput extends IInput {
|
|
|
104
86
|
get _element() {
|
|
105
87
|
return this.options.canvas || window;
|
|
106
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
Creates an instance of MouseInput.
|
|
91
|
+
@param {MouseInputOptions} options - The options for the MouseInput.
|
|
92
|
+
*/
|
|
93
|
+
constructor(options = {}) {
|
|
94
|
+
super();
|
|
95
|
+
/**
|
|
96
|
+
An observable of the wheel scrolling.
|
|
97
|
+
*/
|
|
98
|
+
this._wheel$ = null;
|
|
99
|
+
this._delta$ = new Subject();
|
|
100
|
+
this._position$ = new BehaviorSubject(Pnt2.O);
|
|
101
|
+
this._multiTouchPositions$ = new BehaviorSubject([]);
|
|
102
|
+
this.stopped$ = new Subject();
|
|
103
|
+
this._state$ = new BehaviorSubject(MouseInputState.NONE);
|
|
104
|
+
this.options = Object.assign(Object.assign({}, DEFAULT_MOUSE_INPUT_OPTIONS), options);
|
|
105
|
+
this.canvasClickListener = this.canvasClickListener.bind(this);
|
|
106
|
+
}
|
|
107
107
|
startInternal() {
|
|
108
108
|
if (this.options.canvas) {
|
|
109
109
|
this.options.canvas.style.touchAction = 'none';
|
|
File without changes
|
|
File without changes
|
package/dist/base/math/box.d.ts
CHANGED
|
File without changes
|
package/dist/base/math/box.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/base/math/point2.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/base/math/point3.js
CHANGED
|
File without changes
|
|
@@ -88,6 +88,12 @@ export declare class Qtrn {
|
|
|
88
88
|
* @returns a quaternion representing the rotation
|
|
89
89
|
*/
|
|
90
90
|
static fromMatrix4(m: number[]): Point4;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a 3x3 rotation matrix into a quaternion
|
|
93
|
+
* @param m the matrix representing the rotation
|
|
94
|
+
* @returns a quaternion representing the rotation
|
|
95
|
+
*/
|
|
96
|
+
static fromMatrix3(m: number[][]): Point4;
|
|
91
97
|
/**
|
|
92
98
|
* Creates a quaternion from euler
|
|
93
99
|
* @param e the euler vector
|
|
@@ -178,6 +178,44 @@ export class Qtrn {
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Converts a 3x3 rotation matrix into a quaternion
|
|
183
|
+
* @param m the matrix representing the rotation
|
|
184
|
+
* @returns a quaternion representing the rotation
|
|
185
|
+
*/
|
|
186
|
+
static fromMatrix3(m) {
|
|
187
|
+
const trace = m[0][0] + m[1][1] + m[2][2];
|
|
188
|
+
let w, x, y, z;
|
|
189
|
+
if (trace > 0) {
|
|
190
|
+
const s = 0.5 / Math.sqrt(trace + 1);
|
|
191
|
+
w = 0.25 / s;
|
|
192
|
+
x = (m[2][1] - m[1][2]) * s;
|
|
193
|
+
y = (m[0][2] - m[2][0]) * s;
|
|
194
|
+
z = (m[1][0] - m[0][1]) * s;
|
|
195
|
+
}
|
|
196
|
+
else if (m[0][0] > m[1][1] && m[0][0] > m[2][2]) {
|
|
197
|
+
const s = 2 * Math.sqrt(1 + m[0][0] - m[1][1] - m[2][2]);
|
|
198
|
+
w = (m[2][1] - m[1][2]) / s;
|
|
199
|
+
x = 0.25 * s;
|
|
200
|
+
y = (m[0][1] + m[1][0]) / s;
|
|
201
|
+
z = (m[0][2] + m[2][0]) / s;
|
|
202
|
+
}
|
|
203
|
+
else if (m[1][1] > m[2][2]) {
|
|
204
|
+
const s = 2 * Math.sqrt(1 + m[1][1] - m[0][0] - m[2][2]);
|
|
205
|
+
w = (m[0][2] - m[2][0]) / s;
|
|
206
|
+
x = (m[0][1] + m[1][0]) / s;
|
|
207
|
+
y = 0.25 * s;
|
|
208
|
+
z = (m[1][2] + m[2][1]) / s;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
const s = 2 * Math.sqrt(1 + m[2][2] - m[0][0] - m[1][1]);
|
|
212
|
+
w = (m[1][0] - m[0][1]) / s;
|
|
213
|
+
x = (m[0][2] + m[2][0]) / s;
|
|
214
|
+
y = (m[1][2] + m[2][1]) / s;
|
|
215
|
+
z = 0.25 * s;
|
|
216
|
+
}
|
|
217
|
+
return { w, x, y, z };
|
|
218
|
+
}
|
|
181
219
|
/**
|
|
182
220
|
* Creates a quaternion from euler
|
|
183
221
|
* @param e the euler vector
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type AxisDirection2 = 'x' | 'y' | '-x' | '-y';
|
|
2
|
+
export type AxisDirection3 = AxisDirection2 | 'z' | '-z';
|
|
3
|
+
export type AxisDirection4 = AxisDirection3 | 'w' | '-w';
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type CollisionGroup = number;
|
|
2
2
|
export interface BodyOptions {
|
|
3
3
|
dynamic: boolean;
|
|
4
4
|
mass: number;
|
|
@@ -7,7 +7,7 @@ export interface BodyOptions {
|
|
|
7
7
|
ownCollisionGroups: CollisionGroup[] | 'all';
|
|
8
8
|
interactWithCollisionGroups: CollisionGroup[] | 'all';
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type DebugBodySettings = {
|
|
11
11
|
shape: any;
|
|
12
12
|
ignoreTransform?: boolean;
|
|
13
13
|
} & ({
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point2, Point3 } from './points';
|
|
2
|
-
export
|
|
2
|
+
export type GgBox<T> = {
|
|
3
3
|
min: T;
|
|
4
4
|
max: T;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type GgBox2d = GgBox<Point2>;
|
|
7
|
+
export type GgBox3d = GgBox<Point3>;
|
|
File without changes
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Point2 = {
|
|
2
2
|
readonly x: number;
|
|
3
3
|
readonly y: number;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type Point3 = {
|
|
6
6
|
readonly x: number;
|
|
7
7
|
readonly y: number;
|
|
8
8
|
readonly z: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type Point4 = {
|
|
11
11
|
readonly x: number;
|
|
12
12
|
readonly y: number;
|
|
13
13
|
readonly z: number;
|
|
14
14
|
readonly w: number;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type Spherical = {
|
|
17
17
|
readonly radius: number;
|
|
18
18
|
readonly phi: number;
|
|
19
19
|
readonly theta: number;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type MutableSpherical = {
|
|
22
22
|
radius: number;
|
|
23
23
|
phi: number;
|
|
24
24
|
theta: number;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/dev/gg-static.d.ts
CHANGED
|
File without changes
|