babylonjs-editor-tools 0.0.4 → 0.0.6

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.
@@ -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
@@ -15,9 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./loader"), exports);
18
- __exportStar(require("./texture"), exports);
19
18
  __exportStar(require("./rendering/ssao"), exports);
20
19
  __exportStar(require("./rendering/ssr"), exports);
21
20
  __exportStar(require("./rendering/motion-blur"), exports);
22
21
  __exportStar(require("./rendering/default-pipeline"), exports);
22
+ __exportStar(require("./decorators/scene"), exports);
23
23
  //# sourceMappingURL=index.js.map
package/build/light.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureShadowMapRefreshRate = exports.configureShadowMapRenderListPredicate = void 0;
4
+ const math_vector_1 = require("@babylonjs/core/Maths/math.vector");
5
+ const renderTargetTexture_1 = require("@babylonjs/core/Materials/Textures/renderTargetTexture");
6
+ function configureShadowMapRenderListPredicate(scene) {
7
+ scene.lights.forEach((light) => {
8
+ const shadowMap = light.getShadowGenerator()?.getShadowMap();
9
+ if (!shadowMap) {
10
+ return;
11
+ }
12
+ shadowMap.renderListPredicate = (mesh) => {
13
+ const distance = math_vector_1.Vector3.Distance(mesh.getAbsolutePosition(), light.getAbsolutePosition());
14
+ return distance <= light.range;
15
+ };
16
+ });
17
+ }
18
+ exports.configureShadowMapRenderListPredicate = configureShadowMapRenderListPredicate;
19
+ async function configureShadowMapRefreshRate(scene) {
20
+ scene.executeWhenReady(() => {
21
+ scene.lights.forEach((light) => {
22
+ const shadowMap = light.getShadowGenerator()?.getShadowMap();
23
+ if (shadowMap) {
24
+ shadowMap.refreshRate = light.metadata?.refreshRate ?? renderTargetTexture_1.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME;
25
+ }
26
+ });
27
+ });
28
+ }
29
+ exports.configureShadowMapRefreshRate = configureShadowMapRefreshRate;
30
+ //# sourceMappingURL=light.js.map
package/build/loader.js CHANGED
@@ -6,10 +6,14 @@ 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");
10
+ const light_1 = require("./light");
9
11
  require("./texture");
