babylonjs-editor-tools 0.0.5 → 0.0.7
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/decorators/apply.js +20 -0
- package/build/decorators/scene.js +35 -0
- package/build/index.js +1 -0
- package/build/loader.js +3 -1
- package/build/rendering/default-pipeline.js +33 -30
- package/build/rendering/motion-blur.js +8 -5
- package/build/rendering/ssao.js +17 -14
- package/build/rendering/ssr.js +26 -23
- package/build/texture.js +13 -4
- package/declaration/decorators/apply.d.ts +13 -0
- package/declaration/decorators/scene.d.ts +17 -0
- package/declaration/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyDecorators = void 0;
|
|
4
|
+
function applyDecorators(scene, object, instance) {
|
|
5
|
+
const ctor = instance.constructor;
|
|
6
|
+
if (!ctor) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// @nodeFromScene
|
|
10
|
+
ctor._NodesFromScene?.forEach((params) => {
|
|
11
|
+
instance[params.propertyKey.toString()] = scene.getNodeByName(params.nodeName);
|
|
12
|
+
});
|
|
13
|
+
// @nodeFromDescendants
|
|
14
|
+
ctor._NodesFromDescendants?.forEach((params) => {
|
|
15
|
+
const descendant = object.getDescendants?.(params.directDescendantsOnly, (node) => node.name === params.nodeName)[0];
|
|
16
|
+
instance[params.propertyKey.toString()] = descendant ?? null;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.applyDecorators = applyDecorators;
|
|
20
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeFromDescendants = exports.nodeFromScene = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Makes the decorated property linked to the node that has the given name.
|
|
6
|
+
* Once the script is instantiated, the reference to the node is retrieved from the scene
|
|
7
|
+
* and assigned to the property. Node link cant' be used in constructor.
|
|
8
|
+
* This can be used only by scripts using Classes.
|
|
9
|
+
* @param nodeName defines the name of the node to retrieve in scene.
|
|
10
|
+
*/
|
|
11
|
+
function nodeFromScene(nodeName) {
|
|
12
|
+
return function (target, propertyKey) {
|
|
13
|
+
const ctor = target.constructor;
|
|
14
|
+
ctor._NodesFromScene ??= [];
|
|
15
|
+
ctor._NodesFromScene.push({ propertyKey, nodeName });
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.nodeFromScene = nodeFromScene;
|
|
19
|
+
/**
|
|
20
|
+
* Makes the decorated property linked to the node that has the given name.
|
|
21
|
+
* Once the script is instantiated, the reference to the node is retrieved from the descendants
|
|
22
|
+
* of the current node and assigned to the property. Node link cant' be used in constructor.
|
|
23
|
+
* This can be used only by scripts using Classes.
|
|
24
|
+
* @param nodeName defines the name of the node to retrieve in scene.
|
|
25
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
|
|
26
|
+
*/
|
|
27
|
+
function nodeFromDescendants(nodeName, directDescendantsOnly = false) {
|
|
28
|
+
return function (target, propertyKey) {
|
|
29
|
+
const ctor = target.constructor;
|
|
30
|
+
ctor._NodesFromDescendants ??= [];
|
|
31
|
+
ctor._NodesFromDescendants.push({ propertyKey, nodeName, directDescendantsOnly });
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.nodeFromDescendants = nodeFromDescendants;
|
|
35
|
+
//# sourceMappingURL=scene.js.map
|
package/build/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./rendering/ssao"), exports);
|
|
|
19
19
|
__exportStar(require("./rendering/ssr"), exports);
|
|
20
20
|
__exportStar(require("./rendering/motion-blur"), exports);
|
|
21
21
|
__exportStar(require("./rendering/default-pipeline"), exports);
|
|
22
|
+
__exportStar(require("./decorators/scene"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/build/loader.js
CHANGED
|
@@ -6,11 +6,12 @@ const ssr_1 = require("./rendering/ssr");
|
|
|
6
6
|
const ssao_1 = require("./rendering/ssao");
|
|
7
7
|
const motion_blur_1 = require("./rendering/motion-blur");
|
|
8
8
|
const default_pipeline_1 = require("./rendering/default-pipeline");
|
|
9
|
+
const apply_1 = require("./decorators/apply");
|
|
9
10
|
const light_1 = require("./light");
|
|
10
11
|
require("./texture");
|
|
11
12
|
async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, quality = "high") {
|
|
12
13
|
scene.loadingQuality = quality;
|
|
13
|
-
await sceneLoader_1.SceneLoader.AppendAsync(rootUrl, sceneFilename, scene);
|
|
14
|
+
await sceneLoader_1.SceneLoader.AppendAsync(rootUrl, sceneFilename, scene, null, ".babylon");
|
|
14
15
|
(0, light_1.configureShadowMapRenderListPredicate)(scene);
|
|
15
16
|
(0, light_1.configureShadowMapRefreshRate)(scene);
|
|
16
17
|
if (scene.metadata?.rendering) {
|
|
@@ -49,6 +50,7 @@ function loadScriptsFor(scene, object, scriptsMap) {
|
|
|
49
50
|
}
|
|
50
51
|
if (exports.default) {
|
|
51
52
|
const instance = new exports.default(object);
|
|
53
|
+
(0, apply_1.applyDecorators)(scene, object, instance);
|
|
52
54
|
if (instance.onStart) {
|
|
53
55
|
scene.onBeforeRenderObservable.addOnce(() => instance.onStart());
|
|
54
56
|
}
|
|
@@ -62,37 +62,40 @@ function serializeDefaultRenderingPipeline() {
|
|
|
62
62
|
}
|
|
63
63
|
exports.serializeDefaultRenderingPipeline = serializeDefaultRenderingPipeline;
|
|
64
64
|
function parseDefaultRenderingPipeline(scene, camera, data) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
defaultRenderingPipeline.fxaaEnabled = data.fxaaEnabled;
|
|
68
|
-
defaultRenderingPipeline.imageProcessingEnabled = data.imageProcessingEnabled;
|
|
69
|
-
if (defaultRenderingPipeline.imageProcessing) {
|
|
70
|
-
defaultRenderingPipeline.imageProcessing.exposure = data.exposure;
|
|
71
|
-
defaultRenderingPipeline.imageProcessing.contrast = data.contrast;
|
|
72
|
-
defaultRenderingPipeline.imageProcessing.fromLinearSpace = data.fromLinearSpace;
|
|
73
|
-
defaultRenderingPipeline.imageProcessing.toneMappingEnabled = data.toneMappingEnabled;
|
|
74
|
-
defaultRenderingPipeline.imageProcessing.toneMappingType = data.toneMappingType;
|
|
75
|
-
defaultRenderingPipeline.imageProcessing.ditheringEnabled = data.ditheringEnabled;
|
|
76
|
-
defaultRenderingPipeline.imageProcessing.ditheringIntensity = data.ditheringIntensity;
|
|
65
|
+
if (defaultRenderingPipeline) {
|
|
66
|
+
return defaultRenderingPipeline;
|
|
77
67
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
68
|
+
const pipeline = createDefaultRenderingPipeline(scene, camera);
|
|
69
|
+
pipeline.samples = data.samples;
|
|
70
|
+
pipeline.fxaaEnabled = data.fxaaEnabled;
|
|
71
|
+
pipeline.imageProcessingEnabled = data.imageProcessingEnabled;
|
|
72
|
+
if (pipeline.imageProcessing) {
|
|
73
|
+
pipeline.imageProcessing.exposure = data.exposure;
|
|
74
|
+
pipeline.imageProcessing.contrast = data.contrast;
|
|
75
|
+
pipeline.imageProcessing.fromLinearSpace = data.fromLinearSpace;
|
|
76
|
+
pipeline.imageProcessing.toneMappingEnabled = data.toneMappingEnabled;
|
|
77
|
+
pipeline.imageProcessing.toneMappingType = data.toneMappingType;
|
|
78
|
+
pipeline.imageProcessing.ditheringEnabled = data.ditheringEnabled;
|
|
79
|
+
pipeline.imageProcessing.ditheringIntensity = data.ditheringIntensity;
|
|
80
|
+
}
|
|
81
|
+
pipeline.bloomEnabled = data.bloomEnabled;
|
|
82
|
+
pipeline.bloomThreshold = data.bloomThreshold;
|
|
83
|
+
pipeline.bloomWeight = data.bloomWeight;
|
|
84
|
+
pipeline.bloomScale = data.bloomScale;
|
|
85
|
+
pipeline.bloomKernel = data.bloomKernel;
|
|
86
|
+
pipeline.sharpenEnabled = data.sharpenEnabled;
|
|
87
|
+
pipeline.sharpen.edgeAmount = data.sharpenEdgeAmount;
|
|
88
|
+
pipeline.sharpen.colorAmount = data.sharpenColorAmount;
|
|
89
|
+
pipeline.grainEnabled = data.grainEnabled;
|
|
90
|
+
pipeline.grain.intensity = data.grainIntensity;
|
|
91
|
+
pipeline.grain.animated = data.grainAnimated;
|
|
92
|
+
pipeline.depthOfFieldEnabled = data.depthOfFieldEnabled;
|
|
93
|
+
pipeline.depthOfFieldBlurLevel = data.depthOfFieldBlurLevel;
|
|
94
|
+
pipeline.depthOfField.lensSize = data.lensSize;
|
|
95
|
+
pipeline.depthOfField.fStop = data.fStop;
|
|
96
|
+
pipeline.depthOfField.focusDistance = data.focusDistance;
|
|
97
|
+
pipeline.depthOfField.focalLength = data.focalLength;
|
|
98
|
+
return pipeline;
|
|
96
99
|
}
|
|
97
100
|
exports.parseDefaultRenderingPipeline = parseDefaultRenderingPipeline;
|
|
98
101
|
//# sourceMappingURL=default-pipeline.js.map
|
|
@@ -33,11 +33,14 @@ function serializeMotionBlurPostProcess() {
|
|
|
33
33
|
}
|
|
34
34
|
exports.serializeMotionBlurPostProcess = serializeMotionBlurPostProcess;
|
|
35
35
|
function parseMotionBlurPostProcess(scene, camera, data) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
if (motionBlurPostProcess) {
|
|
37
|
+
return motionBlurPostProcess;
|
|
38
|
+
}
|
|
39
|
+
const postProcess = createMotionBlurPostProcess(scene, camera);
|
|
40
|
+
postProcess.isObjectBased = data.isObjectBased;
|
|
41
|
+
postProcess.motionStrength = data.motionStrength;
|
|
42
|
+
postProcess.motionBlurSamples = data.motionBlurSamples;
|
|
43
|
+
return postProcess;
|
|
41
44
|
}
|
|
42
45
|
exports.parseMotionBlurPostProcess = parseMotionBlurPostProcess;
|
|
43
46
|
//# sourceMappingURL=motion-blur.js.map
|
package/build/rendering/ssao.js
CHANGED
|
@@ -41,20 +41,23 @@ function serializeSSAO2RenderingPipeline() {
|
|
|
41
41
|
}
|
|
42
42
|
exports.serializeSSAO2RenderingPipeline = serializeSSAO2RenderingPipeline;
|
|
43
43
|
function parseSSAO2RenderingPipeline(scene, camera, data) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
if (ssaoRenderingPipeline) {
|
|
45
|
+
return ssaoRenderingPipeline;
|
|
46
|
+
}
|
|
47
|
+
const pipeline = createSSAO2RenderingPipeline(scene, camera);
|
|
48
|
+
pipeline.radius = data.radius;
|
|
49
|
+
pipeline.totalStrength = data.totalStrength;
|
|
50
|
+
pipeline.samples = data.samples;
|
|
51
|
+
pipeline.maxZ = data.maxZ;
|
|
52
|
+
pipeline.minZAspect = data.minZAspect;
|
|
53
|
+
pipeline.epsilon = data.epsilon;
|
|
54
|
+
pipeline.textureSamples = data.textureSamples;
|
|
55
|
+
pipeline.bypassBlur = data.bypassBlur;
|
|
56
|
+
pipeline.bilateralSamples = data.bilateralSamples;
|
|
57
|
+
pipeline.bilateralSoften = data.bilateralSoften;
|
|
58
|
+
pipeline.bilateralTolerance = data.bilateralTolerance;
|
|
59
|
+
pipeline.expensiveBlur = data.expensiveBlur;
|
|
60
|
+
return pipeline;
|
|
58
61
|
}
|
|
59
62
|
exports.parseSSAO2RenderingPipeline = parseSSAO2RenderingPipeline;
|
|
60
63
|
//# sourceMappingURL=ssao.js.map
|
package/build/rendering/ssr.js
CHANGED
|
@@ -50,29 +50,32 @@ function serializeSSRRenderingPipeline() {
|
|
|
50
50
|
}
|
|
51
51
|
exports.serializeSSRRenderingPipeline = serializeSSRRenderingPipeline;
|
|
52
52
|
function parseSSRRenderingPipeline(scene, camera, data) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
53
|
+
if (ssrRenderingPipeline) {
|
|
54
|
+
return ssrRenderingPipeline;
|
|
55
|
+
}
|
|
56
|
+
const pipeline = createSSRRenderingPipeline(scene, camera);
|
|
57
|
+
pipeline.samples = data.samples;
|
|
58
|
+
pipeline.step = data.step;
|
|
59
|
+
pipeline.thickness = data.thickness;
|
|
60
|
+
pipeline.strength = data.strength;
|
|
61
|
+
pipeline.reflectionSpecularFalloffExponent = data.reflectionSpecularFalloffExponent;
|
|
62
|
+
pipeline.maxSteps = data.maxSteps;
|
|
63
|
+
pipeline.maxDistance = data.maxDistance;
|
|
64
|
+
pipeline.roughnessFactor = data.roughnessFactor;
|
|
65
|
+
pipeline.reflectivityThreshold = data.reflectivityThreshold;
|
|
66
|
+
pipeline.blurDispersionStrength = data.blurDispersionStrehgth;
|
|
67
|
+
pipeline.clipToFrustum = data.clipToFrustum;
|
|
68
|
+
pipeline.enableSmoothReflections = data.enableSmoothReflections;
|
|
69
|
+
pipeline.enableAutomaticThicknessComputation = data.enableAutomaticThicknessComputation;
|
|
70
|
+
pipeline.attenuateFacingCamera = data.attenuateFacingCamera;
|
|
71
|
+
pipeline.attenuateScreenBorders = data.attenuateScreenBorders;
|
|
72
|
+
pipeline.attenuateIntersectionDistance = data.attenuateIntersectionDistance;
|
|
73
|
+
pipeline.attenuateBackfaceReflection = data.attenuateBackfaceReflection;
|
|
74
|
+
pipeline.blurDownsample = data.blurDownsample;
|
|
75
|
+
pipeline.selfCollisionNumSkip = data.selfCollisionNumSkip;
|
|
76
|
+
pipeline.ssrDownsample = data.ssrDownsample;
|
|
77
|
+
pipeline.backfaceDepthTextureDownsample = data.backfaceDepthTextureDownsample;
|
|
78
|
+
return pipeline;
|
|
76
79
|
}
|
|
77
80
|
exports.parseSSRRenderingPipeline = parseSSRRenderingPipeline;
|
|
78
81
|
//# sourceMappingURL=ssr.js.map
|
package/build/texture.js
CHANGED
|
@@ -12,16 +12,25 @@ decorators_serialization_1.SerializationHelper._TextureParser = (sourceProperty,
|
|
|
12
12
|
}
|
|
13
13
|
const width = sourceProperty.metadata.baseSize.width;
|
|
14
14
|
const height = sourceProperty.metadata.baseSize.height;
|
|
15
|
+
const isPowerOfTwo = width === (0, scalar_1.getPowerOfTwoUntil)(width) || height === (0, scalar_1.getPowerOfTwoUntil)(height);
|
|
15
16
|
let suffix = "";
|
|
16
17
|
switch (scene.loadingQuality) {
|
|
17
18
|
case "medium":
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
let midWidth = (width * 0.66) >> 0;
|
|
20
|
+
let midHeight = (height * 0.66) >> 0;
|
|
21
|
+
if (isPowerOfTwo) {
|
|
22
|
+
midWidth = (0, scalar_1.getPowerOfTwoUntil)(midWidth);
|
|
23
|
+
midHeight = (0, scalar_1.getPowerOfTwoUntil)(midHeight);
|
|
24
|
+
}
|
|
20
25
|
suffix = `_${midWidth}_${midHeight}`;
|
|
21
26
|
break;
|
|
22
27
|
case "low":
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
let lowWidth = (width * 0.33) >> 0;
|
|
29
|
+
let lowHeight = (height * 0.33) >> 0;
|
|
30
|
+
if (isPowerOfTwo) {
|
|
31
|
+
lowWidth = (0, scalar_1.getPowerOfTwoUntil)(lowWidth);
|
|
32
|
+
lowHeight = (0, scalar_1.getPowerOfTwoUntil)(lowHeight);
|
|
33
|
+
}
|
|
25
34
|
suffix = `_${lowWidth}_${lowHeight}`;
|
|
26
35
|
break;
|
|
27
36
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Scene } from "@babylonjs/core/scene";
|
|
2
|
+
export interface ISceneDecoratorData {
|
|
3
|
+
_NodesFromScene: {
|
|
4
|
+
nodeName: string;
|
|
5
|
+
propertyKey: string | Symbol;
|
|
6
|
+
}[];
|
|
7
|
+
_NodesFromDescendants: {
|
|
8
|
+
nodeName: string;
|
|
9
|
+
propertyKey: string | Symbol;
|
|
10
|
+
directDescendantsOnly: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export declare function applyDecorators(scene: Scene, object: any, instance: any): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes the decorated property linked to the node that has the given name.
|
|
3
|
+
* Once the script is instantiated, the reference to the node is retrieved from the scene
|
|
4
|
+
* and assigned to the property. Node link cant' be used in constructor.
|
|
5
|
+
* This can be used only by scripts using Classes.
|
|
6
|
+
* @param nodeName defines the name of the node to retrieve in scene.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nodeFromScene(nodeName: string): (target: any, propertyKey: string | Symbol) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Makes the decorated property linked to the node that has the given name.
|
|
11
|
+
* Once the script is instantiated, the reference to the node is retrieved from the descendants
|
|
12
|
+
* of the current node and assigned to the property. Node link cant' be used in constructor.
|
|
13
|
+
* This can be used only by scripts using Classes.
|
|
14
|
+
* @param nodeName defines the name of the node to retrieve in scene.
|
|
15
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered.
|
|
16
|
+
*/
|
|
17
|
+
export declare function nodeFromDescendants(nodeName: string, directDescendantsOnly?: boolean): (target: any, propertyKey: string | Symbol) => void;
|
package/declaration/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babylonjs-editor-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Babylon.js Editor Tools is a set of tools to help you create, edit and manage your Babylon.js scenes made using the Babylon.JS Editor",
|
|
5
5
|
"productName": "Babylon.js Editor Tools",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typings": "declaration/index.ts",
|
|
11
11
|
"license": "(Apache-2.0)",
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@babylonjs/core": "7.
|
|
13
|
+
"@babylonjs/core": "7.15.1",
|
|
14
14
|
"typescript": "5.3.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {}
|