@onerjs/core 8.46.9 → 8.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.js +13 -12
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/easing.js +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/pathCursor.js +1 -2
- package/Animations/pathCursor.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +7 -0
- package/Layers/selectionOutlineLayer.js +18 -1
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.js +16 -3
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
- package/Lights/Clustered/clusteredLightContainer.js +42 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +7 -0
- package/Lights/light.js +10 -0
- package/Lights/light.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +10 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Meshes/mesh.js +29 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.js +5 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +8 -6
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,CAAC,MAAM,yCAAyC,GAAG,0BAA0B,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAwBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;QACvE,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC;QAE9F,MAAM,OAAO,GAAG;YACZ,gCAAgC,yEAAiE,GAAG;YACpG,mCAAmC,4EAAoE,GAAG;YAC1G,kBAAkB,+CAAuC,GAAG;YAC5D,kBAAkB,+CAAuC,GAAG;YAC5D,uBAAuB,oDAA4C,GAAG;SACzE,CAAC;QACF,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,UAAU,GAAG,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YACvC,IAAI,CAAC,SAAS,GAAG,0BAA0B,CAAC,SAAS,CAAC;QAC1D,CAAC;QACD,IAAI,0BAA0B,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC;QAC5D,CAAC;QACD,IAAI,0BAA0B,CAAC,KAAK,EAAE,CAAC;YACnC,IAAI,CAAC,KAAK,GAAG,0BAA0B,CAAC,KAAK,CAAC;QAClD,CAAC;QACD,IAAI,0BAA0B,CAAC,eAAe,EAAE,CAAC;YAC7C,IAAI,CAAC,eAAe,GAAG,0BAA0B,CAAC,eAAe,CAAC;QACtE,CAAC;QACD,IAAI,0BAA0B,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC;QAC5D,CAAC;QACD,IAAI,0BAA0B,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtK,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;;AAhhBD;;GAEG;AACW,mCAAS,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { type Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\nimport { TextureSampler } from \"../Textures/textureSampler\";\r\n\r\nimport { type GreasedLineMaterialOptions, type IGreasedLineMaterial, GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\nexport const GreasedLineUseOffsetsSimpleMaterialDefine = \"GREASED_LINE_USE_OFFSETS\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n /**\r\n * Force to use GLSL in WebGPU\r\n */\r\n public static ForceGLSL = false;\r\n\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const engine = scene.getEngine();\r\n const isWGSL = engine.isWebGPU && !(options.forceGLSL || GreasedLineSimpleMaterial.ForceGLSL);\r\n\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n if (scene.useRightHandedSystem) {\r\n defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n }\r\n\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n const uniforms = [\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n \"grlColors\",\r\n ];\r\n\r\n if (!isWGSL) {\r\n uniforms.push(\"world\", \"viewProjection\", \"view\", \"projection\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n uniformBuffers: isWGSL ? [\"Scene\", \"Mesh\"] : undefined,\r\n attributes,\r\n uniforms,\r\n samplers: isWGSL ? [] : [\"grlColors\"],\r\n defines,\r\n extraInitializationsAsync: async () => {\r\n if (isWGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/greasedLine.vertex\"), import(\"../../ShadersWGSL/greasedLine.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/greasedLine.vertex\"), import(\"../../Shaders/greasedLine.fragment\")]);\r\n }\r\n },\r\n shaderLanguage: isWGSL ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n }\r\n );\r\n\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, this._colors, this.colorsSampling, scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n }\r\n\r\n if (isWGSL) {\r\n const sampler = new TextureSampler();\r\n sampler.setParameters(); // use the default values\r\n sampler.samplingMode = this.colorsSampling;\r\n this.setTextureSampler(\"grlColorsSampler\", sampler);\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n this._colorsTexture?.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n this._colorsTexture?.dispose();\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n this._colorsTexture?.dispose();\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n if (this._colors) {\r\n greasedLineMaterialOptions.colors = this._colors;\r\n }\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n if (greasedLineMaterialOptions.color) {\r\n this.color = greasedLineMaterialOptions.color;\r\n }\r\n if (greasedLineMaterialOptions.colorDistributionType) {\r\n this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType;\r\n }\r\n if (greasedLineMaterialOptions.colorsSampling) {\r\n this.colorsSampling = greasedLineMaterialOptions.colorsSampling;\r\n }\r\n if (greasedLineMaterialOptions.colorMode) {\r\n this.colorMode = greasedLineMaterialOptions.colorMode;\r\n }\r\n if (greasedLineMaterialOptions.useColors) {\r\n this.useColors = greasedLineMaterialOptions.useColors;\r\n }\r\n if (greasedLineMaterialOptions.visibility) {\r\n this.visibility = greasedLineMaterialOptions.visibility;\r\n }\r\n if (greasedLineMaterialOptions.useDash) {\r\n this.useDash = greasedLineMaterialOptions.useDash;\r\n }\r\n if (greasedLineMaterialOptions.dashCount) {\r\n this.dashCount = greasedLineMaterialOptions.dashCount;\r\n }\r\n if (greasedLineMaterialOptions.dashRatio) {\r\n this.dashRatio = greasedLineMaterialOptions.dashRatio;\r\n }\r\n if (greasedLineMaterialOptions.dashOffset) {\r\n this.dashOffset = greasedLineMaterialOptions.dashOffset;\r\n }\r\n if (greasedLineMaterialOptions.width) {\r\n this.width = greasedLineMaterialOptions.width;\r\n }\r\n if (greasedLineMaterialOptions.sizeAttenuation) {\r\n this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation;\r\n }\r\n if (greasedLineMaterialOptions.resolution) {\r\n this.resolution = greasedLineMaterialOptions.resolution;\r\n }\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"greasedLineSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineSimpleMaterial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,CAAC,MAAM,yCAAyC,GAAG,0BAA0B,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAwBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAY,EAAE,OAAmC;QACvE,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,S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C,eAAe,CAAC;QACtE,CAAC;QACD,IAAI,0BAA0B,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,UAAU,GAAG,0BAA0B,CAAC,UAAU,CAAC;QAC5D,CAAC;QACD,IAAI,0BAA0B,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,IAAI,iBAAiB,EAAE,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtK,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,0BAA0B,CAAC,YAAY,IAAI,IAAI,CAAC;QACrE,IAAI,CAAC,SAAS,CAAC,4BAA4B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;;AA1hBD;;GAEG;AACW,mCAAS,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { type Scene } from \"../../scene\";\r\nimport { RawTexture } from \"../Textures/rawTexture\";\r\nimport { ShaderMaterial } from \"../shaderMaterial\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Vector2 } from \"../../Maths/math.vector\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\nimport { TextureSampler } from \"../Textures/textureSampler\";\r\n\r\nimport { type GreasedLineMaterialOptions, type IGreasedLineMaterial, GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport { GreasedLineMaterialDefaults } from \"./greasedLineMaterialDefaults\";\r\n\r\nexport const GreasedLineUseOffsetsSimpleMaterialDefine = \"GREASED_LINE_USE_OFFSETS\";\r\n\r\n/**\r\n * GreasedLineSimpleMaterial\r\n */\r\nexport class GreasedLineSimpleMaterial extends ShaderMaterial implements IGreasedLineMaterial {\r\n /**\r\n * Force to use GLSL in WebGPU\r\n */\r\n public static ForceGLSL = false;\r\n\r\n private _visibility: number;\r\n private _width: number;\r\n private _useDash: boolean;\r\n private _dashCount: number;\r\n private _dashArray: number;\r\n private _dashRatio: number;\r\n private _dashOffset: number;\r\n private _useColors: boolean;\r\n private _color: Color3 = Color3.White();\r\n private _colors: Nullable<Color3[]>;\r\n private _colorsDistributionType: GreasedLineMeshColorDistributionType = GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n private _colorMode: GreasedLineMeshColorMode;\r\n private _colorsSampling: number;\r\n private _resolution: Vector2;\r\n private _sizeAttenuation: boolean;\r\n private _colorsTexture: Nullable<RawTexture> = null;\r\n private _cameraFacing: boolean;\r\n\r\n /**\r\n * GreasedLineSimple material constructor\r\n * @param name material name\r\n * @param scene the scene\r\n * @param options material options\r\n */\r\n constructor(name: string, scene: Scene, options: GreasedLineMaterialOptions) {\r\n const engine = scene.getEngine();\r\n const isWGSL = engine.isWebGPU && !(options.forceGLSL || GreasedLineSimpleMaterial.ForceGLSL);\r\n\r\n const defines = [\r\n `COLOR_DISTRIBUTION_TYPE_LINE ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_LINE}.`,\r\n `COLOR_DISTRIBUTION_TYPE_SEGMENT ${GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT}.`,\r\n `COLOR_MODE_SET ${GreasedLineMeshColorMode.COLOR_MODE_SET}.`,\r\n `COLOR_MODE_ADD ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.`,\r\n `COLOR_MODE_MULTIPLY ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.`,\r\n ];\r\n if (scene.useRightHandedSystem) {\r\n defines.push(\"GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\");\r\n }\r\n\r\n const attributes = [\"position\", \"grl_widths\", \"grl_offsets\", \"grl_colorPointers\"];\r\n\r\n if (options.cameraFacing) {\r\n defines.push(\"GREASED_LINE_CAMERA_FACING\");\r\n attributes.push(\"grl_previousAndSide\", \"grl_nextAndCounters\");\r\n } else {\r\n attributes.push(\"grl_slopes\");\r\n attributes.push(\"grl_counters\");\r\n }\r\n\r\n const uniforms = [\r\n \"grlColorsWidth\",\r\n \"grlUseColors\",\r\n \"grlWidth\",\r\n \"grlColor\",\r\n \"grl_colorModeAndColorDistributionType\",\r\n \"grlResolution\",\r\n \"grlAspect\",\r\n \"grlAizeAttenuation\",\r\n \"grlDashArray\",\r\n \"grlDashOffset\",\r\n \"grlDashRatio\",\r\n \"grlUseDash\",\r\n \"grlVisibility\",\r\n \"grlColors\",\r\n ];\r\n\r\n if (!isWGSL) {\r\n uniforms.push(\"world\", \"viewProjection\", \"view\", \"projection\");\r\n }\r\n\r\n super(\r\n name,\r\n scene,\r\n {\r\n vertex: \"greasedLine\",\r\n fragment: \"greasedLine\",\r\n },\r\n {\r\n uniformBuffers: isWGSL ? [\"Scene\", \"Mesh\"] : undefined,\r\n attributes,\r\n uniforms,\r\n samplers: isWGSL ? [] : [\"grlColors\"],\r\n defines,\r\n extraInitializationsAsync: async () => {\r\n if (isWGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/greasedLine.vertex\"), import(\"../../ShadersWGSL/greasedLine.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/greasedLine.vertex\"), import(\"../../Shaders/greasedLine.fragment\")]);\r\n }\r\n },\r\n shaderLanguage: isWGSL ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n }\r\n );\r\n\r\n options = options || {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n\r\n this.visibility = options.visibility ?? 1;\r\n this.useDash = options.useDash ?? false;\r\n this.dashRatio = options.dashRatio ?? 0.5;\r\n this.dashOffset = options.dashOffset ?? 0;\r\n this.dashCount = options.dashCount ?? 1; // calculate the _dashArray value, call the setter\r\n this.width = options.width\r\n ? options.width\r\n : options.sizeAttenuation && options.cameraFacing\r\n ? GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\r\n : GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n this.sizeAttenuation = options.sizeAttenuation ?? false;\r\n this.color = options.color ?? Color3.White();\r\n this.useColors = options.useColors ?? false;\r\n this.colorsDistributionType = options.colorDistributionType ?? GreasedLineMeshColorDistributionType.COLOR_DISTRIBUTION_TYPE_SEGMENT;\r\n this.colorsSampling = options.colorsSampling ?? RawTexture.NEAREST_NEAREST;\r\n this.colorMode = options.colorMode ?? GreasedLineMeshColorMode.COLOR_MODE_SET;\r\n this._colors = options.colors ?? null;\r\n this._cameraFacing = options.cameraFacing ?? true;\r\n this.resolution = options.resolution ?? new Vector2(engine.getRenderWidth(), engine.getRenderHeight()); // calculate aspect call the setter\r\n\r\n if (options.colorsTexture) {\r\n this.colorsTexture = options.colorsTexture;\r\n } else {\r\n if (this._colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, this._colors, this.colorsSampling, scene);\r\n } else {\r\n this._color = this._color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n }\r\n\r\n if (isWGSL) {\r\n const sampler = new TextureSampler();\r\n sampler.setParameters(); // use the default values\r\n sampler.samplingMode = this.colorsSampling;\r\n this.setTextureSampler(\"grlColorsSampler\", sampler);\r\n }\r\n\r\n engine.onDisposeObservable.add(() => {\r\n GreasedLineTools.DisposeEmptyColorsTexture();\r\n });\r\n }\r\n\r\n /**\r\n * Disposes the plugin material.\r\n */\r\n public override dispose(): void {\r\n if (this._colorsTexture && this._colorsTexture !== GreasedLineMaterialDefaults.EmptyColorsTexture) {\r\n this._colorsTexture.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n private _setColorModeAndColorDistributionType() {\r\n this.setVector2(\"grl_colorModeAndColorDistributionType\", new Vector2(this._colorMode, this._colorsDistributionType));\r\n }\r\n\r\n /**\r\n * Updates the material. Use when material created in lazy mode.\r\n */\r\n public updateLazy() {\r\n if (this._colors) {\r\n this.setColors(this._colors, false, true);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the colors used to colorize the line\r\n */\r\n get colors() {\r\n return this._colors;\r\n }\r\n\r\n /**\r\n * Sets the colors used to colorize the line\r\n */\r\n set colors(value: Nullable<Color3[]>) {\r\n this.setColors(value);\r\n }\r\n\r\n /**\r\n * Creates or updates the colors texture\r\n * @param colors color table RGBA\r\n * @param lazy if lazy, the colors are not updated\r\n * @param forceNewTexture force creation of a new texture\r\n */\r\n public setColors(colors: Nullable<Color3[]>, lazy = false, forceNewTexture = false): void {\r\n const origColorsCount = this._colors?.length ?? 0;\r\n\r\n this._colors = colors;\r\n\r\n if (colors === null || colors.length === 0) {\r\n if (this._colorsTexture && this._colorsTexture !== GreasedLineMaterialDefaults.EmptyColorsTexture) {\r\n this._colorsTexture.dispose();\r\n }\r\n const scene = this.getScene();\r\n if (scene) {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n return;\r\n }\r\n\r\n if (lazy && !forceNewTexture) {\r\n return;\r\n }\r\n\r\n if (this._colorsTexture && origColorsCount === colors.length && !forceNewTexture) {\r\n const colorArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n this._colorsTexture.update(colorArray);\r\n } else {\r\n if (this._colorsTexture && this._colorsTexture !== GreasedLineMaterialDefaults.EmptyColorsTexture) {\r\n this._colorsTexture.dispose();\r\n }\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, colors, this.colorsSampling, this.getScene());\r\n }\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n get colorsTexture() {\r\n return (this._colorsTexture as RawTexture) ?? null;\r\n }\r\n\r\n /**\r\n * Sets the colorsTexture\r\n */\r\n set colorsTexture(value: RawTexture) {\r\n this._colorsTexture = value;\r\n this.setFloat(\"grlColorsWidth\", this._colorsTexture.getSize().width);\r\n this.setTexture(\"grlColors\", this._colorsTexture);\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n get width() {\r\n return this._width;\r\n }\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n set width(value: number) {\r\n this._width = value;\r\n this.setFloat(\"grlWidth\", value);\r\n }\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n get useColors() {\r\n return this._useColors;\r\n }\r\n\r\n set useColors(value: boolean) {\r\n this._useColors = value;\r\n this.setFloat(\"grlUseColors\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n get colorsSampling() {\r\n return this._colorsSampling;\r\n }\r\n\r\n /**\r\n * The type of sampling of the colors texture. The values are the same when using with textures.\r\n */\r\n set colorsSampling(value: number) {\r\n this._colorsSampling = value;\r\n }\r\n\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n get visibility() {\r\n return this._visibility;\r\n }\r\n\r\n set visibility(value: number) {\r\n this._visibility = value;\r\n this.setFloat(\"grlVisibility\", value);\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n get useDash() {\r\n return this._useDash;\r\n }\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n set useDash(value: boolean) {\r\n this._useDash = value;\r\n this.setFloat(\"grlUseDash\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the dash offset\r\n */\r\n get dashOffset() {\r\n return this._dashOffset;\r\n }\r\n\r\n /**\r\n * Sets the dash offset\r\n */\r\n set dashOffset(value: number) {\r\n this._dashOffset = value;\r\n this.setFloat(\"grlDashOffset\", value);\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n get dashRatio() {\r\n return this._dashRatio;\r\n }\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n set dashRatio(value: number) {\r\n this._dashRatio = value;\r\n this.setFloat(\"grlDashRatio\", value);\r\n }\r\n\r\n /**\r\n * Gets the number of dashes in the line\r\n */\r\n get dashCount() {\r\n return this._dashCount;\r\n }\r\n /**\r\n * Sets the number of dashes in the line\r\n * @param value dash\r\n */\r\n set dashCount(value: number) {\r\n this._dashCount = value;\r\n this._dashArray = 1 / value;\r\n this.setFloat(\"grlDashArray\", this._dashArray);\r\n }\r\n\r\n /**\r\n * False means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n get sizeAttenuation() {\r\n return this._sizeAttenuation;\r\n }\r\n\r\n /**\r\n * Turn on/off attenuation of the width option and widths array.\r\n * @param value false means 1 unit in width = 1 unit on scene, true means 1 unit in width is reduced on the screen to make better looking lines\r\n */\r\n set sizeAttenuation(value: boolean) {\r\n this._sizeAttenuation = value;\r\n this.setFloat(\"grlSizeAttenuation\", GreasedLineTools.BooleanToNumber(value));\r\n }\r\n\r\n /**\r\n * Gets the color of the line\r\n */\r\n get color() {\r\n return this._color;\r\n }\r\n\r\n /**\r\n * Sets the color of the line\r\n * @param value Color3\r\n */\r\n set color(value: Color3) {\r\n this.setColor(value);\r\n }\r\n\r\n /**\r\n * Sets the color of the line. If set the whole line will be mixed with this color according to the colorMode option.\r\n * The simple material always needs a color to be set. If you set it to null it will set the color to the default color (GreasedLineSimpleMaterial.DEFAULT_COLOR).\r\n * @param value color\r\n */\r\n public setColor(value: Nullable<Color3>) {\r\n value = value ?? GreasedLineMaterialDefaults.DEFAULT_COLOR;\r\n this._color = value;\r\n this.setColor3(\"grlColor\", value);\r\n }\r\n\r\n /**\r\n * Gets the color distributiopn type\r\n */\r\n get colorsDistributionType() {\r\n return this._colorsDistributionType;\r\n }\r\n\r\n /**\r\n * Sets the color distribution type\r\n * @see GreasedLineMeshColorDistributionType\r\n * @param value color distribution type\r\n */\r\n set colorsDistributionType(value: GreasedLineMeshColorDistributionType) {\r\n this._colorsDistributionType = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n get colorMode() {\r\n return this._colorMode;\r\n }\r\n\r\n /**\r\n * Sets the mixing mode of the color and colors paramaters. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n set colorMode(value: GreasedLineMeshColorMode) {\r\n this._colorMode = value;\r\n this._setColorModeAndColorDistributionType();\r\n }\r\n\r\n /**\r\n * Gets the resolution\r\n */\r\n get resolution() {\r\n return this._resolution;\r\n }\r\n\r\n /**\r\n * Sets the resolution\r\n * @param value resolution of the screen for GreasedLine\r\n */\r\n set resolution(value: Vector2) {\r\n this._resolution = value;\r\n this.setVector2(\"grlResolution\", value);\r\n this.setFloat(\"grlAspect\", value.x / value.y);\r\n }\r\n\r\n /**\r\n * Serializes this plugin material\r\n * @returns serializationObjec\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n const greasedLineMaterialOptions: GreasedLineMaterialOptions = {\r\n colorDistributionType: this._colorsDistributionType,\r\n colorsSampling: this._colorsSampling,\r\n colorMode: this._colorMode,\r\n color: this._color,\r\n dashCount: this._dashCount,\r\n dashOffset: this._dashOffset,\r\n dashRatio: this._dashRatio,\r\n resolution: this._resolution,\r\n sizeAttenuation: this._sizeAttenuation,\r\n useColors: this._useColors,\r\n useDash: this._useDash,\r\n visibility: this._visibility,\r\n width: this._width,\r\n cameraFacing: this._cameraFacing,\r\n };\r\n\r\n if (this._colors) {\r\n greasedLineMaterialOptions.colors = this._colors;\r\n }\r\n\r\n serializationObject.greasedLineMaterialOptions = greasedLineMaterialOptions;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized objects\r\n * @param source serialized object\r\n * @param scene scene\r\n * @param _rootUrl root url for textures\r\n */\r\n public parse(source: any, scene: Scene, _rootUrl: string): void {\r\n const greasedLineMaterialOptions = <GreasedLineMaterialOptions>source.greasedLineMaterialOptions;\r\n\r\n this._colorsTexture?.dispose();\r\n\r\n if (greasedLineMaterialOptions.color) {\r\n this.color = greasedLineMaterialOptions.color;\r\n }\r\n if (greasedLineMaterialOptions.colorDistributionType) {\r\n this.colorsDistributionType = greasedLineMaterialOptions.colorDistributionType;\r\n }\r\n if (greasedLineMaterialOptions.colorsSampling) {\r\n this.colorsSampling = greasedLineMaterialOptions.colorsSampling;\r\n }\r\n if (greasedLineMaterialOptions.colorMode) {\r\n this.colorMode = greasedLineMaterialOptions.colorMode;\r\n }\r\n if (greasedLineMaterialOptions.useColors) {\r\n this.useColors = greasedLineMaterialOptions.useColors;\r\n }\r\n if (greasedLineMaterialOptions.visibility) {\r\n this.visibility = greasedLineMaterialOptions.visibility;\r\n }\r\n if (greasedLineMaterialOptions.useDash) {\r\n this.useDash = greasedLineMaterialOptions.useDash;\r\n }\r\n if (greasedLineMaterialOptions.dashCount) {\r\n this.dashCount = greasedLineMaterialOptions.dashCount;\r\n }\r\n if (greasedLineMaterialOptions.dashRatio) {\r\n this.dashRatio = greasedLineMaterialOptions.dashRatio;\r\n }\r\n if (greasedLineMaterialOptions.dashOffset) {\r\n this.dashOffset = greasedLineMaterialOptions.dashOffset;\r\n }\r\n if (greasedLineMaterialOptions.width) {\r\n this.width = greasedLineMaterialOptions.width;\r\n }\r\n if (greasedLineMaterialOptions.sizeAttenuation) {\r\n this.sizeAttenuation = greasedLineMaterialOptions.sizeAttenuation;\r\n }\r\n if (greasedLineMaterialOptions.resolution) {\r\n this.resolution = greasedLineMaterialOptions.resolution;\r\n }\r\n if (greasedLineMaterialOptions.colors) {\r\n this.colorsTexture = GreasedLineTools.CreateColorsTexture(`${this.name}-colors-texture`, greasedLineMaterialOptions.colors, this.colorsSampling, this.getScene());\r\n } else {\r\n this.colorsTexture = GreasedLineTools.PrepareEmptyColorsTexture(scene);\r\n }\r\n\r\n this._cameraFacing = greasedLineMaterialOptions.cameraFacing ?? true;\r\n this.setDefine(\"GREASED_LINE_CAMERA_FACING\", this._cameraFacing);\r\n }\r\n}\r\n"]}
|
|
@@ -374,12 +374,22 @@ export class CubeTexture extends BaseTexture {
|
|
|
374
374
|
*/
|
|
375
375
|
clone() {
|
|
376
376
|
let uniqueId = 0;
|
|
377
|
+
// Save the irradianceTexture before cloning. The irradianceTexture is
|
|
378
|
+
// stored on the InternalTexture (_texture._irradianceTexture), which may
|
|
379
|
+
// be shared between the source and clone when loaded from cache.
|
|
380
|
+
// BaseTexture.clone() returns null, so CopySource sets the shared
|
|
381
|
+
// irradianceTexture to null, losing it on both the original and the clone.
|
|
382
|
+
const savedIrradianceTexture = this.irradianceTexture;
|
|
377
383
|
const newCubeTexture = SerializationHelper.Clone(() => {
|
|
378
384
|
const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine(), this._extensions, this._noMipmap, this._files);
|
|
379
385
|
uniqueId = cubeTexture.uniqueId;
|
|
380
386
|
return cubeTexture;
|
|
381
387
|
}, this);
|
|
382
388
|
newCubeTexture.uniqueId = uniqueId;
|
|
389
|
+
// Restore the irradianceTexture if it was cleared during cloning.
|
|
390
|
+
if (savedIrradianceTexture && !this.irradianceTexture) {
|
|
391
|
+
this.irradianceTexture = savedIrradianceTexture;
|
|
392
|
+
}
|
|
383
393
|
return newCubeTexture;
|
|
384
394
|
}
|
|
385
395
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cub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wDACuB;AAyB5C;IADC,kBAAkB,EAAE;kDAGpB;AAQD;IADC,SAAS,CAAC,WAAW,CAAC;4CAItB;AAmBM;IADN,SAAS,CAAC,OAAO,CAAC;2CACsB;AAG/B;IADT,SAAS,CAAC,iBAAiB,CAAC;qDACuB;AAU5C;IADP,SAAS,CAAC,YAAY,CAAC;gDACuB;AAGvC;IADP,iBAAiB,CAAC,eAAe,CAAC;mDACJ;AAGvB;IADP,iBAAiB,CAAC,yBAAyB,CAAC;6DACW;AAqa5D,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC;AAC/C,6CAA6C;AAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport { type AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\nimport \"../../Engines/AbstractEngine/abstractEngine.cubeTexture\";\r\n\r\n/**\r\n * Defines the available options when creating a cube texture\r\n */\r\nexport interface ICubeTextureCreationOptions {\r\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\r\n extensions?: string[];\r\n\r\n /** noMipmap defines if mipmaps should be created or not */\r\n noMipmap?: boolean;\r\n\r\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\r\n files?: string[];\r\n\r\n /** buffer to load instead of loading the data from the url */\r\n buffer?: ArrayBufferView;\r\n\r\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\r\n onLoad?: () => void;\r\n\r\n /** onError defines a callback triggered in case of error during load */\r\n onError?: (message?: string, exception?: any) => void;\r\n\r\n /** format defines the internal format to use for the texture once loaded */\r\n format?: number;\r\n\r\n /** prefiltered defines whether or not the texture is created from prefiltered data */\r\n prefiltered?: boolean;\r\n\r\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\r\n forcedExtension?: any;\r\n\r\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\r\n createPolynomials?: boolean;\r\n\r\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\r\n lodScale?: number;\r\n\r\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\r\n lodOffset?: number;\r\n\r\n /** loaderOptions options to be passed to the loader */\r\n loaderOptions?: any;\r\n\r\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\r\n useSRGBBuffer?: boolean;\r\n\r\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\r\n sphericalPolynomialTargetSize?: number;\r\n}\r\n\r\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\nconst DefaultLodScale = 0.8;\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nexport class CubeTexture extends BaseTexture {\r\n private _delayedOnLoad: Nullable<() => void>;\r\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\r\n private _lodScale: number;\r\n private _lodOffset: number;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\r\n\r\n /**\r\n * The url of the texture\r\n */\r\n @serialize()\r\n public url: string;\r\n\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\r\n */\r\n @serializeAsVector3()\r\n public boundingBoxPosition = Vector3.Zero();\r\n\r\n private _boundingBoxSize: Vector3;\r\n\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n public set boundingBoxSize(value: Vector3) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\r\n */\r\n @serializeAsVector3()\r\n public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n @serialize(\"rotationY\")\r\n public set rotationY(value: number) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n }\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n public get rotationY(): number {\r\n return this._rotationY;\r\n }\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public override get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n private _noMipmap: boolean;\r\n\r\n /** @internal */\r\n @serialize(\"files\")\r\n public _files: Nullable<string[]> = null;\r\n\r\n @serialize(\"forcedExtension\")\r\n protected _forcedExtension: Nullable<string> = null;\r\n\r\n /**\r\n * Gets the forced extension (if any)\r\n */\r\n public get forcedExtension(): Nullable<string> {\r\n return this._forcedExtension;\r\n }\r\n\r\n @serialize(\"extensions\")\r\n private _extensions: Nullable<string[]> = null;\r\n\r\n @serializeAsMatrix(\"textureMatrix\")\r\n private _textureMatrix: Matrix;\r\n\r\n @serializeAsMatrix(\"textureMatrixRefraction\")\r\n private _textureMatrixRefraction: Matrix = new Matrix();\r\n\r\n private _format: number;\r\n private _createPolynomials: boolean;\r\n private _loaderOptions: any;\r\n private _useSRGBBuffer?: boolean;\r\n private _buffer: Nullable<ArrayBufferView> = null;\r\n\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\r\n let rootUrlKey = \"\";\r\n\r\n for (const url of files) {\r\n rootUrlKey += url;\r\n }\r\n\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n }\r\n\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @returns the prefiltered texture\r\n */\r\n public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true) {\r\n const oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n\r\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n\r\n scene.useDelayedTextureLoading = oldValue;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param sceneOrEngine defines the scene or engine the texture is attached to\r\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\r\n * @returns the cube texture\r\n */\r\n constructor(\r\n rootUrl: string,\r\n sceneOrEngine: Scene | AbstractEngine,\r\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\r\n noMipmap: boolean = false,\r\n files: Nullable<string[]> = null,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n prefiltered = false,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = DefaultLodScale,\r\n lodOffset: number = 0,\r\n loaderOptions?: any,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = rootUrl;\r\n this.url = rootUrl;\r\n this._noMipmap = noMipmap;\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this.coordinatesMode = Texture.CUBIC_MODE;\r\n\r\n let extensions: Nullable<string[]>;\r\n let buffer: Nullable<ArrayBufferView> = null;\r\n\r\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\r\n extensions = extensionsOrOptions.extensions ?? null;\r\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\r\n files = extensionsOrOptions.files ?? null;\r\n buffer = extensionsOrOptions.buffer ?? null;\r\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\r\n prefiltered = extensionsOrOptions.prefiltered ?? false;\r\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\r\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\r\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\r\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\r\n this._loaderOptions = extensionsOrOptions.loaderOptions;\r\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\r\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\r\n onLoad = extensionsOrOptions.onLoad ?? null;\r\n onError = extensionsOrOptions.onError ?? null;\r\n } else {\r\n this._noMipmap = noMipmap;\r\n this._format = format;\r\n this._createPolynomials = createPolynomials;\r\n extensions = extensionsOrOptions;\r\n this._loaderOptions = loaderOptions;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._lodScale = lodScale;\r\n this._lodOffset = lodOffset;\r\n }\r\n\r\n if (!rootUrl && !files) {\r\n return;\r\n }\r\n\r\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"CubeTexture\";\r\n }\r\n\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n * @param onError callback called if there was an error during the loading process (defaults to null)\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param delayLoad defines if the texture should be loaded now (false by default)\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param buffer the buffer to use instead of loading from the url\r\n */\r\n public updateURL(\r\n url: string,\r\n forcedExtension: Nullable<string> = null,\r\n onLoad: Nullable<() => void> = null,\r\n prefiltered: boolean = false,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n extensions: Nullable<string[]> = null,\r\n delayLoad = false,\r\n files: Nullable<string[]> = null,\r\n buffer: Nullable<ArrayBufferView> = null\r\n ): void {\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\r\n const isDDS = extension.indexOf(\".dds\") === 0;\r\n const isEnv = extension.indexOf(\".env\") === 0;\r\n const isBasis = extension.indexOf(\".basis\") === 0;\r\n\r\n if (isEnv) {\r\n this.gammaSpace = false;\r\n this._prefiltered = false;\r\n this.anisotropicFilteringLevel = 1;\r\n } else {\r\n this._prefiltered = prefiltered;\r\n\r\n if (prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n\r\n if (files) {\r\n this._files = files;\r\n } else {\r\n if (!isBasis && !isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n\r\n this._files = this._files || [];\r\n this._files.length = 0;\r\n\r\n if (extensions) {\r\n for (let index = 0; index < extensions.length; index++) {\r\n this._files.push(url + extensions[index]);\r\n }\r\n this._extensions = extensions;\r\n }\r\n }\r\n\r\n this._buffer = buffer;\r\n\r\n if (delayLoad) {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n this._delayedOnLoad = onLoad;\r\n this._delayedOnError = onError;\r\n } else {\r\n this._loadTexture(onLoad, onError);\r\n }\r\n }\r\n\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n public override delayLoad(forcedExtension?: string): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\r\n }\r\n\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n public override getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\r\n }\r\n\r\n this._textureMatrix = value;\r\n\r\n if (!this.getScene()?.useRightHandedSystem) {\r\n return;\r\n }\r\n\r\n const scale = TmpVectors.Vector3[0];\r\n const quat = TmpVectors.Quaternion[0];\r\n const trans = TmpVectors.Vector3[1];\r\n\r\n this._textureMatrix.decompose(scale, quat, trans);\r\n\r\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\r\n quat.w *= -1;\r\n\r\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public override getRefractionTextureMatrix(): Matrix {\r\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\r\n }\r\n\r\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\r\n const scene = this.getScene();\r\n const oldTexture = this._texture;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\r\n\r\n const onLoadProcessing = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (oldTexture) {\r\n oldTexture.dispose();\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n this._loadingError = true;\r\n this._errorObject = { message, exception };\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\r\n };\r\n\r\n if (!this._texture) {\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\r\n this.url,\r\n scene,\r\n this._lodScale,\r\n this._lodOffset,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n this._createPolynomials\r\n );\r\n } else {\r\n this._texture = this._getEngine()!.createCubeTexture(\r\n this.url,\r\n scene,\r\n this._files,\r\n this._noMipmap,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n false,\r\n this._lodScale,\r\n this._lodOffset,\r\n null,\r\n this._loaderOptions,\r\n !!this._useSRGBBuffer,\r\n this._buffer\r\n );\r\n }\r\n\r\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoadProcessing());\r\n } else {\r\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let prefiltered: boolean = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(\r\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\r\n scene,\r\n parsedTexture.extensions,\r\n false,\r\n parsedTexture.files || null,\r\n null,\r\n null,\r\n undefined,\r\n prefiltered,\r\n parsedTexture.forcedExtension\r\n );\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedTexture.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n public override clone(): CubeTexture {\r\n let uniqueId = 0;\r\n\r\n const newCubeTexture = SerializationHelper.Clone(() => {\r\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n\r\n return cubeTexture;\r\n }, this);\r\n\r\n newCubeTexture.uniqueId = uniqueId;\r\n\r\n return newCubeTexture;\r\n }\r\n}\r\n\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\r\n"]}
|
|
1
|
+
{"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,yDAAyD,CAAC;AAoDjE,gIAAgI;AAChI,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IA2BxC;;;;;OAKG;IACH,IAAW,eAAe,CAAC,KAAc;QACrC,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/D,OAAO;QACX,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,uBAAuB,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;IACD;;;OAGG;IAEH,IAAW,eAAe;QACtB,OA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I,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;YAEhC,OAAO,WAAW,CAAC;QACvB,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEnC,kEAAkE;QAClE,IAAI,sBAAsB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACpD,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,CAAC;QACpD,CAAC;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAngBU;IADN,SAAS,EAAE;wCACO;AAQZ;IADN,kBAAkB,EAAE;wDACuB;AAyB5C;IADC,kBAAkB,EAAE;kDAGpB;AAQD;IADC,SAAS,CAAC,WAAW,CAAC;4CAItB;AAmBM;IADN,SAAS,CAAC,OAAO,CAAC;2CACsB;AAG/B;IADT,SAAS,CAAC,iBAAiB,CAAC;qDACuB;AAU5C;IADP,SAAS,CAAC,YAAY,CAAC;gDACuB;AAGvC;IADP,iBAAiB,CAAC,eAAe,CAAC;mDACJ;AAGvB;IADP,iBAAiB,CAAC,yBAAyB,CAAC;6DACW;AAib5D,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC;AAC/C,6CAA6C;AAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport { type AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\nimport \"../../Engines/AbstractEngine/abstractEngine.cubeTexture\";\r\n\r\n/**\r\n * Defines the available options when creating a cube texture\r\n */\r\nexport interface ICubeTextureCreationOptions {\r\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\r\n extensions?: string[];\r\n\r\n /** noMipmap defines if mipmaps should be created or not */\r\n noMipmap?: boolean;\r\n\r\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\r\n files?: string[];\r\n\r\n /** buffer to load instead of loading the data from the url */\r\n buffer?: ArrayBufferView;\r\n\r\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\r\n onLoad?: () => void;\r\n\r\n /** onError defines a callback triggered in case of error during load */\r\n onError?: (message?: string, exception?: any) => void;\r\n\r\n /** format defines the internal format to use for the texture once loaded */\r\n format?: number;\r\n\r\n /** prefiltered defines whether or not the texture is created from prefiltered data */\r\n prefiltered?: boolean;\r\n\r\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\r\n forcedExtension?: any;\r\n\r\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\r\n createPolynomials?: boolean;\r\n\r\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\r\n lodScale?: number;\r\n\r\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\r\n lodOffset?: number;\r\n\r\n /** loaderOptions options to be passed to the loader */\r\n loaderOptions?: any;\r\n\r\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\r\n useSRGBBuffer?: boolean;\r\n\r\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\r\n sphericalPolynomialTargetSize?: number;\r\n}\r\n\r\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\nconst DefaultLodScale = 0.8;\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nexport class CubeTexture extends BaseTexture {\r\n private _delayedOnLoad: Nullable<() => void>;\r\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\r\n private _lodScale: number;\r\n private _lodOffset: number;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\r\n\r\n /**\r\n * The url of the texture\r\n */\r\n @serialize()\r\n public url: string;\r\n\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\r\n */\r\n @serializeAsVector3()\r\n public boundingBoxPosition = Vector3.Zero();\r\n\r\n private _boundingBoxSize: Vector3;\r\n\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n public set boundingBoxSize(value: Vector3) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\r\n */\r\n @serializeAsVector3()\r\n public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n @serialize(\"rotationY\")\r\n public set rotationY(value: number) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n }\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n public get rotationY(): number {\r\n return this._rotationY;\r\n }\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public override get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n private _noMipmap: boolean;\r\n\r\n /** @internal */\r\n @serialize(\"files\")\r\n public _files: Nullable<string[]> = null;\r\n\r\n @serialize(\"forcedExtension\")\r\n protected _forcedExtension: Nullable<string> = null;\r\n\r\n /**\r\n * Gets the forced extension (if any)\r\n */\r\n public get forcedExtension(): Nullable<string> {\r\n return this._forcedExtension;\r\n }\r\n\r\n @serialize(\"extensions\")\r\n private _extensions: Nullable<string[]> = null;\r\n\r\n @serializeAsMatrix(\"textureMatrix\")\r\n private _textureMatrix: Matrix;\r\n\r\n @serializeAsMatrix(\"textureMatrixRefraction\")\r\n private _textureMatrixRefraction: Matrix = new Matrix();\r\n\r\n private _format: number;\r\n private _createPolynomials: boolean;\r\n private _loaderOptions: any;\r\n private _useSRGBBuffer?: boolean;\r\n private _buffer: Nullable<ArrayBufferView> = null;\r\n\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\r\n let rootUrlKey = \"\";\r\n\r\n for (const url of files) {\r\n rootUrlKey += url;\r\n }\r\n\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n }\r\n\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @returns the prefiltered texture\r\n */\r\n public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true) {\r\n const oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n\r\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n\r\n scene.useDelayedTextureLoading = oldValue;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param sceneOrEngine defines the scene or engine the texture is attached to\r\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\r\n * @returns the cube texture\r\n */\r\n constructor(\r\n rootUrl: string,\r\n sceneOrEngine: Scene | AbstractEngine,\r\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\r\n noMipmap: boolean = false,\r\n files: Nullable<string[]> = null,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n prefiltered = false,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = DefaultLodScale,\r\n lodOffset: number = 0,\r\n loaderOptions?: any,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = rootUrl;\r\n this.url = rootUrl;\r\n this._noMipmap = noMipmap;\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this.coordinatesMode = Texture.CUBIC_MODE;\r\n\r\n let extensions: Nullable<string[]>;\r\n let buffer: Nullable<ArrayBufferView> = null;\r\n\r\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\r\n extensions = extensionsOrOptions.extensions ?? null;\r\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\r\n files = extensionsOrOptions.files ?? null;\r\n buffer = extensionsOrOptions.buffer ?? null;\r\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\r\n prefiltered = extensionsOrOptions.prefiltered ?? false;\r\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\r\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\r\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\r\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\r\n this._loaderOptions = extensionsOrOptions.loaderOptions;\r\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\r\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\r\n onLoad = extensionsOrOptions.onLoad ?? null;\r\n onError = extensionsOrOptions.onError ?? null;\r\n } else {\r\n this._noMipmap = noMipmap;\r\n this._format = format;\r\n this._createPolynomials = createPolynomials;\r\n extensions = extensionsOrOptions;\r\n this._loaderOptions = loaderOptions;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._lodScale = lodScale;\r\n this._lodOffset = lodOffset;\r\n }\r\n\r\n if (!rootUrl && !files) {\r\n return;\r\n }\r\n\r\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"CubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"CubeTexture\";\r\n }\r\n\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n * @param onError callback called if there was an error during the loading process (defaults to null)\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param delayLoad defines if the texture should be loaded now (false by default)\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param buffer the buffer to use instead of loading from the url\r\n */\r\n public updateURL(\r\n url: string,\r\n forcedExtension: Nullable<string> = null,\r\n onLoad: Nullable<() => void> = null,\r\n prefiltered: boolean = false,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n extensions: Nullable<string[]> = null,\r\n delayLoad = false,\r\n files: Nullable<string[]> = null,\r\n buffer: Nullable<ArrayBufferView> = null\r\n ): void {\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\r\n const isDDS = extension.indexOf(\".dds\") === 0;\r\n const isEnv = extension.indexOf(\".env\") === 0;\r\n const isBasis = extension.indexOf(\".basis\") === 0;\r\n\r\n if (isEnv) {\r\n this.gammaSpace = false;\r\n this._prefiltered = false;\r\n this.anisotropicFilteringLevel = 1;\r\n } else {\r\n this._prefiltered = prefiltered;\r\n\r\n if (prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n\r\n if (files) {\r\n this._files = files;\r\n } else {\r\n if (!isBasis && !isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n\r\n this._files = this._files || [];\r\n this._files.length = 0;\r\n\r\n if (extensions) {\r\n for (let index = 0; index < extensions.length; index++) {\r\n this._files.push(url + extensions[index]);\r\n }\r\n this._extensions = extensions;\r\n }\r\n }\r\n\r\n this._buffer = buffer;\r\n\r\n if (delayLoad) {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n this._delayedOnLoad = onLoad;\r\n this._delayedOnError = onError;\r\n } else {\r\n this._loadTexture(onLoad, onError);\r\n }\r\n }\r\n\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n public override delayLoad(forcedExtension?: string): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\r\n }\r\n\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n public override getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\r\n }\r\n\r\n this._textureMatrix = value;\r\n\r\n if (!this.getScene()?.useRightHandedSystem) {\r\n return;\r\n }\r\n\r\n const scale = TmpVectors.Vector3[0];\r\n const quat = TmpVectors.Quaternion[0];\r\n const trans = TmpVectors.Vector3[1];\r\n\r\n this._textureMatrix.decompose(scale, quat, trans);\r\n\r\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\r\n quat.w *= -1;\r\n\r\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public override getRefractionTextureMatrix(): Matrix {\r\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\r\n }\r\n\r\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\r\n const scene = this.getScene();\r\n const oldTexture = this._texture;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\r\n\r\n const onLoadProcessing = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (oldTexture) {\r\n oldTexture.dispose();\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n this._loadingError = true;\r\n this._errorObject = { message, exception };\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\r\n };\r\n\r\n if (!this._texture) {\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\r\n this.url,\r\n scene,\r\n this._lodScale,\r\n this._lodOffset,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n this._createPolynomials\r\n );\r\n } else {\r\n this._texture = this._getEngine()!.createCubeTexture(\r\n this.url,\r\n scene,\r\n this._files,\r\n this._noMipmap,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n false,\r\n this._lodScale,\r\n this._lodOffset,\r\n null,\r\n this._loaderOptions,\r\n !!this._useSRGBBuffer,\r\n this._buffer\r\n );\r\n }\r\n\r\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoadProcessing());\r\n } else {\r\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let prefiltered: boolean = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(\r\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\r\n scene,\r\n parsedTexture.extensions,\r\n false,\r\n parsedTexture.files || null,\r\n null,\r\n null,\r\n undefined,\r\n prefiltered,\r\n parsedTexture.forcedExtension\r\n );\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n\r\n // Animations\r\n if (parsedTexture.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedTexture.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n public override clone(): CubeTexture {\r\n let uniqueId = 0;\r\n\r\n // Save the irradianceTexture before cloning. The irradianceTexture is\r\n // stored on the InternalTexture (_texture._irradianceTexture), which may\r\n // be shared between the source and clone when loaded from cache.\r\n // BaseTexture.clone() returns null, so CopySource sets the shared\r\n // irradianceTexture to null, losing it on both the original and the clone.\r\n const savedIrradianceTexture = this.irradianceTexture;\r\n\r\n const newCubeTexture = SerializationHelper.Clone(() => {\r\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n\r\n return cubeTexture;\r\n }, this);\r\n\r\n newCubeTexture.uniqueId = uniqueId;\r\n\r\n // Restore the irradianceTexture if it was cleared during cloning.\r\n if (savedIrradianceTexture && !this.irradianceTexture) {\r\n this.irradianceTexture = savedIrradianceTexture;\r\n }\r\n\r\n return newCubeTexture;\r\n }\r\n}\r\n\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\r\n"]}
|
package/Meshes/mesh.js
CHANGED
|
@@ -4110,8 +4110,14 @@ export class Mesh extends AbstractMesh {
|
|
|
4110
4110
|
}
|
|
4111
4111
|
}
|
|
4112
4112
|
}
|
|
4113
|
+
// Preserve the caller's first mesh for naming and property copying,
|
|
4114
|
+
// since sorting below may reorder the array.
|
|
4115
|
+
const source = meshes[0];
|
|
4113
4116
|
if (multiMultiMaterials) {
|
|
4114
4117
|
subdivideWithSubMeshes = false;
|
|
4118
|
+
// Sort meshes by material so that meshes sharing the same material are adjacent.
|
|
4119
|
+
// This produces contiguous index ranges per material, enabling submesh consolidation below.
|
|
4120
|
+
meshes.sort((a, b) => (a.material?.uniqueId ?? -1) - (b.material?.uniqueId ?? -1));
|
|
4115
4121
|
}
|
|
4116
4122
|
const materialArray = new Array();
|
|
4117
4123
|
const materialIndexArray = new Array();
|
|
@@ -4168,13 +4174,34 @@ export class Mesh extends AbstractMesh {
|
|
|
4168
4174
|
}
|
|
4169
4175
|
}
|
|
4170
4176
|
}
|
|
4171
|
-
|
|
4177
|
+
// Consolidate consecutive submesh entries that share the same material and
|
|
4178
|
+
// have contiguous index ranges. Same-material entries are not guaranteed to
|
|
4179
|
+
// be gap-free, so only merge when the next range starts exactly where the
|
|
4180
|
+
// current one ends.
|
|
4181
|
+
if (multiMultiMaterials && indiceArray.length > 1) {
|
|
4182
|
+
let writeIdx = 0;
|
|
4183
|
+
for (let readIdx = 1; readIdx < indiceArray.length; readIdx++) {
|
|
4184
|
+
const previousIndice = indiceArray[writeIdx];
|
|
4185
|
+
const currentIndice = indiceArray[readIdx];
|
|
4186
|
+
if (materialIndexArray[readIdx] === materialIndexArray[writeIdx] && previousIndice.start + previousIndice.count === currentIndice.start) {
|
|
4187
|
+
// Extend the previous entry only when this range is contiguous
|
|
4188
|
+
previousIndice.count += currentIndice.count;
|
|
4189
|
+
}
|
|
4190
|
+
else {
|
|
4191
|
+
writeIdx++;
|
|
4192
|
+
indiceArray[writeIdx] = currentIndice;
|
|
4193
|
+
materialIndexArray[writeIdx] = materialIndexArray[readIdx];
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
indiceArray.length = writeIdx + 1;
|
|
4197
|
+
materialIndexArray.length = writeIdx + 1;
|
|
4198
|
+
}
|
|
4172
4199
|
const getVertexDataFromMesh = (mesh) => {
|
|
4173
4200
|
const wm = mesh.computeWorldMatrix(true);
|
|
4174
4201
|
const vertexData = VertexData.ExtractFromMesh(mesh, false, false);
|
|
4175
4202
|
return { vertexData, transform: wm };
|
|
4176
4203
|
};
|
|
4177
|
-
const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(
|
|
4204
|
+
const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(meshes[0]);
|
|
4178
4205
|
if (isAsync) {
|
|
4179
4206
|
yield;
|
|
4180
4207
|
}
|