@gg-web-engine/core 0.0.40 → 0.0.49
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 +5 -3
- 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 +3 -3
- package/dist/3d/entities/controllers/input/car-keyboard-handling.controller.js +3 -3
- package/dist/3d/entities/controllers/input/free-camera.controller.d.ts +24 -13
- package/dist/3d/entities/controllers/input/free-camera.controller.js +65 -44
- package/dist/3d/entities/controllers/input/gg-car-keyboard-handling.controller.d.ts +2 -2
- 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 +21 -2
- package/dist/3d/entities/controllers/input/orbit-camera.controller.js +35 -18
- 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 +6 -4
- 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 +1 -0
- package/dist/base/index.js +1 -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 +2 -1
- package/dist/base/inputs/mouse.input.js +21 -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/base/pipes/gg-elastic.pipe.d.ts +5 -0
- package/dist/base/pipes/gg-elastic.pipe.js +44 -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
|
@@ -1,18 +1,37 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Options for configuring mouse input.
|
|
6
|
+
*/
|
|
4
7
|
mouseOptions: Partial<MouseInputOptions>;
|
|
8
|
+
/**
|
|
9
|
+
* Orbiting options. false disables orbiting, sensitivity fields are the speed in radians per 1000px mouse movement. 1 by default
|
|
10
|
+
*/
|
|
5
11
|
orbiting: {
|
|
6
12
|
sensitivityX: number;
|
|
7
13
|
sensitivityY: number;
|
|
8
14
|
} | false;
|
|
15
|
+
/**
|
|
16
|
+
* An elasticity factor for orbiting. 0 by default (no elastic motion)
|
|
17
|
+
*/
|
|
18
|
+
orbitingElasticity: number;
|
|
19
|
+
/**
|
|
20
|
+
* Zooming options. false disables zooming. Enabled by default
|
|
21
|
+
*/
|
|
9
22
|
zooming: {
|
|
10
23
|
sensitivity: number;
|
|
11
24
|
} | false;
|
|
25
|
+
/**
|
|
26
|
+
* Panning options. false disables panning. Enabled by default
|
|
27
|
+
*/
|
|
12
28
|
panning: {
|
|
13
29
|
sensitivityX: number;
|
|
14
30
|
sensitivityY: number;
|
|
15
31
|
} | false;
|
|
32
|
+
/**
|
|
33
|
+
* Dollying options. false disables dollying. Enabled by default
|
|
34
|
+
*/
|
|
16
35
|
dollying: {
|
|
17
36
|
sensitivity: number;
|
|
18
37
|
} | false;
|
|
@@ -21,7 +40,7 @@ export declare class OrbitCameraController extends IEntity {
|
|
|
21
40
|
protected readonly camera: Renderer3dEntity;
|
|
22
41
|
readonly tickOrder = TickOrder.INPUT_CONTROLLERS;
|
|
23
42
|
protected readonly options: OrbitCameraControllerOptions;
|
|
24
|
-
|
|
43
|
+
readonly mouseInput: MouseInput;
|
|
25
44
|
protected spherical: MutableSpherical;
|
|
26
45
|
target: Point3;
|
|
27
46
|
get radius(): number;
|
|
@@ -7,26 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { IEntity, MouseInput, MouseInputState, Pnt3, Qtrn, TickOrder, } from '../../../../base';
|
|
11
|
-
import { filter, takeUntil } from 'rxjs';
|
|
10
|
+
import { ggElastic, IEntity, MouseInput, MouseInputState, Pnt2, Pnt3, Qtrn, TickOrder, } from '../../../../base';
|
|
11
|
+
import { BehaviorSubject, filter, takeUntil } from 'rxjs';
|
|
12
12
|
import { map } from 'rxjs/operators';
|
|
13
13
|
const DEFAULT_OPTIONS = {
|
|
14
14
|
mouseOptions: {},
|
|
15
15
|
orbiting: { sensitivityX: 1, sensitivityY: 1 },
|
|
16
|
+
orbitingElasticity: 0,
|
|
16
17
|
zooming: { sensitivity: 1 },
|
|
17
18
|
panning: { sensitivityX: 1, sensitivityY: 1 },
|
|
18
19
|
dollying: { sensitivity: 1 },
|
|
19
20
|
};
|
|
20
21
|
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
22
|
get radius() {
|
|
31
23
|
return this.spherical.radius;
|
|
32
24
|
}
|
|
@@ -45,6 +37,15 @@ export class OrbitCameraController extends IEntity {
|
|
|
45
37
|
set theta(value) {
|
|
46
38
|
this.spherical.theta = value;
|
|
47
39
|
}
|
|
40
|
+
constructor(camera, options = {}) {
|
|
41
|
+
super();
|
|
42
|
+
this.camera = camera;
|
|
43
|
+
this.tickOrder = TickOrder.INPUT_CONTROLLERS;
|
|
44
|
+
this.spherical = { phi: 0, radius: 10, theta: 0 };
|
|
45
|
+
this.target = Pnt3.O;
|
|
46
|
+
this.options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
47
|
+
this.mouseInput = new MouseInput(this.options.mouseOptions);
|
|
48
|
+
}
|
|
48
49
|
onSpawned(world) {
|
|
49
50
|
const _super = Object.create(null, {
|
|
50
51
|
onSpawned: { get: () => super.onSpawned }
|
|
@@ -53,13 +54,29 @@ export class OrbitCameraController extends IEntity {
|
|
|
53
54
|
yield _super.onSpawned.call(this, world);
|
|
54
55
|
this.spherical = Pnt3.toSpherical(Pnt3.sub(this.camera.position, this.target));
|
|
55
56
|
if (this.options.orbiting) {
|
|
56
|
-
this.mouseInput.delta$
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
let mouseDelta$ = this.mouseInput.delta$.pipe(takeUntil(this._onRemoved$), filter(() => this.mouseInput.state == MouseInputState.DRAG));
|
|
58
|
+
if (this.options.orbitingElasticity > 0) {
|
|
59
|
+
const s$ = new BehaviorSubject(this.spherical);
|
|
60
|
+
mouseDelta$.subscribe(delta => {
|
|
61
|
+
const s = s$.getValue();
|
|
62
|
+
s$.next({
|
|
63
|
+
phi: Math.max(0.000001, Math.min(Math.PI - 0.000001, s.phi - (delta.y * this.options.orbiting.sensitivityY) / 1000)),
|
|
64
|
+
theta: s.theta - (delta.x * this.options.orbiting.sensitivityX) / 1000,
|
|
65
|
+
radius: 1,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
s$.pipe(takeUntil(this._onRemoved$), ggElastic(this.tick$, this.options.orbitingElasticity, (a, b, f) => ({ phi: a.phi + f * (b.phi - a.phi), theta: a.theta + f * (b.theta - a.theta), radius: 1 }), (a, b) => Pnt2.dist({ x: a.phi, y: a.theta }, { x: b.phi, y: b.theta }) < 0.0001)).subscribe(s => {
|
|
69
|
+
this.spherical.theta = s.theta;
|
|
70
|
+
this.spherical.phi = s.phi;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
mouseDelta$.subscribe(delta => {
|
|
75
|
+
this.spherical.theta -= (delta.x * this.options.orbiting.sensitivityX) / 1000;
|
|
76
|
+
this.spherical.phi -= (delta.y * this.options.orbiting.sensitivityY) / 1000;
|
|
77
|
+
this.spherical.phi = Math.max(0.000001, Math.min(Math.PI - 0.000001, this.spherical.phi));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
63
80
|
}
|
|
64
81
|
if (this.options.zooming) {
|
|
65
82
|
this.mouseInput.wheel$.pipe(takeUntil(this._onRemoved$)).subscribe(delta => {
|
|
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
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ import { Entity3d } from './entity-3d';
|
|
|
5
5
|
import { LoadOptions, LoadResultWithProps } from '../loader';
|
|
6
6
|
import { IPositionable3d } from '../interfaces/i-positionable-3d';
|
|
7
7
|
import { IRenderable3dEntity } from './i-renderable-3d.entity';
|
|
8
|
-
export
|
|
8
|
+
export type MapGraphNodeType = {
|
|
9
9
|
path: string;
|
|
10
10
|
position: Point3;
|
|
11
11
|
rotation?: Point4;
|
|
@@ -33,14 +33,15 @@ export declare class MapGraph extends Graph<MapGraphNodeType> {
|
|
|
33
33
|
getNearestDummy(thisNodes: Graph<MapGraphNodeType>[], cursor: Point3): Graph<MapGraphNodeType>;
|
|
34
34
|
nodes(): MapGraph[];
|
|
35
35
|
}
|
|
36
|
-
export
|
|
36
|
+
export type Gg3dMapGraphEntityOptions = {
|
|
37
37
|
loadDepth: number;
|
|
38
38
|
inertia: number;
|
|
39
|
+
maxNodesLoadingPerTick: number;
|
|
39
40
|
};
|
|
40
41
|
export declare class MapGraph3dEntity<VTypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends IRenderable3dEntity<VTypeDoc, PTypeDoc> {
|
|
41
42
|
readonly mapGraph: MapGraph;
|
|
42
43
|
readonly tickOrder = TickOrder.POST_RENDERING;
|
|
43
|
-
readonly
|
|
44
|
+
readonly loaderCursor$: BehaviorSubject<Point3>;
|
|
44
45
|
readonly loaded: Map<MapGraphNodeType, (IEntity & IPositionable3d)[]>;
|
|
45
46
|
private _initialLoadComplete$;
|
|
46
47
|
get initialLoadComplete$(): Observable<boolean>;
|
|
@@ -63,6 +64,9 @@ export declare class MapGraph3dEntity<VTypeDoc extends VisualTypeDocRepo3D = Vis
|
|
|
63
64
|
protected readonly mapGraphNodes: MapGraph[];
|
|
64
65
|
protected readonly options: Gg3dMapGraphEntityOptions;
|
|
65
66
|
protected loadClock: PausableClock | null;
|
|
67
|
+
private _loadRateLimit;
|
|
68
|
+
get loadRateLimit(): number;
|
|
69
|
+
set loadRateLimit(value: number);
|
|
66
70
|
constructor(mapGraph: MapGraph, options?: Partial<Gg3dMapGraphEntityOptions>);
|
|
67
71
|
onSpawned(world: Gg3dWorld<VTypeDoc, PTypeDoc>): void;
|
|
68
72
|
onRemoved(): void;
|
|
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { BehaviorSubject,
|
|
10
|
+
import { BehaviorSubject, startWith, Subject, takeUntil } from 'rxjs';
|
|
11
11
|
import { distinctUntilChanged, map, tap } from 'rxjs/operators';
|
|
12
|
-
import { Graph, Qtrn, TickOrder } from '../../base';
|
|
12
|
+
import { Graph, Pnt3, Qtrn, TickOrder } from '../../base';
|
|
13
13
|
import { IRenderable3dEntity } from './i-renderable-3d.entity';
|
|
14
14
|
export class MapGraph extends Graph {
|
|
15
15
|
/**
|
|
@@ -79,40 +79,49 @@ export class MapGraph extends Graph {
|
|
|
79
79
|
const defaultOptions = {
|
|
80
80
|
loadDepth: 5,
|
|
81
81
|
inertia: 0,
|
|
82
|
+
maxNodesLoadingPerTick: 1,
|
|
82
83
|
};
|
|
83
84
|
export class MapGraph3dEntity extends IRenderable3dEntity {
|
|
85
|
+
get initialLoadComplete$() {
|
|
86
|
+
return this._initialLoadComplete$.asObservable();
|
|
87
|
+
}
|
|
88
|
+
get nearestDummy() {
|
|
89
|
+
return this._nearestDummy$.getValue();
|
|
90
|
+
}
|
|
91
|
+
get chunkLoaded$() {
|
|
92
|
+
return this._chunkLoaded$.asObservable();
|
|
93
|
+
}
|
|
94
|
+
get loadRateLimit() {
|
|
95
|
+
return this._loadRateLimit;
|
|
96
|
+
}
|
|
97
|
+
set loadRateLimit(value) {
|
|
98
|
+
this._loadRateLimit = value;
|
|
99
|
+
if (this.loadClock) {
|
|
100
|
+
this.loadClock.tickRateLimit = value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
84
103
|
constructor(mapGraph, options = {}) {
|
|
85
104
|
super();
|
|
86
105
|
this.mapGraph = mapGraph;
|
|
87
106
|
this.tickOrder = TickOrder.POST_RENDERING;
|
|
88
|
-
this.
|
|
107
|
+
this.loaderCursor$ = new BehaviorSubject(Pnt3.O);
|
|
89
108
|
this.loaded = new Map();
|
|
90
109
|
this._initialLoadComplete$ = new BehaviorSubject(false);
|
|
91
110
|
this._nearestDummy$ = new BehaviorSubject(null);
|
|
92
111
|
this._chunkLoaded$ = new Subject();
|
|
93
112
|
this.loadClock = null;
|
|
113
|
+
this._loadRateLimit = 1;
|
|
94
114
|
this.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
95
115
|
this.mapGraphNodes = mapGraph.nodes();
|
|
96
116
|
}
|
|
97
|
-
get initialLoadComplete$() {
|
|
98
|
-
return this._initialLoadComplete$.asObservable();
|
|
99
|
-
}
|
|
100
|
-
get nearestDummy() {
|
|
101
|
-
return this._nearestDummy$.getValue();
|
|
102
|
-
}
|
|
103
|
-
get chunkLoaded$() {
|
|
104
|
-
return this._chunkLoaded$.asObservable();
|
|
105
|
-
}
|
|
106
117
|
onSpawned(world) {
|
|
107
118
|
super.onSpawned(world);
|
|
108
119
|
this.loadClock = world.createClock(true);
|
|
109
|
-
this.loadClock.tickRateLimit =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
: NEVER), map(pos => this.mapGraph.getNearestDummy(this.mapGraphNodes, pos)), tap(node => this._nearestDummy$.next(node)), distinctUntilChanged())
|
|
115
|
-
.subscribe(currentChunk => {
|
|
120
|
+
this.loadClock.tickRateLimit = this._loadRateLimit;
|
|
121
|
+
let loadList = [];
|
|
122
|
+
let unloadList = [];
|
|
123
|
+
this.loadClock.tick$.pipe(startWith(null), // map will perform initial loading even if world not started yet. Handy to preload map
|
|
124
|
+
takeUntil(this._onRemoved$), map(() => this.mapGraph.getNearestDummy(this.mapGraphNodes, this.loaderCursor$.getValue())), distinctUntilChanged(), tap(node => this._nearestDummy$.next(node))).subscribe(currentChunk => {
|
|
116
125
|
let haveToBeLoaded = new Set();
|
|
117
126
|
let canBeLoaded;
|
|
118
127
|
if (this.options.inertia > 0) {
|
|
@@ -131,13 +140,45 @@ export class MapGraph3dEntity extends IRenderable3dEntity {
|
|
|
131
140
|
}
|
|
132
141
|
for (const loadedNode of this.loaded.keys()) {
|
|
133
142
|
if (!canBeLoaded.has(loadedNode)) {
|
|
134
|
-
|
|
143
|
+
if (!unloadList.includes(loadedNode)) {
|
|
144
|
+
unloadList.push(loadedNode);
|
|
145
|
+
}
|
|
135
146
|
}
|
|
136
147
|
else {
|
|
137
148
|
haveToBeLoaded.delete(loadedNode);
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
|
-
|
|
151
|
+
for (let n of Array.from(haveToBeLoaded.keys())) {
|
|
152
|
+
if (!loadList.includes(n)) {
|
|
153
|
+
loadList.push(n);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
this.tick$
|
|
158
|
+
.pipe(startWith(null), // map will perform initial loading even if world not started yet. Handy to preload map
|
|
159
|
+
takeUntil(this._onRemoved$))
|
|
160
|
+
.subscribe(() => {
|
|
161
|
+
if (unloadList.length) {
|
|
162
|
+
for (const n of unloadList) {
|
|
163
|
+
this.disposeChunk(n);
|
|
164
|
+
}
|
|
165
|
+
unloadList = [];
|
|
166
|
+
}
|
|
167
|
+
if (loadList.length) {
|
|
168
|
+
if (this._initialLoadComplete$.value && loadList.length > this.options.maxNodesLoadingPerTick) {
|
|
169
|
+
let loadNow = loadList.slice(0, this.options.maxNodesLoadingPerTick);
|
|
170
|
+
loadList = loadList.slice(this.options.maxNodesLoadingPerTick);
|
|
171
|
+
Promise.all(loadNow.map(n => this.loadChunk(n))).then();
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
Promise.all(loadList.map(n => this.loadChunk(n))).then(() => {
|
|
175
|
+
if (!this._initialLoadComplete$.value) {
|
|
176
|
+
this._initialLoadComplete$.next(true);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
loadList = [];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
141
182
|
});
|
|
142
183
|
}
|
|
143
184
|
onRemoved() {
|
|
@@ -146,7 +187,7 @@ export class MapGraph3dEntity extends IRenderable3dEntity {
|
|
|
146
187
|
this.loadClock.stop();
|
|
147
188
|
this.loadClock = null;
|
|
148
189
|
}
|
|
149
|
-
this.
|
|
190
|
+
this.loaderCursor$.next(Pnt3.O);
|
|
150
191
|
}
|
|
151
192
|
loadChunk(node) {
|
|
152
193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4,12 +4,12 @@ import { IDisplayObject3dComponent } from '../components/rendering/i-display-obj
|
|
|
4
4
|
import { IRaycastVehicleComponent, SuspensionOptions } from '../components/physics/i-raycast-vehicle.component';
|
|
5
5
|
import { IRigidBody3dComponent } from '../components/physics/i-rigid-body-3d.component';
|
|
6
6
|
import { PhysicsTypeDocRepo3D, VisualTypeDocRepo3D } from '../gg-3d-world';
|
|
7
|
-
export
|
|
7
|
+
export type WheelDisplayOptions = {
|
|
8
8
|
displayObject?: IDisplayObject3dComponent;
|
|
9
9
|
wheelObjectDirection?: AxisDirection3;
|
|
10
10
|
autoScaleMesh?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type RVEntitySharedWheelOptions = {
|
|
13
13
|
tyreWidth?: number;
|
|
14
14
|
tyreRadius?: number;
|
|
15
15
|
frictionSlip?: number;
|
|
@@ -17,7 +17,7 @@ export declare type RVEntitySharedWheelOptions = {
|
|
|
17
17
|
maxTravel?: number;
|
|
18
18
|
display?: WheelDisplayOptions;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type RVEntityAxleOptions = {
|
|
21
21
|
halfAxleWidth: number;
|
|
22
22
|
axlePosition: number;
|
|
23
23
|
axleHeight: number;
|
|
@@ -26,7 +26,7 @@ export declare enum RVEntityTractionBias {
|
|
|
26
26
|
FWD = 1,
|
|
27
27
|
RWD = 0
|
|
28
28
|
}
|
|
29
|
-
export
|
|
29
|
+
export type RVEntityProperties = {
|
|
30
30
|
tractionBias: RVEntityTractionBias | number;
|
|
31
31
|
suspension: SuspensionOptions;
|
|
32
32
|
} & ({
|
|
@@ -13,6 +13,47 @@ const wheeelDefaults = {
|
|
|
13
13
|
maxTravel: 0.5,
|
|
14
14
|
};
|
|
15
15
|
export class RaycastVehicle3dEntity extends Entity3d {
|
|
16
|
+
get name() {
|
|
17
|
+
return super.name;
|
|
18
|
+
}
|
|
19
|
+
set name(value) {
|
|
20
|
+
const oldName = super.name;
|
|
21
|
+
super.name = value;
|
|
22
|
+
for (const w of this.wheels || []) {
|
|
23
|
+
if (w) {
|
|
24
|
+
w.name = w.name.replace(oldName, value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// m/s
|
|
29
|
+
getSpeed() {
|
|
30
|
+
return this.vehicleComponent.wheelSpeed;
|
|
31
|
+
}
|
|
32
|
+
get steeringAngle() {
|
|
33
|
+
return this._steeringAngle;
|
|
34
|
+
}
|
|
35
|
+
set steeringAngle(value) {
|
|
36
|
+
if (this._steeringAngle != value) {
|
|
37
|
+
this._steeringAngle = value;
|
|
38
|
+
}
|
|
39
|
+
this.frontWheelsIndices.forEach(index => this.vehicleComponent.setSteering(index, value));
|
|
40
|
+
}
|
|
41
|
+
applyTraction(axle, force) {
|
|
42
|
+
if (axle != 'rear') {
|
|
43
|
+
this.frontWheelsIndices.forEach(index => this.vehicleComponent.applyEngineForce(index, force));
|
|
44
|
+
}
|
|
45
|
+
if (axle != 'front') {
|
|
46
|
+
this.rearWheelsIndices.forEach(index => this.vehicleComponent.applyEngineForce(index, force));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
applyBrake(axle, force) {
|
|
50
|
+
if (axle != 'rear') {
|
|
51
|
+
this.frontWheelsIndices.forEach(index => this.vehicleComponent.applyBrake(index, force));
|
|
52
|
+
}
|
|
53
|
+
if (axle != 'front') {
|
|
54
|
+
this.rearWheelsIndices.forEach(index => this.vehicleComponent.applyBrake(index, force));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
16
57
|
/** car mesh and physics body direction has to be pointing: y front, z up*/
|
|
17
58
|
constructor(carProperties, chassis3D, vehicleComponent) {
|
|
18
59
|
super(chassis3D, vehicleComponent);
|
|
@@ -100,47 +141,6 @@ export class RaycastVehicle3dEntity extends Entity3d {
|
|
|
100
141
|
this.addChildren(...this.wheels.filter(x => !!x));
|
|
101
142
|
this.vehicleComponent.entity = this;
|
|
102
143
|
}
|
|
103
|
-
get name() {
|
|
104
|
-
return super.name;
|
|
105
|
-
}
|
|
106
|
-
set name(value) {
|
|
107
|
-
const oldName = super.name;
|
|
108
|
-
super.name = value;
|
|
109
|
-
for (const w of this.wheels || []) {
|
|
110
|
-
if (w) {
|
|
111
|
-
w.name = w.name.replace(oldName, value);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// m/s
|
|
116
|
-
getSpeed() {
|
|
117
|
-
return this.vehicleComponent.wheelSpeed;
|
|
118
|
-
}
|
|
119
|
-
get steeringAngle() {
|
|
120
|
-
return this._steeringAngle;
|
|
121
|
-
}
|
|
122
|
-
set steeringAngle(value) {
|
|
123
|
-
if (this._steeringAngle != value) {
|
|
124
|
-
this._steeringAngle = value;
|
|
125
|
-
}
|
|
126
|
-
this.frontWheelsIndices.forEach(index => this.vehicleComponent.setSteering(index, value));
|
|
127
|
-
}
|
|
128
|
-
applyTraction(axle, force) {
|
|
129
|
-
if (axle != 'rear') {
|
|
130
|
-
this.frontWheelsIndices.forEach(index => this.vehicleComponent.applyEngineForce(index, force));
|
|
131
|
-
}
|
|
132
|
-
if (axle != 'front') {
|
|
133
|
-
this.rearWheelsIndices.forEach(index => this.vehicleComponent.applyEngineForce(index, force));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
applyBrake(axle, force) {
|
|
137
|
-
if (axle != 'rear') {
|
|
138
|
-
this.frontWheelsIndices.forEach(index => this.vehicleComponent.applyBrake(index, force));
|
|
139
|
-
}
|
|
140
|
-
if (axle != 'front') {
|
|
141
|
-
this.rearWheelsIndices.forEach(index => this.vehicleComponent.applyBrake(index, force));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
144
|
runTransformBinding(objectBody, object3D) {
|
|
145
145
|
super.runTransformBinding(objectBody, object3D);
|
|
146
146
|
for (const [i, wheel] of (this.wheels || []).entries()) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { IEntity, Pnt3, Qtrn, TickOrder } from '../../base';
|
|
2
2
|
import { map } from 'rxjs/operators';
|
|
3
3
|
export class Trigger3dEntity extends IEntity {
|
|
4
|
-
constructor(objectBody) {
|
|
5
|
-
super();
|
|
6
|
-
this.objectBody = objectBody;
|
|
7
|
-
this.tickOrder = TickOrder.OBJECTS_BINDING;
|
|
8
|
-
this._position = Pnt3.O;
|
|
9
|
-
this._rotation = Qtrn.O;
|
|
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 Trigger3dEntity 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 = Pnt3.O;
|
|
29
|
+
this._rotation = Qtrn.O;
|
|
30
|
+
this.tick$.subscribe(() => {
|
|
31
|
+
this.objectBody.checkOverlaps();
|
|
32
|
+
});
|
|
33
|
+
this.addComponents(this.objectBody);
|
|
34
|
+
}
|
|
35
35
|
}
|
package/dist/3d/factories.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BodyShape3DDescriptor, Shape3DDescriptor, Shape3DMeshDescriptor } from './models/shapes';
|
|
2
2
|
import { Point3, Point4 } from '../base';
|
|
3
3
|
import { PhysicsTypeDocRepo3D, VisualTypeDocRepo3D } from './gg-3d-world';
|
|
4
|
-
export
|
|
4
|
+
export type DisplayObject3dOpts<Tex> = {
|
|
5
5
|
color?: number;
|
|
6
6
|
shading?: 'unlit' | 'standart' | 'phong' | 'wireframe';
|
|
7
7
|
diffuse?: Tex;
|
package/dist/3d/factories.js
CHANGED
|
File without changes
|
package/dist/3d/gg-3d-world.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { IRaycastVehicleComponent } from './components/physics/i-raycast-vehicle
|
|
|
13
13
|
import { IRigidBody3dComponent } from './components/physics/i-rigid-body-3d.component';
|
|
14
14
|
import { ITrigger3dComponent } from './components/physics/i-trigger-3d.component';
|
|
15
15
|
import { IDisplayObject3dComponentLoader, IPhysicsBody3dComponentLoader } from './loaders';
|
|
16
|
-
export
|
|
16
|
+
export type VisualTypeDocRepo3D = {
|
|
17
17
|
factory: IDisplayObject3dComponentFactory;
|
|
18
18
|
loader: IDisplayObject3dComponentLoader;
|
|
19
19
|
displayObject: IDisplayObject3dComponent;
|
|
@@ -22,7 +22,7 @@ export declare type VisualTypeDocRepo3D = {
|
|
|
22
22
|
camera: ICameraComponent;
|
|
23
23
|
texture: unknown;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type PhysicsTypeDocRepo3D = {
|
|
26
26
|
factory: IPhysicsBody3dComponentFactory;
|
|
27
27
|
loader: IPhysicsBody3dComponentLoader;
|
|
28
28
|
rigidBody: IRigidBody3dComponent;
|
|
@@ -35,5 +35,5 @@ export declare class Gg3dWorld<VTypeDoc extends VisualTypeDocRepo3D = VisualType
|
|
|
35
35
|
readonly loader: Gg3dLoader<VTypeDoc, PTypeDoc>;
|
|
36
36
|
constructor(visualScene: VS, physicsWorld: PW);
|
|
37
37
|
addPrimitiveRigidBody(descr: BodyShape3DDescriptor, position?: Point3, rotation?: Point4, material?: DisplayObject3dOpts<VTypeDoc['texture']>): Entity3d<VTypeDoc, PTypeDoc>;
|
|
38
|
-
addRenderer(camera: VTypeDoc['camera'], canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions>): Renderer3dEntity<VTypeDoc>;
|
|
38
|
+
addRenderer(camera: VTypeDoc['camera'], canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & VTypeDoc['rendererExtraOpts']>): Renderer3dEntity<VTypeDoc>;
|
|
39
39
|
}
|
package/dist/3d/gg-3d-world.js
CHANGED
|
File without changes
|
package/dist/3d/index.d.ts
CHANGED
|
File without changes
|
package/dist/3d/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|