@babylonjs/core 7.27.0 → 7.27.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.
Files changed (144) hide show
  1. package/Animations/animationGroup.d.ts +2 -2
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Audio/audioSceneComponent.d.ts +5 -9
  4. package/Audio/audioSceneComponent.js.map +1 -1
  5. package/Bones/skeleton.d.ts +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +2 -0
  8. package/Cameras/camera.js +2 -0
  9. package/Cameras/camera.js.map +1 -1
  10. package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -0
  11. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/{abstractScene.d.ts → IAssetContainer.d.ts} +33 -6
  15. package/IAssetContainer.js +2 -0
  16. package/IAssetContainer.js.map +1 -0
  17. package/Layers/effectLayerSceneComponent.d.ts +6 -6
  18. package/Layers/effectLayerSceneComponent.js +3 -3
  19. package/Layers/effectLayerSceneComponent.js.map +1 -1
  20. package/Layers/glowLayer.d.ts +3 -3
  21. package/Layers/glowLayer.js +2 -2
  22. package/Layers/glowLayer.js.map +1 -1
  23. package/Layers/highlightLayer.d.ts +3 -3
  24. package/Layers/highlightLayer.js +2 -2
  25. package/Layers/highlightLayer.js.map +1 -1
  26. package/Layers/layerSceneComponent.d.ts +5 -5
  27. package/Layers/layerSceneComponent.js.map +1 -1
  28. package/LensFlares/lensFlareSystemSceneComponent.d.ts +6 -6
  29. package/LensFlares/lensFlareSystemSceneComponent.js +6 -6
  30. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  31. package/Lights/Shadows/shadowGeneratorSceneComponent.d.ts +3 -3
  32. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -1
  34. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  35. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +2 -2
  36. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  37. package/Materials/Textures/baseTexture.d.ts +2 -2
  38. package/Materials/Textures/baseTexture.js.map +1 -1
  39. package/Materials/effectRenderer.d.ts +1 -0
  40. package/Materials/effectRenderer.js +2 -0
  41. package/Materials/effectRenderer.js.map +1 -1
  42. package/Materials/material.d.ts +2 -2
  43. package/Materials/material.decalMapConfiguration.d.ts +1 -1
  44. package/Materials/material.decalMapConfiguration.js +1 -1
  45. package/Materials/material.decalMapConfiguration.js.map +1 -1
  46. package/Materials/material.js.map +1 -1
  47. package/Materials/shaderMaterial.d.ts +5 -0
  48. package/Materials/shaderMaterial.js +7 -0
  49. package/Materials/shaderMaterial.js.map +1 -1
  50. package/Maths/math.color.d.ts +20 -0
  51. package/Maths/math.color.js +41 -12
  52. package/Maths/math.color.js.map +1 -1
  53. package/Meshes/Builders/greasedLineBuilder.d.ts +16 -0
  54. package/Meshes/Builders/greasedLineBuilder.js +1 -1
  55. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  56. package/Meshes/Builders/groundBuilder.d.ts +1 -0
  57. package/Meshes/Builders/groundBuilder.js +2 -2
  58. package/Meshes/Builders/groundBuilder.js.map +1 -1
  59. package/Meshes/GreasedLine/greasedLineBaseMesh.js +1 -1
  60. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  61. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  62. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  63. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  64. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  65. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +3 -0
  66. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +86 -1
  67. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  68. package/Meshes/Node/Blocks/Sources/nullBlock.d.ts +4 -0
  69. package/Meshes/Node/Blocks/Sources/nullBlock.js +8 -0
  70. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  71. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +13 -0
  72. package/Meshes/Node/Blocks/Sources/planeBlock.js +41 -3
  73. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  74. package/Meshes/Node/Blocks/debugBlock.js +1 -1
  75. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  76. package/Meshes/Node/Blocks/geometryElbowBlock.js +1 -1
  77. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  78. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +4 -0
  79. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +47 -1
  80. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  81. package/Meshes/geometry.d.ts +2 -2
  82. package/Meshes/geometry.js.map +1 -1
  83. package/Meshes/mesh.d.ts +7 -0
  84. package/Meshes/mesh.js +15 -0
  85. package/Meshes/mesh.js.map +1 -1
  86. package/Meshes/meshUVSpaceRenderer.d.ts +3 -2
  87. package/Meshes/meshUVSpaceRenderer.js +15 -3
  88. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  89. package/Misc/greasedLineTools.d.ts +3 -1
  90. package/Misc/greasedLineTools.js +17 -2
  91. package/Misc/greasedLineTools.js.map +1 -1
  92. package/Misc/index.d.ts +2 -0
  93. package/Misc/index.js +2 -0
  94. package/Misc/index.js.map +1 -1
  95. package/Misc/screenshotTools.js +3 -2
  96. package/Misc/screenshotTools.js.map +1 -1
  97. package/Misc/textureTools.js +20 -4
  98. package/Misc/textureTools.js.map +1 -1
  99. package/Morph/morphTargetManager.d.ts +2 -2
  100. package/Morph/morphTargetManager.js.map +1 -1
  101. package/PostProcesses/postProcess.d.ts +2 -2
  102. package/PostProcesses/postProcess.js.map +1 -1
  103. package/Probes/reflectionProbe.d.ts +5 -5
  104. package/Probes/reflectionProbe.js +3 -3
  105. package/Probes/reflectionProbe.js.map +1 -1
  106. package/Rendering/fluidRenderer/fluidRenderer.d.ts +2 -2
  107. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  108. package/Rendering/prePassRendererSceneComponent.d.ts +2 -2
  109. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  110. package/Rendering/subSurfaceSceneComponent.d.ts +2 -2
  111. package/Rendering/subSurfaceSceneComponent.js.map +1 -1
  112. package/Shaders/lod.fragment.js +2 -2
  113. package/Shaders/lod.fragment.js.map +1 -1
  114. package/Shaders/lodCube.fragment.js +2 -2
  115. package/Shaders/lodCube.fragment.js.map +1 -1
  116. package/Shaders/spriteMap.fragment.js +18 -6
  117. package/Shaders/spriteMap.fragment.js.map +1 -1
  118. package/Shaders/spriteMap.vertex.js +1 -1
  119. package/Shaders/spriteMap.vertex.js.map +1 -1
  120. package/ShadersWGSL/lod.fragment.d.ts +5 -0
  121. package/ShadersWGSL/lod.fragment.js +11 -0
  122. package/ShadersWGSL/lod.fragment.js.map +1 -0
  123. package/ShadersWGSL/lodCube.fragment.d.ts +5 -0
  124. package/ShadersWGSL/lodCube.fragment.js +30 -0
  125. package/ShadersWGSL/lodCube.fragment.js.map +1 -0
  126. package/Sprites/spriteMap.d.ts +16 -0
  127. package/Sprites/spriteMap.js +17 -0
  128. package/Sprites/spriteMap.js.map +1 -1
  129. package/assetContainer.d.ts +143 -3
  130. package/assetContainer.js +129 -8
  131. package/assetContainer.js.map +1 -1
  132. package/index.d.ts +0 -1
  133. package/index.js +0 -1
  134. package/index.js.map +1 -1
  135. package/node.d.ts +2 -2
  136. package/node.js.map +1 -1
  137. package/package.json +1 -1
  138. package/scene.d.ts +103 -14
  139. package/scene.js +170 -71
  140. package/scene.js.map +1 -1
  141. package/sceneComponent.d.ts +3 -3
  142. package/sceneComponent.js.map +1 -1
  143. package/abstractScene.js +0 -117
  144. package/abstractScene.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"spriteMap.js","sourceRoot":"","sources":["../../../../dev/core/src/Sprites/spriteMap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,+BAA+B,CAAC;AACvC,OAAO,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,gCAA+B;AA6EnD;;GAEG;AACH,MAAM,OAAO,SAAS;IAgBlB,kDAAkD;IAClD,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ,CAAC,CAAU;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ,CAAC,CAAU;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,2BAA2B;IAC3B,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,2BAA2B;IAC3B,IAAW,YAAY,CAAC,CAAa;QACjC,M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AC,KAAK,CAAC,MAAM,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACzC,MAAM,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACzB;YACD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC,CAAC;QACF,GAAG,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAC1B,EAAE,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import type { IDisposable, Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { ISpriteJSONSprite, ISpriteJSONAtlas } from \"./ISprites\";\r\nimport { Effect } from \"../Materials/effect\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport \"../Shaders/spriteMap.fragment\";\r\nimport \"../Shaders/spriteMap.vertex\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Defines the basic options interface of a SpriteMap\r\n */\r\nexport interface ISpriteMapOptions {\r\n /**\r\n * Vector2 of the number of cells in the grid.\r\n */\r\n stageSize?: Vector2;\r\n\r\n /**\r\n * Vector2 of the size of the output plane in World Units.\r\n */\r\n outputSize?: Vector2;\r\n\r\n /**\r\n * Vector3 of the position of the output plane in World Units.\r\n */\r\n outputPosition?: Vector3;\r\n\r\n /**\r\n * Vector3 of the rotation of the output plane.\r\n */\r\n outputRotation?: Vector3;\r\n\r\n /**\r\n * number of layers that the system will reserve in resources.\r\n */\r\n layerCount?: number;\r\n\r\n /**\r\n * number of max animation frames a single cell will reserve in resources.\r\n */\r\n maxAnimationFrames?: number;\r\n\r\n /**\r\n * number cell index of the base tile when the system compiles.\r\n */\r\n baseTile?: number;\r\n\r\n /**\r\n * boolean flip the sprite after its been repositioned by the framing data.\r\n */\r\n flipU?: boolean;\r\n\r\n /**\r\n * Vector3 scalar of the global RGB values of the SpriteMap.\r\n */\r\n colorMultiply?: Vector3;\r\n}\r\n\r\n/**\r\n * Defines the IDisposable interface in order to be cleanable from resources.\r\n */\r\nexport interface ISpriteMap extends IDisposable {\r\n /**\r\n * String name of the SpriteMap.\r\n */\r\n name: string;\r\n\r\n /**\r\n * The JSON Array file from a https://www.codeandweb.com/texturepacker export. Or similar structure.\r\n */\r\n atlasJSON: ISpriteJSONAtlas;\r\n\r\n /**\r\n * Texture of the SpriteMap.\r\n */\r\n spriteSheet: Texture;\r\n\r\n /**\r\n * The parameters to initialize the SpriteMap with.\r\n */\r\n options: ISpriteMapOptions;\r\n}\r\n\r\n/**\r\n * Class used to manage a grid restricted sprite deployment on an Output plane.\r\n */\r\nexport class SpriteMap implements ISpriteMap {\r\n /** The Name of the spriteMap */\r\n public name: string;\r\n\r\n /** The JSON file with the frame and meta data */\r\n public atlasJSON: ISpriteJSONAtlas;\r\n\r\n /** The systems Sprite Sheet Texture */\r\n public spriteSheet: Texture;\r\n\r\n /** Arguments passed with the Constructor */\r\n public options: ISpriteMapOptions;\r\n\r\n /** Public Sprite Storage array, parsed from atlasJSON */\r\n public sprites: Array<ISpriteJSONSprite>;\r\n\r\n /** Returns the Number of Sprites in the System */\r\n public get spriteCount(): number {\r\n return this.sprites.length;\r\n }\r\n\r\n /** Returns the Position of Output Plane*/\r\n public get position(): Vector3 {\r\n return this._output.position;\r\n }\r\n\r\n /** Returns the Position of Output Plane*/\r\n public set position(v: Vector3) {\r\n this._output.position = v;\r\n }\r\n\r\n /** Returns the Rotation of Output Plane*/\r\n public get rotation(): Vector3 {\r\n return this._output.rotation;\r\n }\r\n\r\n /** Returns the Rotation of Output Plane*/\r\n public set rotation(v: Vector3) {\r\n this._output.rotation = v;\r\n }\r\n\r\n /** Sets the AnimationMap*/\r\n public get animationMap() {\r\n return this._animationMap;\r\n }\r\n\r\n /** Sets the AnimationMap*/\r\n public set animationMap(v: RawTexture) {\r\n const buffer = v!._texture!._bufferView;\r\n const am = this._createTileAnimationBuffer(buffer);\r\n this._animationMap.dispose();\r\n this._animationMap = am;\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n }\r\n\r\n /** Scene that the SpriteMap was created in */\r\n private _scene: Scene;\r\n\r\n /** Texture Buffer of Float32 that holds tile frame data*/\r\n private _frameMap: RawTexture;\r\n\r\n /** Texture Buffers of Float32 that holds tileMap data*/\r\n private _tileMaps: RawTexture[];\r\n\r\n /** Texture Buffer of Float32 that holds Animation Data*/\r\n private _animationMap: RawTexture;\r\n\r\n /** Custom ShaderMaterial Central to the System*/\r\n private _material: ShaderMaterial;\r\n\r\n /** Custom ShaderMaterial Central to the System*/\r\n private _output: Mesh;\r\n\r\n /** Systems Time Ticker*/\r\n private _time: number;\r\n\r\n /**\r\n * Creates a new SpriteMap\r\n * @param name defines the SpriteMaps Name\r\n * @param atlasJSON is the JSON file that controls the Sprites Frames and Meta\r\n * @param spriteSheet is the Texture that the Sprites are on.\r\n * @param options a basic deployment configuration\r\n * @param scene The Scene that the map is deployed on\r\n */\r\n constructor(name: string, atlasJSON: ISpriteJSONAtlas, spriteSheet: Texture, options: ISpriteMapOptions, scene: Scene) {\r\n this.name = name;\r\n this.sprites = [];\r\n this.atlasJSON = atlasJSON;\r\n this.sprites = this.atlasJSON[\"frames\"];\r\n this.spriteSheet = spriteSheet;\r\n\r\n /**\r\n * Run through the options and set what ever defaults are needed that where not declared.\r\n */\r\n this.options = options;\r\n options.stageSize = options.stageSize || new Vector2(1, 1);\r\n options.outputSize = options.outputSize || options.stageSize;\r\n options.outputPosition = options.outputPosition || Vector3.Zero();\r\n options.outputRotation = options.outputRotation || Vector3.Zero();\r\n options.layerCount = options.layerCount || 1;\r\n options.maxAnimationFrames = options.maxAnimationFrames || 0;\r\n options.baseTile = options.baseTile || 0;\r\n options.flipU = options.flipU || false;\r\n options.colorMultiply = options.colorMultiply || new Vector3(1, 1, 1);\r\n\r\n this._scene = scene;\r\n\r\n this._frameMap = this._createFrameBuffer();\r\n\r\n this._tileMaps = new Array();\r\n for (let i = 0; i < options.layerCount; i++) {\r\n this._tileMaps.push(this._createTileBuffer(null, i));\r\n }\r\n\r\n this._animationMap = this._createTileAnimationBuffer(null);\r\n\r\n const defines = [];\r\n defines.push(\"#define LAYERS \" + options.layerCount);\r\n\r\n if (options.flipU) {\r\n defines.push(\"#define FLIPU\");\r\n }\r\n\r\n defines.push(`#define MAX_ANIMATION_FRAMES ${options.maxAnimationFrames}.0`);\r\n\r\n const shaderString: string = Effect.ShadersStore[\"spriteMapPixelShader\"];\r\n\r\n let layerSampleString: string;\r\n if (!scene.getEngine()._features.supportSwitchCaseInShader) {\r\n layerSampleString = \"\";\r\n for (let i = 0; i < options.layerCount; i++) {\r\n layerSampleString += `if (${i} == i) { frameID = texture2D(tileMaps[${i}], (tileID + 0.5) / stageSize, 0.).x; }`;\r\n }\r\n } else {\r\n layerSampleString = \"switch(i) {\";\r\n for (let i = 0; i < options.layerCount; i++) {\r\n layerSampleString += \"case \" + i + \" : frameID = texture(tileMaps[\" + i + \"], (tileID + 0.5) / stageSize, 0.).x;\";\r\n layerSampleString += \"break;\";\r\n }\r\n layerSampleString += \"}\";\r\n }\r\n\r\n Effect.ShadersStore[\"spriteMap\" + this.name + \"PixelShader\"] = shaderString.replace(\"#define LAYER_ID_SWITCH\", layerSampleString);\r\n\r\n this._material = new ShaderMaterial(\r\n \"spriteMap:\" + this.name,\r\n this._scene,\r\n {\r\n vertex: \"spriteMap\",\r\n fragment: \"spriteMap\" + this.name,\r\n },\r\n {\r\n defines,\r\n attributes: [\"position\", \"normal\", \"uv\"],\r\n uniforms: [\"worldViewProjection\", \"time\", \"stageSize\", \"outputSize\", \"spriteMapSize\", \"spriteCount\", \"time\", \"colorMul\", \"mousePosition\", \"curTile\", \"flipU\"],\r\n samplers: [\"spriteSheet\", \"frameMap\", \"tileMaps\", \"animationMap\"],\r\n needAlphaBlending: true,\r\n }\r\n );\r\n\r\n this._time = 0;\r\n\r\n this._material.setFloat(\"spriteCount\", this.spriteCount);\r\n this._material.setVector2(\"stageSize\", options.stageSize);\r\n this._material.setVector2(\"outputSize\", options.outputSize);\r\n this._material.setTexture(\"spriteSheet\", this.spriteSheet);\r\n this._material.setVector2(\"spriteMapSize\", new Vector2(1, 1));\r\n this._material.setVector3(\"colorMul\", options.colorMultiply);\r\n\r\n let tickSave = 0;\r\n\r\n const bindSpriteTexture = () => {\r\n if (this.spriteSheet && this.spriteSheet.isReady()) {\r\n if (this.spriteSheet._texture) {\r\n this._material.setVector2(\"spriteMapSize\", new Vector2(this.spriteSheet._texture.baseWidth || 1, this.spriteSheet._texture.baseHeight || 1));\r\n return;\r\n }\r\n }\r\n if (tickSave < 100) {\r\n setTimeout(() => {\r\n tickSave++;\r\n bindSpriteTexture();\r\n }, 100);\r\n }\r\n };\r\n\r\n bindSpriteTexture();\r\n\r\n this._material.setVector3(\"colorMul\", options.colorMultiply);\r\n this._material.setTexture(\"frameMap\", this._frameMap);\r\n this._material.setTextureArray(\"tileMaps\", this._tileMaps);\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n this._material.setFloat(\"time\", this._time);\r\n\r\n this._output = CreatePlane(name + \":output\", { size: 1, updatable: true }, scene);\r\n this._output.scaling.x = options.outputSize.x;\r\n this._output.scaling.y = options.outputSize.y;\r\n this.position = options.outputPosition;\r\n this.rotation = options.outputRotation;\r\n\r\n const obfunction = () => {\r\n this._time += this._scene.getEngine().getDeltaTime();\r\n this._material.setFloat(\"time\", this._time);\r\n };\r\n\r\n this._scene.onBeforeRenderObservable.add(obfunction);\r\n this._output.material = this._material;\r\n }\r\n\r\n /**\r\n * Returns tileID location\r\n * @returns Vector2 the cell position ID\r\n */\r\n public getTileID(): Vector2 {\r\n const p = this.getMousePosition();\r\n p.multiplyInPlace(this.options.stageSize || Vector2.Zero());\r\n p.x = Math.floor(p.x);\r\n p.y = Math.floor(p.y);\r\n return p;\r\n }\r\n\r\n /**\r\n * Gets the UV location of the mouse over the SpriteMap.\r\n * @returns Vector2 the UV position of the mouse interaction\r\n */\r\n public getMousePosition(): Vector2 {\r\n const out = this._output;\r\n const pickinfo: Nullable<PickingInfo> = this._scene.pick(this._scene.pointerX, this._scene.pointerY, (mesh) => {\r\n if (mesh !== out) {\r\n return false;\r\n }\r\n return true;\r\n });\r\n\r\n if (!pickinfo || !pickinfo.hit || !pickinfo.getTextureCoordinates) {\r\n return new Vector2(-1, -1);\r\n }\r\n\r\n const coords = pickinfo.getTextureCoordinates();\r\n if (coords) {\r\n return coords;\r\n }\r\n\r\n return new Vector2(-1, -1);\r\n }\r\n\r\n /**\r\n * Creates the \"frame\" texture Buffer\r\n * -------------------------------------\r\n * Structure of frames\r\n * \"filename\": \"Falling-Water-2.png\",\r\n * \"frame\": {\"x\":69,\"y\":103,\"w\":24,\"h\":32},\r\n * \"rotated\": true,\r\n * \"trimmed\": true,\r\n * \"spriteSourceSize\": {\"x\":4,\"y\":0,\"w\":24,\"h\":32},\r\n * \"sourceSize\": {\"w\":32,\"h\":32}\r\n * @returns RawTexture of the frameMap\r\n */\r\n private _createFrameBuffer(): RawTexture {\r\n const data = [];\r\n //Do two Passes\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n data.push(0, 0, 0, 0); //frame\r\n data.push(0, 0, 0, 0); //spriteSourceSize\r\n data.push(0, 0, 0, 0); //sourceSize, rotated, trimmed\r\n data.push(0, 0, 0, 0); //Keep it pow2 cause I\"m cool like that... it helps with sampling accuracy as well. Plus then we have 4 other parameters for future stuff.\r\n }\r\n //Second Pass\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n const f = this.sprites[i][\"frame\"];\r\n const sss = this.sprites[i][\"spriteSourceSize\"];\r\n const ss = this.sprites[i][\"sourceSize\"];\r\n const r = this.sprites[i][\"rotated\"] ? 1 : 0;\r\n const t = this.sprites[i][\"trimmed\"] ? 1 : 0;\r\n\r\n //frame\r\n data[i * 4] = f.x;\r\n data[i * 4 + 1] = f.y;\r\n data[i * 4 + 2] = f.w;\r\n data[i * 4 + 3] = f.h;\r\n //spriteSourceSize\r\n data[i * 4 + this.spriteCount * 4] = sss.x;\r\n data[i * 4 + 1 + this.spriteCount * 4] = sss.y;\r\n data[i * 4 + 3 + this.spriteCount * 4] = sss.h;\r\n //sourceSize, rotated, trimmed\r\n data[i * 4 + this.spriteCount * 8] = ss.w;\r\n data[i * 4 + 1 + this.spriteCount * 8] = ss.h;\r\n data[i * 4 + 2 + this.spriteCount * 8] = r;\r\n data[i * 4 + 3 + this.spriteCount * 8] = t;\r\n }\r\n\r\n const floatArray = new Float32Array(data);\r\n\r\n const t = RawTexture.CreateRGBATexture(floatArray, this.spriteCount, 4, this._scene, false, false, Texture.NEAREST_NEAREST, Constants.TEXTURETYPE_FLOAT);\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Creates the tileMap texture Buffer\r\n * @param buffer normally and array of numbers, or a false to generate from scratch\r\n * @param _layer indicates what layer for a logic trigger dealing with the baseTile. The system uses this\r\n * @returns RawTexture of the tileMap\r\n */\r\n private _createTileBuffer(buffer: any, _layer: number = 0): RawTexture {\r\n let data = [];\r\n const _ty = this.options.stageSize!.y || 0;\r\n const _tx = this.options.stageSize!.x || 0;\r\n\r\n if (!buffer) {\r\n let bt = this.options.baseTile;\r\n if (_layer != 0) {\r\n bt = 0;\r\n }\r\n\r\n for (let y = 0; y < _ty; y++) {\r\n for (let x = 0; x < _tx * 4; x += 4) {\r\n data.push(bt, 0, 0, 0);\r\n }\r\n }\r\n } else {\r\n data = buffer;\r\n }\r\n\r\n const floatArray = new Float32Array(data);\r\n const t = RawTexture.CreateRGBATexture(floatArray, _tx, _ty, this._scene, false, false, Texture.NEAREST_NEAREST, Constants.TEXTURETYPE_FLOAT);\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Modifies the data of the tileMaps\r\n * @param _layer is the ID of the layer you want to edit on the SpriteMap\r\n * @param pos is the iVector2 Coordinates of the Tile\r\n * @param tile The SpriteIndex of the new Tile\r\n */\r\n public changeTiles(_layer: number = 0, pos: Vector2 | Vector2[], tile: number = 0): void {\r\n const buffer = this._tileMaps[_layer]!._texture!._bufferView;\r\n if (buffer === null) {\r\n return;\r\n }\r\n\r\n let p = [];\r\n if (pos instanceof Vector2) {\r\n p.push(pos);\r\n } else {\r\n p = pos;\r\n }\r\n\r\n const _tx = this.options.stageSize!.x || 0;\r\n\r\n for (let i = 0; i < p.length; i++) {\r\n const _p = p[i];\r\n _p.x = Math.floor(_p.x);\r\n _p.y = Math.floor(_p.y);\r\n const id: number = _p.x * 4 + _p.y * (_tx * 4);\r\n (buffer as any)[id] = tile;\r\n }\r\n\r\n const t = this._createTileBuffer(buffer);\r\n this._tileMaps[_layer].dispose();\r\n this._tileMaps[_layer] = t;\r\n this._material.setTextureArray(\"tileMap\", this._tileMaps);\r\n }\r\n\r\n /**\r\n * Creates the animationMap texture Buffer\r\n * @param buffer normally and array of numbers, or a false to generate from scratch\r\n * @returns RawTexture of the animationMap\r\n */\r\n private _createTileAnimationBuffer(buffer: Nullable<ArrayBufferView>): RawTexture {\r\n const data = [];\r\n let floatArray;\r\n if (!buffer) {\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n data.push(0, 0, 0, 0);\r\n let count = 1;\r\n while (count < (this.options.maxAnimationFrames || 4)) {\r\n data.push(0, 0, 0, 0);\r\n count++;\r\n }\r\n }\r\n floatArray = new Float32Array(data);\r\n } else {\r\n floatArray = buffer;\r\n }\r\n\r\n const t = RawTexture.CreateRGBATexture(\r\n floatArray,\r\n this.spriteCount,\r\n this.options.maxAnimationFrames || 4,\r\n this._scene,\r\n false,\r\n false,\r\n Texture.NEAREST_NEAREST,\r\n Constants.TEXTURETYPE_FLOAT\r\n );\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Modifies the data of the animationMap\r\n * @param cellID is the Index of the Sprite\r\n * @param _frame is the target Animation frame\r\n * @param toCell is the Target Index of the next frame of the animation\r\n * @param time is a value between 0-1 that is the trigger for when the frame should change tiles\r\n * @param speed is a global scalar of the time variable on the map.\r\n */\r\n public addAnimationToTile(cellID: number = 0, _frame: number = 0, toCell: number = 0, time: number = 0, speed: number = 1): void {\r\n const buffer: any = this._animationMap!._texture!._bufferView;\r\n const id: number = cellID * 4 + this.spriteCount * 4 * _frame;\r\n if (!buffer) {\r\n return;\r\n }\r\n buffer[id] = toCell;\r\n buffer[id + 1] = time;\r\n buffer[id + 2] = speed;\r\n const t = this._createTileAnimationBuffer(buffer);\r\n this._animationMap.dispose();\r\n this._animationMap = t;\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n }\r\n\r\n /**\r\n * Exports the .tilemaps file\r\n */\r\n public saveTileMaps(): void {\r\n let maps = \"\";\r\n for (let i = 0; i < this._tileMaps.length; i++) {\r\n if (i > 0) {\r\n maps += \"\\n\\r\";\r\n }\r\n\r\n maps += this._tileMaps[i]!._texture!._bufferView!.toString();\r\n }\r\n const hiddenElement = document.createElement(\"a\");\r\n hiddenElement.href = \"data:octet/stream;charset=utf-8,\" + encodeURI(maps);\r\n hiddenElement.target = \"_blank\";\r\n hiddenElement.download = this.name + \".tilemaps\";\r\n hiddenElement.click();\r\n hiddenElement.remove();\r\n }\r\n\r\n /**\r\n * Imports the .tilemaps file\r\n * @param url of the .tilemaps file\r\n */\r\n public loadTileMaps(url: string): void {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\"GET\", url);\r\n\r\n const _lc = this.options!.layerCount || 0;\r\n\r\n xhr.onload = () => {\r\n const data = xhr.response.split(\"\\n\\r\");\r\n for (let i = 0; i < _lc; i++) {\r\n const d = data[i].split(\",\").map(Number);\r\n const t = this._createTileBuffer(d);\r\n this._tileMaps[i].dispose();\r\n this._tileMaps[i] = t;\r\n }\r\n this._material.setTextureArray(\"tileMap\", this._tileMaps);\r\n };\r\n xhr.send();\r\n }\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n this._output.dispose();\r\n this._material.dispose();\r\n this._animationMap.dispose();\r\n this._tileMaps.forEach((tm) => {\r\n tm.dispose();\r\n });\r\n this._frameMap.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"spriteMap.js","sourceRoot":"","sources":["../../../../dev/core/src/Sprites/spriteMap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MA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,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACzC,MAAM,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;aACzB;YACD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC,CAAC;QACF,GAAG,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAC1B,EAAE,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import type { IDisposable, Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PickingInfo } from \"../Collisions/pickingInfo\";\r\nimport type { ISpriteJSONSprite, ISpriteJSONAtlas } from \"./ISprites\";\r\nimport { Effect } from \"../Materials/effect\";\r\n\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport \"../Shaders/spriteMap.fragment\";\r\nimport \"../Shaders/spriteMap.vertex\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nexport enum SpriteMapFrameRotationDirection {\r\n CCW = 0,\r\n CW = 1,\r\n}\r\n\r\n/**\r\n * Defines the basic options interface of a SpriteMap\r\n */\r\nexport interface ISpriteMapOptions {\r\n /**\r\n * Vector2 of the number of cells in the grid.\r\n */\r\n stageSize?: Vector2;\r\n\r\n /**\r\n * Vector2 of the size of the output plane in World Units.\r\n */\r\n outputSize?: Vector2;\r\n\r\n /**\r\n * Vector3 of the position of the output plane in World Units.\r\n */\r\n outputPosition?: Vector3;\r\n\r\n /**\r\n * Vector3 of the rotation of the output plane.\r\n */\r\n outputRotation?: Vector3;\r\n\r\n /**\r\n * number of layers that the system will reserve in resources.\r\n */\r\n layerCount?: number;\r\n\r\n /**\r\n * number of max animation frames a single cell will reserve in resources.\r\n */\r\n maxAnimationFrames?: number;\r\n\r\n /**\r\n * number cell index of the base tile when the system compiles.\r\n */\r\n baseTile?: number;\r\n\r\n /**\r\n * boolean flip the sprite after its been repositioned by the framing data.\r\n */\r\n flipU?: boolean;\r\n\r\n /**\r\n * Vector3 scalar of the global RGB values of the SpriteMap.\r\n */\r\n colorMultiply?: Vector3;\r\n\r\n /**\r\n * Rotation direction of the frame by 90 degrees.\r\n * Applied when the the frame's \"rotated\" parameter is true.\r\n * Default is CCW.\r\n */\r\n frameRotationDirection?: SpriteMapFrameRotationDirection;\r\n}\r\n\r\n/**\r\n * Defines the IDisposable interface in order to be cleanable from resources.\r\n */\r\nexport interface ISpriteMap extends IDisposable {\r\n /**\r\n * String name of the SpriteMap.\r\n */\r\n name: string;\r\n\r\n /**\r\n * The JSON Array file from a https://www.codeandweb.com/texturepacker export. Or similar structure.\r\n */\r\n atlasJSON: ISpriteJSONAtlas;\r\n\r\n /**\r\n * Texture of the SpriteMap.\r\n */\r\n spriteSheet: Texture;\r\n\r\n /**\r\n * The parameters to initialize the SpriteMap with.\r\n */\r\n options: ISpriteMapOptions;\r\n}\r\n\r\n/**\r\n * Class used to manage a grid restricted sprite deployment on an Output plane.\r\n */\r\nexport class SpriteMap implements ISpriteMap {\r\n /** The Name of the spriteMap */\r\n public name: string;\r\n\r\n /** The JSON file with the frame and meta data */\r\n public atlasJSON: ISpriteJSONAtlas;\r\n\r\n /** The systems Sprite Sheet Texture */\r\n public spriteSheet: Texture;\r\n\r\n /** Arguments passed with the Constructor */\r\n public options: ISpriteMapOptions;\r\n\r\n /** Public Sprite Storage array, parsed from atlasJSON */\r\n public sprites: Array<ISpriteJSONSprite>;\r\n\r\n /** Returns the Number of Sprites in the System */\r\n public get spriteCount(): number {\r\n return this.sprites.length;\r\n }\r\n\r\n /** Returns the Position of Output Plane*/\r\n public get position(): Vector3 {\r\n return this._output.position;\r\n }\r\n\r\n /** Returns the Position of Output Plane*/\r\n public set position(v: Vector3) {\r\n this._output.position = v;\r\n }\r\n\r\n /** Returns the Rotation of Output Plane*/\r\n public get rotation(): Vector3 {\r\n return this._output.rotation;\r\n }\r\n\r\n /** Returns the Rotation of Output Plane*/\r\n public set rotation(v: Vector3) {\r\n this._output.rotation = v;\r\n }\r\n\r\n /** Sets the AnimationMap*/\r\n public get animationMap() {\r\n return this._animationMap;\r\n }\r\n\r\n /** Sets the AnimationMap*/\r\n public set animationMap(v: RawTexture) {\r\n const buffer = v!._texture!._bufferView;\r\n const am = this._createTileAnimationBuffer(buffer);\r\n this._animationMap.dispose();\r\n this._animationMap = am;\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n }\r\n\r\n /** Scene that the SpriteMap was created in */\r\n private _scene: Scene;\r\n\r\n /** Texture Buffer of Float32 that holds tile frame data*/\r\n private _frameMap: RawTexture;\r\n\r\n /** Texture Buffers of Float32 that holds tileMap data*/\r\n private _tileMaps: RawTexture[];\r\n\r\n /** Texture Buffer of Float32 that holds Animation Data*/\r\n private _animationMap: RawTexture;\r\n\r\n /** Custom ShaderMaterial Central to the System*/\r\n private _material: ShaderMaterial;\r\n\r\n /** Custom ShaderMaterial Central to the System*/\r\n private _output: Mesh;\r\n\r\n /** Systems Time Ticker*/\r\n private _time: number;\r\n\r\n /**\r\n * Creates a new SpriteMap\r\n * @param name defines the SpriteMaps Name\r\n * @param atlasJSON is the JSON file that controls the Sprites Frames and Meta\r\n * @param spriteSheet is the Texture that the Sprites are on.\r\n * @param options a basic deployment configuration\r\n * @param scene The Scene that the map is deployed on\r\n */\r\n constructor(name: string, atlasJSON: ISpriteJSONAtlas, spriteSheet: Texture, options: ISpriteMapOptions, scene: Scene) {\r\n this.name = name;\r\n this.sprites = [];\r\n this.atlasJSON = atlasJSON;\r\n this.sprites = this.atlasJSON[\"frames\"];\r\n this.spriteSheet = spriteSheet;\r\n\r\n /**\r\n * Run through the options and set what ever defaults are needed that where not declared.\r\n */\r\n this.options = options;\r\n options.stageSize = options.stageSize || new Vector2(1, 1);\r\n options.outputSize = options.outputSize || options.stageSize;\r\n options.outputPosition = options.outputPosition || Vector3.Zero();\r\n options.outputRotation = options.outputRotation || Vector3.Zero();\r\n options.layerCount = options.layerCount || 1;\r\n options.maxAnimationFrames = options.maxAnimationFrames || 0;\r\n options.baseTile = options.baseTile || 0;\r\n options.flipU = options.flipU || false;\r\n options.colorMultiply = options.colorMultiply || new Vector3(1, 1, 1);\r\n\r\n this._scene = scene;\r\n\r\n this._frameMap = this._createFrameBuffer();\r\n\r\n this._tileMaps = new Array();\r\n for (let i = 0; i < options.layerCount; i++) {\r\n this._tileMaps.push(this._createTileBuffer(null, i));\r\n }\r\n\r\n this._animationMap = this._createTileAnimationBuffer(null);\r\n\r\n const defines = [];\r\n defines.push(\"#define LAYERS \" + options.layerCount);\r\n\r\n if (options?.frameRotationDirection === SpriteMapFrameRotationDirection.CW) {\r\n defines.push(\"#define FR_CW\");\r\n }\r\n\r\n if (options.flipU) {\r\n defines.push(\"#define FLIPU\");\r\n }\r\n\r\n defines.push(`#define MAX_ANIMATION_FRAMES ${options.maxAnimationFrames}.0`);\r\n\r\n const shaderString: string = Effect.ShadersStore[\"spriteMapPixelShader\"];\r\n\r\n let layerSampleString: string;\r\n if (!scene.getEngine()._features.supportSwitchCaseInShader) {\r\n layerSampleString = \"\";\r\n for (let i = 0; i < options.layerCount; i++) {\r\n layerSampleString += `if (${i} == i) { frameID = texture2D(tileMaps[${i}], (tileID + 0.5) / stageSize, 0.).x; }`;\r\n }\r\n } else {\r\n layerSampleString = \"switch(i) {\";\r\n for (let i = 0; i < options.layerCount; i++) {\r\n layerSampleString += \"case \" + i + \" : frameID = texture(tileMaps[\" + i + \"], (tileID + 0.5) / stageSize, 0.).x;\";\r\n layerSampleString += \"break;\";\r\n }\r\n layerSampleString += \"}\";\r\n }\r\n\r\n Effect.ShadersStore[\"spriteMap\" + this.name + \"PixelShader\"] = shaderString.replace(\"#define LAYER_ID_SWITCH\", layerSampleString);\r\n\r\n this._material = new ShaderMaterial(\r\n \"spriteMap:\" + this.name,\r\n this._scene,\r\n {\r\n vertex: \"spriteMap\",\r\n fragment: \"spriteMap\" + this.name,\r\n },\r\n {\r\n defines,\r\n attributes: [\"position\", \"normal\", \"uv\"],\r\n uniforms: [\"worldViewProjection\", \"time\", \"stageSize\", \"outputSize\", \"spriteMapSize\", \"spriteCount\", \"time\", \"colorMul\", \"mousePosition\", \"curTile\", \"flipU\"],\r\n samplers: [\"spriteSheet\", \"frameMap\", \"tileMaps\", \"animationMap\"],\r\n needAlphaBlending: true,\r\n }\r\n );\r\n\r\n this._time = 0;\r\n\r\n this._material.setFloat(\"spriteCount\", this.spriteCount);\r\n this._material.setVector2(\"stageSize\", options.stageSize);\r\n this._material.setVector2(\"outputSize\", options.outputSize);\r\n this._material.setTexture(\"spriteSheet\", this.spriteSheet);\r\n this._material.setVector2(\"spriteMapSize\", new Vector2(1, 1));\r\n this._material.setVector3(\"colorMul\", options.colorMultiply);\r\n\r\n let tickSave = 0;\r\n\r\n const bindSpriteTexture = () => {\r\n if (this.spriteSheet && this.spriteSheet.isReady()) {\r\n if (this.spriteSheet._texture) {\r\n this._material.setVector2(\"spriteMapSize\", new Vector2(this.spriteSheet._texture.baseWidth || 1, this.spriteSheet._texture.baseHeight || 1));\r\n return;\r\n }\r\n }\r\n if (tickSave < 100) {\r\n setTimeout(() => {\r\n tickSave++;\r\n bindSpriteTexture();\r\n }, 100);\r\n }\r\n };\r\n\r\n bindSpriteTexture();\r\n\r\n this._material.setVector3(\"colorMul\", options.colorMultiply);\r\n this._material.setTexture(\"frameMap\", this._frameMap);\r\n this._material.setTextureArray(\"tileMaps\", this._tileMaps);\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n this._material.setFloat(\"time\", this._time);\r\n\r\n this._output = CreatePlane(name + \":output\", { size: 1, updatable: true }, scene);\r\n this._output.scaling.x = options.outputSize.x;\r\n this._output.scaling.y = options.outputSize.y;\r\n this.position = options.outputPosition;\r\n this.rotation = options.outputRotation;\r\n\r\n const obfunction = () => {\r\n this._time += this._scene.getEngine().getDeltaTime();\r\n this._material.setFloat(\"time\", this._time);\r\n };\r\n\r\n this._scene.onBeforeRenderObservable.add(obfunction);\r\n this._output.material = this._material;\r\n }\r\n\r\n /**\r\n * Returns the index of the frame for a given filename\r\n * @param name filename of the frame\r\n * @returns index of the frame\r\n */\r\n public getTileIdxByName(name: string): number {\r\n const idx = this.atlasJSON.frames.findIndex((f) => f.filename === name);\r\n return idx;\r\n }\r\n\r\n /**\r\n * Returns tileID location\r\n * @returns Vector2 the cell position ID\r\n */\r\n public getTileID(): Vector2 {\r\n const p = this.getMousePosition();\r\n p.multiplyInPlace(this.options.stageSize || Vector2.Zero());\r\n p.x = Math.floor(p.x);\r\n p.y = Math.floor(p.y);\r\n return p;\r\n }\r\n\r\n /**\r\n * Gets the UV location of the mouse over the SpriteMap.\r\n * @returns Vector2 the UV position of the mouse interaction\r\n */\r\n public getMousePosition(): Vector2 {\r\n const out = this._output;\r\n const pickinfo: Nullable<PickingInfo> = this._scene.pick(this._scene.pointerX, this._scene.pointerY, (mesh) => {\r\n if (mesh !== out) {\r\n return false;\r\n }\r\n return true;\r\n });\r\n\r\n if (!pickinfo || !pickinfo.hit || !pickinfo.getTextureCoordinates) {\r\n return new Vector2(-1, -1);\r\n }\r\n\r\n const coords = pickinfo.getTextureCoordinates();\r\n if (coords) {\r\n return coords;\r\n }\r\n\r\n return new Vector2(-1, -1);\r\n }\r\n\r\n /**\r\n * Creates the \"frame\" texture Buffer\r\n * -------------------------------------\r\n * Structure of frames\r\n * \"filename\": \"Falling-Water-2.png\",\r\n * \"frame\": {\"x\":69,\"y\":103,\"w\":24,\"h\":32},\r\n * \"rotated\": true,\r\n * \"trimmed\": true,\r\n * \"spriteSourceSize\": {\"x\":4,\"y\":0,\"w\":24,\"h\":32},\r\n * \"sourceSize\": {\"w\":32,\"h\":32}\r\n * @returns RawTexture of the frameMap\r\n */\r\n private _createFrameBuffer(): RawTexture {\r\n const data = [];\r\n //Do two Passes\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n data.push(0, 0, 0, 0); //frame\r\n data.push(0, 0, 0, 0); //spriteSourceSize\r\n data.push(0, 0, 0, 0); //sourceSize, rotated, trimmed\r\n data.push(0, 0, 0, 0); //Keep it pow2 cause I\"m cool like that... it helps with sampling accuracy as well. Plus then we have 4 other parameters for future stuff.\r\n }\r\n //Second Pass\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n const f = this.sprites[i][\"frame\"];\r\n const sss = this.sprites[i][\"spriteSourceSize\"];\r\n const ss = this.sprites[i][\"sourceSize\"];\r\n const r = this.sprites[i][\"rotated\"] ? 1 : 0;\r\n const t = this.sprites[i][\"trimmed\"] ? 1 : 0;\r\n\r\n //frame\r\n data[i * 4] = f.x;\r\n data[i * 4 + 1] = f.y;\r\n data[i * 4 + 2] = f.w;\r\n data[i * 4 + 3] = f.h;\r\n //spriteSourceSize\r\n data[i * 4 + this.spriteCount * 4] = sss.x;\r\n data[i * 4 + 1 + this.spriteCount * 4] = sss.y;\r\n data[i * 4 + 3 + this.spriteCount * 4] = sss.h;\r\n //sourceSize, rotated, trimmed\r\n data[i * 4 + this.spriteCount * 8] = ss.w;\r\n data[i * 4 + 1 + this.spriteCount * 8] = ss.h;\r\n data[i * 4 + 2 + this.spriteCount * 8] = r;\r\n data[i * 4 + 3 + this.spriteCount * 8] = t;\r\n }\r\n\r\n const floatArray = new Float32Array(data);\r\n\r\n const t = RawTexture.CreateRGBATexture(floatArray, this.spriteCount, 4, this._scene, false, false, Texture.NEAREST_NEAREST, Constants.TEXTURETYPE_FLOAT);\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Creates the tileMap texture Buffer\r\n * @param buffer normally and array of numbers, or a false to generate from scratch\r\n * @param _layer indicates what layer for a logic trigger dealing with the baseTile. The system uses this\r\n * @returns RawTexture of the tileMap\r\n */\r\n private _createTileBuffer(buffer: any, _layer: number = 0): RawTexture {\r\n let data = [];\r\n const _ty = this.options.stageSize!.y || 0;\r\n const _tx = this.options.stageSize!.x || 0;\r\n\r\n if (!buffer) {\r\n let bt = this.options.baseTile;\r\n if (_layer != 0) {\r\n bt = 0;\r\n }\r\n\r\n for (let y = 0; y < _ty; y++) {\r\n for (let x = 0; x < _tx * 4; x += 4) {\r\n data.push(bt, 0, 0, 0);\r\n }\r\n }\r\n } else {\r\n data = buffer;\r\n }\r\n\r\n const floatArray = new Float32Array(data);\r\n const t = RawTexture.CreateRGBATexture(floatArray, _tx, _ty, this._scene, false, false, Texture.NEAREST_NEAREST, Constants.TEXTURETYPE_FLOAT);\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Modifies the data of the tileMaps\r\n * @param _layer is the ID of the layer you want to edit on the SpriteMap\r\n * @param pos is the iVector2 Coordinates of the Tile\r\n * @param tile The SpriteIndex of the new Tile\r\n */\r\n public changeTiles(_layer: number = 0, pos: Vector2 | Vector2[], tile: number = 0): void {\r\n const buffer = this._tileMaps[_layer]!._texture!._bufferView;\r\n if (buffer === null) {\r\n return;\r\n }\r\n\r\n let p = [];\r\n if (pos instanceof Vector2) {\r\n p.push(pos);\r\n } else {\r\n p = pos;\r\n }\r\n\r\n const _tx = this.options.stageSize!.x || 0;\r\n\r\n for (let i = 0; i < p.length; i++) {\r\n const _p = p[i];\r\n _p.x = Math.floor(_p.x);\r\n _p.y = Math.floor(_p.y);\r\n const id: number = _p.x * 4 + _p.y * (_tx * 4);\r\n (buffer as any)[id] = tile;\r\n }\r\n\r\n const t = this._createTileBuffer(buffer);\r\n this._tileMaps[_layer].dispose();\r\n this._tileMaps[_layer] = t;\r\n this._material.setTextureArray(\"tileMap\", this._tileMaps);\r\n }\r\n\r\n /**\r\n * Creates the animationMap texture Buffer\r\n * @param buffer normally and array of numbers, or a false to generate from scratch\r\n * @returns RawTexture of the animationMap\r\n */\r\n private _createTileAnimationBuffer(buffer: Nullable<ArrayBufferView>): RawTexture {\r\n const data = [];\r\n let floatArray;\r\n if (!buffer) {\r\n for (let i = 0; i < this.spriteCount; i++) {\r\n data.push(0, 0, 0, 0);\r\n let count = 1;\r\n while (count < (this.options.maxAnimationFrames || 4)) {\r\n data.push(0, 0, 0, 0);\r\n count++;\r\n }\r\n }\r\n floatArray = new Float32Array(data);\r\n } else {\r\n floatArray = buffer;\r\n }\r\n\r\n const t = RawTexture.CreateRGBATexture(\r\n floatArray,\r\n this.spriteCount,\r\n this.options.maxAnimationFrames || 4,\r\n this._scene,\r\n false,\r\n false,\r\n Texture.NEAREST_NEAREST,\r\n Constants.TEXTURETYPE_FLOAT\r\n );\r\n\r\n return t;\r\n }\r\n\r\n /**\r\n * Modifies the data of the animationMap\r\n * @param cellID is the Index of the Sprite\r\n * @param _frame is the target Animation frame\r\n * @param toCell is the Target Index of the next frame of the animation\r\n * @param time is a value between 0-1 that is the trigger for when the frame should change tiles\r\n * @param speed is a global scalar of the time variable on the map.\r\n */\r\n public addAnimationToTile(cellID: number = 0, _frame: number = 0, toCell: number = 0, time: number = 0, speed: number = 1): void {\r\n const buffer: any = this._animationMap!._texture!._bufferView;\r\n const id: number = cellID * 4 + this.spriteCount * 4 * _frame;\r\n if (!buffer) {\r\n return;\r\n }\r\n buffer[id] = toCell;\r\n buffer[id + 1] = time;\r\n buffer[id + 2] = speed;\r\n const t = this._createTileAnimationBuffer(buffer);\r\n this._animationMap.dispose();\r\n this._animationMap = t;\r\n this._material.setTexture(\"animationMap\", this._animationMap);\r\n }\r\n\r\n /**\r\n * Exports the .tilemaps file\r\n */\r\n public saveTileMaps(): void {\r\n let maps = \"\";\r\n for (let i = 0; i < this._tileMaps.length; i++) {\r\n if (i > 0) {\r\n maps += \"\\n\\r\";\r\n }\r\n\r\n maps += this._tileMaps[i]!._texture!._bufferView!.toString();\r\n }\r\n const hiddenElement = document.createElement(\"a\");\r\n hiddenElement.href = \"data:octet/stream;charset=utf-8,\" + encodeURI(maps);\r\n hiddenElement.target = \"_blank\";\r\n hiddenElement.download = this.name + \".tilemaps\";\r\n hiddenElement.click();\r\n hiddenElement.remove();\r\n }\r\n\r\n /**\r\n * Imports the .tilemaps file\r\n * @param url of the .tilemaps file\r\n */\r\n public loadTileMaps(url: string): void {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(\"GET\", url);\r\n\r\n const _lc = this.options!.layerCount || 0;\r\n\r\n xhr.onload = () => {\r\n const data = xhr.response.split(\"\\n\\r\");\r\n for (let i = 0; i < _lc; i++) {\r\n const d = data[i].split(\",\").map(Number);\r\n const t = this._createTileBuffer(d);\r\n this._tileMaps[i].dispose();\r\n this._tileMaps[i] = t;\r\n }\r\n this._material.setTextureArray(\"tileMap\", this._tileMaps);\r\n };\r\n xhr.send();\r\n }\r\n\r\n /**\r\n * Release associated resources\r\n */\r\n public dispose(): void {\r\n this._output.dispose();\r\n this._material.dispose();\r\n this._animationMap.dispose();\r\n this._tileMaps.forEach((tm) => {\r\n tm.dispose();\r\n });\r\n this._frameMap.dispose();\r\n }\r\n}\r\n"]}
