@gg-web-engine/core 0.0.39 → 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 +1 -1
- 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 +3 -1
- package/dist/2d/entities/i-renderable-2d.entity.js +7 -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 +4 -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 +1 -1
- 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 +3 -1
- package/dist/3d/entities/i-renderable-3d.entity.js +7 -0
- package/dist/3d/entities/map-graph-3d.entity.d.ts +9 -6
- package/dist/3d/entities/map-graph-3d.entity.js +70 -26
- package/dist/3d/entities/raycast-vehicle-3d.entity.d.ts +6 -4
- package/dist/3d/entities/raycast-vehicle-3d.entity.js +44 -30
- 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 +4 -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 +8 -1
- package/dist/base/clock/pausable-clock.js +38 -23
- 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 +3 -3
- 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 +1 -1
- package/dist/base/entities/controllers/inline-controller.js +4 -1
- 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 +11 -5
- package/dist/base/gg-world.js +60 -17
- 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 +27 -22
- 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 +5 -0
- package/dist/dev/gg-debugger.ui.js +129 -8
- package/dist/dev/gg-static.d.ts +0 -0
- package/dist/dev/gg-static.js +49 -41
- package/dist/dev/index.d.ts +1 -0
- package/dist/dev/index.js +1 -0
- package/dist/dev/performance-meter.entity.d.ts +21 -0
- package/dist/dev/performance-meter.entity.js +120 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/package.json +7 -7
- package/tsconfig.json +0 -0
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IVisualSceneComponent, Point2, RendererOptions } from '../../../base';
|
|
2
2
|
import { VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
3
|
export interface IVisualScene2dComponent<TypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IVisualSceneComponent<Point2, number, TypeDoc> {
|
|
4
|
-
createRenderer(canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions>): TypeDoc['renderer'];
|
|
4
|
+
createRenderer(canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & TypeDoc['rendererExtraOpts']>): TypeDoc['renderer'];
|
|
5
5
|
}
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimationFunction, AnimationMixer, Point2 } from '../../../base';
|
|
2
2
|
import { Gg2dWorld, PhysicsTypeDocRepo2D, VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
3
|
import { Entity2d } from '../entity-2d';
|
|
4
|
-
|
|
4
|
+
type Positioning2d = {
|
|
5
5
|
position: Point2;
|
|
6
6
|
rotation: number;
|
|
7
7
|
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Pnt2, TickOrder } from '../../base';
|
|
2
2
|
import { IRenderable2dEntity } from './i-renderable-2d.entity';
|
|
3
3
|
export class Entity2d extends IRenderable2dEntity {
|
|
4
|
-
constructor(object2D, objectBody) {
|
|
5
|
-
super();
|
|
6
|
-
this.object2D = object2D;
|
|
7
|
-
this.objectBody = objectBody;
|
|
8
|
-
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
9
|
-
this._position = Pnt2.O;
|
|
10
|
-
this._rotation = 0;
|
|
11
|
-
if (objectBody) {
|
|
12
|
-
this.tick$.subscribe(() => {
|
|
13
|
-
this.runTransformBinding(objectBody, object2D);
|
|
14
|
-
});
|
|
15
|
-
this.runTransformBinding(objectBody, object2D);
|
|
16
|
-
this.name = objectBody.name;
|
|
17
|
-
}
|
|
18
|
-
else if (object2D) {
|
|
19
|
-
this._position = object2D.position;
|
|
20
|
-
this._rotation = object2D.rotation;
|
|
21
|
-
this.name = object2D.name;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
throw new Error('Cannot create entity without an object2D and a body');
|
|
25
|
-
}
|
|
26
|
-
objectBody && this.addComponents(objectBody);
|
|
27
|
-
object2D && this.addComponents(object2D);
|
|
28
|
-
}
|
|
29
4
|
get position() {
|
|
30
5
|
return this._position;
|
|
31
6
|
}
|
|
@@ -69,4 +44,29 @@ export class Entity2d extends IRenderable2dEntity {
|
|
|
69
44
|
this._position = pos;
|
|
70
45
|
this._rotation = quat;
|
|
71
46
|
}
|
|
47
|
+
constructor(object2D, objectBody) {
|
|
48
|
+
super();
|
|
49
|
+
this.object2D = object2D;
|
|
50
|
+
this.objectBody = objectBody;
|
|
51
|
+
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
52
|
+
this._position = Pnt2.O;
|
|
53
|
+
this._rotation = 0;
|
|
54
|
+
if (objectBody) {
|
|
55
|
+
this.tick$.subscribe(() => {
|
|
56
|
+
this.runTransformBinding(objectBody, object2D);
|
|
57
|
+
});
|
|
58
|
+
this.runTransformBinding(objectBody, object2D);
|
|
59
|
+
this.name = objectBody.name;
|
|
60
|
+
}
|
|
61
|
+
else if (object2D) {
|
|
62
|
+
this._position = object2D.position;
|
|
63
|
+
this._rotation = object2D.rotation;
|
|
64
|
+
this.name = object2D.name;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error('Cannot create entity without an object2D and a body');
|
|
68
|
+
}
|
|
69
|
+
objectBody && this.addComponents(objectBody);
|
|
70
|
+
object2D && this.addComponents(object2D);
|
|
71
|
+
}
|
|
72
72
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IRenderableEntity, Point2 } from '../../base';
|
|
2
|
-
import { PhysicsTypeDocRepo2D, VisualTypeDocRepo2D } from '../gg-2d-world';
|
|
2
|
+
import { Gg2dWorld, PhysicsTypeDocRepo2D, VisualTypeDocRepo2D } from '../gg-2d-world';
|
|
3
3
|
export declare abstract class IRenderable2dEntity<TypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D, PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> extends IRenderableEntity<Point2, number, TypeDoc, PTypeDoc> {
|
|
4
|
+
protected _world: Gg2dWorld<TypeDoc, PTypeDoc> | null;
|
|
5
|
+
get world(): Gg2dWorld<TypeDoc, PTypeDoc> | null;
|
|
4
6
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { IEntity, Pnt2, TickOrder } from '../../base';
|
|
2
2
|
import { map } from 'rxjs/operators';
|
|
3
3
|
export class Trigger2dEntity extends IEntity {
|
|
4
|
-
constructor(objectBody) {
|
|
5
|
-
super();
|
|
6
|
-
this.objectBody = objectBody;
|
|
7
|
-
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
8
|
-
this._position = Pnt2.O;
|
|
9
|
-
this._rotation = 0;
|
|
10
|
-
this.tick$.subscribe(() => {
|
|
11
|
-
this.objectBody.checkOverlaps();
|
|
12
|
-
});
|
|
13
|
-
this.addComponents(this.objectBody);
|
|
14
|
-
}
|
|
15
4
|
get onEntityEntered() {
|
|
16
5
|
return this.objectBody.onEntityEntered.pipe(map(c => c.entity));
|
|
17
6
|
}
|
|
@@ -32,4 +21,15 @@ export class Trigger2dEntity extends IEntity {
|
|
|
32
21
|
this.objectBody.rotation = value;
|
|
33
22
|
this._rotation = value;
|
|
34
23
|
}
|
|
24
|
+
constructor(objectBody) {
|
|
25
|
+
super();
|
|
26
|
+
this.objectBody = objectBody;
|
|
27
|
+
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
28
|
+
this._position = Pnt2.O;
|
|
29
|
+
this._rotation = 0;
|
|
30
|
+
this.tick$.subscribe(() => {
|
|
31
|
+
this.objectBody.checkOverlaps();
|
|
32
|
+
});
|
|
33
|
+
this.addComponents(this.objectBody);
|
|
34
|
+
}
|
|
35
35
|
}
|
package/dist/2d/factories.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point2 } from '../base';
|
|
2
2
|
import { BodyShape2DDescriptor, Shape2DDescriptor } from './models/shapes';
|
|
3
3
|
import { PhysicsTypeDocRepo2D, VisualTypeDocRepo2D } from './gg-2d-world';
|
|
4
|
-
export
|
|
4
|
+
export type DisplayObject2dOpts<Tex> = {
|
|
5
5
|
color?: number;
|
|
6
6
|
texture?: Tex;
|
|
7
7
|
};
|
package/dist/2d/factories.js
CHANGED
|
File without changes
|
package/dist/2d/gg-2d-world.d.ts
CHANGED
|
@@ -9,13 +9,14 @@ import { IRenderer2dComponent } from './components/rendering/i-renderer-2d.compo
|
|
|
9
9
|
import { IDisplayObject2dComponent } from './components/rendering/i-display-object-2d.component';
|
|
10
10
|
import { ITrigger2dComponent } from './components/physics/i-trigger-2d.component';
|
|
11
11
|
import { IRigidBody2dComponent } from './components/physics/i-rigid-body-2d.component';
|
|
12
|
-
export
|
|
12
|
+
export type VisualTypeDocRepo2D = {
|
|
13
13
|
factory: IDisplayObject2dComponentFactory;
|
|
14
14
|
displayObject: IDisplayObject2dComponent;
|
|
15
15
|
renderer: IRenderer2dComponent;
|
|
16
|
+
rendererExtraOpts: {};
|
|
16
17
|
texture: unknown;
|
|
17
18
|
};
|
|
18
|
-
export
|
|
19
|
+
export type PhysicsTypeDocRepo2D = {
|
|
19
20
|
factory: IPhysicsBody2dComponentFactory;
|
|
20
21
|
rigidBody: IRigidBody2dComponent;
|
|
21
22
|
trigger: ITrigger2dComponent;
|
|
@@ -25,5 +26,5 @@ export declare class Gg2dWorld<VTypeDoc extends VisualTypeDocRepo2D = VisualType
|
|
|
25
26
|
readonly physicsWorld: PW;
|
|
26
27
|
constructor(visualScene: VS, physicsWorld: PW);
|
|
27
28
|
addPrimitiveRigidBody(descr: BodyShape2DDescriptor, position?: Point2, rotation?: number, material?: DisplayObject2dOpts<VTypeDoc['texture']>): Entity2d<VTypeDoc, PTypeDoc>;
|
|
28
|
-
addRenderer(canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions>): Renderer2dEntity<VTypeDoc>;
|
|
29
|
+
addRenderer(canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & VTypeDoc['rendererExtraOpts']>): Renderer2dEntity<VTypeDoc>;
|
|
29
30
|
}
|
package/dist/2d/gg-2d-world.js
CHANGED
|
File without changes
|
package/dist/2d/index.d.ts
CHANGED
|
File without changes
|
package/dist/2d/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,6 +2,6 @@ import { BodyOptions, DebugBodySettings } from '../../base';
|
|
|
2
2
|
import { Shape2DDescriptor } from './shapes';
|
|
3
3
|
export interface Body2DOptions extends BodyOptions {
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type DebugBody2DSettings = DebugBodySettings & {
|
|
6
6
|
shape: Shape2DDescriptor;
|
|
7
7
|
};
|
|
File without changes
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Point2 } from '../../base';
|
|
2
2
|
import { Body2DOptions } from './body-options';
|
|
3
|
-
export
|
|
3
|
+
export type Shape2DDescriptor = {
|
|
4
4
|
shape: 'SQUARE';
|
|
5
5
|
dimensions: Point2;
|
|
6
6
|
} | {
|
|
7
7
|
shape: 'CIRCLE';
|
|
8
8
|
radius: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type BodyShape2DDescriptor = {
|
|
11
11
|
shape: Shape2DDescriptor;
|
|
12
12
|
body: Partial<Body2DOptions>;
|
|
13
13
|
};
|
package/dist/2d/models/shapes.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Point3, Point4 } from '../../../base';
|
|
2
2
|
import { IRigidBody3dComponent } from './i-rigid-body-3d.component';
|
|
3
3
|
import { PhysicsTypeDocRepo3D } from '../../gg-3d-world';
|
|
4
|
-
export
|
|
4
|
+
export type SuspensionOptions = {
|
|
5
5
|
stiffness: number;
|
|
6
6
|
damping: number;
|
|
7
7
|
compression: number;
|
|
8
8
|
restLength: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type WheelOptions = {
|
|
11
11
|
isLeft: boolean;
|
|
12
12
|
isFront: boolean;
|
|
13
13
|
tyreWidth: number;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,5 +2,5 @@ import { IVisualSceneComponent, Point3, Point4, RendererOptions } from '../../..
|
|
|
2
2
|
import { VisualTypeDocRepo3D } from '../../gg-3d-world';
|
|
3
3
|
export interface IVisualScene3dComponent<TypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D> extends IVisualSceneComponent<Point3, Point4, TypeDoc> {
|
|
4
4
|
readonly loader: TypeDoc['loader'];
|
|
5
|
-
createRenderer(camera: TypeDoc['camera'], canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions>): TypeDoc['renderer'];
|
|
5
|
+
createRenderer(camera: TypeDoc['camera'], canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & TypeDoc['rendererExtraOpts']>): TypeDoc['renderer'];
|
|
6
6
|
}
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimationFunction, AnimationMixer, Point3, Point4 } from '../../../../base';
|
|
2
2
|
import { Gg3dWorld, VisualTypeDocRepo3D } from '../../../gg-3d-world';
|
|
3
3
|
import { Renderer3dEntity } from '../../renderer-3d.entity';
|
|
4
|
-
export
|
|
4
|
+
export type Camera3dAnimationArgs = {
|
|
5
5
|
position: Point3;
|
|
6
6
|
target: Point3;
|
|
7
7
|
up?: Point3;
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimationFunction, AnimationMixer, Point3, Point4 } from '../../../../base';
|
|
2
2
|
import { Gg3dWorld, PhysicsTypeDocRepo3D, VisualTypeDocRepo3D } from '../../../gg-3d-world';
|
|
3
3
|
import { IPositionable3d } from '../../../interfaces/i-positionable-3d';
|
|
4
|
-
|
|
4
|
+
type Positioning3d = {
|
|
5
5
|
position: Point3;
|
|
6
6
|
rotation: Point4;
|
|
7
7
|
};
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DirectionKeyboardInput, DirectionKeyboardKeymap, GgWorld, IEntity, KeyboardInput, TickOrder } from '../../../../base';
|
|
3
|
-
export
|
|
3
|
+
export type CarKeyboardControllerOptions = {
|
|
4
4
|
readonly keymap: DirectionKeyboardKeymap;
|
|
5
5
|
readonly maxSteerDeltaPerSecond: number;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type CarHandlingOutput = {
|
|
8
8
|
upDown: number;
|
|
9
9
|
leftRight: number;
|
|
10
10
|
};
|
|
@@ -10,6 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { combineLatest, filter, Subject, takeUntil } from 'rxjs';
|
|
11
11
|
import { DirectionKeyboardInput, IEntity, TickOrder, } from '../../../../base';
|
|
12
12
|
export class CarKeyboardHandlingController extends IEntity {
|
|
13
|
+
get output$() {
|
|
14
|
+
return this._output$.asObservable();
|
|
15
|
+
}
|
|
13
16
|
constructor(keyboard, options = {
|
|
14
17
|
keymap: 'arrows',
|
|
15
18
|
maxSteerDeltaPerSecond: 12,
|
|
@@ -21,9 +24,6 @@ export class CarKeyboardHandlingController extends IEntity {
|
|
|
21
24
|
this._output$ = new Subject();
|
|
22
25
|
this.directionsInput = new DirectionKeyboardInput(keyboard, options.keymap);
|
|
23
26
|
}
|
|
24
|
-
get output$() {
|
|
25
|
-
return this._output$.asObservable();
|
|
26
|
-
}
|
|
27
27
|
onSpawned(world) {
|
|
28
28
|
const _super = Object.create(null, {
|
|
29
29
|
onSpawned: { get: () => super.onSpawned }
|
|
@@ -3,7 +3,7 @@ import { Renderer3dEntity } from '../../renderer-3d.entity';
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for configuring a FreeCameraInput controller.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type FreeCameraControllerOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* A keymap for controlling camera movement, where each key corresponds to a movement direction.
|
|
9
9
|
*/
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GgWorld, IEntity, KeyboardInput, TickOrder } from '../../../../base';
|
|
2
2
|
import { GgCarEntity } from '../../gg-car/gg-car.entity';
|
|
3
3
|
import { CarKeyboardControllerOptions, CarKeyboardHandlingController } from './car-keyboard-handling.controller';
|
|
4
|
-
export
|
|
4
|
+
export type GgCarKeyboardControllerOptions = CarKeyboardControllerOptions & {
|
|
5
5
|
gearUpDownKeys: [string, string];
|
|
6
6
|
autoReverse: boolean;
|
|
7
7
|
handbrakeKey: string;
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GgWorld, IEntity, MouseInput, MouseInputOptions, MutableSpherical, Point3, TickOrder } from '../../../../base';
|
|
2
2
|
import { Renderer3dEntity } from '../../renderer-3d.entity';
|
|
3
|
-
export
|
|
3
|
+
export type OrbitCameraControllerOptions = {
|
|
4
4
|
mouseOptions: Partial<MouseInputOptions>;
|
|
5
5
|
orbiting: {
|
|
6
6
|
sensitivityX: number;
|
|
@@ -12,21 +12,12 @@ import { filter, takeUntil } from 'rxjs';
|
|
|
12
12
|
import { map } from 'rxjs/operators';
|
|
13
13
|
const DEFAULT_OPTIONS = {
|
|
14
14
|
mouseOptions: {},
|
|
15
|
-
orbiting: { sensitivityX: 1, sensitivityY: 1 },
|
|
15
|
+
orbiting: { sensitivityX: 1, sensitivityY: 1 }, // sensitivity units: rotation degree per 5 pixels movement
|
|
16
16
|
zooming: { sensitivity: 1 },
|
|
17
17
|
panning: { sensitivityX: 1, sensitivityY: 1 },
|
|
18
18
|
dollying: { sensitivity: 1 },
|
|
19
19
|
};
|
|
20
20
|
export class OrbitCameraController extends IEntity {
|
|
21
|
-
constructor(camera, options = {}) {
|
|
22
|
-
super();
|
|
23
|
-
this.camera = camera;
|
|
24
|
-
this.tickOrder = TickOrder.INPUT_CONTROLLERS;
|
|
25
|
-
this.spherical = { phi: 0, radius: 10, theta: 0 };
|
|
26
|
-
this.target = Pnt3.O;
|
|
27
|
-
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
28
|
-
this.mouseInput = new MouseInput(this.options.mouseOptions);
|
|
29
|
-
}
|
|
30
21
|
get radius() {
|
|
31
22
|
return this.spherical.radius;
|
|
32
23
|
}
|
|
@@ -45,6 +36,15 @@ export class OrbitCameraController extends IEntity {
|
|
|
45
36
|
set theta(value) {
|
|
46
37
|
this.spherical.theta = value;
|
|
47
38
|
}
|
|
39
|
+
constructor(camera, options = {}) {
|
|
40
|
+
super();
|
|
41
|
+
this.camera = camera;
|
|
42
|
+
this.tickOrder = TickOrder.INPUT_CONTROLLERS;
|
|
43
|
+
this.spherical = { phi: 0, radius: 10, theta: 0 };
|
|
44
|
+
this.target = Pnt3.O;
|
|
45
|
+
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
46
|
+
this.mouseInput = new MouseInput(this.options.mouseOptions);
|
|
47
|
+
}
|
|
48
48
|
onSpawned(world) {
|
|
49
49
|
const _super = Object.create(null, {
|
|
50
50
|
onSpawned: { get: () => super.onSpawned }
|
|
File without changes
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Pnt3, Qtrn, TickOrder } from '../../base';
|
|
2
2
|
import { IRenderable3dEntity } from './i-renderable-3d.entity';
|
|
3
3
|
export class Entity3d extends IRenderable3dEntity {
|
|
4
|
-
constructor(object3D, objectBody = null) {
|
|
5
|
-
super();
|
|
6
|
-
this.object3D = object3D;
|
|
7
|
-
this.objectBody = objectBody;
|
|
8
|
-
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
9
|
-
this._position = Pnt3.O;
|
|
10
|
-
this._rotation = Qtrn.O;
|
|
11
|
-
if (objectBody) {
|
|
12
|
-
this.tick$.subscribe(() => {
|
|
13
|
-
this.runTransformBinding(objectBody, object3D);
|
|
14
|
-
});
|
|
15
|
-
this.runTransformBinding(objectBody, object3D);
|
|
16
|
-
this.name = objectBody.name;
|
|
17
|
-
}
|
|
18
|
-
else if (object3D) {
|
|
19
|
-
this._position = object3D.position;
|
|
20
|
-
this._rotation = object3D.rotation;
|
|
21
|
-
this.name = object3D.name;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
throw new Error('Cannot create entity without a mesh and a body');
|
|
25
|
-
}
|
|
26
|
-
objectBody && this.addComponents(objectBody);
|
|
27
|
-
object3D && this.addComponents(object3D);
|
|
28
|
-
}
|
|
29
4
|
get position() {
|
|
30
5
|
return this._position;
|
|
31
6
|
}
|
|
@@ -69,4 +44,29 @@ export class Entity3d extends IRenderable3dEntity {
|
|
|
69
44
|
this._position = pos;
|
|
70
45
|
this._rotation = quat;
|
|
71
46
|
}
|
|
47
|
+
constructor(object3D, objectBody = null) {
|
|
48
|
+
super();
|
|
49
|
+
this.object3D = object3D;
|
|
50
|
+
this.objectBody = objectBody;
|
|
51
|
+
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
52
|
+
this._position = Pnt3.O;
|
|
53
|
+
this._rotation = Qtrn.O;
|
|
54
|
+
if (objectBody) {
|
|
55
|
+
this.tick$.subscribe(() => {
|
|
56
|
+
this.runTransformBinding(objectBody, object3D);
|
|
57
|
+
});
|
|
58
|
+
this.runTransformBinding(objectBody, object3D);
|
|
59
|
+
this.name = objectBody.name;
|
|
60
|
+
}
|
|
61
|
+
else if (object3D) {
|
|
62
|
+
this._position = object3D.position;
|
|
63
|
+
this._rotation = object3D.rotation;
|
|
64
|
+
this.name = object3D.name;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error('Cannot create entity without a mesh and a body');
|
|
68
|
+
}
|
|
69
|
+
objectBody && this.addComponents(objectBody);
|
|
70
|
+
object3D && this.addComponents(object3D);
|
|
71
|
+
}
|
|
72
72
|
}
|
|
@@ -4,7 +4,7 @@ import { IRenderable3dEntity } from '../i-renderable-3d.entity';
|
|
|
4
4
|
import { IPositionable3d } from '../../interfaces/i-positionable-3d';
|
|
5
5
|
import { Point3, Point4 } from '../../../base';
|
|
6
6
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
7
|
-
export
|
|
7
|
+
export type GgCarProperties = RVEntityProperties & {
|
|
8
8
|
mpsToRpmFactor?: number;
|
|
9
9
|
engine: {
|
|
10
10
|
minRpm: number;
|
|
@@ -3,22 +3,6 @@ import { IRenderable3dEntity } from '../i-renderable-3d.entity';
|
|
|
3
3
|
import { cubicSplineInterpolation, TickOrder } from '../../../base';
|
|
4
4
|
import { BehaviorSubject, filter, throttleTime } from 'rxjs';
|
|
5
5
|
export class GgCarEntity extends IRenderable3dEntity {
|
|
6
|
-
constructor(carProperties, chassis3D, chassisBody) {
|
|
7
|
-
super();
|
|
8
|
-
this.carProperties = carProperties;
|
|
9
|
-
this.tickOrder = TickOrder.PHYSICS_SIMULATION - 5;
|
|
10
|
-
this._rpm$ = new BehaviorSubject(this.carProperties.engine.minRpm);
|
|
11
|
-
this._tailLightsOn = false;
|
|
12
|
-
// 0..1
|
|
13
|
-
this._acceleration$ = new BehaviorSubject(0);
|
|
14
|
-
// 0..1
|
|
15
|
-
this._brake$ = new BehaviorSubject(0);
|
|
16
|
-
this.handBrake$ = new BehaviorSubject(false);
|
|
17
|
-
this._gear = 0;
|
|
18
|
-
this._gear$ = new BehaviorSubject(0);
|
|
19
|
-
this.raycastVehicle = this.createRaycastVehicle(carProperties, chassis3D, chassisBody);
|
|
20
|
-
this.addChildren(this.raycastVehicle);
|
|
21
|
-
}
|
|
22
6
|
get position() {
|
|
23
7
|
return this.raycastVehicle.position;
|
|
24
8
|
}
|
|
@@ -131,6 +115,22 @@ export class GgCarEntity extends IRenderable3dEntity {
|
|
|
131
115
|
}
|
|
132
116
|
// TODO remove
|
|
133
117
|
set isHonking(value) { }
|
|
118
|
+
constructor(carProperties, chassis3D, chassisBody) {
|
|
119
|
+
super();
|
|
120
|
+
this.carProperties = carProperties;
|
|
121
|
+
this.tickOrder = TickOrder.PHYSICS_SIMULATION - 5;
|
|
122
|
+
this._rpm$ = new BehaviorSubject(this.carProperties.engine.minRpm);
|
|
123
|
+
this._tailLightsOn = false;
|
|
124
|
+
// 0..1
|
|
125
|
+
this._acceleration$ = new BehaviorSubject(0);
|
|
126
|
+
// 0..1
|
|
127
|
+
this._brake$ = new BehaviorSubject(0);
|
|
128
|
+
this.handBrake$ = new BehaviorSubject(false);
|
|
129
|
+
this._gear = 0;
|
|
130
|
+
this._gear$ = new BehaviorSubject(0);
|
|
131
|
+
this.raycastVehicle = this.createRaycastVehicle(carProperties, chassis3D, chassisBody);
|
|
132
|
+
this.addChildren(this.raycastVehicle);
|
|
133
|
+
}
|
|
134
134
|
createRaycastVehicle(carProperties, chassis3D, chassisBody) {
|
|
135
135
|
return new RaycastVehicle3dEntity(carProperties, chassis3D, chassisBody);
|
|
136
136
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IRenderableEntity, Point3, Point4 } from '../../base';
|
|
2
|
-
import { PhysicsTypeDocRepo3D, VisualTypeDocRepo3D } from '../gg-3d-world';
|
|
2
|
+
import { Gg3dWorld, PhysicsTypeDocRepo3D, VisualTypeDocRepo3D } from '../gg-3d-world';
|
|
3
3
|
export declare abstract class IRenderable3dEntity<TypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends IRenderableEntity<Point3, Point4, TypeDoc, PTypeDoc> {
|
|
4
|
+
protected _world: Gg3dWorld<TypeDoc, PTypeDoc> | null;
|
|
5
|
+
get world(): Gg3dWorld<TypeDoc, PTypeDoc> | null;
|
|
4
6
|
}
|