Skip to content

Commit 67816be

Browse files
use import as syntax for babylon and threejs so that lite runners work properly, fixed threejs unit tests, improved build commands for github actions
1 parent eeb3926 commit 67816be

File tree

12 files changed

+198
-197
lines changed

12 files changed

+198
-197
lines changed

.github/workflows/basic.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ jobs:
2828
cache: 'npm'
2929
- run: npm ci
3030
- run: npm run install-rebuild-all-packages
31-
- run: npm run build --if-present
3231
- run: npm test

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@
3636
"build-jscad": "cd packages/dev/jscad && npm run build-p",
3737
"build-manifold-worker": "cd packages/dev/manifold-worker && npm run build-p",
3838
"build-manifold": "cd packages/dev/manifold && npm run build-p",
39-
"build-packages": "npm run build-base && npm run build-occt && npm run build-core && npm run build-jscad && npm run build-manifold",
40-
"install-rebuild-all-packages": "npm run ci-packages && npm run rm-dist-packages && npm run build-packages",
39+
"build-packages": "npm run build-base && npm run build-occt && npm run build-jscad && npm run build-manifold && npm run build-occt-worker && npm run build-jscad-worker && npm run build-manifold-worker && npm run build-core && npm run build-babylonjs && npm run build-threejs",
40+
"rebuild-all-packages": "npm run rm-dist-packages && npm run build-packages",
41+
"install-rebuild-all-packages": "npm run ci-packages && npm run rebuild-all-packages",
4142
"test-base": "cd packages/dev/base && npm run test-c",
4243
"test-occt": "cd packages/dev/occt && npm run test-c",
4344
"test-core": "cd packages/dev/core && npm run test-c",
4445
"test-jscad": "cd packages/dev/jscad && npm run test-c",
4546
"test-manifold": "cd packages/dev/manifold && npm run test-c",
46-
"test": "npm run test-occt && npm run test-base && npm run test-core && npm run test-jscad && npm run test-manifold"
47+
"test-threejs": "cd packages/dev/threejs && npm run test-c",
48+
"test": "npm run test-occt && npm run test-base && npm run test-core && npm run test-jscad && npm run test-manifold && npm run test-threejs"
4749
},
4850
"repository": {
4951
"type": "git",

packages/dev/babylonjs/lib/api/bitbybit/babylon/io.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as Inputs from "../../inputs/inputs";
2-
import { GLTF2Export } from "@babylonjs/serializers/glTF/2.0";
2+
import * as SERIALIZERS from "@babylonjs/serializers";
33
import * as BABYLON from "@babylonjs/core";
44
import { Context } from "../../context";
5-
import { STLExport } from "@babylonjs/serializers";
65

76
export class BabylonIO {
87

@@ -130,7 +129,7 @@ export class BabylonIO {
130129
}
131130
};
132131
}
133-
GLTF2Export.GLBAsync(this.context.scene, inputs.fileName, options).then((glb) => {
132+
SERIALIZERS.GLTF2Export.GLBAsync(this.context.scene, inputs.fileName, options).then((glb) => {
134133
glb.downloadFiles();
135134
});
136135
}
@@ -149,7 +148,7 @@ export class BabylonIO {
149148
}
150149
let meshes: BABYLON.Mesh[] = [inputs.mesh, ...childrenMeshes];
151150
meshes = meshes.filter(m => m.isVisible);
152-
STLExport.CreateSTL(meshes as BABYLON.Mesh[], true, inputs.fileName, true, true, true);
151+
SERIALIZERS.STLExport.CreateSTL(meshes as BABYLON.Mesh[], true, inputs.fileName, true, true, true);
153152
return Promise.resolve({});
154153
}
155154

@@ -173,7 +172,7 @@ export class BabylonIO {
173172
}
174173
});
175174

176-
STLExport.CreateSTL(meshes as BABYLON.Mesh[], true, inputs.fileName, true, true, true);
175+
SERIALIZERS.STLExport.CreateSTL(meshes as BABYLON.Mesh[], true, inputs.fileName, true, true, true);
177176
return Promise.resolve({});
178177
}
179178