@@ -1,15 +1,155 @@
1
- import { AbstractScene } from "./abstractScene";
2
1
  import type { Scene } from "./scene";
3
2
  import { Mesh } from "./Meshes/mesh";
3
+ import { TransformNode } from "./Meshes/transformNode";
4
4
  import type { Skeleton } from "./Bones/skeleton";
5
5
  import type { AnimationGroup } from "./Animations/animationGroup";
6
6
  import type { Animatable } from "./Animations/animatable";
7
+ import { AbstractMesh } from "./Meshes/abstractMesh";
8
+ import type { MultiMaterial } from "./Materials/multiMaterial";
9
+ import type { Material } from "./Materials/material";
7
10
  import type { Nullable } from "./types";
8
11
  import type { Node } from "./node";
12
+ import { Light } from "./Lights/light";
13
+ import { Camera } from "./Cameras/camera";
14
+ import type { IParticleSystem } from "./Particles/IParticleSystem";
15
+ import type { IAssetContainer } from "./IAssetContainer";
16
+ import type { Animation } from "./Animations/animation";
17
+ import type { MorphTargetManager } from "./Morph/morphTargetManager";
18
+ import type { Geometry } from "./Meshes/geometry";
19
+ import type { AbstractActionManager } from "./Actions/abstractActionManager";
20
+ import type { BaseTexture } from "./Materials/Textures/baseTexture";
21
+ import type { PostProcess } from "./PostProcesses/postProcess";
22
+ import type { Sound } from "./Audio/sound";
23
+ import type { Layer } from "./Layers/layer";
24
+ import type { EffectLayer } from "./Layers/effectLayer";
25
+ import type { ReflectionProbe } from "./Probes/reflectionProbe";
26
+ import type { LensFlareSystem } from "./LensFlares/lensFlareSystem";
27
+ import type { ProceduralTexture } from "./Materials/Textures/Procedurals/proceduralTexture";
28
+ /**
29
+ * Root class for AssetContainer and KeepAssets
30
+ */
31
+ export declare class AbstractAssetContainer implements IAssetContainer {
32
+ /**
33
+ * Gets the list of root nodes (ie. nodes with no parent)
34
+ */
35
+ rootNodes: Node[];
36
+ /** All of the cameras added to this scene
37
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
38
+ */
39
+ cameras: Camera[];
40
+ /**
41
+ * All of the lights added to this scene
42
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
43
+ */
44
+ lights: Light[];
45
+ /**
46
+ * All of the (abstract) meshes added to this scene
47
+ */
48
+ meshes: AbstractMesh[];
49
+ /**
50
+ * The list of skeletons added to the scene
51
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
52
+ */
53
+ skeletons: Skeleton[];
54
+ /**
55
+ * All of the particle systems added to this scene
56
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
57
+ */
58
+ particleSystems: IParticleSystem[];
59
+ /**
60
+ * Gets a list of Animations associated with the scene
61
+ */
62
+ animations: Animation[];
63
+ /**
64
+ * All of the animation groups added to this scene
65
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
66
+ */
67
+ animationGroups: AnimationGroup[];
68
+ /**
69
+ * All of the multi-materials added to this scene
70
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
71
+ */
72
+ multiMaterials: MultiMaterial[];
73
+ /**
74
+ * All of the materials added to this scene
75
+ * In the context of a Scene, it is not supposed to be modified manually.
76
+ * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
77
+ * Note also that the order of the Material within the array is not significant and might change.
78
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
79
+ */
80
+ materials: Material[];
81
+ /**
82
+ * The list of morph target managers added to the scene
83
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
84
+ */
85
+ morphTargetManagers: MorphTargetManager[];
86
+ /**
87
+ * The list of geometries used in the scene.
88
+ */
89
+ geometries: Geometry[];
90
+ /**
91
+ * All of the transform nodes added to this scene
92
+ * In the context of a Scene, it is not supposed to be modified manually.
93
+ * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
94
+ * Note also that the order of the TransformNode within the array is not significant and might change.
95
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
96
+ */
97
+ transformNodes: TransformNode[];
98
+ /**
99
+ * ActionManagers available on the scene.
100
+ * @deprecated
101
+ */
102
+ actionManagers: AbstractActionManager[];
103
+ /**
104
+ * Textures to keep.
105
+ */
106
+ textures: BaseTexture[];
107
+ /** @internal */
108
+ protected _environmentTexture: Nullable<BaseTexture>;
109
+ /**
110
+ * Texture used in all pbr material as the reflection texture.
111
+ * As in the majority of the scene they are the same (exception for multi room and so on),
112
+ * this is easier to reference from here than from all the materials.
113
+ */
114
+ get environmentTexture(): Nullable<BaseTexture>;
115
+ set environmentTexture(value: Nullable<BaseTexture>);
116
+ /**
117
+ * The list of postprocesses added to the scene
118
+ */
119
+ postProcesses: PostProcess[];
120
+ /**
121
+ * The list of sounds
122
+ */
123
+ sounds: Nullable<Sound[]>;
124
+ /**
125
+ * The list of effect layers added to the scene
126
+ */
127
+ effectLayers: EffectLayer[];
128
+ /**
129
+ * The list of layers added to the scene
130
+ */
131
+ layers: Layer[];
132
+ /**
133
+ * The list of reflection probes added to the scene
134
+ */
135
+ reflectionProbes: ReflectionProbe[];
136
+ /**
137
+ * The list of lens flare systems added to the scene
138
+ */
139
+ lensFlareSystems: LensFlareSystem[];
140
+ /**
141
+ * The list of procedural textures added to the scene
142
+ */
143
+ proceduralTextures: ProceduralTexture[];
144
+ /**
145
+ * @returns all meshes, lights, cameras, transformNodes and bones
146
+ */
147
+ getNodes(): Array<Node>;
148
+ }
9
149
  /**
10
150
  * Set of assets to keep when moving a scene into an asset container.
11
151
  */
