@gg-web-engine/core 0.0.28 → 0.0.30
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/dist/2d/components/physics/i-physics-world-2d.component.d.ts +2 -3
- package/dist/2d/components/physics/i-rigid-body-2d.component.d.ts +2 -2
- package/dist/2d/components/physics/i-trigger-2d.component.d.ts +4 -5
- package/dist/2d/components/rendering/i-display-object-2d.component.d.ts +2 -2
- package/dist/2d/components/rendering/i-renderer-2d.component.d.ts +2 -2
- package/dist/2d/components/rendering/i-visual-scene-2d.component.d.ts +3 -5
- package/dist/2d/entities/controllers/entity-2d-positioning.animator.d.ts +2 -2
- package/dist/2d/entities/entity-2d.d.ts +6 -9
- package/dist/2d/entities/i-renderable-2d.entity.d.ts +2 -3
- package/dist/2d/entities/renderer-2d.entity.d.ts +2 -3
- package/dist/2d/entities/trigger-2d.entity.d.ts +4 -3
- package/dist/2d/factories.d.ts +13 -10
- package/dist/2d/factories.js +8 -5
- package/dist/2d/gg-2d-world.d.ts +22 -6
- package/dist/2d/gg-2d-world.js +2 -2
- package/dist/3d/components/physics/i-physics-world-3d.component.d.ts +3 -5
- package/dist/3d/components/physics/i-raycast-vehicle.component.d.ts +3 -2
- package/dist/3d/components/physics/i-rigid-body-3d.component.d.ts +2 -2
- package/dist/3d/components/physics/i-trigger-3d.component.d.ts +4 -5
- package/dist/3d/components/rendering/i-camera.component.d.ts +2 -2
- package/dist/3d/components/rendering/i-display-object-3d.component.d.ts +2 -2
- package/dist/3d/components/rendering/i-renderer-3d.component.d.ts +3 -4
- package/dist/3d/components/rendering/i-visual-scene-3d.component.d.ts +4 -8
- package/dist/3d/entities/controllers/animators/camera-3d.animator.d.ts +6 -6
- package/dist/3d/entities/controllers/animators/entity-3d-positioning.animator.d.ts +2 -2
- package/dist/3d/entities/controllers/input/free-camera.controller.d.ts +1 -1
- package/dist/3d/entities/controllers/input/free-camera.controller.js +1 -1
- package/dist/3d/entities/controllers/input/orbit-camera.controller.d.ts +1 -1
- package/dist/3d/entities/controllers/input/orbit-camera.controller.js +1 -1
- package/dist/3d/entities/entity-3d.d.ts +5 -6
- package/dist/3d/entities/gg-car/gg-car.entity.d.ts +9 -8
- package/dist/3d/entities/gg-car/gg-car.entity.js +20 -8
- package/dist/3d/entities/i-renderable-3d.entity.d.ts +2 -3
- package/dist/3d/entities/map-graph-3d.entity.d.ts +20 -14
- package/dist/3d/entities/raycast-vehicle-3d.entity.d.ts +4 -4
- package/dist/3d/entities/raycast-vehicle-3d.entity.js +0 -1
- package/dist/3d/entities/renderer-3d.entity.d.ts +3 -5
- package/dist/3d/entities/trigger-3d.entity.d.ts +4 -3
- package/dist/3d/factories.d.ts +29 -13
- package/dist/3d/factories.js +12 -6
- package/dist/3d/gg-3d-world.d.ts +28 -7
- package/dist/3d/gg-3d-world.js +2 -2
- package/dist/3d/loader.d.ts +12 -14
- package/dist/3d/loaders.d.ts +5 -6
- package/dist/3d/models/shapes.d.ts +2 -0
- package/dist/base/components/i-world-component.d.ts +4 -6
- package/dist/base/components/physics/i-body.component.d.ts +10 -7
- package/dist/base/components/physics/i-physics-world.component.d.ts +6 -3
- package/dist/base/components/physics/i-rigid-body.component.d.ts +3 -3
- package/dist/base/components/physics/i-trigger.component.d.ts +5 -5
- package/dist/base/components/rendering/i-display-object.component.d.ts +6 -6
- package/dist/base/components/rendering/i-renderer.component.d.ts +7 -7
- package/dist/base/components/rendering/i-visual-scene.component.d.ts +4 -3
- package/dist/base/data-structures/bitmask.d.ts +30 -0
- package/dist/base/data-structures/bitmask.js +55 -0
- package/dist/base/entities/controllers/animation-mixer.d.ts +3 -3
- package/dist/base/entities/i-entity.d.ts +8 -10
- package/dist/base/entities/i-renderable.entity.d.ts +2 -3
- package/dist/base/entities/i-renderer.entity.d.ts +6 -7
- package/dist/base/gg-world.d.ts +17 -6
- package/dist/base/index.d.ts +1 -0
- package/dist/base/index.js +1 -0
- package/dist/base/interfaces/i-debug-physics-drawer.d.ts +2 -2
- package/dist/base/math/quaternion.d.ts +14 -0
- package/dist/base/math/quaternion.js +18 -0
- package/dist/base/models/body-options.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IEntity } from '../i-entity';
|
|
2
2
|
import { Observable, Subject } from 'rxjs';
|
|
3
|
-
import { GgWorld } from '../../gg-world';
|
|
3
|
+
import { GgWorld, PhysicsTypeDocRepo, VisualTypeDocRepo } from '../../gg-world';
|
|
4
4
|
export declare 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.
|
|
@@ -8,7 +8,7 @@ export declare type AnimationFunction<T> = (elapsed: number, delta: number) => T
|
|
|
8
8
|
* The current value of the animation can be subscribed to using the `subscribeToValue` property.
|
|
9
9
|
* The animation function can be changed with `transitAnimationFunction` or `transitFromStaticState`.
|
|
10
10
|
*/
|
|
11
|
-
export declare class AnimationMixer<T> extends IEntity {
|
|
11
|
+
export declare class AnimationMixer<T, D = any, R = any, VTypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>, PTypeDoc extends PhysicsTypeDocRepo<D, R> = PhysicsTypeDocRepo<D, R>> extends IEntity<D, R, VTypeDoc, PTypeDoc> {
|
|
12
12
|
protected _animationFunction: AnimationFunction<T>;
|
|
13
13
|
protected _lerp: (a: T, b: T, t: number) => T;
|
|
14
14
|
readonly tickOrder: number;
|
|
@@ -71,6 +71,6 @@ export declare class AnimationMixer<T> extends IEntity {
|
|
|
71
71
|
* @param easing an easing function for transition
|
|
72
72
|
*/
|
|
73
73
|
transitAnimationFunction(newFunc: AnimationFunction<T>, transitionDuration: number, easing?: (t: number) => number): void;
|
|
74
|
-
onSpawned(world: GgWorld<
|
|
74
|
+
onSpawned(world: GgWorld<D, R, VTypeDoc, PTypeDoc>): void;
|
|
75
75
|
dispose(): void;
|
|
76
76
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { GgWorld } from '../gg-world';
|
|
1
|
+
import { GgWorld, PhysicsTypeDocRepo, VisualTypeDocRepo } from '../gg-world';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
|
-
import { IVisualSceneComponent } from '../components/rendering/i-visual-scene.component';
|
|
4
|
-
import { IPhysicsWorldComponent } from '../components/physics/i-physics-world.component';
|
|
5
3
|
import { IWorldComponent } from '../components/i-world-component';
|
|
6
4
|
/**
|
|
7
5
|
* Engine's default tick orders: the less value, the earlier tick will be run.
|
|
@@ -15,7 +13,7 @@ export declare enum TickOrder {
|
|
|
15
13
|
RENDERING = 1000,
|
|
16
14
|
POST_RENDERING = 1200
|
|
17
15
|
}
|
|
18
|
-
export declare abstract class IEntity<D = any, R = any,
|
|
16
|
+
export declare abstract class IEntity<D = any, R = any, VTypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>, PTypeDoc extends PhysicsTypeDocRepo<D, R> = PhysicsTypeDocRepo<D, R>> {
|
|
19
17
|
private static default_name_counter;
|
|
20
18
|
/**
|
|
21
19
|
* will receive [elapsed time, delta] of each world clock tick
|
|
@@ -28,8 +26,8 @@ export declare abstract class IEntity<D = any, R = any, V extends IVisualSceneCo
|
|
|
28
26
|
/**
|
|
29
27
|
* a world reference, where this entity was added to
|
|
30
28
|
*/
|
|
31
|
-
protected _world: GgWorld<D, R,
|
|
32
|
-
get world(): GgWorld<D, R,
|
|
29
|
+
protected _world: GgWorld<D, R, VTypeDoc, PTypeDoc> | null;
|
|
30
|
+
get world(): GgWorld<D, R, VTypeDoc, PTypeDoc> | null;
|
|
33
31
|
protected _name: string;
|
|
34
32
|
get name(): string;
|
|
35
33
|
set name(value: string);
|
|
@@ -45,12 +43,12 @@ export declare abstract class IEntity<D = any, R = any, V extends IVisualSceneCo
|
|
|
45
43
|
addChildren(...entities: IEntity[]): void;
|
|
46
44
|
removeChildren(entities: IEntity[], dispose?: boolean): void;
|
|
47
45
|
private _components;
|
|
48
|
-
get components(): IWorldComponent<D, R,
|
|
49
|
-
addComponents(...components: IWorldComponent<D, R,
|
|
50
|
-
removeComponents(components: IWorldComponent<D, R,
|
|
46
|
+
get components(): IWorldComponent<D, R, VTypeDoc, PTypeDoc>[];
|
|
47
|
+
addComponents(...components: IWorldComponent<D, R, VTypeDoc, PTypeDoc>[]): void;
|
|
48
|
+
removeComponents(components: IWorldComponent<D, R, VTypeDoc, PTypeDoc>[], dispose?: boolean): void;
|
|
51
49
|
protected _onSpawned$: Subject<void>;
|
|
52
50
|
protected _onRemoved$: Subject<void>;
|
|
53
|
-
onSpawned(world: GgWorld<D, R,
|
|
51
|
+
onSpawned(world: GgWorld<D, R, VTypeDoc, PTypeDoc>): void;
|
|
54
52
|
onRemoved(): void;
|
|
55
53
|
dispose(): void;
|
|
56
54
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IEntity } from './i-entity';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare abstract class IRenderableEntity<D = any, R = any, V extends IVisualSceneComponent<D, R> = IVisualSceneComponent<D, R>, P extends IPhysicsWorldComponent<D, R> = IPhysicsWorldComponent<D, R>> extends IEntity<D, R, V, P> {
|
|
2
|
+
import { PhysicsTypeDocRepo, VisualTypeDocRepo } from '../gg-world';
|
|
3
|
+
export declare abstract class IRenderableEntity<D = any, R = any, TypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>, PTypeDoc extends PhysicsTypeDocRepo<D, R> = PhysicsTypeDocRepo<D, R>> extends IEntity<D, R, TypeDoc, PTypeDoc> {
|
|
5
4
|
private _visible;
|
|
6
5
|
get visible(): boolean;
|
|
7
6
|
get worldVisible(): boolean;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { IEntity, TickOrder } from './i-entity';
|
|
2
|
-
import { GgWorld } from '../gg-world';
|
|
2
|
+
import { GgWorld, VisualTypeDocRepo } from '../gg-world';
|
|
3
3
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
4
4
|
import { Point2 } from '../models/points';
|
|
5
|
-
import {
|
|
6
|
-
import { IVisualSceneComponent } from '../components/rendering/i-visual-scene.component';
|
|
5
|
+
import { RendererOptions } from '../components/rendering/i-renderer.component';
|
|
7
6
|
/**
|
|
8
7
|
* Represents a base class for a renderer entity.
|
|
9
8
|
* @class
|
|
10
9
|
*/
|
|
11
|
-
export declare abstract class IRendererEntity<D, R,
|
|
12
|
-
readonly renderer:
|
|
10
|
+
export declare abstract class IRendererEntity<D, R, TypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>> extends IEntity<D, R, TypeDoc> {
|
|
11
|
+
readonly renderer: TypeDoc['renderer'];
|
|
13
12
|
readonly tickOrder = TickOrder.RENDERING;
|
|
14
13
|
/** Represents the current size of the renderer. */
|
|
15
14
|
protected _rendererSize$: BehaviorSubject<Point2 | null>;
|
|
@@ -28,7 +27,7 @@ export declare abstract class IRendererEntity<D, R, VS extends IVisualSceneCompo
|
|
|
28
27
|
Initializes a new instance of the BaseGgRenderer class.
|
|
29
28
|
* @param renderer
|
|
30
29
|
*/
|
|
31
|
-
constructor(renderer:
|
|
32
|
-
onSpawned(world: GgWorld<D, R,
|
|
30
|
+
constructor(renderer: TypeDoc['renderer']);
|
|
31
|
+
onSpawned(world: GgWorld<D, R, TypeDoc>): void;
|
|
33
32
|
dispose(): void;
|
|
34
33
|
}
|
package/dist/base/gg-world.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { IEntity, IPhysicsWorldComponent, IPositionable, IRenderableEntity, IVisualSceneComponent, KeyboardInput, PausableClock } from '../base';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { IDisplayObjectComponent, IEntity, IPhysicsWorldComponent, IPositionable, IRenderableEntity, IRendererComponent, IRigidBodyComponent, ITriggerComponent, IVisualSceneComponent, KeyboardInput, PausableClock } from '../base';
|
|
2
|
+
export declare type VisualTypeDocRepo<D, R> = {
|
|
3
|
+
factory: unknown;
|
|
4
|
+
displayObject: IDisplayObjectComponent<D, R>;
|
|
5
|
+
renderer: IRendererComponent<D, R>;
|
|
6
|
+
};
|
|
7
|
+
export declare type PhysicsTypeDocRepo<D, R> = {
|
|
8
|
+
factory: unknown;
|
|
9
|
+
rigidBody: IRigidBodyComponent<D, R>;
|
|
10
|
+
trigger: ITriggerComponent<D, R>;
|
|
11
|
+
};
|
|
12
|
+
export declare abstract class GgWorld<D, R, VTypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>, PTypeDoc extends PhysicsTypeDocRepo<D, R> = PhysicsTypeDocRepo<D, R>, VS extends IVisualSceneComponent<D, R, VTypeDoc> = IVisualSceneComponent<D, R, VTypeDoc>, PW extends IPhysicsWorldComponent<D, R, PTypeDoc> = IPhysicsWorldComponent<D, R, PTypeDoc>> {
|
|
13
|
+
readonly visualScene: VS;
|
|
14
|
+
readonly physicsWorld: PW;
|
|
5
15
|
readonly worldClock: PausableClock;
|
|
6
16
|
readonly keyboardInput: KeyboardInput;
|
|
7
17
|
private static default_name_counter;
|
|
@@ -10,7 +20,7 @@ export declare abstract class GgWorld<D, R, V extends IVisualSceneComponent<D, R
|
|
|
10
20
|
protected readonly tickListeners: IEntity[];
|
|
11
21
|
private static _documentWorlds;
|
|
12
22
|
static get documentWorlds(): GgWorld<any, any>[];
|
|
13
|
-
protected constructor(visualScene:
|
|
23
|
+
protected constructor(visualScene: VS, physicsWorld: PW);
|
|
14
24
|
init(): Promise<void>;
|
|
15
25
|
start(): void;
|
|
16
26
|
pauseWorld(): void;
|
|
@@ -20,7 +30,8 @@ export declare abstract class GgWorld<D, R, V extends IVisualSceneComponent<D, R
|
|
|
20
30
|
get worldTime(): number;
|
|
21
31
|
createClock(autoStart: boolean): PausableClock;
|
|
22
32
|
dispose(): void;
|
|
23
|
-
abstract addPrimitiveRigidBody(descr:
|
|
33
|
+
abstract addPrimitiveRigidBody(descr: unknown, // type defined in subclasses
|
|
34
|
+
position?: D, rotation?: R, material?: unknown): IPositionable<D, R> & IRenderableEntity<D, R, VTypeDoc>;
|
|
24
35
|
addEntity(entity: IEntity): void;
|
|
25
36
|
removeEntity(entity: IEntity, dispose?: boolean): void;
|
|
26
37
|
get physicsDebugViewActive(): boolean;
|
package/dist/base/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './components/rendering/i-renderer.component';
|
|
|
10
10
|
export * from './components/rendering/i-visual-scene.component';
|
|
11
11
|
export * from './components/i-component';
|
|
12
12
|
export * from './components/i-world-component';
|
|
13
|
+
export * from './data-structures/bitmask';
|
|
13
14
|
export * from './data-structures/graph';
|
|
14
15
|
export * from './entities/controllers/animation-mixer';
|
|
15
16
|
export * from './entities/controllers/inline-controller';
|
package/dist/base/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './components/rendering/i-renderer.component';
|
|
|
10
10
|
export * from './components/rendering/i-visual-scene.component';
|
|
11
11
|
export * from './components/i-component';
|
|
12
12
|
export * from './components/i-world-component';
|
|
13
|
+
export * from './data-structures/bitmask';
|
|
13
14
|
export * from './data-structures/graph';
|
|
14
15
|
export * from './entities/controllers/animation-mixer';
|
|
15
16
|
export * from './entities/controllers/inline-controller';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDisplayObjectComponent } from '../components/rendering/i-display-object.component';
|
|
2
2
|
import { Point3 } from '../models/points';
|
|
3
|
-
import {
|
|
4
|
-
export interface IDebugPhysicsDrawer<D, R,
|
|
3
|
+
import { VisualTypeDocRepo } from '../gg-world';
|
|
4
|
+
export interface IDebugPhysicsDrawer<D, R, TypeDoc extends VisualTypeDocRepo<D, R> = VisualTypeDocRepo<D, R>> extends IDisplayObjectComponent<D, R, TypeDoc> {
|
|
5
5
|
drawContactPoint(point: D, normal: D, color?: Point3): void;
|
|
6
6
|
drawLine(from: D, to: D, color?: Point3): void;
|
|
7
7
|
update(): void;
|
|
@@ -32,6 +32,20 @@ export declare class Qtrn {
|
|
|
32
32
|
* @returns The product of the two Point4 objects.
|
|
33
33
|
*/
|
|
34
34
|
static mult(a: Point4, b: Point4): Point4;
|
|
35
|
+
/**
|
|
36
|
+
* Calculates and returns the conjugate of a quaternion.
|
|
37
|
+
* The conjugate of a quaternion is obtained by changing the sign of its vector components.
|
|
38
|
+
* @param q The Point4 (quaternion) object.
|
|
39
|
+
* @returns The conjugate of the quaternion passed as argument.
|
|
40
|
+
*/
|
|
41
|
+
static conjugate(q: Point4): Point4;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the opposite of a quaternion.
|
|
44
|
+
* It's obtained by negating all quaternion elements(x, y, z and w).
|
|
45
|
+
* @param q The Point4 (quaternion) object.
|
|
46
|
+
* @returns The opposite of the quaternion passed as argument.
|
|
47
|
+
*/
|
|
48
|
+
static opposite(q: Point4): Point4;
|
|
35
49
|
/**
|
|
36
50
|
* Combines an arbitrary number of quaternions by multiplying them together in order.
|
|
37
51
|
* @param quaternions The quaternions to combine.
|
|
@@ -51,6 +51,24 @@ export class Qtrn {
|
|
|
51
51
|
z: a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w,
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Calculates and returns the conjugate of a quaternion.
|
|
56
|
+
* The conjugate of a quaternion is obtained by changing the sign of its vector components.
|
|
57
|
+
* @param q The Point4 (quaternion) object.
|
|
58
|
+
* @returns The conjugate of the quaternion passed as argument.
|
|
59
|
+
*/
|
|
60
|
+
static conjugate(q) {
|
|
61
|
+
return { x: -q.x, y: -q.y, z: -q.z, w: q.w };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the opposite of a quaternion.
|
|
65
|
+
* It's obtained by negating all quaternion elements(x, y, z and w).
|
|
66
|
+
* @param q The Point4 (quaternion) object.
|
|
67
|
+
* @returns The opposite of the quaternion passed as argument.
|
|
68
|
+
*/
|
|
69
|
+
static opposite(q) {
|
|
70
|
+
return { x: -q.x, y: -q.y, z: -q.z, w: -q.w };
|
|
71
|
+
}
|
|
54
72
|
/**
|
|
55
73
|
* Combines an arbitrary number of quaternions by multiplying them together in order.
|
|
56
74
|
* @param quaternions The quaternions to combine.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export declare type CollisionGroup = number;
|
|
1
2
|
export interface BodyOptions {
|
|
2
3
|
dynamic: boolean;
|
|
3
4
|
mass: number;
|
|
4
5
|
restitution: number;
|
|
5
6
|
friction: number;
|
|
7
|
+
ownCollisionGroups: CollisionGroup[] | 'all';
|
|
8
|
+
interactWithCollisionGroups: CollisionGroup[] | 'all';
|
|
6
9
|
}
|