@babylonjs/core 7.52.3 → 7.53.1
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/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +0 -3
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +9 -6
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +10 -5
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +2 -2
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +3 -3
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +7 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +3 -12
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -36
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +5 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +17 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +3 -11
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +5 -14
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +1 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +18 -17
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +10 -1
- package/FlowGraph/flowGraphDataConnection.js +23 -13
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +5 -0
- package/FlowGraph/flowGraphRichTypes.js +12 -0
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js +48 -0
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +3 -3
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +6 -6
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.d.ts +38 -0
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +88 -0
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +7 -7
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +7 -7
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +2 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +3 -3
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +12 -12
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +21 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +27 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +5 -5
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +23 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +5 -5
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +8 -8
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +9 -9
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +7 -7
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -3
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +3 -3
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +8 -8
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +3 -3
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +3 -3
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +2 -2
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +5 -5
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/materialDefines.js +1 -1
- package/Materials/materialDefines.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +6 -0
- package/Meshes/Builders/shapeBuilder.js +7 -4
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/PostProcesses/anaglyphPostProcess.d.ts +0 -1
- package/PostProcesses/anaglyphPostProcess.js +14 -11
- package/PostProcesses/anaglyphPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.d.ts +15 -8
- package/PostProcesses/chromaticAberrationPostProcess.js +72 -42
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +2 -0
- package/PostProcesses/index.js +2 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +5 -0
- package/PostProcesses/postProcess.js +10 -2
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinAnaglyphPostProcess.d.ts +23 -0
- package/PostProcesses/thinAnaglyphPostProcess.js +42 -0
- package/PostProcesses/thinAnaglyphPostProcess.js.map +1 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.d.ts +45 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.js +69 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -0
- package/package.json +1 -1
|
@@ -79,7 +79,7 @@ export class MaterialDefines {
|
|
|
79
79
|
this._areLightsDirty = true;
|
|
80
80
|
this._areFresnelDirty = true;
|
|
81
81
|
this._areMiscDirty = true;
|
|
82
|
-
this._arePrePassDirty =
|
|
82
|
+
this._arePrePassDirty = true;
|
|
83
83
|
this._areImageProcessingDirty = true;
|
|
84
84
|
this._isDirty = true;
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialDefines.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/materialDefines.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,eAAe;IAsCxB;;;OAGG;IACH,YAAY,kBAAuE;QAzCnF,gBAAgB;QACN,UAAK,GAAa,EAAE,CAAC;QACvB,aAAQ,GAAG,IAAI,CAAC;QAIxB,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,uBAAkB,GAAG,KAAK,CAAC;QAClC,gBAAgB;QACT,wBAAmB,GAAG,IAAI,CAAC;QAClC,gBAAgB;QACT,sBAAiB,GAAG,IAAI,CAAC;QAChC,gBAAgB;QACT,qBAAgB,GAAG,IAAI,CAAC;QAC/B,gBAAgB;QACT,kBAAa,GAAG,IAAI,CAAC;QAC5B,gBAAgB;QACT,qBAAgB,GAAG,IAAI,CAAC;QAC/B,gBAAgB;QACT,6BAAwB,GAAG,IAAI,CAAC;QAEvC,gBAAgB;QACT,aAAQ,GAAG,KAAK,CAAC;QACxB,gBAAgB;QACT,SAAI,GAAG,KAAK,CAAC;QAEpB,gBAAgB;QACT,iBAAY,GAAG,KAAK,CAAC;QAC5B,gBAAgB;QACT,aAAQ,GAAG,KAAK,CAAC;QAWpB,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAE9C,iCAAiC;QACjC,IAAI,kBAAkB,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;gBACpC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC;oBACjE,IAAI,CAAC,gBAAgB,CAAC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,GAAG,IAAI,GAAG,IAAI,CAAC;oBACvC,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["/**\r\n * Manages the defines for the Material\r\n */\r\nexport class MaterialDefines {\r\n /** @internal */\r\n protected _keys: string[] = [];\r\n private _isDirty = true;\r\n /** @internal */\r\n public _renderId: number;\r\n\r\n /** @internal */\r\n public _areLightsDirty = true;\r\n /** @internal */\r\n public _areLightsDisposed = false;\r\n /** @internal */\r\n public _areAttributesDirty = true;\r\n /** @internal */\r\n public _areTexturesDirty = true;\r\n /** @internal */\r\n public _areFresnelDirty = true;\r\n /** @internal */\r\n public _areMiscDirty = true;\r\n /** @internal */\r\n public _arePrePassDirty = true;\r\n /** @internal */\r\n public _areImageProcessingDirty = true;\r\n\r\n /** @internal */\r\n public _normals = false;\r\n /** @internal */\r\n public _uvs = false;\r\n\r\n /** @internal */\r\n public _needNormals = false;\r\n /** @internal */\r\n public _needUVs = false;\r\n\r\n protected _externalProperties?: { [name: string]: { type: string; default: any } };\r\n\r\n [id: string]: any;\r\n\r\n /**\r\n * Creates a new instance\r\n * @param externalProperties list of external properties to inject into the object\r\n */\r\n constructor(externalProperties?: { [name: string]: { type: string; default: any } }) {\r\n this._externalProperties = externalProperties;\r\n\r\n // Initialize External Properties\r\n if (externalProperties) {\r\n for (const prop in externalProperties) {\r\n if (Object.prototype.hasOwnProperty.call(externalProperties, prop)) {\r\n this._setDefaultValue(prop);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n public get isDirty(): boolean {\r\n return this._isDirty;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n public markAsProcessed() {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._arePrePassDirty = false;\r\n this._areImageProcessingDirty = false;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n public markAsUnprocessed() {\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n public markAllAsDirty() {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._arePrePassDirty = false;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n public markAsImageProcessingDirty() {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n public markAsLightDirty(disposed = false) {\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n public markAsAttributesDirty() {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n public markAsTexturesDirty() {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n public markAsFresnelDirty() {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n public markAsMiscDirty() {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the prepass state as changed\r\n */\r\n public markAsPrePassDirty() {\r\n this._arePrePassDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n public rebuild() {\r\n this._keys.length = 0;\r\n\r\n for (const key of Object.keys(this)) {\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n\r\n this._keys.push(key);\r\n }\r\n\r\n if (this._externalProperties) {\r\n for (const name in this._externalProperties) {\r\n if (this._keys.indexOf(name) === -1) {\r\n this._keys.push(name);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n public isEqual(other: MaterialDefines): boolean {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n\r\n if ((<any>this)[prop] !== (<any>other)[prop]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n public cloneTo(other: MaterialDefines): void {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n\r\n (<any>other)[prop] = (<any>this)[prop];\r\n }\r\n }\r\n\r\n /**\r\n * Resets the material define values\r\n */\r\n public reset(): void {\r\n this._keys.forEach((prop) => this._setDefaultValue(prop));\r\n }\r\n\r\n private _setDefaultValue(prop: string): void {\r\n const type = this._externalProperties?.[prop]?.type ?? typeof (<any>this)[prop];\r\n const defValue = this._externalProperties?.[prop]?.default;\r\n\r\n switch (type) {\r\n case \"number\":\r\n (<any>this)[prop] = defValue ?? 0;\r\n break;\r\n case \"string\":\r\n (<any>this)[prop] = defValue ?? \"\";\r\n break;\r\n default:\r\n (<any>this)[prop] = defValue ?? false;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n public toString(): string {\r\n let result = \"\";\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n const value = (<any>this)[prop];\r\n const type = typeof value;\r\n\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"materialDefines.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/materialDefines.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,eAAe;IAsCxB;;;OAGG;IACH,YAAY,kBAAuE;QAzCnF,gBAAgB;QACN,UAAK,GAAa,EAAE,CAAC;QACvB,aAAQ,GAAG,IAAI,CAAC;QAIxB,gBAAgB;QACT,oBAAe,GAAG,IAAI,CAAC;QAC9B,gBAAgB;QACT,uBAAkB,GAAG,KAAK,CAAC;QAClC,gBAAgB;QACT,wBAAmB,GAAG,IAAI,CAAC;QAClC,gBAAgB;QACT,sBAAiB,GAAG,IAAI,CAAC;QAChC,gBAAgB;QACT,qBAAgB,GAAG,IAAI,CAAC;QAC/B,gBAAgB;QACT,kBAAa,GAAG,IAAI,CAAC;QAC5B,gBAAgB;QACT,qBAAgB,GAAG,IAAI,CAAC;QAC/B,gBAAgB;QACT,6BAAwB,GAAG,IAAI,CAAC;QAEvC,gBAAgB;QACT,aAAQ,GAAG,KAAK,CAAC;QACxB,gBAAgB;QACT,SAAI,GAAG,KAAK,CAAC;QAEpB,gBAAgB;QACT,iBAAY,GAAG,KAAK,CAAC;QAC5B,gBAAgB;QACT,aAAQ,GAAG,KAAK,CAAC;QAWpB,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAE9C,iCAAiC;QACjC,IAAI,kBAAkB,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;gBACpC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI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CAAC;oBACjD,MAAM;gBACV;oBACI,IAAI,KAAK,EAAE,CAAC;wBACR,MAAM,IAAI,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;oBACvC,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["/**\r\n * Manages the defines for the Material\r\n */\r\nexport class MaterialDefines {\r\n /** @internal */\r\n protected _keys: string[] = [];\r\n private _isDirty = true;\r\n /** @internal */\r\n public _renderId: number;\r\n\r\n /** @internal */\r\n public _areLightsDirty = true;\r\n /** @internal */\r\n public _areLightsDisposed = false;\r\n /** @internal */\r\n public _areAttributesDirty = true;\r\n /** @internal */\r\n public _areTexturesDirty = true;\r\n /** @internal */\r\n public _areFresnelDirty = true;\r\n /** @internal */\r\n public _areMiscDirty = true;\r\n /** @internal */\r\n public _arePrePassDirty = true;\r\n /** @internal */\r\n public _areImageProcessingDirty = true;\r\n\r\n /** @internal */\r\n public _normals = false;\r\n /** @internal */\r\n public _uvs = false;\r\n\r\n /** @internal */\r\n public _needNormals = false;\r\n /** @internal */\r\n public _needUVs = false;\r\n\r\n protected _externalProperties?: { [name: string]: { type: string; default: any } };\r\n\r\n [id: string]: any;\r\n\r\n /**\r\n * Creates a new instance\r\n * @param externalProperties list of external properties to inject into the object\r\n */\r\n constructor(externalProperties?: { [name: string]: { type: string; default: any } }) {\r\n this._externalProperties = externalProperties;\r\n\r\n // Initialize External Properties\r\n if (externalProperties) {\r\n for (const prop in externalProperties) {\r\n if (Object.prototype.hasOwnProperty.call(externalProperties, prop)) {\r\n this._setDefaultValue(prop);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if the material needs to be re-calculated\r\n */\r\n public get isDirty(): boolean {\r\n return this._isDirty;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that it has been re-calculated\r\n */\r\n public markAsProcessed() {\r\n this._isDirty = false;\r\n this._areAttributesDirty = false;\r\n this._areTexturesDirty = false;\r\n this._areFresnelDirty = false;\r\n this._areLightsDirty = false;\r\n this._areLightsDisposed = false;\r\n this._areMiscDirty = false;\r\n this._arePrePassDirty = false;\r\n this._areImageProcessingDirty = false;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that it needs to be re-calculated\r\n */\r\n public markAsUnprocessed() {\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate all of its defines need to be re-calculated\r\n */\r\n public markAllAsDirty() {\r\n this._areTexturesDirty = true;\r\n this._areAttributesDirty = true;\r\n this._areLightsDirty = true;\r\n this._areFresnelDirty = true;\r\n this._areMiscDirty = true;\r\n this._arePrePassDirty = true;\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate that image processing needs to be re-calculated\r\n */\r\n public markAsImageProcessingDirty() {\r\n this._areImageProcessingDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the material to indicate the lights need to be re-calculated\r\n * @param disposed Defines whether the light is dirty due to dispose or not\r\n */\r\n public markAsLightDirty(disposed = false) {\r\n this._areLightsDirty = true;\r\n this._areLightsDisposed = this._areLightsDisposed || disposed;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the attribute state as changed\r\n */\r\n public markAsAttributesDirty() {\r\n this._areAttributesDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the texture state as changed\r\n */\r\n public markAsTexturesDirty() {\r\n this._areTexturesDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the fresnel state as changed\r\n */\r\n public markAsFresnelDirty() {\r\n this._areFresnelDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the misc state as changed\r\n */\r\n public markAsMiscDirty() {\r\n this._areMiscDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Marks the prepass state as changed\r\n */\r\n public markAsPrePassDirty() {\r\n this._arePrePassDirty = true;\r\n this._isDirty = true;\r\n }\r\n\r\n /**\r\n * Rebuilds the material defines\r\n */\r\n public rebuild() {\r\n this._keys.length = 0;\r\n\r\n for (const key of Object.keys(this)) {\r\n if (key[0] === \"_\") {\r\n continue;\r\n }\r\n\r\n this._keys.push(key);\r\n }\r\n\r\n if (this._externalProperties) {\r\n for (const name in this._externalProperties) {\r\n if (this._keys.indexOf(name) === -1) {\r\n this._keys.push(name);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if two material defines are equal\r\n * @param other - A material define instance to compare to\r\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\r\n */\r\n public isEqual(other: MaterialDefines): boolean {\r\n if (this._keys.length !== other._keys.length) {\r\n return false;\r\n }\r\n\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n\r\n if ((<any>this)[prop] !== (<any>other)[prop]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Clones this instance's defines to another instance\r\n * @param other - material defines to clone values to\r\n */\r\n public cloneTo(other: MaterialDefines): void {\r\n if (this._keys.length !== other._keys.length) {\r\n other._keys = this._keys.slice(0);\r\n }\r\n\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n\r\n (<any>other)[prop] = (<any>this)[prop];\r\n }\r\n }\r\n\r\n /**\r\n * Resets the material define values\r\n */\r\n public reset(): void {\r\n this._keys.forEach((prop) => this._setDefaultValue(prop));\r\n }\r\n\r\n private _setDefaultValue(prop: string): void {\r\n const type = this._externalProperties?.[prop]?.type ?? typeof (<any>this)[prop];\r\n const defValue = this._externalProperties?.[prop]?.default;\r\n\r\n switch (type) {\r\n case \"number\":\r\n (<any>this)[prop] = defValue ?? 0;\r\n break;\r\n case \"string\":\r\n (<any>this)[prop] = defValue ?? \"\";\r\n break;\r\n default:\r\n (<any>this)[prop] = defValue ?? false;\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Converts the material define values to a string\r\n * @returns - String of material define information\r\n */\r\n public toString(): string {\r\n let result = \"\";\r\n for (let index = 0; index < this._keys.length; index++) {\r\n const prop = this._keys[index];\r\n const value = (<any>this)[prop];\r\n const type = typeof value;\r\n\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n result += \"#define \" + prop + \" \" + value + \"\\n\";\r\n break;\r\n default:\r\n if (value) {\r\n result += \"#define \" + prop + \"\\n\";\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -43,6 +43,9 @@ export declare function ExtrudeShape(name: string, options: {
|
|
|
43
43
|
invertUV?: boolean;
|
|
44
44
|
firstNormal?: Vector3;
|
|
45
45
|
adjustFrame?: boolean;
|
|
46
|
+
capFunction?: Nullable<{
|
|
47
|
+
(shapePath: Vector3[]): Vector3[];
|
|
48
|
+
}>;
|
|
46
49
|
}, scene?: Nullable<Scene>): Mesh;
|
|
47
50
|
/**
|
|
48
51
|
* Creates an custom extruded shape mesh.
|
|
@@ -96,6 +99,9 @@ export declare function ExtrudeShapeCustom(name: string, options: {
|
|
|
96
99
|
invertUV?: boolean;
|
|
97
100
|
firstNormal?: Vector3;
|
|
98
101
|
adjustFrame?: boolean;
|
|
102
|
+
capFunction?: Nullable<{
|
|
103
|
+
(shapePath: Vector3[]): Vector3[];
|
|
104
|
+
}>;
|
|
99
105
|
}, scene?: Nullable<Scene>): Mesh;
|
|
100
106
|
/**
|
|
101
107
|
* Class containing static functions to help procedurally build meshes
|
|
@@ -38,7 +38,8 @@ export function ExtrudeShape(name, options, scene = null) {
|
|
|
38
38
|
const invertUV = options.invertUV || false;
|
|
39
39
|
const closeShape = options.closeShape || false;
|
|
40
40
|
const closePath = options.closePath || false;
|
|
41
|
-
|
|
41
|
+
const capFunction = options.capFunction || null;
|
|
42
|
+
return _ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, closePath, closeShape, cap, false, scene, updatable ? true : false, sideOrientation, instance, invertUV, options.frontUVs || null, options.backUVs || null, options.firstNormal || null, options.adjustFrame ? true : false, capFunction);
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Creates an custom extruded shape mesh.
|
|
@@ -90,9 +91,10 @@ export function ExtrudeShapeCustom(name, options, scene = null) {
|
|
|
90
91
|
const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);
|
|
91
92
|
const instance = options.instance;
|
|
92
93
|
const invertUV = options.invertUV || false;
|
|
93
|
-
|
|
94
|
+
const capFunction = options.capFunction || null;
|
|
95
|
+
return _ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable ? true : false, sideOrientation, instance || null, invertUV, options.frontUVs || null, options.backUVs || null, firstNormal, adjustFrame, capFunction || null);
|
|
94
96
|
}
|
|
95
|
-
function _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV, frontUVs, backUVs, firstNormal, adjustFrame) {
|
|
97
|
+
function _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV, frontUVs, backUVs, firstNormal, adjustFrame, capFunction) {
|
|
96
98
|
// extrusion geometry
|
|
97
99
|
const extrusionPathArray = (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame) => {
|
|
98
100
|
const tangents = path3D.getTangents();
|
|
@@ -155,7 +157,7 @@ function _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction
|
|
|
155
157
|
index++;
|
|
156
158
|
}
|
|
157
159
|
// cap
|
|
158
|
-
const
|
|
160
|
+
const defaultCapPath = (shapePath) => {
|
|
159
161
|
const pointCap = Array();
|
|
160
162
|
const barycenter = Vector3.Zero();
|
|
161
163
|
let i;
|
|
@@ -168,6 +170,7 @@ function _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction
|
|
|
168
170
|
}
|
|
169
171
|
return pointCap;
|
|
170
172
|
};
|
|
173
|
+
const capPath = capFunction || defaultCapPath;
|
|
171
174
|
switch (cap) {
|
|
172
175
|
case Mesh.NO_CAP:
|
|
173
176
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/shapeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CACxB,IAAY,EACZ,OAgBC,EACD,QAAyB,IAAI;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC;IAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACpC,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KA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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM;QACvC,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. Consider using this for any path that is straight, and particular for paths in the xy plane.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShape(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scale?: number;\r\n rotation?: number;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scale = options.scale || 1;\r\n const rotation = options.rotation || 0;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance || null;\r\n const invertUV = options.invertUV || false;\r\n const closeShape = options.closeShape || false;\r\n const closePath = options.closePath || false;\r\n\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n scale,\r\n rotation,\r\n null,\r\n null,\r\n closePath,\r\n closeShape,\r\n cap,\r\n false,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n options.firstNormal || null,\r\n options.adjustFrame ? true : false\r\n );\r\n}\r\n\r\n/**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray` - depreciated in favor of closeShape\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray` - depreciated in favor of closePath\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. It should be supplied when the path is in the xy plane, and particularly if these sections are straight, because the underlying Path3D object will pick a normal in the xy plane that causes the extrusion to be collapsed into the plane. This should be used for any path that is straight.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShapeCustom(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scaleFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n rotationFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n ribbonCloseArray?: boolean;\r\n ribbonClosePath?: boolean;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scaleFunction =\r\n options.scaleFunction ||\r\n (() => {\r\n return 1;\r\n });\r\n const rotationFunction =\r\n options.rotationFunction ||\r\n (() => {\r\n return 0;\r\n });\r\n const ribbonCloseArray = options.closePath || options.ribbonCloseArray || false;\r\n const ribbonClosePath = options.closeShape || options.ribbonClosePath || false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const firstNormal = options.firstNormal || null;\r\n const adjustFrame = options.adjustFrame || false;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const invertUV = options.invertUV || false;\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n null,\r\n null,\r\n scaleFunction,\r\n rotationFunction,\r\n ribbonCloseArray,\r\n ribbonClosePath,\r\n cap,\r\n true,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance || null,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n firstNormal,\r\n adjustFrame\r\n );\r\n}\r\n\r\nfunction _ExtrudeShapeGeneric(\r\n name: string,\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rbCA: boolean,\r\n rbCP: boolean,\r\n cap: number,\r\n custom: boolean,\r\n scene: Nullable<Scene>,\r\n updtbl: boolean,\r\n side: number,\r\n instance: Nullable<Mesh>,\r\n invertUV: boolean,\r\n frontUVs: Nullable<Vector4>,\r\n backUVs: Nullable<Vector4>,\r\n firstNormal: Nullable<Vector3>,\r\n adjustFrame: boolean\r\n): Mesh {\r\n // extrusion geometry\r\n const extrusionPathArray = (\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n path3D: Path3D,\r\n shapePaths: Vector3[][],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n custom: boolean,\r\n adjustFrame: boolean\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const binormals = path3D.getBinormals();\r\n const distances = path3D.getDistances();\r\n if (adjustFrame) {\r\n /* fix tangents,normals, binormals */\r\n for (let i = 0; i < tangents.length; i++) {\r\n if (tangents[i].x == 0 && tangents[i].y == 0 && tangents[i].z == 0) {\r\n tangents[i].copyFrom(tangents[i - 1]);\r\n }\r\n if (normals[i].x == 0 && normals[i].y == 0 && normals[i].z == 0) {\r\n normals[i].copyFrom(normals[i - 1]);\r\n }\r\n if (binormals[i].x == 0 && binormals[i].y == 0 && binormals[i].z == 0) {\r\n binormals[i].copyFrom(binormals[i - 1]);\r\n }\r\n if (i > 0) {\r\n let v = tangents[i - 1];\r\n if (Vector3.Dot(v, tangents[i]) < 0) {\r\n tangents[i].scaleInPlace(-1);\r\n }\r\n v = normals[i - 1];\r\n if (Vector3.Dot(v, normals[i]) < 0) {\r\n normals[i].scaleInPlace(-1);\r\n }\r\n v = binormals[i - 1];\r\n if (Vector3.Dot(v, binormals[i]) < 0) {\r\n binormals[i].scaleInPlace(-1);\r\n }\r\n }\r\n }\r\n }\r\n let angle = 0;\r\n const returnScale = () => {\r\n return scale !== null ? scale : 1;\r\n };\r\n const returnRotation = () => {\r\n return rotation !== null ? rotation : 0;\r\n };\r\n const rotate: { (i: number, distance: number): number } = custom && rotateFunction ? rotateFunction : returnRotation;\r\n const scl: { (i: number, distance: number): number } = custom && scaleFunction ? scaleFunction : returnScale;\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n\r\n for (let i = 0; i < curve.length; i++) {\r\n const shapePath: Vector3[] = [];\r\n const angleStep = rotate(i, distances[i]);\r\n const scaleRatio = scl(i, distances[i]);\r\n Matrix.RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n for (let p = 0; p < shape.length; p++) {\r\n const planed = tangents[i].scale(shape[p].z).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y));\r\n const rotated = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n const capPath = (shapePath: Vector3[]) => {\r\n const pointCap = Array<Vector3>();\r\n const barycenter = Vector3.Zero();\r\n let i: number;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case Mesh.CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case Mesh.CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // instance update\r\n const storage = instance._creationDataStorage!;\r\n path3D = firstNormal ? storage.path3D.update(curve, firstNormal) : storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom, adjustFrame);\r\n instance = CreateRibbon(\"\", { pathArray, closeArray: false, closePath: false, offset: 0, updatable: false, sideOrientation: 0, instance }, scene || undefined);\r\n\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);\r\n const newShapePaths = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame);\r\n const extrudedGeneric = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: rbCA,\r\n closePath: rbCP,\r\n updatable: updtbl,\r\n sideOrientation: side,\r\n invertUV: invertUV,\r\n frontUVs: frontUVs || undefined,\r\n backUVs: backUVs || undefined,\r\n },\r\n scene\r\n );\r\n extrudedGeneric._creationDataStorage!.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage!.path3D = path3D;\r\n extrudedGeneric._creationDataStorage!.cap = cap;\r\n\r\n return extrudedGeneric;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use the functions directly from the module\r\n */\r\nexport const ShapeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShape,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShapeCustom,\r\n};\r\n\r\nMesh.ExtrudeShape = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene> = null,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShape(name, options, scene);\r\n};\r\n\r\nMesh.ExtrudeShapeCustom = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShapeCustom(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"shapeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/shapeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAC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X,QAAyB,IAAI,EAC7B,SAAmB,EACnB,eAAwB,EACxB,QAAe,EACX,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,QAAQ;QAClB,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM;QACvC,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,IAAI,CAAC,kBAAkB,GAAG,CACtB,IAAY,EACZ,KAAgB,EAChB,IAAe,EACf,aAAkE,EAClE,gBAAqE,EACrE,gBAAyB,EACzB,eAAwB,EACxB,GAAW,EACX,KAAY,EACZ,SAAmB,EACnB,eAAwB,EACxB,QAAe,EACX,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,aAAa;QAC5B,gBAAgB,EAAE,gBAAgB;QAClC,gBAAgB,EAAE,gBAAgB;QAClC,eAAe,EAAE,eAAe;QAChC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM;QACvC,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,SAAS;KACvB,CAAC;IAEF,OAAO,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\r\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. Consider using this for any path that is straight, and particular for paths in the xy plane.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShape(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scale?: number;\r\n rotation?: number;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n capFunction?: Nullable<{ (shapePath: Vector3[]): Vector3[] }>;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scale = options.scale || 1;\r\n const rotation = options.rotation || 0;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance || null;\r\n const invertUV = options.invertUV || false;\r\n const closeShape = options.closeShape || false;\r\n const closePath = options.closePath || false;\r\n const capFunction = options.capFunction || null;\r\n\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n scale,\r\n rotation,\r\n null,\r\n null,\r\n closePath,\r\n closeShape,\r\n cap,\r\n false,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n options.firstNormal || null,\r\n options.adjustFrame ? true : false,\r\n capFunction\r\n );\r\n}\r\n\r\n/**\r\n * Creates an custom extruded shape mesh.\r\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\r\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\r\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\r\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\r\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\r\n * * It must returns a float value that will be the scale value applied to the shape on each path point\r\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\r\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\r\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray` - depreciated in favor of closeShape\r\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray` - depreciated in favor of closePath\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\r\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. It should be supplied when the path is in the xy plane, and particularly if these sections are straight, because the underlying Path3D object will pick a normal in the xy plane that causes the extrusion to be collapsed into the plane. This should be used for any path that is straight.\r\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the custom extruded shape mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\r\n */\r\nexport function ExtrudeShapeCustom(\r\n name: string,\r\n options: {\r\n shape: Vector3[];\r\n path: Vector3[];\r\n scaleFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n rotationFunction?: Nullable<{ (i: number, distance: number): number }>;\r\n ribbonCloseArray?: boolean;\r\n ribbonClosePath?: boolean;\r\n closeShape?: boolean;\r\n closePath?: boolean;\r\n cap?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n firstNormal?: Vector3;\r\n adjustFrame?: boolean;\r\n capFunction?: Nullable<{ (shapePath: Vector3[]): Vector3[] }>;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n const shape = options.shape;\r\n const scaleFunction =\r\n options.scaleFunction ||\r\n (() => {\r\n return 1;\r\n });\r\n const rotationFunction =\r\n options.rotationFunction ||\r\n (() => {\r\n return 0;\r\n });\r\n const ribbonCloseArray = options.closePath || options.ribbonCloseArray || false;\r\n const ribbonClosePath = options.closeShape || options.ribbonClosePath || false;\r\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\r\n const updatable = options.updatable;\r\n const firstNormal = options.firstNormal || null;\r\n const adjustFrame = options.adjustFrame || false;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n const instance = options.instance;\r\n const invertUV = options.invertUV || false;\r\n const capFunction = options.capFunction || null;\r\n return _ExtrudeShapeGeneric(\r\n name,\r\n shape,\r\n path,\r\n null,\r\n null,\r\n scaleFunction,\r\n rotationFunction,\r\n ribbonCloseArray,\r\n ribbonClosePath,\r\n cap,\r\n true,\r\n scene,\r\n updatable ? true : false,\r\n sideOrientation,\r\n instance || null,\r\n invertUV,\r\n options.frontUVs || null,\r\n options.backUVs || null,\r\n firstNormal,\r\n adjustFrame,\r\n capFunction || null\r\n );\r\n}\r\n\r\nfunction _ExtrudeShapeGeneric(\r\n name: string,\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rbCA: boolean,\r\n rbCP: boolean,\r\n cap: number,\r\n custom: boolean,\r\n scene: Nullable<Scene>,\r\n updtbl: boolean,\r\n side: number,\r\n instance: Nullable<Mesh>,\r\n invertUV: boolean,\r\n frontUVs: Nullable<Vector4>,\r\n backUVs: Nullable<Vector4>,\r\n firstNormal: Nullable<Vector3>,\r\n adjustFrame: boolean,\r\n capFunction: Nullable<{ (shapePath: Vector3[]): Vector3[] }>\r\n): Mesh {\r\n // extrusion geometry\r\n const extrusionPathArray = (\r\n shape: Vector3[],\r\n curve: Vector3[],\r\n path3D: Path3D,\r\n shapePaths: Vector3[][],\r\n scale: Nullable<number>,\r\n rotation: Nullable<number>,\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotateFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n custom: boolean,\r\n adjustFrame: boolean\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const binormals = path3D.getBinormals();\r\n const distances = path3D.getDistances();\r\n if (adjustFrame) {\r\n /* fix tangents,normals, binormals */\r\n for (let i = 0; i < tangents.length; i++) {\r\n if (tangents[i].x == 0 && tangents[i].y == 0 && tangents[i].z == 0) {\r\n tangents[i].copyFrom(tangents[i - 1]);\r\n }\r\n if (normals[i].x == 0 && normals[i].y == 0 && normals[i].z == 0) {\r\n normals[i].copyFrom(normals[i - 1]);\r\n }\r\n if (binormals[i].x == 0 && binormals[i].y == 0 && binormals[i].z == 0) {\r\n binormals[i].copyFrom(binormals[i - 1]);\r\n }\r\n if (i > 0) {\r\n let v = tangents[i - 1];\r\n if (Vector3.Dot(v, tangents[i]) < 0) {\r\n tangents[i].scaleInPlace(-1);\r\n }\r\n v = normals[i - 1];\r\n if (Vector3.Dot(v, normals[i]) < 0) {\r\n normals[i].scaleInPlace(-1);\r\n }\r\n v = binormals[i - 1];\r\n if (Vector3.Dot(v, binormals[i]) < 0) {\r\n binormals[i].scaleInPlace(-1);\r\n }\r\n }\r\n }\r\n }\r\n let angle = 0;\r\n const returnScale = () => {\r\n return scale !== null ? scale : 1;\r\n };\r\n const returnRotation = () => {\r\n return rotation !== null ? rotation : 0;\r\n };\r\n const rotate: { (i: number, distance: number): number } = custom && rotateFunction ? rotateFunction : returnRotation;\r\n const scl: { (i: number, distance: number): number } = custom && scaleFunction ? scaleFunction : returnScale;\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n\r\n for (let i = 0; i < curve.length; i++) {\r\n const shapePath: Vector3[] = [];\r\n const angleStep = rotate(i, distances[i]);\r\n const scaleRatio = scl(i, distances[i]);\r\n Matrix.RotationAxisToRef(tangents[i], angle, rotationMatrix);\r\n for (let p = 0; p < shape.length; p++) {\r\n const planed = tangents[i].scale(shape[p].z).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y));\r\n const rotated = Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(planed, rotationMatrix, rotated);\r\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\r\n shapePath[p] = rotated;\r\n }\r\n shapePaths[index] = shapePath;\r\n angle += angleStep;\r\n index++;\r\n }\r\n // cap\r\n const defaultCapPath = (shapePath: Vector3[]) => {\r\n const pointCap = Array<Vector3>();\r\n const barycenter = Vector3.Zero();\r\n let i: number;\r\n for (i = 0; i < shapePath.length; i++) {\r\n barycenter.addInPlace(shapePath[i]);\r\n }\r\n barycenter.scaleInPlace(1.0 / shapePath.length);\r\n for (i = 0; i < shapePath.length; i++) {\r\n pointCap.push(barycenter);\r\n }\r\n return pointCap;\r\n };\r\n const capPath = capFunction || defaultCapPath;\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n break;\r\n case Mesh.CAP_END:\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n case Mesh.CAP_ALL:\r\n shapePaths[0] = capPath(shapePaths[2]);\r\n shapePaths[1] = shapePaths[2];\r\n shapePaths[index] = shapePaths[index - 1];\r\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\r\n break;\r\n default:\r\n break;\r\n }\r\n return shapePaths;\r\n };\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // instance update\r\n const storage = instance._creationDataStorage!;\r\n path3D = firstNormal ? storage.path3D.update(curve, firstNormal) : storage.path3D.update(curve);\r\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom, adjustFrame);\r\n instance = CreateRibbon(\"\", { pathArray, closeArray: false, closePath: false, offset: 0, updatable: false, sideOrientation: 0, instance }, scene || undefined);\r\n\r\n return instance;\r\n }\r\n // extruded shape creation\r\n path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);\r\n const newShapePaths = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame);\r\n const extrudedGeneric = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closeArray: rbCA,\r\n closePath: rbCP,\r\n updatable: updtbl,\r\n sideOrientation: side,\r\n invertUV: invertUV,\r\n frontUVs: frontUVs || undefined,\r\n backUVs: backUVs || undefined,\r\n },\r\n scene\r\n );\r\n extrudedGeneric._creationDataStorage!.pathArray = pathArray;\r\n extrudedGeneric._creationDataStorage!.path3D = path3D;\r\n extrudedGeneric._creationDataStorage!.cap = cap;\r\n\r\n return extrudedGeneric;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated please use the functions directly from the module\r\n */\r\nexport const ShapeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShape,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n ExtrudeShapeCustom,\r\n};\r\n\r\nMesh.ExtrudeShape = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scale: number,\r\n rotation: number,\r\n cap: number,\r\n scene: Nullable<Scene> = null,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scale: scale,\r\n rotation: rotation,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShape(name, options, scene);\r\n};\r\n\r\nMesh.ExtrudeShapeCustom = (\r\n name: string,\r\n shape: Vector3[],\r\n path: Vector3[],\r\n scaleFunction: Nullable<{ (i: number, distance: number): number }>,\r\n rotationFunction: Nullable<{ (i: number, distance: number): number }>,\r\n ribbonCloseArray: boolean,\r\n ribbonClosePath: boolean,\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n shape: shape,\r\n path: path,\r\n scaleFunction: scaleFunction,\r\n rotationFunction: rotationFunction,\r\n ribbonCloseArray: ribbonCloseArray,\r\n ribbonClosePath: ribbonClosePath,\r\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n updatable: updatable,\r\n };\r\n\r\n return ExtrudeShapeCustom(name, options, scene);\r\n};\r\n"]}
|
|
@@ -22,5 +22,4 @@ export declare class AnaglyphPostProcess extends PostProcess {
|
|
|
22
22
|
* @param reusable defines if the postprocess will be reused multiple times per frame
|
|
23
23
|
*/
|
|
24
24
|
constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: AbstractEngine, reusable?: boolean);
|
|
25
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
26
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PostProcess } from "./postProcess.js";
|
|
2
2
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
3
|
+
import { ThinAnaglyphPostProcess } from "./thinAnaglyphPostProcess.js";
|
|
3
4
|
/**
|
|
4
5
|
* Postprocess used to generate anaglyphic rendering
|
|
5
6
|
*/
|
|
@@ -21,22 +22,24 @@ export class AnaglyphPostProcess extends PostProcess {
|
|
|
21
22
|
* @param reusable defines if the postprocess will be reused multiple times per frame
|
|
22
23
|
*/
|
|
23
24
|
constructor(name, options, rigCameras, samplingMode, engine, reusable) {
|
|
24
|
-
|
|
25
|
+
const localOptions = {
|
|
26
|
+
samplers: ThinAnaglyphPostProcess.Samplers,
|
|
27
|
+
size: typeof options === "number" ? options : undefined,
|
|
28
|
+
camera: rigCameras[1],
|
|
29
|
+
samplingMode,
|
|
30
|
+
engine,
|
|
31
|
+
reusable,
|
|
32
|
+
...options,
|
|
33
|
+
};
|
|
34
|
+
super(name, ThinAnaglyphPostProcess.FragmentUrl, {
|
|
35
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinAnaglyphPostProcess(name, engine, localOptions) : undefined,
|
|
36
|
+
...localOptions,
|
|
37
|
+
});
|
|
25
38
|
this._passedProcess = rigCameras[0]._rigPostProcess;
|
|
26
39
|
this.onApplyObservable.add((effect) => {
|
|
27
40
|
effect.setTextureFromPostProcess("leftSampler", this._passedProcess);
|
|
28
41
|
});
|
|
29
42
|
}
|
|
30
|
-
_gatherImports(useWebGPU, list) {
|
|
31
|
-
if (useWebGPU) {
|
|
32
|
-
this._webGPUReady = true;
|
|
33
|
-
list.push(import("../ShadersWGSL/anaglyph.fragment.js"));
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
list.push(import("../Shaders/anaglyph.fragment.js"));
|
|
37
|
-
}
|
|
38
|
-
super._gatherImports(useWebGPU, list);
|
|
39
|
-
}
|
|
40
43
|
}
|
|
41
44
|
RegisterClass("BABYLON.AnaglyphPostProcess", AnaglyphPostProcess);
|
|
42
45
|
//# sourceMappingURL=anaglyphPostProcess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anaglyphPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/anaglyphPostProcess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAA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MAAM,CAAC,yBAAyB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ThinAnaglyphPostProcess } from \"./thinAnaglyphPostProcess\";\r\n\r\n/**\r\n * Postprocess used to generate anaglyphic rendering\r\n */\r\nexport class AnaglyphPostProcess extends PostProcess {\r\n private _passedProcess: Nullable<PostProcess>;\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"AnaglyphPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"AnaglyphPostProcess\";\r\n }\r\n\r\n /**\r\n * Creates a new AnaglyphPostProcess\r\n * @param name defines postprocess name\r\n * @param options defines creation options or target ratio scale\r\n * @param rigCameras defines cameras using this postprocess\r\n * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param engine defines hosting engine\r\n * @param reusable defines if the postprocess will be reused multiple times per frame\r\n */\r\n constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: AbstractEngine, reusable?: boolean) {\r\n const localOptions = {\r\n samplers: ThinAnaglyphPostProcess.Samplers,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera: rigCameras[1],\r\n samplingMode,\r\n engine,\r\n reusable,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinAnaglyphPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinAnaglyphPostProcess(name, engine, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this._passedProcess = rigCameras[0]._rigPostProcess;\r\n\r\n this.onApplyObservable.add((effect: Effect) => {\r\n effect.setTextureFromPostProcess(\"leftSampler\", this._passedProcess);\r\n });\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.AnaglyphPostProcess\", AnaglyphPostProcess);\r\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Vector2 } from "../Maths/math.vector";
|
|
1
|
+
import type { Vector2 } from "../Maths/math.vector";
|
|
2
2
|
import type { Nullable } from "../types";
|
|
3
3
|
import type { PostProcessOptions } from "./postProcess";
|
|
4
4
|
import { PostProcess } from "./postProcess";
|
|
5
5
|
import type { Camera } from "../Cameras/camera";
|
|
6
6
|
import type { AbstractEngine } from "../Engines/abstractEngine";
|
|
7
7
|
import type { Scene } from "../scene";
|
|
8
|
+
import { ThinChromaticAberrationPostProcess } from "./thinChromaticAberrationPostProcess";
|
|
8
9
|
/**
|
|
9
10
|
* The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen
|
|
10
11
|
*/
|
|
@@ -12,28 +13,35 @@ export declare class ChromaticAberrationPostProcess extends PostProcess {
|
|
|
12
13
|
/**
|
|
13
14
|
* The amount of separation of rgb channels (default: 30)
|
|
14
15
|
*/
|
|
15
|
-
aberrationAmount: number;
|
|
16
|
+
get aberrationAmount(): number;
|
|
17
|
+
set aberrationAmount(value: number);
|
|
16
18
|
/**
|
|
17
19
|
* The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)
|
|
18
20
|
*/
|
|
19
|
-
radialIntensity: number;
|
|
21
|
+
get radialIntensity(): number;
|
|
22
|
+
set radialIntensity(value: number);
|
|
20
23
|
/**
|
|
21
24
|
* The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))
|
|
22
25
|
*/
|
|
23
|
-
direction: Vector2;
|
|
26
|
+
get direction(): Vector2;
|
|
27
|
+
set direction(value: Vector2);
|
|
24
28
|
/**
|
|
25
29
|
* The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corner] (default: Vector2(0.5 ,0.5))
|
|
26
30
|
*/
|
|
27
|
-
centerPosition: Vector2;
|
|
31
|
+
get centerPosition(): Vector2;
|
|
32
|
+
set centerPosition(value: Vector2);
|
|
28
33
|
/** The width of the screen to apply the effect on */
|
|
29
|
-
screenWidth: number;
|
|
34
|
+
get screenWidth(): number;
|
|
35
|
+
set screenWidth(value: number);
|
|
30
36
|
/** The height of the screen to apply the effect on */
|
|
31
|
-
screenHeight: number;
|
|
37
|
+
get screenHeight(): number;
|
|
38
|
+
set screenHeight(value: number);
|
|
32
39
|
/**
|
|
33
40
|
* Gets a string identifying the name of the class
|
|
34
41
|
* @returns "ChromaticAberrationPostProcess" string
|
|
35
42
|
*/
|
|
36
43
|
getClassName(): string;
|
|
44
|
+
protected _effectWrapper: ThinChromaticAberrationPostProcess;
|
|
37
45
|
/**
|
|
38
46
|
* Creates a new instance ChromaticAberrationPostProcess
|
|
39
47
|
* @param name The name of the effect.
|
|
@@ -48,7 +56,6 @@ export declare class ChromaticAberrationPostProcess extends PostProcess {
|
|
|
48
56
|
* @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
|
|
49
57
|
*/
|
|
50
58
|
constructor(name: string, screenWidth: number, screenHeight: number, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number, blockCompilation?: boolean);
|
|
51
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
52
59
|
/**
|
|
53
60
|
* @internal
|
|
54
61
|
*/
|
|
@@ -1,14 +1,64 @@
|
|
|
1
1
|
import { __decorate } from "../tslib.es6.js";
|
|
2
|
-
import { Vector2 } from "../Maths/math.vector.js";
|
|
3
2
|
import { PostProcess } from "./postProcess.js";
|
|
4
3
|
|
|
5
4
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
6
5
|
import { serialize } from "../Misc/decorators.js";
|
|
7
6
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
7
|
+
import { ThinChromaticAberrationPostProcess } from "./thinChromaticAberrationPostProcess.js";
|
|
8
8
|
/**
|
|
9
9
|
* The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen
|
|
10
10
|
*/
|
|
11
11
|
export class ChromaticAberrationPostProcess extends PostProcess {
|
|
12
|
+
/**
|
|
13
|
+
* The amount of separation of rgb channels (default: 30)
|
|
14
|
+
*/
|
|
15
|
+
get aberrationAmount() {
|
|
16
|
+
return this._effectWrapper.aberrationAmount;
|
|
17
|
+
}
|
|
18
|
+
set aberrationAmount(value) {
|
|
19
|
+
this._effectWrapper.aberrationAmount = value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)
|
|
23
|
+
*/
|
|
24
|
+
get radialIntensity() {
|
|
25
|
+
return this._effectWrapper.radialIntensity;
|
|
26
|
+
}
|
|
27
|
+
set radialIntensity(value) {
|
|
28
|
+
this._effectWrapper.radialIntensity = value;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))
|
|
32
|
+
*/
|
|
33
|
+
get direction() {
|
|
34
|
+
return this._effectWrapper.direction;
|
|
35
|
+
}
|
|
36
|
+
set direction(value) {
|
|
37
|
+
this._effectWrapper.direction = value;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corner] (default: Vector2(0.5 ,0.5))
|
|
41
|
+
*/
|
|
42
|
+
get centerPosition() {
|
|
43
|
+
return this._effectWrapper.centerPosition;
|
|
44
|
+
}
|
|
45
|
+
set centerPosition(value) {
|
|
46
|
+
this._effectWrapper.centerPosition = value;
|
|
47
|
+
}
|
|
48
|
+
/** The width of the screen to apply the effect on */
|
|
49
|
+
get screenWidth() {
|
|
50
|
+
return this._effectWrapper.screenWidth;
|
|
51
|
+
}
|
|
52
|
+
set screenWidth(value) {
|
|
53
|
+
this._effectWrapper.screenWidth = value;
|
|
54
|
+
}
|
|
55
|
+
/** The height of the screen to apply the effect on */
|
|
56
|
+
get screenHeight() {
|
|
57
|
+
return this._effectWrapper.screenHeight;
|
|
58
|
+
}
|
|
59
|
+
set screenHeight(value) {
|
|
60
|
+
this._effectWrapper.screenHeight = value;
|
|
61
|
+
}
|
|
12
62
|
/**
|
|
13
63
|
* Gets a string identifying the name of the class
|
|
14
64
|
* @returns "ChromaticAberrationPostProcess" string
|
|
@@ -30,43 +80,23 @@ export class ChromaticAberrationPostProcess extends PostProcess {
|
|
|
30
80
|
* @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)
|
|
31
81
|
*/
|
|
32
82
|
constructor(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
this.centerPosition = new Vector2(0.5, 0.5);
|
|
83
|
+
const localOptions = {
|
|
84
|
+
uniforms: ThinChromaticAberrationPostProcess.Uniforms,
|
|
85
|
+
size: typeof options === "number" ? options : undefined,
|
|
86
|
+
camera,
|
|
87
|
+
samplingMode,
|
|
88
|
+
engine,
|
|
89
|
+
reusable,
|
|
90
|
+
textureType,
|
|
91
|
+
blockCompilation,
|
|
92
|
+
...options,
|
|
93
|
+
};
|
|
94
|
+
super(name, ThinChromaticAberrationPostProcess.FragmentUrl, {
|
|
95
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinChromaticAberrationPostProcess(name, engine, localOptions) : undefined,
|
|
96
|
+
...localOptions,
|
|
97
|
+
});
|
|
50
98
|
this.screenWidth = screenWidth;
|
|
51
99
|
this.screenHeight = screenHeight;
|
|
52
|
-
this.onApplyObservable.add((effect) => {
|
|
53
|
-
effect.setFloat("chromatic_aberration", this.aberrationAmount);
|
|
54
|
-
effect.setFloat("screen_width", screenWidth);
|
|
55
|
-
effect.setFloat("screen_height", screenHeight);
|
|
56
|
-
effect.setFloat("radialIntensity", this.radialIntensity);
|
|
57
|
-
effect.setFloat2("direction", this.direction.x, this.direction.y);
|
|
58
|
-
effect.setFloat2("centerPosition", this.centerPosition.x, this.centerPosition.y);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
_gatherImports(useWebGPU, list) {
|
|
62
|
-
if (useWebGPU) {
|
|
63
|
-
this._webGPUReady = true;
|
|
64
|
-
list.push(Promise.all([import("../ShadersWGSL/chromaticAberration.fragment.js")]));
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
list.push(Promise.all([import("../Shaders/chromaticAberration.fragment.js")]));
|
|
68
|
-
}
|
|
69
|
-
super._gatherImports(useWebGPU, list);
|
|
70
100
|
}
|
|
71
101
|
/**
|
|
72
102
|
* @internal
|
|
@@ -79,21 +109,21 @@ export class ChromaticAberrationPostProcess extends PostProcess {
|
|
|
79
109
|
}
|
|
80
110
|
__decorate([
|
|
81
111
|
serialize()
|
|
82
|
-
], ChromaticAberrationPostProcess.prototype, "aberrationAmount",
|
|
112
|
+
], ChromaticAberrationPostProcess.prototype, "aberrationAmount", null);
|
|
83
113
|
__decorate([
|
|
84
114
|
serialize()
|
|
85
|
-
], ChromaticAberrationPostProcess.prototype, "radialIntensity",
|
|
115
|
+
], ChromaticAberrationPostProcess.prototype, "radialIntensity", null);
|
|
86
116
|
__decorate([
|
|
87
117
|
serialize()
|
|
88
|
-
], ChromaticAberrationPostProcess.prototype, "direction",
|
|
118
|
+
], ChromaticAberrationPostProcess.prototype, "direction", null);
|
|
89
119
|
__decorate([
|
|
90
120
|
serialize()
|
|
91
|
-
], ChromaticAberrationPostProcess.prototype, "centerPosition",
|
|
121
|
+
], ChromaticAberrationPostProcess.prototype, "centerPosition", null);
|
|
92
122
|
__decorate([
|
|
93
123
|
serialize()
|
|
94
|
-
], ChromaticAberrationPostProcess.prototype, "screenWidth",
|
|
124
|
+
], ChromaticAberrationPostProcess.prototype, "screenWidth", null);
|
|
95
125
|
__decorate([
|
|
96
126
|
serialize()
|
|
97
|
-
], ChromaticAberrationPostProcess.prototype, "screenHeight",
|
|
127
|
+
], ChromaticAberrationPostProcess.prototype, "screenHeight", null);
|
|
98
128
|
RegisterClass("BABYLON.ChromaticAberrationPostProcess", ChromaticAberrationPostProcess);
|
|
99
129
|
//# sourceMappingURL=chromaticAberrationPostProcess.js.map
|