@needle-tools/engine 2.55.0-pre → 2.55.2-pre
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/CHANGELOG.md +13 -0
- package/dist/needle-engine.d.ts +143 -133
- package/dist/needle-engine.js +358 -358
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +20 -20
- package/dist/needle-engine.min.js.map +4 -4
- package/dist/needle-engine.tsbuildinfo +1 -1
- package/lib/engine/engine_gizmos.d.ts +2 -0
- package/lib/engine/engine_gizmos.js +24 -1
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +1 -0
- package/lib/engine/engine_physics.js +5 -2
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_serialization_core.js +20 -10
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_setup.js +7 -1
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_time.js +3 -3
- package/lib/engine/engine_time.js.map +1 -1
- package/lib/engine/engine_types.d.ts +1 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js +3 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -2
- package/lib/engine-components/Camera.js +10 -10
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.d.ts +2 -2
- package/lib/engine-components/CameraUtils.js +13 -4
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/LODGroup.js +9 -0
- package/lib/engine-components/LODGroup.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +8 -7
- package/lib/engine-components/OrbitControls.js +38 -7
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ParticleSystem.js +7 -1
- package/lib/engine-components/ParticleSystem.js.map +1 -1
- package/lib/engine-components/ParticleSystemModules.d.ts +1 -1
- package/lib/engine-components/ParticleSystemModules.js +2 -2
- package/lib/engine-components/ParticleSystemModules.js.map +1 -1
- package/lib/engine-components/Renderer.js +16 -2
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +4 -0
- package/lib/engine-components/RigidBody.js +16 -0
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/js-extensions/RGBAColor.d.ts +2 -0
- package/lib/engine-components/js-extensions/RGBAColor.js +2 -0
- package/lib/engine-components/js-extensions/RGBAColor.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/engine/engine_gizmos.ts +27 -2
- package/src/engine/engine_physics.ts +5 -4
- package/src/engine/engine_serialization_core.ts +25 -13
- package/src/engine/engine_setup.ts +9 -4
- package/src/engine/engine_time.ts +2 -2
- package/src/engine/engine_types.ts +1 -0
- package/src/engine/extensions/NEEDLE_lightmaps.ts +3 -1
- package/src/engine-components/Camera.ts +12 -15
- package/src/engine-components/CameraUtils.ts +15 -5
- package/src/engine-components/LODGroup.ts +9 -0
- package/src/engine-components/OrbitControls.ts +58 -19
- package/src/engine-components/ParticleSystem.ts +9 -2
- package/src/engine-components/ParticleSystemModules.ts +2 -2
- package/src/engine-components/Renderer.ts +19 -2
- package/src/engine-components/RigidBody.ts +22 -5
- package/src/engine-components/js-extensions/RGBAColor.ts +3 -0
|
@@ -22,6 +22,7 @@ const debugInstancing = getParam("debuginstancing");
|
|
|
22
22
|
const debugProgressiveLoading = getParam("debugprogressive");
|
|
23
23
|
const suppressProgressiveLoading = getParam("noprogressive");
|
|
24
24
|
|
|
25
|
+
const showWireframe = getParam("wireframe");
|
|
25
26
|
|
|
26
27
|
export enum ReflectionProbeUsage {
|
|
27
28
|
Off = 0,
|
|
@@ -285,15 +286,20 @@ export class Renderer extends Behaviour implements IRenderer {
|
|
|
285
286
|
this._lightmaps = [];
|
|
286
287
|
|
|
287
288
|
if (type === "Mesh") {
|
|
288
|
-
|
|
289
|
+
const mat = this.gameObject["material"];
|
|
290
|
+
if (!mat?.isMeshBasicMaterial) {
|
|
289
291
|
const rm = new RendererLightmap(this.gameObject, this.context);// GameObject.addNewComponent(this.gameObject, RendererLightmap);
|
|
290
292
|
this._lightmaps.push(rm);
|
|
291
293
|
rm.init(this.lightmapIndex, this.lightmapScaleOffset, tex, debugLightmap);
|
|
292
294
|
}
|
|
295
|
+
else {
|
|
296
|
+
if (mat)
|
|
297
|
+
console.warn("Lightmapping is not supported on MeshBasicMaterial", mat.name)
|
|
298
|
+
}
|
|
293
299
|
}
|
|
294
300
|
// for multi materials we need to loop through children
|
|
295
301
|
// and then we add a lightmap renderer component to each of them
|
|
296
|
-
else if (this.isMultiMaterialObject(this.gameObject)) {
|
|
302
|
+
else if (this.isMultiMaterialObject(this.gameObject) && this.sharedMaterials.length > 0) {
|
|
297
303
|
for (const child of this.gameObject.children) {
|
|
298
304
|
if (!child["material"]?.isMeshBasicMaterial) {
|
|
299
305
|
const rm = new RendererLightmap(child as GameObject, this.context);
|
|
@@ -309,6 +315,17 @@ export class Renderer extends Behaviour implements IRenderer {
|
|
|
309
315
|
}
|
|
310
316
|
}
|
|
311
317
|
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
if (showWireframe) {
|
|
321
|
+
for (let i = 0; i < this.sharedMaterials.length; i++) {
|
|
322
|
+
const mat: any = this.sharedMaterials[i];
|
|
323
|
+
if (mat) {
|
|
324
|
+
mat.wireframe = true;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
312
329
|
}
|
|
313
330
|
|
|
314
331
|
private _isInstancingEnabled: boolean = false;
|
|
@@ -38,11 +38,11 @@ class TransformWatch {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
syncValues(){
|
|
42
|
-
for(const key of this._positionKeys){
|
|
41
|
+
syncValues() {
|
|
42
|
+
for (const key of this._positionKeys) {
|
|
43
43
|
this.position![key] = this.obj.position[key];
|
|
44
44
|
}
|
|
45
|
-
for(const key of this._quaternionKeys){
|
|
45
|
+
for (const key of this._quaternionKeys) {
|
|
46
46
|
this.quaternion![key] = this.obj.quaternion[key];
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -213,6 +213,14 @@ export class Rigidbody extends Behaviour implements IRigidbody {
|
|
|
213
213
|
else this.constraints &= ~RigidbodyConstraints.FreezeRotationZ;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
set gravityScale(val: number) {
|
|
217
|
+
this._gravityScale = val;
|
|
218
|
+
}
|
|
219
|
+
get gravityScale() {
|
|
220
|
+
return this._gravityScale;
|
|
221
|
+
}
|
|
222
|
+
private _gravityScale: number = 1;
|
|
223
|
+
|
|
216
224
|
private static tempPosition: THREE.Vector3 = new THREE.Vector3();
|
|
217
225
|
private _propertiesChanged: boolean = false;
|
|
218
226
|
private _currentVelocity: THREE.Vector3 = new THREE.Vector3();
|
|
@@ -271,9 +279,9 @@ export class Rigidbody extends Behaviour implements IRigidbody {
|
|
|
271
279
|
return this.context.physics.internal_getRigidbody(this);
|
|
272
280
|
}
|
|
273
281
|
|
|
274
|
-
public teleport(pt: { x: number, y: number, z: number }, localspace:boolean = true) {
|
|
282
|
+
public teleport(pt: { x: number, y: number, z: number }, localspace: boolean = true) {
|
|
275
283
|
this._watch?.reset(true);
|
|
276
|
-
if(localspace) this.gameObject.position.set(pt.x, pt.y, pt.z);
|
|
284
|
+
if (localspace) this.gameObject.position.set(pt.x, pt.y, pt.z);
|
|
277
285
|
else this.setWorldPosition(pt.x, pt.y, pt.z);
|
|
278
286
|
this.resetForcesAndTorques();
|
|
279
287
|
this.resetVelocities();
|
|
@@ -343,6 +351,15 @@ export class Rigidbody extends Behaviour implements IRigidbody {
|
|
|
343
351
|
this.body?.setAngvel({ x: x, y: y, z: z }, true);
|
|
344
352
|
}
|
|
345
353
|
|
|
354
|
+
public getAngularVelocity(): Vector3 {
|
|
355
|
+
const vel = this.body?.angvel();
|
|
356
|
+
if (!vel) return this._currentVelocity.set(0, 0, 0);
|
|
357
|
+
this._currentVelocity.x = vel.x;
|
|
358
|
+
this._currentVelocity.y = vel.y;
|
|
359
|
+
this._currentVelocity.z = vel.z;
|
|
360
|
+
return this._currentVelocity;
|
|
361
|
+
}
|
|
362
|
+
|
|
346
363
|
public setTorque(x: number | Vector3, y: number, z: number) {
|
|
347
364
|
this.setAngularVelocity(x, y, z);
|
|
348
365
|
}
|