@configura/babylon-view 1.6.1 → 2.0.0-alpha.2
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/.eslintrc.json +18 -18
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/animation/AnimatableObject.d.ts +8 -8
- package/dist/animation/AnimatableObject.js +3 -3
- package/dist/animation/animator/Animator.d.ts +33 -33
- package/dist/animation/animator/Animator.js +58 -58
- package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
- package/dist/animation/animator/AnimatorEasing.js +31 -31
- package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
- package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
- package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
- package/dist/animation/animator/AnimatorHighlight.js +32 -32
- package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
- package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
- package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
- package/dist/animation/animator/AnimatorQueue.js +57 -57
- package/dist/animation/animator/AnimatorScale.d.ts +8 -8
- package/dist/animation/animator/AnimatorScale.js +13 -13
- package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
- package/dist/animation/animator/AnimatorSpin.js +13 -13
- package/dist/animation/animator/EasingFunctions.d.ts +35 -35
- package/dist/animation/animator/EasingFunctions.js +137 -137
- package/dist/animation/coordinator/Coordinator.d.ts +28 -28
- package/dist/animation/coordinator/Coordinator.js +53 -53
- package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
- package/dist/animation/coordinator/CoordinatorDropAndSpin.js +138 -138
- package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
- package/dist/animation/coordinator/CoordinatorIdentity.js +14 -14
- package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
- package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
- package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
- package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
- package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseBounce.js +35 -35
- package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
- package/dist/animation/coordinator/CoordinatorPulseHighlight.js +29 -29
- package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseInflate.js +23 -23
- package/dist/camera/CameraCreator.d.ts +5 -5
- package/dist/camera/CameraCreator.js +4 -4
- package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
- package/dist/camera/CfgArcRotateCameraPointersInput.js +266 -266
- package/dist/camera/CfgOrbitalCamera.d.ts +73 -68
- package/dist/camera/CfgOrbitalCamera.js +260 -250
- package/dist/camera/CfgOrbitalCameraControlProps.d.ts +11 -6
- package/dist/camera/CfgOrbitalCameraControlProps.js +6 -3
- package/dist/camera/GradingApplier.d.ts +3 -3
- package/dist/camera/GradingApplier.js +48 -48
- package/dist/engine/EngineCreator.d.ts +3 -3
- package/dist/engine/EngineCreator.js +10 -10
- package/dist/geometry/CfgGeometry.d.ts +29 -29
- package/dist/geometry/CfgGeometry.js +146 -146
- package/dist/geometry/CfgMesh.d.ts +10 -10
- package/dist/geometry/CfgMesh.js +38 -38
- package/dist/geometry/geoSplitter.d.ts +8 -8
- package/dist/geometry/geoSplitter.js +192 -192
- package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
- package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
- package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
- package/dist/geometry/stretch/CfgStretchData.js +350 -350
- package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
- package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
- package/dist/index.d.ts +16 -13
- package/dist/index.js +16 -13
- package/dist/io/CfgHistoryToCameraConfConnector.d.ts +30 -0
- package/dist/io/CfgHistoryToCameraConfConnector.js +80 -0
- package/dist/io/CfgIOCameraConfConnector.d.ts +36 -0
- package/dist/io/CfgIOCameraConfConnector.js +82 -0
- package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +11 -0
- package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -0
- package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +11 -0
- package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -0
- package/dist/light/CfgDirectionalLight.d.ts +8 -8
- package/dist/light/CfgDirectionalLight.js +18 -18
- package/dist/light/CfgHemisphericLight.d.ts +7 -7
- package/dist/light/CfgHemisphericLight.js +17 -17
- package/dist/light/CfgPointLight.d.ts +8 -8
- package/dist/light/CfgPointLight.js +18 -18
- package/dist/light/DefaultLightRig.d.ts +19 -19
- package/dist/light/DefaultLightRig.js +77 -77
- package/dist/light/LightRigCreator.d.ts +9 -9
- package/dist/light/LightRigCreator.js +3 -3
- package/dist/material/CfgMaterial.d.ts +68 -68
- package/dist/material/CfgMaterial.js +482 -482
- package/dist/material/DummyMaterialCreator.d.ts +4 -4
- package/dist/material/DummyMaterialCreator.js +15 -15
- package/dist/material/material.d.ts +18 -18
- package/dist/material/material.js +128 -128
- package/dist/material/texture.d.ts +14 -14
- package/dist/material/texture.js +306 -306
- package/dist/nodes/CfgContentRootNode.d.ts +19 -19
- package/dist/nodes/CfgContentRootNode.js +75 -75
- package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
- package/dist/nodes/CfgDeferredMeshNode.js +378 -378
- package/dist/nodes/CfgProductNode.d.ts +127 -127
- package/dist/nodes/CfgProductNode.js +598 -598
- package/dist/nodes/CfgSymNode.d.ts +50 -50
- package/dist/nodes/CfgSymNode.js +249 -249
- package/dist/nodes/CfgSymRootNode.d.ts +45 -45
- package/dist/nodes/CfgSymRootNode.js +229 -229
- package/dist/nodes/CfgTransformNode.d.ts +33 -33
- package/dist/nodes/CfgTransformNode.js +83 -83
- package/dist/scene/SceneCreator.d.ts +6 -6
- package/dist/scene/SceneCreator.js +22 -22
- package/dist/utilities/CfgBoundingBox.d.ts +21 -21
- package/dist/utilities/CfgBoundingBox.js +81 -81
- package/dist/utilities/anchor/anchor.d.ts +50 -50
- package/dist/utilities/anchor/anchor.js +133 -133
- package/dist/utilities/anchor/anchorMap.d.ts +20 -20
- package/dist/utilities/anchor/anchorMap.js +111 -111
- package/dist/utilities/utilities3D.d.ts +70 -70
- package/dist/utilities/utilities3D.js +265 -265
- package/dist/utilities/utilitiesColor.d.ts +18 -18
- package/dist/utilities/utilitiesColor.js +50 -50
- package/dist/utilities/utilitiesImage.d.ts +6 -6
- package/dist/utilities/utilitiesImage.js +107 -107
- package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
- package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
- package/dist/view/BaseView.d.ts +78 -78
- package/dist/view/BaseView.js +303 -303
- package/dist/view/BaseViewConfiguration.d.ts +32 -32
- package/dist/view/BaseViewConfiguration.js +10 -10
- package/dist/view/RenderEnv.d.ts +43 -43
- package/dist/view/RenderEnv.js +7 -7
- package/dist/view/SingleProductDefaultCameraView.d.ts +37 -34
- package/dist/view/SingleProductDefaultCameraView.js +145 -141
- package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +42 -46
- package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
- package/dist/view/SingleProductView.d.ts +44 -42
- package/dist/view/SingleProductView.js +212 -207
- package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
- package/dist/view/SingleProductViewConfiguration.js +19 -19
- package/package.json +5 -5
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
5
|
-
export class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
-
constructor(name, scene, parent, color, intensity) {
|
|
7
|
-
super(name, new Vector3(0, 0, 1), scene);
|
|
8
|
-
if (parent) {
|
|
9
|
-
this.parent = parent;
|
|
10
|
-
}
|
|
11
|
-
this.groundColor = Color3.Black();
|
|
12
|
-
this.specular = this.diffuse = toColor3(color);
|
|
13
|
-
if (intensity !== undefined) {
|
|
14
|
-
this.intensity = intensity;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
5
|
+
export class CfgHemisphericLight extends HemisphericLight {
|
|
6
|
+
constructor(name, scene, parent, color, intensity) {
|
|
7
|
+
super(name, new Vector3(0, 0, 1), scene);
|
|
8
|
+
if (parent) {
|
|
9
|
+
this.parent = parent;
|
|
10
|
+
}
|
|
11
|
+
this.groundColor = Color3.Black();
|
|
12
|
+
this.specular = this.diffuse = toColor3(color);
|
|
13
|
+
if (intensity !== undefined) {
|
|
14
|
+
this.intensity = intensity;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
-
export declare class CfgPointLight extends PointLight {
|
|
7
|
-
constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
-
}
|
|
1
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
5
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
+
export declare class CfgPointLight extends PointLight {
|
|
7
|
+
constructor(name: string, scene: Scene, parent?: Node, position?: Vector3, color?: Color3 | string | number, intensity?: number);
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=CfgPointLight.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
-
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
-
export class CfgPointLight extends PointLight {
|
|
5
|
-
constructor(name, scene, parent, position, color, intensity) {
|
|
6
|
-
if (position === undefined) {
|
|
7
|
-
position = Vector3.Zero();
|
|
8
|
-
}
|
|
9
|
-
super(name, position, scene);
|
|
10
|
-
if (parent) {
|
|
11
|
-
this.parent = parent;
|
|
12
|
-
}
|
|
13
|
-
this.specular = this.diffuse = toColor3(color);
|
|
14
|
-
if (intensity !== undefined) {
|
|
15
|
-
this.intensity = intensity;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
|
2
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
|
+
import { toColor3 } from "../utilities/utilitiesColor.js";
|
|
4
|
+
export class CfgPointLight extends PointLight {
|
|
5
|
+
constructor(name, scene, parent, position, color, intensity) {
|
|
6
|
+
if (position === undefined) {
|
|
7
|
+
position = Vector3.Zero();
|
|
8
|
+
}
|
|
9
|
+
super(name, position, scene);
|
|
10
|
+
if (parent) {
|
|
11
|
+
this.parent = parent;
|
|
12
|
+
}
|
|
13
|
+
this.specular = this.diffuse = toColor3(color);
|
|
14
|
+
if (intensity !== undefined) {
|
|
15
|
+
this.intensity = intensity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
2
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
3
|
-
import { LightRig, LightRigCreator } from "./LightRigCreator.js";
|
|
4
|
-
export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
|
|
5
|
-
export declare class DefaultLightRig extends LightRig {
|
|
6
|
-
private _allLights;
|
|
7
|
-
private _allPointLights;
|
|
8
|
-
private _defaultIntensities;
|
|
9
|
-
private _dimLevel;
|
|
10
|
-
get dimLevel(): number;
|
|
11
|
-
set dimLevel(v: number);
|
|
12
|
-
private _scale;
|
|
13
|
-
get scale(): number;
|
|
14
|
-
set scale(v: number);
|
|
15
|
-
private applyDimLevel;
|
|
16
|
-
private applyScale;
|
|
17
|
-
constructor(scene: Scene, target: Node | undefined);
|
|
18
|
-
get lightCount(): number;
|
|
19
|
-
}
|
|
1
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
2
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
3
|
+
import { LightRig, LightRigCreator } from "./LightRigCreator.js";
|
|
4
|
+
export declare const getDefaultLightRigCreator: (relativeToCamera: boolean) => LightRigCreator;
|
|
5
|
+
export declare class DefaultLightRig extends LightRig {
|
|
6
|
+
private _allLights;
|
|
7
|
+
private _allPointLights;
|
|
8
|
+
private _defaultIntensities;
|
|
9
|
+
private _dimLevel;
|
|
10
|
+
get dimLevel(): number;
|
|
11
|
+
set dimLevel(v: number);
|
|
12
|
+
private _scale;
|
|
13
|
+
get scale(): number;
|
|
14
|
+
set scale(v: number);
|
|
15
|
+
private applyDimLevel;
|
|
16
|
+
private applyScale;
|
|
17
|
+
constructor(scene: Scene, target: Node | undefined);
|
|
18
|
+
get lightCount(): number;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=DefaultLightRig.d.ts.map
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
-
import { CfgDirectionalLight } from "./CfgDirectionalLight.js";
|
|
3
|
-
import { CfgPointLight } from "./CfgPointLight.js";
|
|
4
|
-
import { LightRig } from "./LightRigCreator.js";
|
|
5
|
-
const LIGHT_DECAY = 2;
|
|
6
|
-
const BASE_LIGHT_SCALE = 1;
|
|
7
|
-
const BASE_LIGHT_POWER = 7;
|
|
8
|
-
const BASE_NO_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 0.5;
|
|
9
|
-
const BASE_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 30 * Math.pow(BASE_LIGHT_SCALE, LIGHT_DECAY);
|
|
10
|
-
function isDecayingLight(object) {
|
|
11
|
-
return object instanceof CfgPointLight;
|
|
12
|
-
}
|
|
13
|
-
export const getDefaultLightRigCreator = (relativeToCamera) => (scene, target) => new DefaultLightRig(scene, relativeToCamera ? target : undefined);
|
|
14
|
-
export class DefaultLightRig extends LightRig {
|
|
15
|
-
constructor(scene, target) {
|
|
16
|
-
super("Light Rig");
|
|
17
|
-
this._allLights = [];
|
|
18
|
-
this._allPointLights = [];
|
|
19
|
-
this._defaultIntensities = [];
|
|
20
|
-
this._dimLevel = 1;
|
|
21
|
-
this._scale = 1;
|
|
22
|
-
if (target === undefined) {
|
|
23
|
-
scene.addTransformNode(this);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.setParent(target);
|
|
27
|
-
}
|
|
28
|
-
this.position.setAll(0);
|
|
29
|
-
this.scaling.setAll(1);
|
|
30
|
-
this.rotation.setAll(0);
|
|
31
|
-
const lightColor = 0xffffff;
|
|
32
|
-
// The light rig is by default attached to a CfgOrbitalCamera and thus rotates around the
|
|
33
|
-
// current product, as well being scaled to fit around the product. The names of the lights
|
|
34
|
-
// below are relative to what the camera looks at in this default configuration. In other
|
|
35
|
-
// words, "behind" means the light is on the far side of the product relative to the camera.
|
|
36
|
-
this._allLights.push(new CfgDirectionalLight("directional", scene, this, new Vector3(-35, -25, -10), lightColor, 1.2 * BASE_NO_DECAY_LIGHT_POWER));
|
|
37
|
-
this._allPointLights.push(new CfgPointLight("rightUpBehind", scene, this, new Vector3(10, 10, -5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
38
|
-
this._allPointLights.push(new CfgPointLight("below", scene, this, new Vector3(0, -10, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.5 * BASE_DECAY_LIGHT_POWER));
|
|
39
|
-
this._allPointLights.push(new CfgPointLight("leftFront", scene, this, new Vector3(-10, 0, 10).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.2 * BASE_DECAY_LIGHT_POWER));
|
|
40
|
-
this._allPointLights.push(new CfgPointLight("rightUpFront", scene, this, new Vector3(10, 10, 5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
41
|
-
this._allPointLights.push(new CfgPointLight("rightUp", scene, this, new Vector3(1, 15, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
42
|
-
this._allLights.push(...this._allPointLights);
|
|
43
|
-
this._allLights.forEach((light, index) => {
|
|
44
|
-
this._defaultIntensities[index] = light.intensity;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
get dimLevel() {
|
|
48
|
-
return this._dimLevel;
|
|
49
|
-
}
|
|
50
|
-
set dimLevel(v) {
|
|
51
|
-
this._dimLevel = v;
|
|
52
|
-
this.applyDimLevel();
|
|
53
|
-
}
|
|
54
|
-
get scale() {
|
|
55
|
-
return this._scale;
|
|
56
|
-
}
|
|
57
|
-
set scale(v) {
|
|
58
|
-
this._scale = v;
|
|
59
|
-
this.applyDimLevel();
|
|
60
|
-
this.applyScale();
|
|
61
|
-
}
|
|
62
|
-
applyDimLevel() {
|
|
63
|
-
const decayCompensation = Math.pow(this.scale, LIGHT_DECAY);
|
|
64
|
-
this._allPointLights.forEach((light, index) => {
|
|
65
|
-
light.intensity =
|
|
66
|
-
this._defaultIntensities[index] *
|
|
67
|
-
this.dimLevel *
|
|
68
|
-
(isDecayingLight(light) ? decayCompensation : 1);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
applyScale() {
|
|
72
|
-
this.scaling = new Vector3(this.scale, this.scale, this.scale);
|
|
73
|
-
}
|
|
74
|
-
get lightCount() {
|
|
75
|
-
return this._allLights.length;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
+
import { CfgDirectionalLight } from "./CfgDirectionalLight.js";
|
|
3
|
+
import { CfgPointLight } from "./CfgPointLight.js";
|
|
4
|
+
import { LightRig } from "./LightRigCreator.js";
|
|
5
|
+
const LIGHT_DECAY = 2;
|
|
6
|
+
const BASE_LIGHT_SCALE = 1;
|
|
7
|
+
const BASE_LIGHT_POWER = 7;
|
|
8
|
+
const BASE_NO_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 0.5;
|
|
9
|
+
const BASE_DECAY_LIGHT_POWER = BASE_LIGHT_POWER * 30 * Math.pow(BASE_LIGHT_SCALE, LIGHT_DECAY);
|
|
10
|
+
function isDecayingLight(object) {
|
|
11
|
+
return object instanceof CfgPointLight;
|
|
12
|
+
}
|
|
13
|
+
export const getDefaultLightRigCreator = (relativeToCamera) => (scene, target) => new DefaultLightRig(scene, relativeToCamera ? target : undefined);
|
|
14
|
+
export class DefaultLightRig extends LightRig {
|
|
15
|
+
constructor(scene, target) {
|
|
16
|
+
super("Light Rig");
|
|
17
|
+
this._allLights = [];
|
|
18
|
+
this._allPointLights = [];
|
|
19
|
+
this._defaultIntensities = [];
|
|
20
|
+
this._dimLevel = 1;
|
|
21
|
+
this._scale = 1;
|
|
22
|
+
if (target === undefined) {
|
|
23
|
+
scene.addTransformNode(this);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.setParent(target);
|
|
27
|
+
}
|
|
28
|
+
this.position.setAll(0);
|
|
29
|
+
this.scaling.setAll(1);
|
|
30
|
+
this.rotation.setAll(0);
|
|
31
|
+
const lightColor = 0xffffff;
|
|
32
|
+
// The light rig is by default attached to a CfgOrbitalCamera and thus rotates around the
|
|
33
|
+
// current product, as well being scaled to fit around the product. The names of the lights
|
|
34
|
+
// below are relative to what the camera looks at in this default configuration. In other
|
|
35
|
+
// words, "behind" means the light is on the far side of the product relative to the camera.
|
|
36
|
+
this._allLights.push(new CfgDirectionalLight("directional", scene, this, new Vector3(-35, -25, -10), lightColor, 1.2 * BASE_NO_DECAY_LIGHT_POWER));
|
|
37
|
+
this._allPointLights.push(new CfgPointLight("rightUpBehind", scene, this, new Vector3(10, 10, -5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
38
|
+
this._allPointLights.push(new CfgPointLight("below", scene, this, new Vector3(0, -10, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.5 * BASE_DECAY_LIGHT_POWER));
|
|
39
|
+
this._allPointLights.push(new CfgPointLight("leftFront", scene, this, new Vector3(-10, 0, 10).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 1.2 * BASE_DECAY_LIGHT_POWER));
|
|
40
|
+
this._allPointLights.push(new CfgPointLight("rightUpFront", scene, this, new Vector3(10, 10, 5).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
41
|
+
this._allPointLights.push(new CfgPointLight("rightUp", scene, this, new Vector3(1, 15, 0).scaleInPlace(BASE_LIGHT_SCALE), lightColor, 0.8 * BASE_DECAY_LIGHT_POWER));
|
|
42
|
+
this._allLights.push(...this._allPointLights);
|
|
43
|
+
this._allLights.forEach((light, index) => {
|
|
44
|
+
this._defaultIntensities[index] = light.intensity;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
get dimLevel() {
|
|
48
|
+
return this._dimLevel;
|
|
49
|
+
}
|
|
50
|
+
set dimLevel(v) {
|
|
51
|
+
this._dimLevel = v;
|
|
52
|
+
this.applyDimLevel();
|
|
53
|
+
}
|
|
54
|
+
get scale() {
|
|
55
|
+
return this._scale;
|
|
56
|
+
}
|
|
57
|
+
set scale(v) {
|
|
58
|
+
this._scale = v;
|
|
59
|
+
this.applyDimLevel();
|
|
60
|
+
this.applyScale();
|
|
61
|
+
}
|
|
62
|
+
applyDimLevel() {
|
|
63
|
+
const decayCompensation = Math.pow(this.scale, LIGHT_DECAY);
|
|
64
|
+
this._allPointLights.forEach((light, index) => {
|
|
65
|
+
light.intensity =
|
|
66
|
+
this._defaultIntensities[index] *
|
|
67
|
+
this.dimLevel *
|
|
68
|
+
(isDecayingLight(light) ? decayCompensation : 1);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
applyScale() {
|
|
72
|
+
this.scaling = new Vector3(this.scale, this.scale, this.scale);
|
|
73
|
+
}
|
|
74
|
+
get lightCount() {
|
|
75
|
+
return this._allLights.length;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
2
|
-
import { Node } from "@babylonjs/core/node.js";
|
|
3
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
4
|
-
export declare type LightRigCreator = (scene: Scene, target: Node | undefined) => LightRig;
|
|
5
|
-
export declare abstract class LightRig extends TransformNode {
|
|
6
|
-
abstract scale: number;
|
|
7
|
-
abstract dimLevel: number;
|
|
8
|
-
abstract lightCount: number;
|
|
9
|
-
}
|
|
1
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
2
|
+
import { Node } from "@babylonjs/core/node.js";
|
|
3
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
4
|
+
export declare type LightRigCreator = (scene: Scene, target: Node | undefined) => LightRig;
|
|
5
|
+
export declare abstract class LightRig extends TransformNode {
|
|
6
|
+
abstract scale: number;
|
|
7
|
+
abstract dimLevel: number;
|
|
8
|
+
abstract lightCount: number;
|
|
9
|
+
}
|
|
10
10
|
//# sourceMappingURL=LightRigCreator.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
2
|
-
export class LightRig extends TransformNode {
|
|
3
|
-
}
|
|
1
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
2
|
+
export class LightRig extends TransformNode {
|
|
3
|
+
}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
-
import { GMaterial3D } from "@configura/web-core/dist/cm/core3D/GMaterial3D.js";
|
|
4
|
-
import { GMaterialClassic } from "@configura/web-core/dist/cm/core3D/GMaterialClassic.js";
|
|
5
|
-
import { GMaterialPBR } from "@configura/web-core/dist/cm/core3D/GMaterialPBR.js";
|
|
6
|
-
import { LogObservable, LogProducer } from "@configura/web-utilities";
|
|
7
|
-
import { RenderEnv } from "../view/RenderEnv.js";
|
|
8
|
-
import { MaterialMetaData } from "./material.js";
|
|
9
|
-
import { GMAndTexture } from "./texture.js";
|
|
10
|
-
/**
|
|
11
|
-
* A wrapper around Babylon.js PBRMaterial class.
|
|
12
|
-
*
|
|
13
|
-
* Also contains logic to create light weight "variants" of the main PBRMaterial to take into
|
|
14
|
-
* account that CmSym allows the meshes to have properties that affects the material currently
|
|
15
|
-
* applied to the mesh, such as double doubled sided or flipping the textures along the y-axis.
|
|
16
|
-
*
|
|
17
|
-
* The variants are created on demand if the request to getPBRMaterial specifies properties that
|
|
18
|
-
* does not match the main PBRMaterial. The variants are then cached.
|
|
19
|
-
*/
|
|
20
|
-
export declare class CfgMaterial implements LogProducer {
|
|
21
|
-
private _material;
|
|
22
|
-
private _variants;
|
|
23
|
-
isTransparent: boolean;
|
|
24
|
-
logger: LogObservable;
|
|
25
|
-
constructor(material: PBRMaterial, maxSimultaneousLights: number);
|
|
26
|
-
/** This material is supposed to be rendered as double sided by default. */
|
|
27
|
-
isDoubleSided(): boolean;
|
|
28
|
-
static makeFromTexture(renderEnvironment: RenderEnv, texture: Texture, sourcePath: string[]): CfgMaterial;
|
|
29
|
-
static makeFromGm(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterial3D, textures: GMAndTexture[]): CfgMaterial;
|
|
30
|
-
static makeFromGmPBR(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterialPBR, textures: GMAndTexture[], name: string): {
|
|
31
|
-
material: PBRMaterial;
|
|
32
|
-
transparent: boolean;
|
|
33
|
-
doubleSided: boolean;
|
|
34
|
-
};
|
|
35
|
-
static makeFromGmClassic(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterialClassic, textures: GMAndTexture[], name: string): {
|
|
36
|
-
material: PBRMaterial;
|
|
37
|
-
transparent: boolean;
|
|
38
|
-
doubleSided: boolean;
|
|
39
|
-
};
|
|
40
|
-
private indexFromOptions;
|
|
41
|
-
private indexFromMaterial;
|
|
42
|
-
private cloneSuffix;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the PBRMaterial associated with this CfgMaterial, optionally modified.
|
|
45
|
-
*
|
|
46
|
-
* If none of the optional parameters are set, the returned material is the one initially
|
|
47
|
-
* supplied when the CfgMaterial was created.
|
|
48
|
-
*
|
|
49
|
-
* If any of the optional parameters are supplied, you will get back a material that has those
|
|
50
|
-
* options set to the given values. The returned material will be a clone if needed, the
|
|
51
|
-
* initial material is NOT affected by this.
|
|
52
|
-
*
|
|
53
|
-
* It is safe to call this method multiple times, this class keeps an internal material cache.
|
|
54
|
-
*
|
|
55
|
-
* @warning: Do not modify the returned material in any way since it might be shared with
|
|
56
|
-
* other parts of the model!
|
|
57
|
-
*
|
|
58
|
-
* @param doubleSided Makes sure that backFaceCulling is OFF in the returned material.
|
|
59
|
-
* @param backThenFront Makes sure that separateCullingPass is ON in the returned material.
|
|
60
|
-
* @param flipTextures Flips the textures in the material along the Y-axis.
|
|
61
|
-
*/
|
|
62
|
-
getPBRMaterial(doubleSided?: boolean, backThenFront?: boolean, flipTextures?: boolean): PBRMaterial;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* The exact changes this method makes depends on the material's separateCullingPass setting, so
|
|
66
|
-
* make sure make any changes to that property before calling this method.
|
|
67
|
-
*/
|
|
68
|
-
export declare function makeMaterialDoubleSided(material: PBRMaterial, doubleSided: boolean): void;
|
|
1
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { GMaterial3D } from "@configura/web-core/dist/cm/core3D/GMaterial3D.js";
|
|
4
|
+
import { GMaterialClassic } from "@configura/web-core/dist/cm/core3D/GMaterialClassic.js";
|
|
5
|
+
import { GMaterialPBR } from "@configura/web-core/dist/cm/core3D/GMaterialPBR.js";
|
|
6
|
+
import { LogObservable, LogProducer } from "@configura/web-utilities";
|
|
7
|
+
import { RenderEnv } from "../view/RenderEnv.js";
|
|
8
|
+
import { MaterialMetaData } from "./material.js";
|
|
9
|
+
import { GMAndTexture } from "./texture.js";
|
|
10
|
+
/**
|
|
11
|
+
* A wrapper around Babylon.js PBRMaterial class.
|
|
12
|
+
*
|
|
13
|
+
* Also contains logic to create light weight "variants" of the main PBRMaterial to take into
|
|
14
|
+
* account that CmSym allows the meshes to have properties that affects the material currently
|
|
15
|
+
* applied to the mesh, such as double doubled sided or flipping the textures along the y-axis.
|
|
16
|
+
*
|
|
17
|
+
* The variants are created on demand if the request to getPBRMaterial specifies properties that
|
|
18
|
+
* does not match the main PBRMaterial. The variants are then cached.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CfgMaterial implements LogProducer {
|
|
21
|
+
private _material;
|
|
22
|
+
private _variants;
|
|
23
|
+
isTransparent: boolean;
|
|
24
|
+
logger: LogObservable;
|
|
25
|
+
constructor(material: PBRMaterial, maxSimultaneousLights: number);
|
|
26
|
+
/** This material is supposed to be rendered as double sided by default. */
|
|
27
|
+
isDoubleSided(): boolean;
|
|
28
|
+
static makeFromTexture(renderEnvironment: RenderEnv, texture: Texture, sourcePath: string[]): CfgMaterial;
|
|
29
|
+
static makeFromGm(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterial3D, textures: GMAndTexture[]): CfgMaterial;
|
|
30
|
+
static makeFromGmPBR(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterialPBR, textures: GMAndTexture[], name: string): {
|
|
31
|
+
material: PBRMaterial;
|
|
32
|
+
transparent: boolean;
|
|
33
|
+
doubleSided: boolean;
|
|
34
|
+
};
|
|
35
|
+
static makeFromGmClassic(renderEnvironment: RenderEnv, meta: MaterialMetaData, gMaterial: GMaterialClassic, textures: GMAndTexture[], name: string): {
|
|
36
|
+
material: PBRMaterial;
|
|
37
|
+
transparent: boolean;
|
|
38
|
+
doubleSided: boolean;
|
|
39
|
+
};
|
|
40
|
+
private indexFromOptions;
|
|
41
|
+
private indexFromMaterial;
|
|
42
|
+
private cloneSuffix;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the PBRMaterial associated with this CfgMaterial, optionally modified.
|
|
45
|
+
*
|
|
46
|
+
* If none of the optional parameters are set, the returned material is the one initially
|
|
47
|
+
* supplied when the CfgMaterial was created.
|
|
48
|
+
*
|
|
49
|
+
* If any of the optional parameters are supplied, you will get back a material that has those
|
|
50
|
+
* options set to the given values. The returned material will be a clone if needed, the
|
|
51
|
+
* initial material is NOT affected by this.
|
|
52
|
+
*
|
|
53
|
+
* It is safe to call this method multiple times, this class keeps an internal material cache.
|
|
54
|
+
*
|
|
55
|
+
* @warning: Do not modify the returned material in any way since it might be shared with
|
|
56
|
+
* other parts of the model!
|
|
57
|
+
*
|
|
58
|
+
* @param doubleSided Makes sure that backFaceCulling is OFF in the returned material.
|
|
59
|
+
* @param backThenFront Makes sure that separateCullingPass is ON in the returned material.
|
|
60
|
+
* @param flipTextures Flips the textures in the material along the Y-axis.
|
|
61
|
+
*/
|
|
62
|
+
getPBRMaterial(doubleSided?: boolean, backThenFront?: boolean, flipTextures?: boolean): PBRMaterial;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The exact changes this method makes depends on the material's separateCullingPass setting, so
|
|
66
|
+
* make sure make any changes to that property before calling this method.
|
|
67
|
+
*/
|
|
68
|
+
export declare function makeMaterialDoubleSided(material: PBRMaterial, doubleSided: boolean): void;
|
|
69
69
|
//# sourceMappingURL=CfgMaterial.d.ts.map
|