babylonjs-editor-tools 0.0.11 → 0.0.12
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/build/index.node.js +1 -1451
- package/build/src/cinematic/events/apply-impulse.js +5 -7
- package/build/src/cinematic/events/set-enabled.js +2 -3
- package/build/src/cinematic/generate.js +6 -4
- package/build/src/cinematic/guards.js +16 -0
- package/build/src/cinematic/parse.js +30 -2
- package/build/src/cinematic/tools.js +0 -31
- package/build/src/decorators/apply.js +25 -0
- package/build/src/decorators/inspector.js +27 -1
- package/build/src/index.js +2 -0
- package/build/src/loading/loader.js +1 -1
- package/build/src/rendering/default-pipeline.js +69 -1
- package/build/src/rendering/motion-blur.js +7 -0
- package/build/src/rendering/ssao.js +7 -0
- package/build/src/rendering/ssr.js +7 -0
- package/build/src/rendering/tools.js +3 -2
- package/build/src/rendering/vls.js +7 -0
- package/build/src/tools/animation.js +21 -0
- package/declaration/src/cinematic/events/apply-impulse.d.ts +5 -3
- package/declaration/src/cinematic/events/set-enabled.d.ts +3 -3
- package/declaration/src/cinematic/generate.d.ts +10 -1
- package/declaration/src/cinematic/guards.d.ts +6 -0
- package/declaration/src/cinematic/tools.d.ts +0 -5
- package/declaration/src/cinematic/typings.d.ts +2 -0
- package/declaration/src/decorators/inspector.d.ts +18 -2
- package/declaration/src/index.d.ts +2 -0
- package/declaration/src/rendering/default-pipeline.d.ts +6 -1
- package/declaration/src/rendering/motion-blur.d.ts +5 -0
- package/declaration/src/rendering/ssao.d.ts +5 -0
- package/declaration/src/rendering/ssr.d.ts +5 -0
- package/declaration/src/rendering/tools.d.ts +2 -1
- package/declaration/src/rendering/vls.d.ts +5 -0
- package/declaration/src/tools/animation.d.ts +5 -0
- package/package.json +8 -8
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
2
2
|
const zeroVector = Vector3.Zero();
|
|
3
3
|
export function handleApplyImpulseEvent(scene, config) {
|
|
4
|
-
const force = Vector3.FromArray(config.force);
|
|
5
|
-
const contactPoint = Vector3.FromArray(config.contactPoint);
|
|
6
4
|
let meshes = config.mesh
|
|
7
|
-
? [
|
|
5
|
+
? [config.mesh]
|
|
8
6
|
: scene.meshes.filter((m) => m.physicsAggregate);
|
|
9
7
|
if (config.radius) {
|
|
10
8
|
meshes = meshes.filter((mesh) => {
|
|
11
9
|
const centerWorld = mesh.getBoundingInfo().boundingBox.centerWorld;
|
|
12
|
-
return Vector3.Distance(centerWorld, contactPoint) <= config.radius;
|
|
10
|
+
return Vector3.Distance(centerWorld, config.contactPoint) <= config.radius;
|
|
13
11
|
});
|
|
14
12
|
}
|
|
15
13
|
meshes.forEach((mesh) => {
|
|
16
14
|
if (mesh.physicsAggregate?.body) {
|
|
17
|
-
const direction = contactPoint.subtract(mesh.getBoundingInfo().boundingBox.centerWorld);
|
|
18
|
-
direction.multiplyInPlace(force);
|
|
15
|
+
const direction = config.contactPoint.subtract(mesh.getBoundingInfo().boundingBox.centerWorld);
|
|
16
|
+
direction.multiplyInPlace(config.force);
|
|
19
17
|
mesh.physicsAggregate.body.setLinearVelocity(zeroVector);
|
|
20
18
|
mesh.physicsAggregate.body.setAngularVelocity(zeroVector);
|
|
21
|
-
mesh.physicsAggregate.body.applyImpulse(direction.negateInPlace(), contactPoint);
|
|
19
|
+
mesh.physicsAggregate.body.applyImpulse(direction.negateInPlace(), config.contactPoint);
|
|
22
20
|
}
|
|
23
21
|
});
|
|
24
22
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export function handleSetEnabledEvent(
|
|
2
|
-
|
|
3
|
-
node?.setEnabled(config.value);
|
|
1
|
+
export function handleSetEnabledEvent(config) {
|
|
2
|
+
config.node?.setEnabled(config.value);
|
|
4
3
|
}
|
|
5
4
|
//# sourceMappingURL=set-enabled.js.map
|
|
@@ -3,17 +3,19 @@ import { Animation } from "@babylonjs/core/Animations/animation";
|
|
|
3
3
|
import { AnimationEvent } from "@babylonjs/core/Animations/animationEvent";
|
|
4
4
|
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
|
|
5
5
|
import { isCamera } from "../tools/guards";
|
|
6
|
+
import { getAnimationTypeForObject } from "../tools/animation";
|
|
6
7
|
import { getMotionBlurPostProcess } from "../rendering/motion-blur";
|
|
7
8
|
import { getDefaultRenderingPipeline } from "../rendering/default-pipeline";
|
|
8
9
|
import { handleSetEnabledEvent } from "./events/set-enabled";
|
|
9
10
|
import { handleApplyImpulseEvent } from "./events/apply-impulse";
|
|
10
|
-
import { cloneKey,
|
|
11
|
+
import { cloneKey, getPropertyValue } from "./tools";
|
|
11
12
|
/**
|
|
12
13
|
* Parses the given cinematic object and generates a new playable animation group.
|
|
13
14
|
* @param cinematic defines the cinematic object to parse that was previously loaded.
|
|
14
15
|
* @param scene defines the reference to the scene where to retrieve the animated objects.
|
|
16
|
+
* @param options defines the options to use when generating the animation group.
|
|
15
17
|
*/
|
|
16
|
-
export function generateCinematicAnimationGroup(cinematic, scene) {
|
|
18
|
+
export function generateCinematicAnimationGroup(cinematic, scene, options) {
|
|
17
19
|
const result = new AnimationGroup(cinematic.name, scene);
|
|
18
20
|
cinematic.tracks.forEach((track) => {
|
|
19
21
|
// Animation groups
|
|
@@ -55,7 +57,7 @@ export function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
55
57
|
}
|
|
56
58
|
const sound = track.sound;
|
|
57
59
|
const soundBuffer = sound?.getAudioBuffer();
|
|
58
|
-
if (sound && soundBuffer && track.sounds?.length) {
|
|
60
|
+
if (!options?.ignoreSounds && sound && soundBuffer && track.sounds?.length) {
|
|
59
61
|
const dummyObject = {
|
|
60
62
|
dummy: 0,
|
|
61
63
|
};
|
|
@@ -91,7 +93,7 @@ export function generateCinematicAnimationGroup(cinematic, scene) {
|
|
|
91
93
|
eventsAnimation.addEvent(new AnimationEvent(configuration.frame, () => {
|
|
92
94
|
switch (configuration.data?.type) {
|
|
93
95
|
case "set-enabled":
|
|
94
|
-
handleSetEnabledEvent(
|
|
96
|
+
handleSetEnabledEvent(configuration.data);
|
|
95
97
|
break;
|
|
96
98
|
case "apply-impulse":
|
|
97
99
|
handleApplyImpulseEvent(scene, configuration.data);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function isCinematicKey(key) {
|
|
2
|
+
return key.type === "key";
|
|
3
|
+
}
|
|
4
|
+
export function isCinematicKeyCut(key) {
|
|
5
|
+
return key.type === "cut";
|
|
6
|
+
}
|
|
7
|
+
export function isCinematicKeyEvent(key) {
|
|
8
|
+
return key.type === "event";
|
|
9
|
+
}
|
|
10
|
+
export function isCinematicGroup(key) {
|
|
11
|
+
return key.type === "group";
|
|
12
|
+
}
|
|
13
|
+
export function isCinematicSound(key) {
|
|
14
|
+
return key.type === "sound";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -3,7 +3,8 @@ import { Color3, Color4 } from "@babylonjs/core/Maths/math.color";
|
|
|
3
3
|
import { Quaternion, Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector";
|
|
4
4
|
import { getDefaultRenderingPipeline } from "../rendering/default-pipeline";
|
|
5
5
|
import { getSoundById } from "../tools/sound";
|
|
6
|
-
import { getAnimationTypeForObject
|
|
6
|
+
import { getAnimationTypeForObject } from "../tools/animation";
|
|
7
|
+
import { getPropertyValue } from "./tools";
|
|
7
8
|
/**
|
|
8
9
|
* Parses the given JSON data and returns a new cinematic object.
|
|
9
10
|
* @param data defines the JSON data of the cinematic to parse.
|
|
@@ -19,6 +20,9 @@ export function parseCinematic(data, scene) {
|
|
|
19
20
|
let animationType = null;
|
|
20
21
|
if (track.node) {
|
|
21
22
|
node = scene.getNodeById(track.node);
|
|
23
|
+
if (!node) {
|
|
24
|
+
node = scene.particleSystems?.find((ps) => ps.id === track.node) ?? null;
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
else if (track.defaultRenderingPipeline) {
|
|
24
28
|
node = getDefaultRenderingPipeline();
|
|
@@ -39,7 +43,30 @@ export function parseCinematic(data, scene) {
|
|
|
39
43
|
animationGroup: track.animationGroup ? scene.getAnimationGroupByName(track.animationGroup) : null,
|
|
40
44
|
animationGroups: track.animationGroups,
|
|
41
45
|
sounds: track.sounds,
|
|
42
|
-
keyFrameEvents: track.keyFrameEvents
|
|
46
|
+
keyFrameEvents: track.keyFrameEvents?.map((event) => {
|
|
47
|
+
const result = {
|
|
48
|
+
...event,
|
|
49
|
+
};
|
|
50
|
+
switch (event.data?.type) {
|
|
51
|
+
case "set-enabled":
|
|
52
|
+
result.data = {
|
|
53
|
+
type: "set-enabled",
|
|
54
|
+
value: event.data.value,
|
|
55
|
+
node: scene.getNodeById(event.data.node),
|
|
56
|
+
};
|
|
57
|
+
break;
|
|
58
|
+
case "apply-impulse":
|
|
59
|
+
result.data = {
|
|
60
|
+
type: "apply-impulse",
|
|
61
|
+
radius: event.data.radius,
|
|
62
|
+
mesh: scene.getMeshById(event.data.mesh),
|
|
63
|
+
force: Vector3.FromArray(event.data.force),
|
|
64
|
+
contactPoint: Vector3.FromArray(event.data.contactPoint),
|
|
65
|
+
};
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}),
|
|
43
70
|
keyFrameAnimations: node && animationType !== null && track.keyFrameAnimations?.map((keyFrame) => {
|
|
44
71
|
const animationKey = keyFrame.type === "key" ? keyFrame : null;
|
|
45
72
|
if (animationKey) {
|
|
@@ -68,6 +95,7 @@ export function parseCinematic(data, scene) {
|
|
|
68
95
|
},
|
|
69
96
|
};
|
|
70
97
|
}
|
|
98
|
+
throw new Error(`Unknown key frame type: ${keyFrame.type}`);
|
|
71
99
|
}),
|
|
72
100
|
};
|
|
73
101
|
}),
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { Size } from "@babylonjs/core/Maths/math.size";
|
|
2
1
|
import { Animation } from "@babylonjs/core/Animations/animation";
|
|
3
|
-
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color";
|
|
4
|
-
import { Quaternion, Vector2, Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
5
2
|
export function cloneKey(dataType, key) {
|
|
6
3
|
let value;
|
|
7
4
|
switch (dataType) {
|
|
@@ -20,34 +17,6 @@ export function cloneKey(dataType, key) {
|
|
|
20
17
|
outTangent: dataType === Animation.ANIMATIONTYPE_FLOAT ? key.outTangent : key.outTangent?.clone(),
|
|
21
18
|
};
|
|
22
19
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns the animation type according to the given animated property type.
|
|
25
|
-
* @param effectiveProperty defines the reference to the animated property to get its animation type.
|
|
26
|
-
*/
|
|
27
|
-
export function getAnimationTypeForObject(effectiveProperty) {
|
|
28
|
-
if (!isNaN(parseFloat(effectiveProperty)) && isFinite(effectiveProperty)) {
|
|
29
|
-
return Animation.ANIMATIONTYPE_FLOAT;
|
|
30
|
-
}
|
|
31
|
-
else if (effectiveProperty instanceof Quaternion) {
|
|
32
|
-
return Animation.ANIMATIONTYPE_QUATERNION;
|
|
33
|
-
}
|
|
34
|
-
else if (effectiveProperty instanceof Vector3) {
|
|
35
|
-
return Animation.ANIMATIONTYPE_VECTOR3;
|
|
36
|
-
}
|
|
37
|
-
else if (effectiveProperty instanceof Vector2) {
|
|
38
|
-
return Animation.ANIMATIONTYPE_VECTOR2;
|
|
39
|
-
}
|
|
40
|
-
else if (effectiveProperty instanceof Color3) {
|
|
41
|
-
return Animation.ANIMATIONTYPE_COLOR3;
|
|
42
|
-
}
|
|
43
|
-
else if (effectiveProperty instanceof Color4) {
|
|
44
|
-
return Animation.ANIMATIONTYPE_COLOR4;
|
|
45
|
-
}
|
|
46
|
-
else if (effectiveProperty instanceof Size) {
|
|
47
|
-
return Animation.ANIMATIONTYPE_SIZE;
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
20
|
/**
|
|
52
21
|
* Returns the current value of the given property of the given object.
|
|
53
22
|
* @param object defines the root object where to parse the property and return its value.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color";
|
|
1
2
|
import { Vector2, Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
2
3
|
import { AdvancedDynamicTexture } from "@babylonjs/gui/2D/advancedDynamicTexture";
|
|
4
|
+
import { getSoundById } from "../tools/sound";
|
|
3
5
|
export function applyDecorators(scene, object, script, instance, rootUrl) {
|
|
4
6
|
const ctor = instance.constructor;
|
|
5
7
|
if (!ctor) {
|
|
@@ -64,6 +66,29 @@ export function applyDecorators(scene, object, script, instance, rootUrl) {
|
|
|
64
66
|
case "vector3":
|
|
65
67
|
instance[propertyKey] = Vector3.FromArray(value);
|
|
66
68
|
break;
|
|
69
|
+
case "color3":
|
|
70
|
+
instance[propertyKey] = Color3.FromArray(value);
|
|
71
|
+
break;
|
|
72
|
+
case "color4":
|
|
73
|
+
instance[propertyKey] = Color4.FromArray(value);
|
|
74
|
+
break;
|
|
75
|
+
case "entity":
|
|
76
|
+
const entityType = params.configuration.entityType;
|
|
77
|
+
switch (entityType) {
|
|
78
|
+
case "node":
|
|
79
|
+
instance[propertyKey] = scene.getNodeById(value) ?? null;
|
|
80
|
+
break;
|
|
81
|
+
case "animationGroup":
|
|
82
|
+
instance[propertyKey] = scene.getAnimationGroupByName(value) ?? null;
|
|
83
|
+
break;
|
|
84
|
+
case "sound":
|
|
85
|
+
instance[propertyKey] = getSoundById(value, scene);
|
|
86
|
+
break;
|
|
87
|
+
case "particleSystem":
|
|
88
|
+
instance[propertyKey] = scene.particleSystems?.find((ps) => ps.id === value) ?? null;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
67
92
|
}
|
|
68
93
|
}
|
|
69
94
|
});
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* once the script is invoked at runtime in the game/application.
|
|
5
5
|
* This can be used only by scripts using Classes.
|
|
6
6
|
* @param label defines the optional label displayed in the inspector in the editor.
|
|
7
|
+
* @param configuration defines the optional configuration for the field in the inspector (description, etc.).
|
|
7
8
|
*/
|
|
8
|
-
export function visibleAsBoolean(label) {
|
|
9
|
+
export function visibleAsBoolean(label, configuration) {
|
|
9
10
|
return function (target, propertyKey) {
|
|
10
11
|
const ctor = target.constructor;
|
|
11
12
|
ctor._VisibleInInspector ??= [];
|
|
@@ -13,6 +14,7 @@ export function visibleAsBoolean(label) {
|
|
|
13
14
|
label,
|
|
14
15
|
propertyKey,
|
|
15
16
|
configuration: {
|
|
17
|
+
...configuration,
|
|
16
18
|
type: "boolean",
|
|
17
19
|
},
|
|
18
20
|
});
|
|
@@ -128,4 +130,28 @@ export function visibleAsColor4(label, configuration) {
|
|
|
128
130
|
});
|
|
129
131
|
};
|
|
130
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Makes the decorated property visible in the editor inspector as an entity.
|
|
135
|
+
* The property can be customized per object in the editor and the custom value is applied
|
|
136
|
+
* once the script is invoked at runtime in the game/application.
|
|
137
|
+
* This can be used only by scripts using Classes.
|
|
138
|
+
* @param entityType defines the type of entity to be displayed in the inspector (node, sound, animationGroup or particleSystem).
|
|
139
|
+
* @param label defines the optional label displayed in the inspector in the editor.
|
|
140
|
+
* @param configuration defines the optional configuration for the field in the inspector (min, max, etc.).
|
|
141
|
+
*/
|
|
142
|
+
export function visibleAsEntity(entityType, label, configuration) {
|
|
143
|
+
return function (target, propertyKey) {
|
|
144
|
+
const ctor = target.constructor;
|
|
145
|
+
ctor._VisibleInInspector ??= [];
|
|
146
|
+
ctor._VisibleInInspector.push({
|
|
147
|
+
label,
|
|
148
|
+
propertyKey,
|
|
149
|
+
configuration: {
|
|
150
|
+
...configuration,
|
|
151
|
+
entityType,
|
|
152
|
+
type: "entity",
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
}
|
|
131
157
|
//# sourceMappingURL=inspector.js.map
|
package/build/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./tools/guards";
|
|
|
3
3
|
export * from "./tools/texture";
|
|
4
4
|
export * from "./tools/light";
|
|
5
5
|
export * from "./tools/scalar";
|
|
6
|
+
export * from "./tools/animation";
|
|
6
7
|
export * from "./rendering/ssao";
|
|
7
8
|
export * from "./rendering/ssr";
|
|
8
9
|
export * from "./rendering/motion-blur";
|
|
@@ -17,4 +18,5 @@ export * from "./script";
|
|
|
17
18
|
export * from "./cinematic/parse";
|
|
18
19
|
export * from "./cinematic/typings";
|
|
19
20
|
export * from "./cinematic/generate";
|
|
21
|
+
export * from "./cinematic/guards";
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -35,7 +35,7 @@ export async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, optio
|
|
|
35
35
|
if (scene.metadata?.rendering) {
|
|
36
36
|
applyRenderingConfigurations(scene, scene.metadata.rendering);
|
|
37
37
|
if (scene.activeCamera) {
|
|
38
|
-
applyRenderingConfigurationForCamera(scene.activeCamera);
|
|
38
|
+
applyRenderingConfigurationForCamera(scene.activeCamera, rootUrl);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (scene.metadata?.physicsGravity) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Color4 } from "@babylonjs/core/Maths/math.color";
|
|
2
2
|
import { Vector2 } from "@babylonjs/core/Maths/math.vector";
|
|
3
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
4
|
+
import { ColorGradingTexture } from "@babylonjs/core/Materials/Textures/colorGradingTexture";
|
|
3
5
|
import { DefaultRenderingPipeline } from "@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline";
|
|
6
|
+
import { isTexture } from "../tools/guards";
|
|
4
7
|
let defaultRenderingPipeline = null;
|
|
5
8
|
/**
|
|
6
9
|
* Defines the configuration of the default rendering pipeline per camera.
|
|
@@ -12,6 +15,13 @@ export const defaultPipelineCameraConfigurations = new Map();
|
|
|
12
15
|
export function getDefaultRenderingPipeline() {
|
|
13
16
|
return defaultRenderingPipeline;
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Sets the reference to the default rendering pipeline.
|
|
20
|
+
* @access editor only.
|
|
21
|
+
*/
|
|
22
|
+
export function setDefaultRenderingPipelineRef(pipeline) {
|
|
23
|
+
defaultRenderingPipeline = pipeline;
|
|
24
|
+
}
|
|
15
25
|
export function disposeDefaultRenderingPipeline() {
|
|
16
26
|
if (defaultRenderingPipeline) {
|
|
17
27
|
defaultRenderingPipeline.dispose();
|
|
@@ -70,9 +80,30 @@ export function serializeDefaultRenderingPipeline() {
|
|
|
70
80
|
glowLayerEnabled: defaultRenderingPipeline.glowLayerEnabled,
|
|
71
81
|
glowLayerIntensity: defaultRenderingPipeline.glowLayer?.intensity,
|
|
72
82
|
glowLayerBlurKernelSize: defaultRenderingPipeline.glowLayer?.blurKernelSize,
|
|
83
|
+
// Since v5.0.0-alpha.10
|
|
84
|
+
colorGradingEnabled: defaultRenderingPipeline.imageProcessing.colorGradingEnabled,
|
|
85
|
+
colorGradingTexture: defaultRenderingPipeline.imageProcessing.colorGradingTexture?.serialize(),
|
|
86
|
+
colorGradingWithGreenDepth: defaultRenderingPipeline.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth,
|
|
87
|
+
colorCurvesEnabled: defaultRenderingPipeline.imageProcessing.colorCurvesEnabled,
|
|
88
|
+
globalHue: defaultRenderingPipeline.imageProcessing.colorCurves?.globalHue,
|
|
89
|
+
globalDensity: defaultRenderingPipeline.imageProcessing.colorCurves?.globalDensity,
|
|
90
|
+
globalExposure: defaultRenderingPipeline.imageProcessing.colorCurves?.globalExposure,
|
|
91
|
+
globalSaturation: defaultRenderingPipeline.imageProcessing.colorCurves?.globalSaturation,
|
|
92
|
+
highlightsHue: defaultRenderingPipeline.imageProcessing.colorCurves?.highlightsHue,
|
|
93
|
+
highlightsDensity: defaultRenderingPipeline.imageProcessing.colorCurves?.highlightsDensity,
|
|
94
|
+
highlightsExposure: defaultRenderingPipeline.imageProcessing.colorCurves?.highlightsExposure,
|
|
95
|
+
highlightsSaturation: defaultRenderingPipeline.imageProcessing.colorCurves?.highlightsSaturation,
|
|
96
|
+
midtonesHue: defaultRenderingPipeline.imageProcessing.colorCurves?.midtonesHue,
|
|
97
|
+
midtonesDensity: defaultRenderingPipeline.imageProcessing.colorCurves?.midtonesDensity,
|
|
98
|
+
midtonesExposure: defaultRenderingPipeline.imageProcessing.colorCurves?.midtonesExposure,
|
|
99
|
+
midtonesSaturation: defaultRenderingPipeline.imageProcessing.colorCurves?.midtonesSaturation,
|
|
100
|
+
shadowsHue: defaultRenderingPipeline.imageProcessing.colorCurves?.shadowsHue,
|
|
101
|
+
shadowsDensity: defaultRenderingPipeline.imageProcessing.colorCurves?.shadowsDensity,
|
|
102
|
+
shadowsExposure: defaultRenderingPipeline.imageProcessing.colorCurves?.shadowsExposure,
|
|
103
|
+
shadowsSaturation: defaultRenderingPipeline.imageProcessing.colorCurves?.shadowsSaturation,
|
|
73
104
|
};
|
|
74
105
|
}
|
|
75
|
-
export function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
106
|
+
export function parseDefaultRenderingPipeline(scene, camera, data, rootUrl) {
|
|
76
107
|
if (defaultRenderingPipeline) {
|
|
77
108
|
return defaultRenderingPipeline;
|
|
78
109
|
}
|
|
@@ -92,6 +123,43 @@ export function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
|
92
123
|
pipeline.imageProcessing.vignetteEnabled = data.vignetteEnabled ?? false;
|
|
93
124
|
pipeline.imageProcessing.vignetteColor = Color4.FromArray(data.vignetteColor ?? [0, 0, 0]);
|
|
94
125
|
pipeline.imageProcessing.vignetteWeight = data.vignetteWeight ?? 0.3;
|
|
126
|
+
// Since v5.0.0-alpha.10
|
|
127
|
+
pipeline.imageProcessing.colorGradingEnabled = data.colorGradingEnabled ?? false;
|
|
128
|
+
pipeline.imageProcessing.imageProcessingConfiguration.colorGradingWithGreenDepth = data.colorGradingWithGreenDepth ?? true;
|
|
129
|
+
if (data.colorGradingTexture) {
|
|
130
|
+
let texture = null;
|
|
131
|
+
if (data.colorGradingTexture.customType === "BABYLON.ColorGradingTexture") {
|
|
132
|
+
const absoluteUrl = rootUrl + data.colorGradingTexture.name;
|
|
133
|
+
texture = new ColorGradingTexture(absoluteUrl, scene);
|
|
134
|
+
texture.level = data.colorGradingTexture.level;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const parsedTexture = Texture.Parse(data.colorGradingTexture, scene, rootUrl);
|
|
138
|
+
if (isTexture(parsedTexture)) {
|
|
139
|
+
texture = parsedTexture;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
pipeline.imageProcessing.colorGradingTexture = texture;
|
|
143
|
+
}
|
|
144
|
+
pipeline.imageProcessing.colorCurvesEnabled = data.colorCurvesEnabled ?? false;
|
|
145
|
+
if (pipeline.imageProcessing.colorCurves) {
|
|
146
|
+
pipeline.imageProcessing.colorCurves.globalHue = data.globalHue ?? 30;
|
|
147
|
+
pipeline.imageProcessing.colorCurves.globalDensity = data.globalDensity ?? 0;
|
|
148
|
+
pipeline.imageProcessing.colorCurves.globalExposure = data.globalExposure ?? 0;
|
|
149
|
+
pipeline.imageProcessing.colorCurves.globalSaturation = data.globalSaturation ?? 0;
|
|
150
|
+
pipeline.imageProcessing.colorCurves.highlightsHue = data.highlightsHue ?? 30;
|
|
151
|
+
pipeline.imageProcessing.colorCurves.highlightsDensity = data.highlightsDensity ?? 0;
|
|
152
|
+
pipeline.imageProcessing.colorCurves.highlightsExposure = data.highlightsExposure ?? 0;
|
|
153
|
+
pipeline.imageProcessing.colorCurves.highlightsSaturation = data.highlightsSaturation ?? 0;
|
|
154
|
+
pipeline.imageProcessing.colorCurves.midtonesHue = data.midtonesHue ?? 30;
|
|
155
|
+
pipeline.imageProcessing.colorCurves.midtonesDensity = data.midtonesDensity ?? 0;
|
|
156
|
+
pipeline.imageProcessing.colorCurves.midtonesExposure = data.midtonesExposure ?? 0;
|
|
157
|
+
pipeline.imageProcessing.colorCurves.midtonesSaturation = data.midtonesSaturation ?? 0;
|
|
158
|
+
pipeline.imageProcessing.colorCurves.shadowsHue = data.shadowsHue ?? 30;
|
|
159
|
+
pipeline.imageProcessing.colorCurves.shadowsDensity = data.shadowsDensity ?? 0;
|
|
160
|
+
pipeline.imageProcessing.colorCurves.shadowsExposure = data.shadowsExposure ?? 0;
|
|
161
|
+
pipeline.imageProcessing.colorCurves.shadowsSaturation = data.shadowsSaturation ?? 0;
|
|
162
|
+
}
|
|
95
163
|
}
|
|
96
164
|
pipeline.bloomEnabled = data.bloomEnabled;
|
|
97
165
|
pipeline.bloomThreshold = data.bloomThreshold;
|
|
@@ -7,6 +7,13 @@ export const motionBlurPostProcessCameraConfigurations = new Map();
|
|
|
7
7
|
export function getMotionBlurPostProcess() {
|
|
8
8
|
return motionBlurPostProcess;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Sets the reference to the motion blur post-process.
|
|
12
|
+
* @access editor only.
|
|
13
|
+
*/
|
|
14
|
+
export function setMotionBlurPostProcessRef(postProcess) {
|
|
15
|
+
motionBlurPostProcess = postProcess;
|
|
16
|
+
}
|
|
10
17
|
export function disposeMotionBlurPostProcess() {
|
|
11
18
|
if (motionBlurPostProcess) {
|
|
12
19
|
motionBlurPostProcess.dispose();
|
|
@@ -7,6 +7,13 @@ export const ssaoRenderingPipelineCameraConfigurations = new Map();
|
|
|
7
7
|
export function getSSAO2RenderingPipeline() {
|
|
8
8
|
return ssaoRenderingPipeline;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Sets the reference to the SSAO rendering pipeline.
|
|
12
|
+
* @access editor only.
|
|
13
|
+
*/
|
|
14
|
+
export function setSSAO2RenderingPipelineRef(pipeline) {
|
|
15
|
+
ssaoRenderingPipeline = pipeline;
|
|
16
|
+
}
|
|
10
17
|
export function disposeSSAO2RenderingPipeline() {
|
|
11
18
|
if (ssaoRenderingPipeline) {
|
|
12
19
|
ssaoRenderingPipeline.dispose();
|
|
@@ -7,6 +7,13 @@ export const ssrRenderingPipelineCameraConfigurations = new Map();
|
|
|
7
7
|
export function getSSRRenderingPipeline() {
|
|
8
8
|
return ssrRenderingPipeline;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Sets the reference to the ssr rendering pipeline.
|
|
12
|
+
* @access editor only.
|
|
13
|
+
*/
|
|
14
|
+
export function setSSRRenderingPipelineRef(pipeline) {
|
|
15
|
+
ssrRenderingPipeline = pipeline;
|
|
16
|
+
}
|
|
10
17
|
export function disposeSSRRenderingPipeline() {
|
|
11
18
|
if (ssrRenderingPipeline) {
|
|
12
19
|
ssrRenderingPipeline.dispose();
|
|
@@ -20,8 +20,9 @@ export function saveRenderingConfigurationForCamera(camera) {
|
|
|
20
20
|
* saved per-camera and can be applied on demand using this function.
|
|
21
21
|
* Previous post-processes configurations are disposed before applying the new ones.
|
|
22
22
|
* @param camera defines the reference to the camera to apply its rendering configurations.
|
|
23
|
+
* @param rootUrl defines the rootUrl that contains all resource files needed by the post-processes (color grading texture, etc.).
|
|
23
24
|
*/
|
|
24
|
-
export function applyRenderingConfigurationForCamera(camera) {
|
|
25
|
+
export function applyRenderingConfigurationForCamera(camera, rootUrl) {
|
|
25
26
|
disposeSSAO2RenderingPipeline();
|
|
26
27
|
disposeVLSPostProcess(camera.getScene());
|
|
27
28
|
disposeSSRRenderingPipeline();
|
|
@@ -45,7 +46,7 @@ export function applyRenderingConfigurationForCamera(camera) {
|
|
|
45
46
|
}
|
|
46
47
|
const defaultRenderingPipeline = defaultPipelineCameraConfigurations.get(camera);
|
|
47
48
|
if (defaultRenderingPipeline) {
|
|
48
|
-
parseDefaultRenderingPipeline(camera.getScene(), camera, defaultRenderingPipeline);
|
|
49
|
+
parseDefaultRenderingPipeline(camera.getScene(), camera, defaultRenderingPipeline, rootUrl);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
//# sourceMappingURL=tools.js.map
|
|
@@ -10,6 +10,13 @@ export const vlsPostProcessCameraConfigurations = new Map();
|
|
|
10
10
|
export function getVLSPostProcess() {
|
|
11
11
|
return vlsPostProcess;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Sets the reference to the volumetric light scattering post-process.
|
|
15
|
+
* @access editor only.
|
|
16
|
+
*/
|
|
17
|
+
export function setVLSPostProcessRef(postProcess) {
|
|
18
|
+
vlsPostProcess = postProcess;
|
|
19
|
+
}
|
|
13
20
|
export function disposeVLSPostProcess(scene) {
|
|
14
21
|
if (vlsPostProcess && scene.activeCamera) {
|
|
15
22
|
vlsPostProcess.dispose(scene.activeCamera);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Animation } from "@babylonjs/core/Animations/animation";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the animation type according to the given animated property type.
|
|
4
|
+
* @param effectiveProperty defines the reference to the animated property to get its animation type.
|
|
5
|
+
*/
|
|
6
|
+
export function getAnimationTypeForObject(effectiveProperty) {
|
|
7
|
+
if (!isNaN(parseFloat(effectiveProperty)) && isFinite(effectiveProperty)) {
|
|
8
|
+
return Animation.ANIMATIONTYPE_FLOAT;
|
|
9
|
+
}
|
|
10
|
+
switch (effectiveProperty?.getClassName?.()) {
|
|
11
|
+
case "Vector2": return Animation.ANIMATIONTYPE_VECTOR2;
|
|
12
|
+
case "Vector3": return Animation.ANIMATIONTYPE_VECTOR3;
|
|
13
|
+
case "Quaternion": return Animation.ANIMATIONTYPE_QUATERNION;
|
|
14
|
+
case "Color3": return Animation.ANIMATIONTYPE_COLOR3;
|
|
15
|
+
case "Color4": return Animation.ANIMATIONTYPE_COLOR4;
|
|
16
|
+
case "Size": return Animation.ANIMATIONTYPE_SIZE;
|
|
17
|
+
case "Matrix": return Animation.ANIMATIONTYPE_MATRIX;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Scene } from "@babylonjs/core/scene";
|
|
2
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
3
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
|
|
2
4
|
export type SetEnabledEventType = {
|
|
3
|
-
mesh:
|
|
5
|
+
mesh: AbstractMesh;
|
|
4
6
|
radius: number;
|
|
5
|
-
force:
|
|
6
|
-
contactPoint:
|
|
7
|
+
force: Vector3;
|
|
8
|
+
contactPoint: Vector3;
|
|
7
9
|
};
|
|
8
10
|
export declare function handleApplyImpulseEvent(scene: Scene, config: SetEnabledEventType): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node } from "@babylonjs/core/node";
|
|
2
2
|
export type SetEnabledEventType = {
|
|
3
3
|
value: boolean;
|
|
4
|
-
node:
|
|
4
|
+
node: Node;
|
|
5
5
|
};
|
|
6
|
-
export declare function handleSetEnabledEvent(
|
|
6
|
+
export declare function handleSetEnabledEvent(config: SetEnabledEventType): void;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { Scene } from "@babylonjs/core/scene";
|
|
2
2
|
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup";
|
|
3
3
|
import { ICinematic } from "./typings";
|
|
4
|
+
export type GenerateCinematicAnimationGroupOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Defines wether or not sounds should be ignored when generating the animation group.
|
|
7
|
+
* This means that no sound will be played during the cinematic playback.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
ignoreSounds?: boolean;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* Parses the given cinematic object and generates a new playable animation group.
|
|
6
14
|
* @param cinematic defines the cinematic object to parse that was previously loaded.
|
|
7
15
|
* @param scene defines the reference to the scene where to retrieve the animated objects.
|
|
16
|
+
* @param options defines the options to use when generating the animation group.
|
|
8
17
|
*/
|
|
9
|
-
export declare function generateCinematicAnimationGroup(cinematic: ICinematic, scene: Scene): AnimationGroup;
|
|
18
|
+
export declare function generateCinematicAnimationGroup(cinematic: ICinematic, scene: Scene, options?: GenerateCinematicAnimationGroupOptions): AnimationGroup;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ICinematicAnimationGroup, ICinematicKey, ICinematicKeyCut, ICinematicKeyEvent, ICinematicSound } from "./typings";
|
|
2
|
+
export declare function isCinematicKey(key: any): key is ICinematicKey;
|
|
3
|
+
export declare function isCinematicKeyCut(key: any): key is ICinematicKeyCut;
|
|
4
|
+
export declare function isCinematicKeyEvent(key: any): key is ICinematicKeyEvent;
|
|
5
|
+
export declare function isCinematicGroup(key: any): key is ICinematicAnimationGroup;
|
|
6
|
+
export declare function isCinematicSound(key: any): key is ICinematicSound;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { IAnimationKey } from "@babylonjs/core/Animations/animationKey";
|
|
2
2
|
export declare function cloneKey(dataType: number, key: IAnimationKey): IAnimationKey;
|
|
3
|
-
/**
|
|
4
|
-
* Returns the animation type according to the given animated property type.
|
|
5
|
-
* @param effectiveProperty defines the reference to the animated property to get its animation type.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getAnimationTypeForObject(effectiveProperty: any): number | null;
|
|
8
3
|
/**
|
|
9
4
|
* Returns the current value of the given property of the given object.
|
|
10
5
|
* @param object defines the root object where to parse the property and return its value.
|
|
@@ -6,6 +6,7 @@ export interface ICinematic {
|
|
|
6
6
|
outputFramesPerSecond: number;
|
|
7
7
|
}
|
|
8
8
|
export interface ICinematicTrack {
|
|
9
|
+
_id?: string;
|
|
9
10
|
animationGroup?: any;
|
|
10
11
|
animationGroups?: ICinematicAnimationGroup[];
|
|
11
12
|
node?: any;
|
|
@@ -42,3 +43,4 @@ export interface ICinematicKeyEvent {
|
|
|
42
43
|
frame: number;
|
|
43
44
|
data?: any;
|
|
44
45
|
}
|
|
46
|
+
export type CinematicKeyType = ICinematicKey | ICinematicKeyCut | ICinematicAnimationGroup | ICinematicSound | ICinematicKeyEvent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export type VisibleInInspectorDecoratorType = "number" | "boolean" | "vector2" | "vector3" | "color3" | "color4";
|
|
1
|
+
export type VisibleInInspectorDecoratorType = "number" | "boolean" | "vector2" | "vector3" | "color3" | "color4" | "entity";
|
|
2
2
|
export type VisibleInInspectorDecoratorConfiguration = {
|
|
3
3
|
type: VisibleInInspectorDecoratorType;
|
|
4
|
+
description?: string;
|
|
4
5
|
};
|
|
5
6
|
/**
|
|
6
7
|
* Makes the decorated property visible in the editor inspector as a boolean.
|
|
@@ -8,8 +9,9 @@ export type VisibleInInspectorDecoratorConfiguration = {
|
|
|
8
9
|
* once the script is invoked at runtime in the game/application.
|
|
9
10
|
* This can be used only by scripts using Classes.
|
|
10
11
|
* @param label defines the optional label displayed in the inspector in the editor.
|
|
12
|
+
* @param configuration defines the optional configuration for the field in the inspector (description, etc.).
|
|
11
13
|
*/
|
|
12
|
-
export declare function visibleAsBoolean(label?: string): (target: any, propertyKey: string | Symbol) => void;
|
|
14
|
+
export declare function visibleAsBoolean(label?: string, configuration?: Omit<VisibleInInspectorDecoratorNumberConfiguration, "type">): (target: any, propertyKey: string | Symbol) => void;
|
|
13
15
|
/**
|
|
14
16
|
* Makes the decorated property visible in the editor inspector as a number.
|
|
15
17
|
* The property can be customized per object in the editor and the custom value is applied
|
|
@@ -80,3 +82,17 @@ export type VisibleInInspectorDecoratorColor4Configuration = VisibleInInspectorD
|
|
|
80
82
|
noClamp?: boolean;
|
|
81
83
|
noColorPicker?: boolean;
|
|
82
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Makes the decorated property visible in the editor inspector as an entity.
|
|
87
|
+
* The property can be customized per object in the editor and the custom value is applied
|
|
88
|
+
* once the script is invoked at runtime in the game/application.
|
|
89
|
+
* This can be used only by scripts using Classes.
|
|
90
|
+
* @param entityType defines the type of entity to be displayed in the inspector (node, sound, animationGroup or particleSystem).
|
|
91
|
+
* @param label defines the optional label displayed in the inspector in the editor.
|
|
92
|
+
* @param configuration defines the optional configuration for the field in the inspector (min, max, etc.).
|
|
93
|
+
*/
|
|
94
|
+
export declare function visibleAsEntity(entityType: VisibleAsEntityType, label?: string, configuration?: Omit<VisibleInInspectorDecoratorEntityConfiguration, "type">): (target: any, propertyKey: string | Symbol) => void;
|
|
95
|
+
export type VisibleAsEntityType = "node" | "sound" | "animationGroup" | "particleSystem";
|
|
96
|
+
export type VisibleInInspectorDecoratorEntityConfiguration = VisibleInInspectorDecoratorConfiguration & {
|
|
97
|
+
entityType?: VisibleAsEntityType;
|
|
98
|
+
};
|
|
@@ -3,6 +3,7 @@ export * from "./tools/guards";
|
|
|
3
3
|
export * from "./tools/texture";
|
|
4
4
|
export * from "./tools/light";
|
|
5
5
|
export * from "./tools/scalar";
|
|
6
|
+
export * from "./tools/animation";
|
|
6
7
|
export * from "./rendering/ssao";
|
|
7
8
|
export * from "./rendering/ssr";
|
|
8
9
|
export * from "./rendering/motion-blur";
|
|
@@ -17,3 +18,4 @@ export * from "./script";
|
|
|
17
18
|
export * from "./cinematic/parse";
|
|
18
19
|
export * from "./cinematic/typings";
|
|
19
20
|
export * from "./cinematic/generate";
|
|
21
|
+
export * from "./cinematic/guards";
|