@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
|
@@ -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
|
package/dist/3d/loader.d.ts
CHANGED
|
@@ -7,25 +7,25 @@ export declare enum CachingStrategy {
|
|
|
7
7
|
Files = 1,
|
|
8
8
|
Entities = 2
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type LoadOptions = {
|
|
11
11
|
cachingStrategy: CachingStrategy;
|
|
12
12
|
position: Point3;
|
|
13
13
|
rotation: Point4;
|
|
14
14
|
loadProps: boolean;
|
|
15
15
|
propsPath?: string;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type LoadResourcesResult<VTypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> = {
|
|
18
18
|
resources: {
|
|
19
19
|
object3D: VTypeDoc['displayObject'] | null;
|
|
20
20
|
body: PTypeDoc['rigidBody'] | null;
|
|
21
21
|
}[];
|
|
22
22
|
meta: GgMeta;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type LoadResult<VTypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> = {
|
|
25
25
|
entities: Entity3d<VTypeDoc, PTypeDoc>[];
|
|
26
26
|
meta: GgMeta;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type LoadResultWithProps<VTypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> = LoadResult<VTypeDoc, PTypeDoc> & {
|
|
29
29
|
props?: LoadResult<VTypeDoc, PTypeDoc>[];
|
|
30
30
|
};
|
|
31
31
|
export declare class Gg3dLoader<VTypeDoc extends VisualTypeDocRepo3D = VisualTypeDocRepo3D, PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> {
|
package/dist/3d/loader.js
CHANGED
|
@@ -22,7 +22,7 @@ const defaultLoadOptions = {
|
|
|
22
22
|
loadProps: true,
|
|
23
23
|
};
|
|
24
24
|
const cloneLoadResourcesResult = (loadResult) => ({
|
|
25
|
-
meta: loadResult.meta,
|
|
25
|
+
meta: loadResult.meta, // TODO deep clone it
|
|
26
26
|
resources: loadResult.resources.map(({ object3D, body }) => ({
|
|
27
27
|
object3D: object3D && object3D.clone(),
|
|
28
28
|
body: body && body.clone(),
|
|
@@ -34,8 +34,8 @@ export class Gg3dLoader {
|
|
|
34
34
|
this.filesCache = new Map();
|
|
35
35
|
this.loadResultCache = new Map();
|
|
36
36
|
}
|
|
37
|
-
loadGgGlbFiles(
|
|
38
|
-
return __awaiter(this,
|
|
37
|
+
loadGgGlbFiles(path_1) {
|
|
38
|
+
return __awaiter(this, arguments, void 0, function* (path, useCache = false) {
|
|
39
39
|
if (useCache && this.filesCache.has(path)) {
|
|
40
40
|
return this.filesCache.get(path);
|
|
41
41
|
}
|
|
@@ -55,8 +55,8 @@ export class Gg3dLoader {
|
|
|
55
55
|
return result;
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
loadGgGlbResources(
|
|
59
|
-
return __awaiter(this,
|
|
58
|
+
loadGgGlbResources(path_1) {
|
|
59
|
+
return __awaiter(this, arguments, void 0, function* (path, cachingStrategy = CachingStrategy.Nothing) {
|
|
60
60
|
if (cachingStrategy == CachingStrategy.Entities && this.loadResultCache.has(path)) {
|
|
61
61
|
const cached = this.loadResultCache.get(path);
|
|
62
62
|
const cachedResult = cached instanceof Promise ? yield cached : cached;
|
|
@@ -94,8 +94,8 @@ export class Gg3dLoader {
|
|
|
94
94
|
return result;
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
loadGgGlb(
|
|
98
|
-
return __awaiter(this,
|
|
97
|
+
loadGgGlb(path_1) {
|
|
98
|
+
return __awaiter(this, arguments, void 0, function* (path, options = defaultLoadOptions) {
|
|
99
99
|
const loadOptions = Object.assign(Object.assign({}, defaultLoadOptions), options);
|
|
100
100
|
const { resources, meta } = yield this.loadGgGlbResources(path, loadOptions.cachingStrategy);
|
|
101
101
|
const result = {
|
package/dist/3d/loaders.d.ts
CHANGED
|
File without changes
|
package/dist/3d/loaders.js
CHANGED
|
File without changes
|
|
@@ -2,6 +2,6 @@ import { BodyOptions, DebugBodySettings } from '../../base';
|
|
|
2
2
|
import { Shape3DDescriptor } from './shapes';
|
|
3
3
|
export interface Body3DOptions extends BodyOptions {
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type DebugBody3DSettings = DebugBodySettings & {
|
|
6
6
|
shape: Shape3DDescriptor;
|
|
7
7
|
};
|
|
File without changes
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Point3, Point4 } from '../../base';
|
|
2
2
|
import { BodyShape3DDescriptor } from './shapes';
|
|
3
|
-
export
|
|
3
|
+
export type GgDummy = {
|
|
4
4
|
name: string;
|
|
5
5
|
position: Point3;
|
|
6
6
|
rotation: Point4;
|
|
7
7
|
} & any;
|
|
8
|
-
export
|
|
8
|
+
export type GgCurve = {
|
|
9
9
|
name: string;
|
|
10
10
|
cyclic: boolean;
|
|
11
11
|
points: Point3[];
|
|
12
12
|
} & any;
|
|
13
|
-
export
|
|
13
|
+
export type GgRigidBody = {
|
|
14
14
|
name: string;
|
|
15
15
|
position: Point3;
|
|
16
16
|
rotation: Point4;
|
|
17
17
|
} & BodyShape3DDescriptor;
|
|
18
|
-
export
|
|
18
|
+
export type GgMeta = {
|
|
19
19
|
dummies: GgDummy[];
|
|
20
20
|
curves: GgCurve[];
|
|
21
21
|
rigidBodies: GgRigidBody[];
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point2, Point3, Point4 } from '../../base';
|
|
2
2
|
import { Body3DOptions } from './body-options';
|
|
3
|
-
export
|
|
3
|
+
export type Shape3DDescriptor = {
|
|
4
4
|
shape: 'PLANE';
|
|
5
5
|
} | {
|
|
6
6
|
shape: 'BOX';
|
|
@@ -31,7 +31,7 @@ export declare type Shape3DDescriptor = {
|
|
|
31
31
|
vertices: Point3[];
|
|
32
32
|
faces: [number, number, number][];
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type Shape3DMeshDescriptor = {
|
|
35
35
|
shape: 'PLANE';
|
|
36
36
|
dimensions?: Point2;
|
|
37
37
|
segments?: Point2;
|
|
@@ -71,7 +71,7 @@ export declare type Shape3DMeshDescriptor = {
|
|
|
71
71
|
vertices: Point3[];
|
|
72
72
|
faces: [number, number, number][];
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export type BodyShape3DDescriptor = {
|
|
75
75
|
shape: Shape3DDescriptor;
|
|
76
76
|
body: Partial<Body3DOptions>;
|
|
77
77
|
};
|
package/dist/3d/models/shapes.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -6,14 +6,6 @@ import { PausableClock } from './pausable-clock';
|
|
|
6
6
|
* Starts as soon as accessed and counts time from 01/01/1970
|
|
7
7
|
*/
|
|
8
8
|
export class GgGlobalClock {
|
|
9
|
-
constructor() {
|
|
10
|
-
this._tick$ = new Subject();
|
|
11
|
-
let oldRelativeTime = this.elapsedTime;
|
|
12
|
-
of(undefined, animationFrameScheduler)
|
|
13
|
-
.pipe(repeat())
|
|
14
|
-
.pipe(map(() => [oldRelativeTime, this.elapsedTime]), tap(([_, cur]) => (oldRelativeTime = cur)))
|
|
15
|
-
.subscribe(this._tick$);
|
|
16
|
-
}
|
|
17
9
|
static get instance() {
|
|
18
10
|
if (!GgGlobalClock._instance) {
|
|
19
11
|
GgGlobalClock._instance = new GgGlobalClock();
|
|
@@ -29,4 +21,12 @@ export class GgGlobalClock {
|
|
|
29
21
|
createChildClock(autoStart) {
|
|
30
22
|
return new PausableClock(autoStart, this);
|
|
31
23
|
}
|
|
24
|
+
constructor() {
|
|
25
|
+
this._tick$ = new Subject();
|
|
26
|
+
let oldRelativeTime = this.elapsedTime;
|
|
27
|
+
of(undefined, animationFrameScheduler)
|
|
28
|
+
.pipe(repeat())
|
|
29
|
+
.pipe(map(() => [oldRelativeTime, this.elapsedTime]), tap(([_, cur]) => (oldRelativeTime = cur)))
|
|
30
|
+
.subscribe(this._tick$);
|
|
31
|
+
}
|
|
32
32
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
2
|
import { IClock } from './i-clock';
|
|
3
3
|
/**
|
|
4
4
|
* A class providing the ability to track time, fire ticks, provide time elapsed, and tick delta with the ability to suspend/resume it.
|
|
@@ -40,6 +40,7 @@ export declare class PausableClock implements IClock {
|
|
|
40
40
|
* Tick rate limiter. If set to 0 - tick rate is unlimited, 15 means "allow at most 15 ticks per second"
|
|
41
41
|
*/
|
|
42
42
|
tickRateLimit: number;
|
|
43
|
+
readonly paused$: Subject<boolean>;
|
|
43
44
|
private startedAt;
|
|
44
45
|
private oldRelativeTime;
|
|
45
46
|
private pausedAt;
|
|
@@ -5,37 +5,6 @@ import { GgGlobalClock } from './global-clock';
|
|
|
5
5
|
* A class providing the ability to track time, fire ticks, provide time elapsed, and tick delta with the ability to suspend/resume it.
|
|
6
6
|
*/
|
|
7
7
|
export class PausableClock {
|
|
8
|
-
/**
|
|
9
|
-
* Constructs a new PausableClock instance.
|
|
10
|
-
* @param autoStart Indicates whether the clock should start automatically upon creation.
|
|
11
|
-
* @param parentClock The parent clock to synchronize with. Defaults to GgGlobalClock instance.
|
|
12
|
-
*/
|
|
13
|
-
constructor(autoStart = false, parentClock = GgGlobalClock.instance) {
|
|
14
|
-
this.parentClock = parentClock;
|
|
15
|
-
this.tickSub = null;
|
|
16
|
-
this._internalTick$ = new Subject();
|
|
17
|
-
this._tick$ = new Subject();
|
|
18
|
-
/**
|
|
19
|
-
* Tick rate limiter. If set to 0 - tick rate is unlimited, 15 means "allow at most 15 ticks per second"
|
|
20
|
-
*/
|
|
21
|
-
this.tickRateLimit = 0;
|
|
22
|
-
// State variables
|
|
23
|
-
this.startedAt = -1;
|
|
24
|
-
this.oldRelativeTime = 0; // "elapsed", emitted on last tick
|
|
25
|
-
this.pausedAt = -1;
|
|
26
|
-
this.lastStopElapsed = 0;
|
|
27
|
-
this._timeScale = 1;
|
|
28
|
-
this.pausedByTimescale = false;
|
|
29
|
-
this.lastFiredTickElapsed = 0;
|
|
30
|
-
if (autoStart) {
|
|
31
|
-
this.start();
|
|
32
|
-
}
|
|
33
|
-
this._internalTick$
|
|
34
|
-
.pipe(map(([_, newTime]) => [newTime, newTime - this.lastFiredTickElapsed]), filter(([elapsed]) => !this.tickRateLimit ||
|
|
35
|
-
Math.floor((this.lastFiredTickElapsed * this.tickRateLimit) / 1000) <
|
|
36
|
-
Math.floor((elapsed * this.tickRateLimit) / 1000)), tap(([elapsed]) => (this.lastFiredTickElapsed = elapsed)))
|
|
37
|
-
.subscribe(this._tick$);
|
|
38
|
-
}
|
|
39
8
|
/**
|
|
40
9
|
* Observable stream of ticks, emitting an array containing the current time and the tick delta.
|
|
41
10
|
*/
|
|
@@ -101,6 +70,39 @@ export class PausableClock {
|
|
|
101
70
|
}
|
|
102
71
|
return this._timeScale * (this.parentClock.elapsedTime - this.startedAt);
|
|
103
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Constructs a new PausableClock instance.
|
|
75
|
+
* @param autoStart Indicates whether the clock should start automatically upon creation.
|
|
76
|
+
* @param parentClock The parent clock to synchronize with. Defaults to GgGlobalClock instance.
|
|
77
|
+
*/
|
|
78
|
+
constructor(autoStart = false, parentClock = GgGlobalClock.instance) {
|
|
79
|
+
this.parentClock = parentClock;
|
|
80
|
+
this.tickSub = null;
|
|
81
|
+
this._internalTick$ = new Subject();
|
|
82
|
+
this._tick$ = new Subject();
|
|
83
|
+
/**
|
|
84
|
+
* Tick rate limiter. If set to 0 - tick rate is unlimited, 15 means "allow at most 15 ticks per second"
|
|
85
|
+
*/
|
|
86
|
+
this.tickRateLimit = 0;
|
|
87
|
+
// events
|
|
88
|
+
this.paused$ = new Subject();
|
|
89
|
+
// State variables
|
|
90
|
+
this.startedAt = -1;
|
|
91
|
+
this.oldRelativeTime = 0; // "elapsed", emitted on last tick
|
|
92
|
+
this.pausedAt = -1;
|
|
93
|
+
this.lastStopElapsed = 0;
|
|
94
|
+
this._timeScale = 1;
|
|
95
|
+
this.pausedByTimescale = false;
|
|
96
|
+
this.lastFiredTickElapsed = 0;
|
|
97
|
+
if (autoStart) {
|
|
98
|
+
this.start();
|
|
99
|
+
}
|
|
100
|
+
this._internalTick$
|
|
101
|
+
.pipe(map(([_, newTime]) => [newTime, newTime - this.lastFiredTickElapsed]), filter(([elapsed]) => !this.tickRateLimit ||
|
|
102
|
+
Math.floor((this.lastFiredTickElapsed * this.tickRateLimit) / 1000) <
|
|
103
|
+
Math.floor((elapsed * this.tickRateLimit) / 1000)), tap(([elapsed]) => (this.lastFiredTickElapsed = elapsed)))
|
|
104
|
+
.subscribe(this._tick$);
|
|
105
|
+
}
|
|
104
106
|
/**
|
|
105
107
|
* Creates a child clock.
|
|
106
108
|
* @param autoStart Indicates whether the child clock should start automatically.
|
|
@@ -135,6 +137,7 @@ export class PausableClock {
|
|
|
135
137
|
this.stopListeningTicks();
|
|
136
138
|
this.pausedAt = this.parentClock.elapsedTime;
|
|
137
139
|
this.pausedByTimescale = false;
|
|
140
|
+
this.paused$.next(true);
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
140
143
|
* Resumes the clock.
|
|
@@ -146,6 +149,7 @@ export class PausableClock {
|
|
|
146
149
|
this.startedAt += this.parentClock.elapsedTime - this.pausedAt;
|
|
147
150
|
this.pausedAt = -1;
|
|
148
151
|
this.startListeningTicks();
|
|
152
|
+
this.paused$.next(false);
|
|
149
153
|
}
|
|
150
154
|
/**
|
|
151
155
|
* Starts listening for ticks from the parent clock.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|