10
- async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, quality = "hight") {
12
+ async function loadScene(rootUrl, sceneFilename, scene, scriptsMap, quality = "high") {
11
13
  scene.loadingQuality = quality;
12
- await sceneLoader_1.SceneLoader.AppendAsync(rootUrl, sceneFilename, scene);
14
+ await sceneLoader_1.SceneLoader.AppendAsync(rootUrl, sceneFilename, scene, null, ".babylon");
15
+ (0, light_1.configureShadowMapRenderListPredicate)(scene);
16
+ (0, light_1.configureShadowMapRefreshRate)(scene);
13
17
  if (scene.metadata?.rendering) {
14
18
  const camera = scene.activeCamera ?? scene.cameras[0];
15
19
  if (scene.metadata.rendering.ssao2RenderingPipeline) {
@@ -46,6 +50,7 @@ function loadScriptsFor(scene, object, scriptsMap) {
46
50
  }
47
51
  if (exports.default) {
48
52
  const instance = new exports.default(object);
53
+ (0, apply_1.applyDecorators)(scene, object, instance);
49
54
  if (instance.onStart) {
50
55
  scene.onBeforeRenderObservable.addOnce(() => instance.onStart());
51
56
  }
@@ -62,37 +62,40 @@ function serializeDefaultRenderingPipeline() {
62
62
  }
63
63
  exports.serializeDefaultRenderingPipeline = serializeDefaultRenderingPipeline;
64
64
  function parseDefaultRenderingPipeline(scene, camera, data) {
65
- const defaultRenderingPipeline = createDefaultRenderingPipeline(scene, camera);
66
- defaultRenderingPipeline.samples = data.samples;
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
- defaultRenderingPipeline.bloomEnabled = data.bloomEnabled;
79
- defaultRenderingPipeline.bloomThreshold = data.bloomThreshold;
80
- defaultRenderingPipeline.bloomWeight = data.bloomWeight;
81
- defaultRenderingPipeline.bloomScale = data.bloomScale;
82
- defaultRenderingPipeline.bloomKernel = data.bloomKernel;
83
- defaultRenderingPipeline.sharpenEnabled = data.sharpenEnabled;
84
- defaultRenderingPipeline.sharpen.edgeAmount = data.sharpenEdgeAmount;
85
- defaultRenderingPipeline.sharpen.colorAmount = data.sharpenColorAmount;
86
- defaultRenderingPipeline.grainEnabled = data.grainEnabled;
87
- defaultRenderingPipeline.grain.intensity = data.grainIntensity;
88
- defaultRenderingPipeline.grain.animated = data.grainAnimated;
89
- defaultRenderingPipeline.depthOfFieldEnabled = data.depthOfFieldEnabled;
90
- defaultRenderingPipeline.depthOfFieldBlurLevel = data.depthOfFieldBlurLevel;
91
- defaultRenderingPipeline.depthOfField.lensSize = data.lensSize;
92
- defaultRenderingPipeline.depthOfField.fStop = data.fStop;
93
- defaultRenderingPipeline.depthOfField.focusDistance = data.focusDistance;
94
- defaultRenderingPipeline.depthOfField.focalLength = data.focalLength;
95
- return defaultRenderingPipeline;
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
- const motionBlurPostProcess = createMotionBlurPostProcess(scene, camera);
37
- motionBlurPostProcess.isObjectBased = data.isObjectBased;
38
- motionBlurPostProcess.motionStrength = data.motionStrength;
39
- motionBlurPostProcess.motionBlurSamples = data.motionBlurSamples;
40
- return motionBlurPostProcess;
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
@@ -41,20 +41,23 @@ function serializeSSAO2RenderingPipeline() {
41
41
  }
42
42
  exports.serializeSSAO2RenderingPipeline = serializeSSAO2RenderingPipeline;
43
43
  function parseSSAO2RenderingPipeline(scene, camera, data) {
44
- const ssao2RenderingPipeline = createSSAO2RenderingPipeline(scene, camera);
45
- ssao2RenderingPipeline.radius = data.radius;
46
- ssao2RenderingPipeline.totalStrength = data.totalStrength;
47
- ssao2RenderingPipeline.samples = data.samples;
48
- ssao2RenderingPipeline.maxZ = data.maxZ;
49
- ssao2RenderingPipeline.minZAspect = data.minZAspect;
50
- ssao2RenderingPipeline.epsilon = data.epsilon;
51
- ssao2RenderingPipeline.textureSamples = data.textureSamples;
52
- ssao2RenderingPipeline.bypassBlur = data.bypassBlur;
53
- ssao2RenderingPipeline.bilateralSamples = data.bilateralSamples;
54
- ssao2RenderingPipeline.bilateralSoften = data.bilateralSoften;
55
- ssao2RenderingPipeline.bilateralTolerance = data.bilateralTolerance;
56
- ssao2RenderingPipeline.expensiveBlur = data.expensiveBlur;
57
- return ssao2RenderingPipeline;
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
@@ -50,29 +50,32 @@ function serializeSSRRenderingPipeline() {
50
50
  }
51
51
  exports.serializeSSRRenderingPipeline = serializeSSRRenderingPipeline;
52
52
  function parseSSRRenderingPipeline(scene, camera, data) {
53
- const ssrRenderingPipeline = createSSRRenderingPipeline(scene, camera);
54
- ssrRenderingPipeline.samples = data.samples;
55
- ssrRenderingPipeline.step = data.step;
56
- ssrRenderingPipeline.thickness = data.thickness;
57
- ssrRenderingPipeline.strength = data.strength;
58
- ssrRenderingPipeline.reflectionSpecularFalloffExponent = data.reflectionSpecularFalloffExponent;
59
- ssrRenderingPipeline.maxSteps = data.maxSteps;
60
- ssrRenderingPipeline.maxDistance = data.maxDistance;
61
- ssrRenderingPipeline.roughnessFactor = data.roughnessFactor;
62
- ssrRenderingPipeline.reflectivityThreshold = data.reflectivityThreshold;
63
- ssrRenderingPipeline.blurDispersionStrength = data.blurDispersionStrehgth;
64
- ssrRenderingPipeline.clipToFrustum = data.clipToFrustum;
65
- ssrRenderingPipeline.enableSmoothReflections = data.enableSmoothReflections;
66
- ssrRenderingPipeline.enableAutomaticThicknessComputation = data.enableAutomaticThicknessComputation;
67
- ssrRenderingPipeline.attenuateFacingCamera = data.attenuateFacingCamera;
68
- ssrRenderingPipeline.attenuateScreenBorders = data.attenuateScreenBorders;
69
- ssrRenderingPipeline.attenuateIntersectionDistance = data.attenuateIntersectionDistance;
70
- ssrRenderingPipeline.attenuateBackfaceReflection = data.attenuateBackfaceReflection;
71
- ssrRenderingPipeline.blurDownsample = data.blurDownsample;
72
- ssrRenderingPipeline.selfCollisionNumSkip = data.selfCollisionNumSkip;
73
- ssrRenderingPipeline.ssrDownsample = data.ssrDownsample;
74
- ssrRenderingPipeline.backfaceDepthTextureDownsample = data.backfaceDepthTextureDownsample;
75
- return ssrRenderingPipeline;
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
@@ -7,7 +7,7 @@ const scalar_1 = require("./tools/scalar");
7
7
  */
8
8
  const textureParser = decorators_serialization_1.SerializationHelper._TextureParser;
9
9
  decorators_serialization_1.SerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {
10
- if (scene.loadingQuality === "hight" || !sourceProperty.metadata?.baseSize) {
10
+ if (scene.loadingQuality === "high" || !sourceProperty.metadata?.baseSize) {
11
11
  return textureParser(sourceProperty, scene, rootUrl);
12
12
  }
13
13
  const width = sourceProperty.metadata.baseSize.width;
@@ -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;
@@ -1,6 +1,6 @@
1
1
  export * from "./loader";
2
- export * from "./texture";
3
2
  export * from "./rendering/ssao";
4
3
  export * from "./rendering/ssr";
5
4
  export * from "./rendering/motion-blur";
6
5
  export * from "./rendering/default-pipeline";
6
+ export * from "./decorators/scene";
@@ -0,0 +1,3 @@
1
+ import { Scene } from "@babylonjs/core/scene";
2
+ export declare function configureShadowMapRenderListPredicate(scene: Scene): void;
3
+ export declare function configureShadowMapRefreshRate(scene: Scene): Promise<void>;
@@ -21,7 +21,7 @@ export type ScriptMap = Record<string, {
21
21
  * Using "medium" or "low" quality levels will reduce the memory usage and improve the performance of the scene
22
22
  * especially on mobiles where memory is limited.
23
23
  */
24
- export type SceneLoaderQualitySelector = "low" | "medium" | "hight";
24
+ export type SceneLoaderQualitySelector = "low" | "medium" | "high";
25
25
  declare module "@babylonjs/core/scene" {
26
26
  interface Scene {
27
27
  loadingQuality: SceneLoaderQualitySelector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-tools",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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": {
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDefaultRenderingPipeline = exports.serializeDefaultRenderingPipeline = exports.createDefaultRenderingPipeline = exports.disposeDefaultRenderingPipeline = exports.getDefaultRenderingPipeline = void 0;
4
- const defaultRenderingPipeline_1 = require("@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline");
5
- let defaultRenderingPipeline = null;
6
- /**
7
- * Returns the reference to the default rendering pipeline if exists.
8
- */
9
- function getDefaultRenderingPipeline() {
10
- return defaultRenderingPipeline;
11
- }
12
- exports.getDefaultRenderingPipeline = getDefaultRenderingPipeline;
13
- function disposeDefaultRenderingPipeline() {
14
- if (defaultRenderingPipeline) {
15
- defaultRenderingPipeline.dispose();
16
- defaultRenderingPipeline = null;
17
- }
18
- }
19
- exports.disposeDefaultRenderingPipeline = disposeDefaultRenderingPipeline;
20
- function createDefaultRenderingPipeline(scene, camera) {
21
- defaultRenderingPipeline = new defaultRenderingPipeline_1.DefaultRenderingPipeline("DefaultRenderingPipeline", true, scene, [camera]);
22
- defaultRenderingPipeline.samples = 4;
23
- defaultRenderingPipeline.depthOfField.lensSize = 512;
24
- defaultRenderingPipeline.depthOfField.fStop = 0.25;
25
- defaultRenderingPipeline.depthOfField.focusDistance = 55_000;
26
- return defaultRenderingPipeline;
27
- }
28
- exports.createDefaultRenderingPipeline = createDefaultRenderingPipeline;
29
- function serializeDefaultRenderingPipeline() {
30
- if (!defaultRenderingPipeline) {
31
- return null;
32
- }
33
- return {
34
- samples: defaultRenderingPipeline.samples,
35
- fxaaEnabled: defaultRenderingPipeline.fxaaEnabled,
36
- imageProcessingEnabled: defaultRenderingPipeline.imageProcessingEnabled,
37
- exposure: defaultRenderingPipeline.imageProcessing?.exposure,
38
- contrast: defaultRenderingPipeline.imageProcessing?.contrast,
39
- fromLinearSpace: defaultRenderingPipeline.imageProcessing?.fromLinearSpace,
40
- toneMappingEnabled: defaultRenderingPipeline.imageProcessing?.toneMappingEnabled,
41
- toneMappingType: defaultRenderingPipeline.imageProcessing?.toneMappingType,
42
- ditheringEnabled: defaultRenderingPipeline.imageProcessing?.ditheringEnabled,
43
- ditheringIntensity: defaultRenderingPipeline.imageProcessing?.ditheringIntensity,
44
- bloomEnabled: defaultRenderingPipeline.bloomEnabled,
45
- bloomThreshold: defaultRenderingPipeline.bloomThreshold,
46
- bloomWeight: defaultRenderingPipeline.bloomWeight,
47
- bloomScale: defaultRenderingPipeline.bloomScale,
48
- bloomKernel: defaultRenderingPipeline.bloomKernel,
49
- sharpenEnabled: defaultRenderingPipeline.sharpenEnabled,
50
- sharpenEdgeAmount: defaultRenderingPipeline.sharpen.edgeAmount,
51
- sharpenColorAmount: defaultRenderingPipeline.sharpen.colorAmount,
52
- grainEnabled: defaultRenderingPipeline.grainEnabled,
53
- grainIntensity: defaultRenderingPipeline.grain.intensity,
54
- grainAnimated: defaultRenderingPipeline.grain.animated,
55
- depthOfFieldEnabled: defaultRenderingPipeline.depthOfFieldEnabled,
56
- depthOfFieldBlurLevel: defaultRenderingPipeline.depthOfFieldBlurLevel,
57
- lensSize: defaultRenderingPipeline.depthOfField.lensSize,
58
- fStop: defaultRenderingPipeline.depthOfField.fStop,
59
- focusDistance: defaultRenderingPipeline.depthOfField.focusDistance,
60
- focalLength: defaultRenderingPipeline.depthOfField.focalLength,
61
- };
62
- }
63
- exports.serializeDefaultRenderingPipeline = serializeDefaultRenderingPipeline;
64
- function parseDefaultRenderingPipeline(scene, camera, data) {
65
- const defaultRenderingPipeline = createDefaultRenderingPipeline(scene, camera);
66
- defaultRenderingPipeline.samples = data.samples;
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;
77
- }
78
- defaultRenderingPipeline.bloomEnabled = data.bloomEnabled;
79
- defaultRenderingPipeline.bloomThreshold = data.bloomThreshold;
80
- defaultRenderingPipeline.bloomWeight = data.bloomWeight;
81
- defaultRenderingPipeline.bloomScale = data.bloomScale;
82
- defaultRenderingPipeline.bloomKernel = data.bloomKernel;
83
- defaultRenderingPipeline.sharpenEnabled = data.sharpenEnabled;
84
- defaultRenderingPipeline.sharpen.edgeAmount = data.sharpenEdgeAmount;
85
- defaultRenderingPipeline.sharpen.colorAmount = data.sharpenColorAmount;
86
- defaultRenderingPipeline.grainEnabled = data.grainEnabled;
87
- defaultRenderingPipeline.grain.intensity = data.grainIntensity;
88
- defaultRenderingPipeline.grain.animated = data.grainAnimated;
89
- defaultRenderingPipeline.depthOfFieldEnabled = data.depthOfFieldEnabled;
90
- defaultRenderingPipeline.depthOfFieldBlurLevel = data.depthOfFieldBlurLevel;
91
- defaultRenderingPipeline.depthOfField.lensSize = data.lensSize;
92
- defaultRenderingPipeline.depthOfField.fStop = data.fStop;
93
- defaultRenderingPipeline.depthOfField.focusDistance = data.focusDistance;
94
- defaultRenderingPipeline.depthOfField.focalLength = data.focalLength;
95
- return defaultRenderingPipeline;
96
- }
97
- exports.parseDefaultRenderingPipeline = parseDefaultRenderingPipeline;
98
- //# sourceMappingURL=default.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=math.js.map
@@ -1,11 +0,0 @@
1
- import { Scene } from "@babylonjs/core/scene";
2
- import { Camera } from "@babylonjs/core/Cameras/camera";
3
- import { DefaultRenderingPipeline } from "@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline";
4
- /**
5
- * Returns the reference to the default rendering pipeline if exists.
6
- */
7
- export declare function getDefaultRenderingPipeline(): DefaultRenderingPipeline | null;
8
- export declare function disposeDefaultRenderingPipeline(): void;
9
- export declare function createDefaultRenderingPipeline(scene: Scene, camera: Camera): DefaultRenderingPipeline;
10
- export declare function serializeDefaultRenderingPipeline(): any;
11
- export declare function parseDefaultRenderingPipeline(scene: Scene, camera: Camera, data: any): DefaultRenderingPipeline;
File without changes