packages/dev/babylonjs/lib/api/bitbybit/babylon/scene.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11

22
import { Context } from "../../context";
33
import * as BABYLON from "@babylonjs/core";
4+
import * as GUI from "@babylonjs/gui";
45
import * as Inputs from "../../inputs/inputs";
56
import { Base } from "../../inputs/base-inputs";
6-
import { Scene } from "@babylonjs/core";
7-
import { GUI3DManager } from "@babylonjs/gui";
87

98

109
export class BabylonScene {
@@ -267,7 +266,7 @@ export class BabylonScene {
267266
scene.environmentTexture.dispose();
268267
}
269268
scene.environmentTexture = null;
270-
scene.fogMode = Scene.FOGMODE_NONE;
269+
scene.fogMode = BABYLON.Scene.FOGMODE_NONE;
271270
scene.meshes.forEach(m => m.dispose());
272271
scene.meshes = [];
273272
scene.materials.forEach(m => m.dispose());
@@ -309,7 +308,7 @@ export class BabylonScene {
309308
(scene.metadata.xr as BABYLON.WebXRDefaultExperience).dispose();
310309
}
311310
if (scene.metadata.guiManager) {
312-
(scene.metadata.guiManager as GUI3DManager).dispose();
311+
(scene.metadata.guiManager as GUI.GUI3DManager).dispose();
313312
}
314313
}
315314
scene.transformNodes = [scene.getTransformNodeByName("root")];

packages/dev/babylonjs/lib/api/inputs/babylon-material-inputs.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-namespace */
22
import * as BABYLON from "@babylonjs/core";
33
import { Base } from "./base-inputs";
4-
import { SkyMaterial } from "@babylonjs/materials";
4+
import * as MATERIALS from "@babylonjs/materials";
55