12
- export declare class KeepAssets extends AbstractScene {
152
+ export declare class KeepAssets extends AbstractAssetContainer {
13
153
  }
14
154
  /**
15
155
  * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function
@@ -35,7 +175,7 @@ export declare class InstantiatedEntries {
35
175
  /**
36
176
  * Container with a set of assets that can be added or removed from a scene.
37
177
  */
38
- export declare class AssetContainer extends AbstractScene {
178
+ export declare class AssetContainer extends AbstractAssetContainer {
39
179
  private _wasAddedToScene;
40
180
  private _onContextRestoredObserver;
41
181
  /**
package/assetContainer.js CHANGED
@@ -1,4 +1,3 @@
1
- import { AbstractScene } from "./abstractScene.js";
2
1
  import { Mesh } from "./Meshes/mesh.js";
3
2
  import { TransformNode } from "./Meshes/transformNode.js";
4
3
  import { AbstractMesh } from "./Meshes/abstractMesh.js";
@@ -8,10 +7,137 @@ import { InstancedMesh } from "./Meshes/instancedMesh.js";
8
7
  import { Light } from "./Lights/light.js";
9
8
  import { Camera } from "./Cameras/camera.js";
10
9
  import { Tools } from "./Misc/tools.js";
10
+ /**
11
+ * Root class for AssetContainer and KeepAssets
12
+ */
13
+ export class AbstractAssetContainer {
14
+ constructor() {
15
+ /**
16
+ * Gets the list of root nodes (ie. nodes with no parent)
17
+ */
18
+ this.rootNodes = [];
19
+ /** All of the cameras added to this scene
20
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
21
+ */
22
+ this.cameras = [];
23
+ /**
24
+ * All of the lights added to this scene
25
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
26
+ */
27
+ this.lights = [];
28
+ /**
29
+ * All of the (abstract) meshes added to this scene
30
+ */
31
+ this.meshes = [];
32
+ /**
33
+ * The list of skeletons added to the scene
34
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
35
+ */
36
+ this.skeletons = [];
37
+ /**
38
+ * All of the particle systems added to this scene
39
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
40
+ */
41
+ this.particleSystems = [];
42
+ /**
43
+ * Gets a list of Animations associated with the scene
44
+ */
45
+ this.animations = [];
46
+ /**
47
+ * All of the animation groups added to this scene
48
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
49
+ */
50
+ this.animationGroups = [];
51
+ /**
52
+ * All of the multi-materials added to this scene
53
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
54
+ */
55
+ this.multiMaterials = [];
56
+ /**
57
+ * All of the materials added to this scene
58
+ * In the context of a Scene, it is not supposed to be modified manually.
59
+ * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
60
+ * Note also that the order of the Material within the array is not significant and might change.
61
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
62
+ */
63
+ this.materials = [];
64
+ /**
65
+ * The list of morph target managers added to the scene
66
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
67
+ */
68
+ this.morphTargetManagers = [];
69
+ /**
70
+ * The list of geometries used in the scene.
71
+ */
72
+ this.geometries = [];
73
+ /**
74
+ * All of the transform nodes added to this scene
75
+ * In the context of a Scene, it is not supposed to be modified manually.
76
+ * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
77
+ * Note also that the order of the TransformNode within the array is not significant and might change.
78
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
79
+ */
80
+ this.transformNodes = [];
81
+ /**
82
+ * ActionManagers available on the scene.
83
+ * @deprecated
84
+ */
85
+ this.actionManagers = [];
86
+ /**
87
+ * Textures to keep.
88
+ */
89
+ this.textures = [];
90
+ /** @internal */
91
+ this._environmentTexture = null;
92
+ /**
93
+ * The list of postprocesses added to the scene
94
+ */
95
+ this.postProcesses = [];
96
+ /**
97
+ * The list of sounds
98
+ */
99
+ this.sounds = null;
100
+ /**
101
+ * The list of effect layers added to the scene
102
+ */
103
+ this.effectLayers = [];
104
+ /**
105
+ * The list of layers added to the scene
106
+ */
107
+ this.layers = [];
108
+ /**
109
+ * The list of reflection probes added to the scene
110
+ */
111
+ this.reflectionProbes = [];
112
+ }
113
+ /**
114
+ * Texture used in all pbr material as the reflection texture.
115
+ * As in the majority of the scene they are the same (exception for multi room and so on),
116
+ * this is easier to reference from here than from all the materials.
117
+ */
118
+ get environmentTexture() {
119
+ return this._environmentTexture;
120
+ }
121
+ set environmentTexture(value) {
122
+ this._environmentTexture = value;
123
+ }
124
+ /**
125
+ * @returns all meshes, lights, cameras, transformNodes and bones
126
+ */
127
+ getNodes() {
128
+ let nodes = [];
129
+ nodes = nodes.concat(this.meshes);
130
+ nodes = nodes.concat(this.lights);
131
+ nodes = nodes.concat(this.cameras);
132
+ nodes = nodes.concat(this.transformNodes); // dummies
133
+ this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));
134
+ return nodes;
135
+ }
136
+ }
11
137
  /**
12
138
  * Set of assets to keep when moving a scene into an asset container.
13
139
  */
14
- export class KeepAssets extends AbstractScene {
140
+ export class KeepAssets extends AbstractAssetContainer {
15
141
  }
16
142
  /**
17
143
  * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function
@@ -52,7 +178,7 @@ export class InstantiatedEntries {
52
178
  /**
53
179
  * Container with a set of assets that can be added or removed from a scene.
54
180
  */
55
- export class AssetContainer extends AbstractScene {
181
+ export class AssetContainer extends AbstractAssetContainer {
56
182
  /**
57
183
  * Instantiates an AssetContainer.
58
184
  * @param scene The scene the AssetContainer belongs to.
@@ -65,12 +191,7 @@ export class AssetContainer extends AbstractScene {
65
191
  return;
66
192
  }
67
193
  this.scene = scene;
68
- this["sounds"] = [];
69
- this["effectLayers"] = [];
70
- this["layers"] = [];
71
- this["lensFlareSystems"] = [];
72
194
  this["proceduralTextures"] = [];
73
- this["reflectionProbes"] = [];
74
195
  scene.onDisposeObservable.add(() => {
75
196
  if (!this._wasAddedToScene) {
76
197
  this.dispose();