66
// tslint:disable-next-line: no-namespace
77
export namespace BabylonMaterial {
@@ -97,14 +97,14 @@ export namespace BabylonMaterial {
9797
material: BABYLON.PBRMetallicRoughnessMaterial;
9898
}
9999
export class SkyMaterialPropDto {
100-
constructor(skyMaterial?: SkyMaterial) {
100+
constructor(skyMaterial?: MATERIALS.SkyMaterial) {
101101
if (skyMaterial !== undefined) { this.skyMaterial = skyMaterial; }
102102
}
103103
/**
104104
* Material to investigate
105105
* @default undefined
106106
*/
107-
skyMaterial: SkyMaterial;
107+
skyMaterial: MATERIALS.SkyMaterial;
108108
}
109109
export class MetallicDto {
110110
constructor(material?: BABYLON.PBRMetallicRoughnessMaterial, metallic?: number) {
@@ -312,15 +312,15 @@ export namespace BabylonMaterial {
312312
dithering = false;
313313
}
314314
export class LuminanceDto {
315-
constructor(material?: SkyMaterial, luminance?: number) {
315+
constructor(material?: MATERIALS.SkyMaterial, luminance?: number) {
316316
if (material !== undefined) { this.material = material; }
317317
if (luminance !== undefined) { this.luminance = luminance; }
318318
}
319319
/**
320320
* Material to update
321321
* @default undefined
322322
*/
323-
material: SkyMaterial;
323+
material: MATERIALS.SkyMaterial;
324324
/**
325325
* Defines the overall luminance of sky in interval ]0, 1[.
326326
* @default 1
@@ -331,15 +331,15 @@ export namespace BabylonMaterial {
331331
luminance?: number;
332332
}
333333
export class TurbidityDto {
334-
constructor(material?: SkyMaterial, turbidity?: number) {
334+
constructor(material?: MATERIALS.SkyMaterial, turbidity?: number) {
335335
if (material !== undefined) { this.material = material; }
336336
if (turbidity !== undefined) { this.turbidity = turbidity; }
337337
}
338338
/**
339339
* Material to update
340340
* @default undefined
341341
*/
342-
material: SkyMaterial;
342+
material: MATERIALS.SkyMaterial;
343343
/**
344344
* Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
345345
* @default 10
@@ -350,15 +350,15 @@ export namespace BabylonMaterial {
350350
turbidity?: number;
351351
}
352352
export class RayleighDto {
353-
constructor(material?: SkyMaterial, rayleigh?: number) {
353+
constructor(material?: MATERIALS.SkyMaterial, rayleigh?: number) {
354354
if (material !== undefined) { this.material = material; }
355355
if (rayleigh !== undefined) { this.rayleigh = rayleigh; }
356356
}
357357
/**
358358
* Material to update
359359
* @default undefined
360360
*/
361-
material: SkyMaterial;
361+
material: MATERIALS.SkyMaterial;
362362
/**
363363
* Defines the sky appearance (light intensity).
364364
* @default 2
@@ -369,15 +369,15 @@ export namespace BabylonMaterial {
369369
rayleigh?: number;
370370
}
371371
export class MieCoefficientDto {
372-
constructor(material?: SkyMaterial, mieCoefficient?: number) {
372+
constructor(material?: MATERIALS.SkyMaterial, mieCoefficient?: number) {
373373
if (material !== undefined) { this.material = material; }
374374
if (mieCoefficient !== undefined) { this.mieCoefficient = mieCoefficient; }
375375
}
376376
/**
377377
* Material to update
378378
* @default undefined
379379
*/
380-
material: SkyMaterial;
380+
material: MATERIALS.SkyMaterial;
381381
/**
382382
* Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
383383
* @default 0.005
@@ -388,15 +388,15 @@ export namespace BabylonMaterial {
388388
mieCoefficient?: number;
389389
}
390390
export class MieDirectionalGDto {
391-
constructor(material?: SkyMaterial, mieDirectionalG?: number) {
391+
constructor(material?: MATERIALS.SkyMaterial, mieDirectionalG?: number) {
392392
if (material !== undefined) { this.material = material; }
393393
if (mieDirectionalG !== undefined) { this.mieDirectionalG = mieDirectionalG; }
394394
}
395395
/**
396396
* Material to update
397397
* @default undefined
398398
*/
399-
material: SkyMaterial;
399+
material: MATERIALS.SkyMaterial;
400400
/**
401401
* Defines the amount of haze particles following the Mie scattering theory.
402402
* @default 0.8
@@ -407,15 +407,15 @@ export namespace BabylonMaterial {
407407
mieDirectionalG?: number;
408408
}
409409
export class DistanceDto {
410-
constructor(material?: SkyMaterial, distance?: number) {
410+
constructor(material?: MATERIALS.SkyMaterial, distance?: number) {
411411
if (material !== undefined) { this.material = material; }
412412
if (distance !== undefined) { this.distance = distance; }
413413
}
414414
/**
415415
* Material to update
416416
* @default undefined
417417
*/
418-
material: SkyMaterial;
418+
material: MATERIALS.SkyMaterial;
419419
/**
420420
* Defines the distance of the sun according to the active scene camera.
421421
* @default 500
@@ -426,15 +426,15 @@ export namespace BabylonMaterial {
426426
distance?: number;
427427
}
428428
export class InclinationDto {
429-
constructor(material?: SkyMaterial, inclination?: number) {
429+
constructor(material?: MATERIALS.SkyMaterial, inclination?: number) {
430430
if (material !== undefined) { this.material = material; }
431431
if (inclination !== undefined) { this.inclination = inclination; }
432432
}
433433
/**
434434
* Material to update
435435
* @default undefined
436436
*/
437-
material: SkyMaterial;
437+
material: MATERIALS.SkyMaterial;
438438
/**
439439
* Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said
440440
* "inclined".
@@ -446,15 +446,15 @@ export namespace BabylonMaterial {
446446
inclination?: number;
447447
}
448448
export class AzimuthDto {
449-
constructor(material?: SkyMaterial, azimuth?: number) {
449+
constructor(material?: MATERIALS.SkyMaterial, azimuth?: number) {
450450
if (material !== undefined) { this.material = material; }
451451
if (azimuth !== undefined) { this.azimuth = azimuth; }
452452
}
453453
/**
454454
* Material to update
455455
* @default undefined
456456
*/
457-
material: SkyMaterial;
457+
material: MATERIALS.SkyMaterial;
458458
/**
459459
* Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between
460460
* an object direction and a reference direction.
@@ -466,15 +466,15 @@ export namespace BabylonMaterial {
466466
azimuth?: number;
467467
}
468468
export class SunPositionDto {
469-
constructor(material?: SkyMaterial, sunPosition?: Base.Vector3) {
469+
constructor(material?: MATERIALS.SkyMaterial, sunPosition?: Base.Vector3) {
470470
if (material !== undefined) { this.material = material; }
471471
if (sunPosition !== undefined) { this.sunPosition = sunPosition; }
472472
}
473473
/**
474474
* Material to update
475475
* @default undefined
476476
*/
477-
material: SkyMaterial;
477+
material: MATERIALS.SkyMaterial;
478478
/**
479479
* Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then
480480
* the property is overridden by the inclination and the azimuth and can be read at any moment.
@@ -483,15 +483,15 @@ export namespace BabylonMaterial {
483483
sunPosition?: Base.Vector3;
484484
}
485485
export class UseSunPositionDto {
486-
constructor(material?: SkyMaterial, useSunPosition?: boolean) {
486+
constructor(material?: MATERIALS.SkyMaterial, useSunPosition?: boolean) {
487487
if (material !== undefined) { this.material = material; }
488488
if (useSunPosition !== undefined) { this.useSunPosition = useSunPosition; }
489489
}
490490
/**
491491
* Material to update
492492
* @default undefined
493493
*/
494-
material: SkyMaterial;
494+
material: MATERIALS.SkyMaterial;
495495
/**
496496
* Defines if the sun position should be computed (inclination and azimuth) according to the given
497497
* .sunPosition property.
@@ -500,15 +500,15 @@ export namespace BabylonMaterial {
500500
useSunPosition?: boolean;
501501
}
502502
export class CameraOffsetDto {
503-
constructor(material?: SkyMaterial, cameraOffset?: Base.Vector3) {
503+
constructor(material?: MATERIALS.SkyMaterial, cameraOffset?: Base.Vector3) {
504504
if (material !== undefined) { this.material = material; }
505505
if (cameraOffset !== undefined) { this.cameraOffset = cameraOffset; }
506506
}
507507
/**
508508
* Material to update
509509
* @default undefined
510510
*/
511-
material: SkyMaterial;
511+
material: MATERIALS.SkyMaterial;
512512
/**
513513
* Defines an offset vector used to get a horizon offset.
514514
* @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis
@@ -517,31 +517,31 @@ export namespace BabylonMaterial {
517517
cameraOffset?: Base.Vector3;
518518
}
519519
export class UpDto {
520-
constructor(material?: SkyMaterial, up?: Base.Vector3) {
520+
constructor(material?: MATERIALS.SkyMaterial, up?: Base.Vector3) {
521521
if (material !== undefined) { this.material = material; }
522522
if (up !== undefined) { this.up = up; }
523523
}
524524
/**
525525
* Material to update
526526
* @default undefined
527527
*/
528-
material: SkyMaterial;
528+
material: MATERIALS.SkyMaterial;
529529
/**
530530
* Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())
531531
* @default undefined
532532
*/
533533
up?: Base.Vector3;
534534
}
535535
export class DitheringDto {
536-
constructor(material?: SkyMaterial, dithering?: boolean) {
536+
constructor(material?: MATERIALS.SkyMaterial, dithering?: boolean) {
537537
if (material !== undefined) { this.material = material; }
538538
if (dithering !== undefined) { this.dithering = dithering; }
539539
}
540540
/**
541541
* Material to update
542542
* @default undefined
543543
*/
544-
material: SkyMaterial;
544+
material: MATERIALS.SkyMaterial;
545545
/**
546546
* Defines if sky should be dithered.
547547
* @default false

0 commit comments

Comments
 (0)