@babylonjs/core 7.50.0 → 7.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Behaviors/Meshes/pointerDragBehavior.js +4 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -3
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.functions.js +5 -3
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Loading/loadingScreen.js +4 -1
- package/Loading/loadingScreen.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.js +4 -4
- package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.js +3 -3
- package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.js +3 -3
- package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/subdivideBlock.d.ts +45 -0
- package/Meshes/Node/Blocks/subdivideBlock.js +98 -0
- package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/csg2.js +4 -0
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geometry.js +1 -1
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/index.d.ts +1 -0
- package/Meshes/index.js +1 -0
- package/Meshes/index.js.map +1 -1
- package/Meshes/mesh.vertexData.js +1 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/mesh.vertexData.subdivide.d.ts +28 -0
- package/Meshes/mesh.vertexData.subdivide.js +400 -0
- package/Meshes/mesh.vertexData.subdivide.js.map +1 -0
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/sceneOptimizer.js +1 -0
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +4 -2
- package/Misc/screenshotTools.js +8 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/urlTools.d.ts +6 -0
- package/Misc/urlTools.js +12 -0
- package/Misc/urlTools.js.map +1 -0
- package/Physics/v2/characterController.d.ts +8 -0
- package/Physics/v2/characterController.js +12 -5
- package/Physics/v2/characterController.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +5 -3
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +1 -1
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js +5 -1
- package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +2 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +5 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +2 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +1 -1
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.d.ts +4 -0
- package/XR/features/WebXRAnchorSystem.js +8 -5
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -127,9 +127,11 @@ export function _isRenderingStateCompiled(pipelineContext, gl, validateShaderPro
|
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
129
129
|
const stateObject = getStateObject(gl);
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
if (stateObject && stateObject.parallelShaderCompile && stateObject.parallelShaderCompile.COMPLETION_STATUS_KHR && webGLPipelineContext.program) {
|
|
131
|
+
if (gl.getProgramParameter(webGLPipelineContext.program, stateObject.parallelShaderCompile.COMPLETION_STATUS_KHR)) {
|
|
132
|
+
_finalizePipelineContext(webGLPipelineContext, gl, validateShaderPrograms);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
133
135
|
}
|
|
134
136
|
return false;
|
|
135
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinEngine.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinEngine.functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAkBhE;;GAEG;AACH,MAAM,YAAY,GAAkD,IAAI,OAAO,EAAE,CAAC;AAElF;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,aAAa,EAAE,CAAC;IAChB,eAAe,EAAE,EAAE;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAqB;IAChD,IAAI,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,iBAAiB,CAAC;QAC7B,CAAC;QACD,KAAK,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CAAC;YACjD,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;QAED,MAAM,IAAI,KAAK,CACX,4CAA4C,IAAI,4BAA4B,KAAK,sBAAsB,EAAE,CAAC,aAAa,EAAE,qBAAqB,eAAe,EAAE,CAClK,CAAC;IACN,CAAC;IAED,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAEzB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAqB,EAAE,EAAgB;IAC/D,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAAC,eAAiC,EAAE,MAAoD;IACxI,MAAM,oBAAoB,GAAG,eAAuC,CAAC;IAErE,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;QAC3C,MAAM,CAAC,eAAe,CAAC,CAAC;QACxB,OAAO;IACX,CAAC;IAED,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;IAEnD,oBAAoB,CAAC,UAAU,GAAG,GAAG,EAAE;QACnC,UAAU,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { IPipelineContext } from \"./IPipelineContext\";\r\nimport type { ShaderProcessingContext } from \"./Processors/shaderProcessingOptions\";\r\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext\";\r\nimport type { _loadFile } from \"./abstractEngine.functions\";\r\nimport { _ConcatenateShader } from \"./abstractEngine.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IThinEngineStateObject {\r\n _contextWasLost?: boolean;\r\n validateShaderPrograms?: boolean;\r\n _webGLVersion: number;\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n disableParallelShaderCompile?: boolean;\r\n _context?: WebGLContext;\r\n _createShaderProgramInjection?: typeof _createShaderProgram;\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram;\r\n createShaderProgramInjection?: typeof createShaderProgram;\r\n loadFileInjection?: typeof _loadFile;\r\n cachedPipelines: { [name: string]: IPipelineContext };\r\n}\r\n/**\r\n * @internal\r\n */\r\nconst _stateObject: WeakMap<WebGLContext, IThinEngineStateObject> = new WeakMap();\r\n\r\n/**\r\n * This will be used in cases where the engine doesn't have a context (like the nullengine)\r\n */\r\nconst singleStateObject: IThinEngineStateObject = {\r\n _webGLVersion: 2,\r\n cachedPipelines: {},\r\n};\r\n\r\n/**\r\n * get or create a state object for the given context\r\n * Note - Used in WebGL only at the moment.\r\n * @param context The context to get the state object from\r\n * @returns the state object\r\n * @internal\r\n */\r\nexport function getStateObject(context: WebGLContext): IThinEngineStateObject {\r\n let state = _stateObject.get(context);\r\n if (!state) {\r\n if (!context) {\r\n return singleStateObject;\r\n }\r\n state = {\r\n // use feature detection. instanceof returns false. This only exists on WebGL2 context\r\n _webGLVersion: (context as WebGL2RenderingContext).TEXTURE_BINDING_3D ? 2 : 1,\r\n _context: context,\r\n // when using the function without an engine we need to set it to enable parallel compilation\r\n parallelShaderCompile: context.getExtension(\"KHR_parallel_shader_compile\") || undefined,\r\n cachedPipelines: {},\r\n };\r\n _stateObject.set(context, state);\r\n }\r\n return state;\r\n}\r\n/**\r\n * Remove the state object that belongs to the specific context\r\n * @param context the context that is being\r\n */\r\nexport function deleteStateObject(context: WebGLContext): void {\r\n _stateObject.delete(context);\r\n}\r\n\r\nexport type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;\r\n/**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createRawShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n\r\n const vertexShader = _compileRawShader(vertexCode, \"vertex\", context, stateObject._contextWasLost);\r\n const fragmentShader = _compileRawShader(fragmentCode, \"fragment\", context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n defines: Nullable<string>,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]> = null,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n const shaderVersion = stateObject._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n const vertexShader = _compileShader(vertexCode, \"vertex\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n const fragmentShader = _compileShader(fragmentCode, \"fragment\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a new pipeline context. Note, make sure to attach an engine instance to the created context\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param _shaderProcessingContext defines the shader processing context used during the processing if available\r\n * @returns the new pipeline\r\n */\r\nexport function createPipelineContext(context: WebGLContext, _shaderProcessingContext: Nullable<ShaderProcessingContext>): IPipelineContext {\r\n const pipelineContext = new WebGLPipelineContext();\r\n const stateObject = getStateObject(context);\r\n if (stateObject.parallelShaderCompile && !stateObject.disableParallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n pipelineContext.context = stateObject._context;\r\n return pipelineContext;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _createShaderProgram(\r\n pipelineContext: WebGLPipelineContext,\r\n vertexShader: WebGLShader,\r\n fragmentShader: WebGLShader,\r\n context: WebGLContext,\r\n _transformFeedbackVaryings: Nullable<string[]> = null,\r\n validateShaderPrograms?: boolean\r\n): WebGLProgram {\r\n const shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n\r\n context.linkProgram(shaderProgram);\r\n\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n\r\n if (!pipelineContext.isParallelCompiled) {\r\n _finalizePipelineContext(pipelineContext, context, validateShaderPrograms);\r\n }\r\n\r\n return shaderProgram;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _isRenderingStateCompiled(pipelineContext: IPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean): boolean {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n if (webGLPipelineContext._isDisposed) {\r\n return false;\r\n }\r\n const stateObject = getStateObject(gl);\r\n if (gl.getProgramParameter(webGLPipelineContext.program!, stateObject.parallelShaderCompile!.COMPLETION_STATUS_KHR)) {\r\n _finalizePipelineContext(webGLPipelineContext, gl, validateShaderPrograms);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _finalizePipelineContext(pipelineContext: WebGLPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean) {\r\n const context = pipelineContext.context!;\r\n const vertexShader = pipelineContext.vertexShader!;\r\n const fragmentShader = pipelineContext.fragmentShader!;\r\n const program = pipelineContext.program!;\r\n\r\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) {\r\n // Get more info\r\n // Vertex\r\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n\r\n // Fragment\r\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n if (/*this.*/ validateShaderPrograms) {\r\n context.validateProgram(program);\r\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n\r\n if (!validated) {\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _preparePipelineContext(\r\n pipelineContext: IPipelineContext,\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n createAsRaw: boolean,\r\n _rawVertexSourceCode: string,\r\n _rawFragmentSourceCode: string,\r\n rebuildRebind: any,\r\n defines: Nullable<string>,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _key: string = \"\",\r\n onReady: () => void,\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram,\r\n createShaderProgramInjection?: typeof createShaderProgram\r\n) {\r\n const stateObject = getStateObject((pipelineContext as WebGLPipelineContext).context!);\r\n if (!createRawShaderProgramInjection) {\r\n createRawShaderProgramInjection = stateObject.createRawShaderProgramInjection ?? createRawShaderProgram;\r\n }\r\n if (!createShaderProgramInjection) {\r\n createShaderProgramInjection = stateObject.createShaderProgramInjection ?? createShaderProgram;\r\n }\r\n const webGLRenderingState = pipelineContext as WebGLPipelineContext;\r\n\r\n if (createAsRaw) {\r\n webGLRenderingState.program = createRawShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n } else {\r\n webGLRenderingState.program = createShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n defines,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n\r\n onReady();\r\n}\r\n\r\nfunction _compileShader(source: string, type: string, defines: Nullable<string>, shaderVersion: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n return _compileRawShader(_ConcatenateShader(source, defines, shaderVersion), type, gl, _contextWasLost);\r\n}\r\n\r\nfunction _compileRawShader(source: string, type: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n\r\n if (!shader) {\r\n let error: GLenum = gl.NO_ERROR;\r\n let tempError: GLenum = gl.NO_ERROR;\r\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\r\n error = tempError;\r\n }\r\n\r\n throw new Error(\r\n `Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${_contextWasLost}`\r\n );\r\n }\r\n\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n\r\n return shader;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _setProgram(program: WebGLProgram, gl: WebGLContext): void {\r\n gl.useProgram(program);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: (pipelineContext?: IPipelineContext) => void) {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action(pipelineContext);\r\n return;\r\n }\r\n\r\n const oldHandler = webGLPipelineContext.onCompiled;\r\n\r\n webGLPipelineContext.onCompiled = () => {\r\n oldHandler?.();\r\n action(pipelineContext);\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"thinEngine.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/thinEngine.functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAkBhE;;GAEG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U,CAAC;IAEnD,oBAAoB,CAAC,UAAU,GAAG,GAAG,EAAE;QACnC,UAAU,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { IPipelineContext } from \"./IPipelineContext\";\r\nimport type { ShaderProcessingContext } from \"./Processors/shaderProcessingOptions\";\r\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext\";\r\nimport type { _loadFile } from \"./abstractEngine.functions\";\r\nimport { _ConcatenateShader } from \"./abstractEngine.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface IThinEngineStateObject {\r\n _contextWasLost?: boolean;\r\n validateShaderPrograms?: boolean;\r\n _webGLVersion: number;\r\n parallelShaderCompile?: { COMPLETION_STATUS_KHR: number };\r\n disableParallelShaderCompile?: boolean;\r\n _context?: WebGLContext;\r\n _createShaderProgramInjection?: typeof _createShaderProgram;\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram;\r\n createShaderProgramInjection?: typeof createShaderProgram;\r\n loadFileInjection?: typeof _loadFile;\r\n cachedPipelines: { [name: string]: IPipelineContext };\r\n}\r\n/**\r\n * @internal\r\n */\r\nconst _stateObject: WeakMap<WebGLContext, IThinEngineStateObject> = new WeakMap();\r\n\r\n/**\r\n * This will be used in cases where the engine doesn't have a context (like the nullengine)\r\n */\r\nconst singleStateObject: IThinEngineStateObject = {\r\n _webGLVersion: 2,\r\n cachedPipelines: {},\r\n};\r\n\r\n/**\r\n * get or create a state object for the given context\r\n * Note - Used in WebGL only at the moment.\r\n * @param context The context to get the state object from\r\n * @returns the state object\r\n * @internal\r\n */\r\nexport function getStateObject(context: WebGLContext): IThinEngineStateObject {\r\n let state = _stateObject.get(context);\r\n if (!state) {\r\n if (!context) {\r\n return singleStateObject;\r\n }\r\n state = {\r\n // use feature detection. instanceof returns false. This only exists on WebGL2 context\r\n _webGLVersion: (context as WebGL2RenderingContext).TEXTURE_BINDING_3D ? 2 : 1,\r\n _context: context,\r\n // when using the function without an engine we need to set it to enable parallel compilation\r\n parallelShaderCompile: context.getExtension(\"KHR_parallel_shader_compile\") || undefined,\r\n cachedPipelines: {},\r\n };\r\n _stateObject.set(context, state);\r\n }\r\n return state;\r\n}\r\n/**\r\n * Remove the state object that belongs to the specific context\r\n * @param context the context that is being\r\n */\r\nexport function deleteStateObject(context: WebGLContext): void {\r\n _stateObject.delete(context);\r\n}\r\n\r\nexport type WebGLContext = WebGLRenderingContext | WebGL2RenderingContext;\r\n/**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createRawShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n\r\n const vertexShader = _compileRawShader(vertexCode, \"vertex\", context, stateObject._contextWasLost);\r\n const fragmentShader = _compileRawShader(fragmentCode, \"fragment\", context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @param _createShaderProgramInjection defines an optional injection to use to create the shader program\r\n * @returns the new webGL program\r\n */\r\nexport function createShaderProgram(\r\n pipelineContext: IPipelineContext,\r\n vertexCode: string,\r\n fragmentCode: string,\r\n defines: Nullable<string>,\r\n context: WebGLContext,\r\n transformFeedbackVaryings: Nullable<string[]> = null,\r\n _createShaderProgramInjection?: typeof _createShaderProgram\r\n): WebGLProgram {\r\n const stateObject = getStateObject(context);\r\n if (!_createShaderProgramInjection) {\r\n _createShaderProgramInjection = stateObject._createShaderProgramInjection ?? _createShaderProgram;\r\n }\r\n const shaderVersion = stateObject._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n const vertexShader = _compileShader(vertexCode, \"vertex\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n const fragmentShader = _compileShader(fragmentCode, \"fragment\", defines, shaderVersion, context, stateObject._contextWasLost);\r\n\r\n return _createShaderProgramInjection(\r\n pipelineContext as WebGLPipelineContext,\r\n vertexShader,\r\n fragmentShader,\r\n context,\r\n transformFeedbackVaryings,\r\n stateObject.validateShaderPrograms\r\n );\r\n}\r\n\r\n/**\r\n * Creates a new pipeline context. Note, make sure to attach an engine instance to the created context\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param _shaderProcessingContext defines the shader processing context used during the processing if available\r\n * @returns the new pipeline\r\n */\r\nexport function createPipelineContext(context: WebGLContext, _shaderProcessingContext: Nullable<ShaderProcessingContext>): IPipelineContext {\r\n const pipelineContext = new WebGLPipelineContext();\r\n const stateObject = getStateObject(context);\r\n if (stateObject.parallelShaderCompile && !stateObject.disableParallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n pipelineContext.context = stateObject._context;\r\n return pipelineContext;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _createShaderProgram(\r\n pipelineContext: WebGLPipelineContext,\r\n vertexShader: WebGLShader,\r\n fragmentShader: WebGLShader,\r\n context: WebGLContext,\r\n _transformFeedbackVaryings: Nullable<string[]> = null,\r\n validateShaderPrograms?: boolean\r\n): WebGLProgram {\r\n const shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n\r\n context.linkProgram(shaderProgram);\r\n\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n\r\n if (!pipelineContext.isParallelCompiled) {\r\n _finalizePipelineContext(pipelineContext, context, validateShaderPrograms);\r\n }\r\n\r\n return shaderProgram;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _isRenderingStateCompiled(pipelineContext: IPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean): boolean {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n if (webGLPipelineContext._isDisposed) {\r\n return false;\r\n }\r\n const stateObject = getStateObject(gl);\r\n if (stateObject && stateObject.parallelShaderCompile && stateObject.parallelShaderCompile.COMPLETION_STATUS_KHR && webGLPipelineContext.program) {\r\n if (gl.getProgramParameter(webGLPipelineContext.program, stateObject.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n _finalizePipelineContext(webGLPipelineContext, gl, validateShaderPrograms);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _finalizePipelineContext(pipelineContext: WebGLPipelineContext, gl: WebGLContext, validateShaderPrograms?: boolean) {\r\n const context = pipelineContext.context!;\r\n const vertexShader = pipelineContext.vertexShader!;\r\n const fragmentShader = pipelineContext.fragmentShader!;\r\n const program = pipelineContext.program!;\r\n\r\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) {\r\n // Get more info\r\n // Vertex\r\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n pipelineContext.vertexCompilationError = log;\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n\r\n // Fragment\r\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\r\n const log = gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n pipelineContext.fragmentCompilationError = log;\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programLinkError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n\r\n if (/*this.*/ validateShaderPrograms) {\r\n context.validateProgram(program);\r\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n\r\n if (!validated) {\r\n const error = context.getProgramInfoLog(program);\r\n if (error) {\r\n pipelineContext.programValidationError = error;\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _preparePipelineContext(\r\n pipelineContext: IPipelineContext,\r\n vertexSourceCode: string,\r\n fragmentSourceCode: string,\r\n createAsRaw: boolean,\r\n _rawVertexSourceCode: string,\r\n _rawFragmentSourceCode: string,\r\n rebuildRebind: any,\r\n defines: Nullable<string>,\r\n transformFeedbackVaryings: Nullable<string[]>,\r\n _key: string = \"\",\r\n onReady: () => void,\r\n createRawShaderProgramInjection?: typeof createRawShaderProgram,\r\n createShaderProgramInjection?: typeof createShaderProgram\r\n) {\r\n const stateObject = getStateObject((pipelineContext as WebGLPipelineContext).context!);\r\n if (!createRawShaderProgramInjection) {\r\n createRawShaderProgramInjection = stateObject.createRawShaderProgramInjection ?? createRawShaderProgram;\r\n }\r\n if (!createShaderProgramInjection) {\r\n createShaderProgramInjection = stateObject.createShaderProgramInjection ?? createShaderProgram;\r\n }\r\n const webGLRenderingState = pipelineContext as WebGLPipelineContext;\r\n\r\n if (createAsRaw) {\r\n webGLRenderingState.program = createRawShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n } else {\r\n webGLRenderingState.program = createShaderProgramInjection(\r\n webGLRenderingState,\r\n vertexSourceCode,\r\n fragmentSourceCode,\r\n defines,\r\n webGLRenderingState.context!,\r\n transformFeedbackVaryings\r\n );\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n\r\n onReady();\r\n}\r\n\r\nfunction _compileShader(source: string, type: string, defines: Nullable<string>, shaderVersion: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n return _compileRawShader(_ConcatenateShader(source, defines, shaderVersion), type, gl, _contextWasLost);\r\n}\r\n\r\nfunction _compileRawShader(source: string, type: string, gl: WebGLContext, _contextWasLost?: boolean): WebGLShader {\r\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n\r\n if (!shader) {\r\n let error: GLenum = gl.NO_ERROR;\r\n let tempError: GLenum = gl.NO_ERROR;\r\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\r\n error = tempError;\r\n }\r\n\r\n throw new Error(\r\n `Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${_contextWasLost}`\r\n );\r\n }\r\n\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n\r\n return shader;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _setProgram(program: WebGLProgram, gl: WebGLContext): void {\r\n gl.useProgram(program);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function _executeWhenRenderingStateIsCompiled(pipelineContext: IPipelineContext, action: (pipelineContext?: IPipelineContext) => void) {\r\n const webGLPipelineContext = pipelineContext as WebGLPipelineContext;\r\n\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action(pipelineContext);\r\n return;\r\n }\r\n\r\n const oldHandler = webGLPipelineContext.onCompiled;\r\n\r\n webGLPipelineContext.onCompiled = () => {\r\n oldHandler?.();\r\n action(pipelineContext);\r\n };\r\n}\r\n"]}
|
package/Loading/loadingScreen.js
CHANGED
|
@@ -215,7 +215,10 @@ export class DefaultLoadingScreen {
|
|
|
215
215
|
set loadingUIText(text) {
|
|
216
216
|
this._loadingText = text;
|
|
217
217
|
if (this._loadingTextDiv) {
|
|
218
|
-
this.
|
|
218
|
+
this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {
|
|
219
|
+
// set loadingTextDiv of current loadingDiv
|
|
220
|
+
loadingDiv.children[0].innerHTML = this._loadingText;
|
|
221
|
+
});
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
get loadingUIText() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadingScreen.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/loadingScreen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAyBrD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAkB7B;;;;;OAKG;IACH,YACY,gBAAmC,EACnC,eAAe,EAAE,EACjB,6BAA6B,OAAO;QAFpC,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,iBAAY,GAAZ,YAAY,CAAK;QACjB,+BAA0B,GAA1B,0BAA0B,CAAU;QAvBhD;;;WAGG;QACK,oCAA+B,GA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,kBAAkB,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM;YACtD,kBAAkB,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC;YAC5C,kBAAkB,CAAC,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAC/C,CAAC;IACN,CAAC;;AAjRD,sEAAsE;AACxD,mCAAc,GAAG,EAAE,AAAL,CAAM;AAElC,yEAAyE;AAC3D,sCAAiB,GAAG,EAAE,AAAL,CAAM;AAsSzC,cAAc,CAAC,2BAA2B,GAAG,CAAC,MAAyB,EAAE,EAAE;IACvE,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Observer } from \"../Misc/observable\";\r\n/**\r\n * Interface used to present a loading screen while loading a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\nexport interface ILoadingScreen {\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n displayLoadingUI: () => void;\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n hideLoadingUI: () => void;\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n loadingUIBackgroundColor: string;\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n loadingUIText: string;\r\n}\r\n\r\n/**\r\n * Class used for the default loading screen\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\nexport class DefaultLoadingScreen implements ILoadingScreen {\r\n private _engine: Nullable<AbstractEngine>;\r\n private _resizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _isLoading: boolean;\r\n /**\r\n * Maps a loading `HTMLDivElement` to a tuple containing the associated `HTMLCanvasElement`\r\n * and its `DOMRect` (or `null` if not yet available).\r\n */\r\n private _loadingDivToRenderingCanvasMap: Map<HTMLDivElement, [HTMLCanvasElement, DOMRect | null]> = new Map();\r\n private _loadingTextDiv: Nullable<HTMLDivElement>;\r\n private _style: Nullable<HTMLStyleElement>;\r\n\r\n /** Gets or sets the logo url to use for the default loading screen */\r\n public static DefaultLogoUrl = \"\";\r\n\r\n /** Gets or sets the spinner url to use for the default loading screen */\r\n public static DefaultSpinnerUrl = \"\";\r\n\r\n /**\r\n * Creates a new default loading screen\r\n * @param _renderingCanvas defines the canvas used to render the scene\r\n * @param _loadingText defines the default text to display\r\n * @param _loadingDivBackgroundColor defines the default background color\r\n */\r\n constructor(\r\n private _renderingCanvas: HTMLCanvasElement,\r\n private _loadingText = \"\",\r\n private _loadingDivBackgroundColor = \"black\"\r\n ) {}\r\n\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n public displayLoadingUI(): void {\r\n if (this._isLoading) {\r\n // Do not add a loading screen if it is already loading\r\n return;\r\n }\r\n\r\n this._isLoading = true;\r\n // get current engine by rendering canvas\r\n this._engine = EngineStore.Instances.find((engine) => engine.getRenderingCanvas() === this._renderingCanvas) as AbstractEngine;\r\n\r\n const loadingDiv = document.createElement(\"div\");\r\n\r\n loadingDiv.id = \"babylonjsLoadingDiv\";\r\n loadingDiv.style.opacity = \"0\";\r\n loadingDiv.style.transition = \"opacity 1.5s ease\";\r\n loadingDiv.style.pointerEvents = \"none\";\r\n loadingDiv.style.display = \"grid\";\r\n loadingDiv.style.gridTemplateRows = \"100%\";\r\n loadingDiv.style.gridTemplateColumns = \"100%\";\r\n loadingDiv.style.justifyItems = \"center\";\r\n loadingDiv.style.alignItems = \"center\";\r\n\r\n // Loading text\r\n this._loadingTextDiv = document.createElement(\"div\");\r\n this._loadingTextDiv.style.position = \"absolute\";\r\n this._loadingTextDiv.style.left = \"0\";\r\n this._loadingTextDiv.style.top = \"50%\";\r\n this._loadingTextDiv.style.marginTop = \"80px\";\r\n this._loadingTextDiv.style.width = \"100%\";\r\n this._loadingTextDiv.style.height = \"20px\";\r\n this._loadingTextDiv.style.fontFamily = \"Arial\";\r\n this._loadingTextDiv.style.fontSize = \"14px\";\r\n this._loadingTextDiv.style.color = \"white\";\r\n this._loadingTextDiv.style.textAlign = \"center\";\r\n this._loadingTextDiv.style.zIndex = \"1\";\r\n this._loadingTextDiv.innerHTML = \"Loading\";\r\n\r\n loadingDiv.appendChild(this._loadingTextDiv);\r\n\r\n //set the predefined text\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n\r\n // Generating keyframes\r\n this._style = document.createElement(\"style\");\r\n this._style.type = \"text/css\";\r\n const keyFrames = `@-webkit-keyframes spin1 {\\\r\n 0% { -webkit-transform: rotate(0deg);}\r\n 100% { -webkit-transform: rotate(360deg);}\r\n }\\\r\n @keyframes spin1 {\\\r\n 0% { transform: rotate(0deg);}\r\n 100% { transform: rotate(360deg);}\r\n }`;\r\n this._style.innerHTML = keyFrames;\r\n document.getElementsByTagName(\"head\")[0].appendChild(this._style);\r\n\r\n const svgSupport = !!window.SVGSVGElement;\r\n // Loading img\r\n const imgBack = new Image();\r\n if (!DefaultLoadingScreen.DefaultLogoUrl) {\r\n imgBack.src = !svgSupport\r\n ? \"https://cdn.babylonjs.com/Assets/babylonLogo.png\"\r\n : `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBj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4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+`;\r\n } else {\r\n imgBack.src = DefaultLoadingScreen.DefaultLogoUrl;\r\n }\r\n\r\n imgBack.style.width = \"150px\";\r\n imgBack.style.gridColumn = \"1\";\r\n imgBack.style.gridRow = \"1\";\r\n imgBack.style.top = \"50%\";\r\n imgBack.style.left = \"50%\";\r\n imgBack.style.transform = \"translate(-50%, -50%)\";\r\n imgBack.style.position = \"absolute\";\r\n\r\n const imageSpinnerContainer = document.createElement(\"div\");\r\n imageSpinnerContainer.style.width = \"300px\";\r\n imageSpinnerContainer.style.gridColumn = \"1\";\r\n imageSpinnerContainer.style.gridRow = \"1\";\r\n imageSpinnerContainer.style.top = \"50%\";\r\n imageSpinnerContainer.style.left = \"50%\";\r\n imageSpinnerContainer.style.transform = \"translate(-50%, -50%)\";\r\n imageSpinnerContainer.style.position = \"absolute\";\r\n\r\n // Loading spinner\r\n const imgSpinner = new Image();\r\n\r\n if (!DefaultLoadingScreen.DefaultSpinnerUrl) {\r\n imgSpinner.src = !svgSupport\r\n ? \"https://cdn.babylonjs.com/Assets/loadingIcon.png\"\r\n : `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJ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XNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==`;\r\n } else {\r\n imgSpinner.src = DefaultLoadingScreen.DefaultSpinnerUrl;\r\n }\r\n\r\n imgSpinner.style.animation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.transformOrigin = \"50% 50%\";\r\n\r\n if (!svgSupport) {\r\n const logoSize = { w: 16, h: 18.5 };\r\n const loadingSize = { w: 30, h: 30 };\r\n // set styling correctly\r\n imgBack.style.width = `${logoSize.w}vh`;\r\n imgBack.style.height = `${logoSize.h}vh`;\r\n imgBack.style.left = `calc(50% - ${logoSize.w / 2}vh)`;\r\n imgBack.style.top = `calc(50% - ${logoSize.h / 2}vh)`;\r\n\r\n imgSpinner.style.width = `${loadingSize.w}vh`;\r\n imgSpinner.style.height = `${loadingSize.h}vh`;\r\n imgSpinner.style.left = `calc(50% - ${loadingSize.w / 2}vh)`;\r\n imgSpinner.style.top = `calc(50% - ${loadingSize.h / 2}vh)`;\r\n }\r\n\r\n imageSpinnerContainer.appendChild(imgSpinner);\r\n\r\n loadingDiv.appendChild(imgBack);\r\n loadingDiv.appendChild(imageSpinnerContainer);\r\n loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n loadingDiv.style.opacity = \"1\";\r\n\r\n const canvases: Array<HTMLCanvasElement> = [];\r\n const views = this._engine.views;\r\n if (views?.length) {\r\n for (const view of views) {\r\n if (view.enabled) {\r\n canvases.push(view.target);\r\n }\r\n }\r\n } else {\r\n canvases.push(this._renderingCanvas);\r\n }\r\n canvases.forEach((canvas, index) => {\r\n const clonedLoadingDiv = loadingDiv!.cloneNode(true) as HTMLDivElement;\r\n clonedLoadingDiv.id += `-${index}`;\r\n this._loadingDivToRenderingCanvasMap.set(clonedLoadingDiv, [canvas, null]);\r\n });\r\n\r\n this._resizeLoadingUI();\r\n\r\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._resizeLoadingUI();\r\n });\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n document.body.appendChild(loadingDiv);\r\n });\r\n }\r\n\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n public hideLoadingUI(): void {\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n let completedTransitions = 0;\r\n\r\n const onTransitionEnd = (event: TransitionEvent) => {\r\n const loadingDiv = event.target as HTMLDivElement;\r\n // ensure that ending transition event is generated by one of the current loadingDivs\r\n const isTransitionEndOnLoadingDiv = this._loadingDivToRenderingCanvasMap.has(loadingDiv);\r\n\r\n if (isTransitionEndOnLoadingDiv) {\r\n completedTransitions++;\r\n loadingDiv.remove();\r\n\r\n const allTransitionsCompleted = completedTransitions === this._loadingDivToRenderingCanvasMap.size;\r\n if (allTransitionsCompleted) {\r\n if (this._loadingTextDiv) {\r\n this._loadingTextDiv.remove();\r\n this._loadingTextDiv = null;\r\n }\r\n if (this._style) {\r\n this._style.remove();\r\n this._style = null;\r\n }\r\n\r\n window.removeEventListener(\"transitionend\", onTransitionEnd);\r\n this._engine!.onResizeObservable.remove(this._resizeObserver);\r\n this._loadingDivToRenderingCanvasMap.clear();\r\n this._engine = null;\r\n this._isLoading = false;\r\n }\r\n }\r\n };\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n loadingDiv.style.opacity = \"0\";\r\n });\r\n\r\n window.addEventListener(\"transitionend\", onTransitionEnd);\r\n }\r\n\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n public set loadingUIText(text: string) {\r\n this._loadingText = text;\r\n\r\n if (this._loadingTextDiv) {\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n }\r\n }\r\n\r\n public get loadingUIText(): string {\r\n return this._loadingText;\r\n }\r\n\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n public get loadingUIBackgroundColor(): string {\r\n return this._loadingDivBackgroundColor;\r\n }\r\n\r\n public set loadingUIBackgroundColor(color: string) {\r\n this._loadingDivBackgroundColor = color;\r\n\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n });\r\n }\r\n\r\n /**\r\n * Checks if the layout of the canvas has changed by comparing the current layout\r\n * rectangle with the previous one.\r\n *\r\n * This function compares of the two `DOMRect` objects to determine if any of the layout dimensions have changed.\r\n * If the layout has changed or if there is no previous layout (i.e., `previousCanvasRect` is `null`),\r\n * it returns `true`. Otherwise, it returns `false`.\r\n *\r\n * @param previousCanvasRect defines the previously recorded `DOMRect` of the canvas, or `null` if no previous state exists.\r\n * @param currentCanvasRect defines the current `DOMRect` of the canvas to compare against the previous layout.\r\n * @returns `true` if the layout has changed, otherwise `false`.\r\n */\r\n private _isCanvasLayoutChanged(previousCanvasRect: DOMRect | null, currentCanvasRect: DOMRect) {\r\n return (\r\n !previousCanvasRect ||\r\n previousCanvasRect.left !== currentCanvasRect.left ||\r\n previousCanvasRect.top !== currentCanvasRect.top ||\r\n previousCanvasRect.right !== currentCanvasRect.right ||\r\n previousCanvasRect.bottom !== currentCanvasRect.bottom ||\r\n previousCanvasRect.width !== currentCanvasRect.width ||\r\n previousCanvasRect.height !== currentCanvasRect.height ||\r\n previousCanvasRect.x !== currentCanvasRect.x ||\r\n previousCanvasRect.y !== currentCanvasRect.y\r\n );\r\n }\r\n\r\n // Resize\r\n private _resizeLoadingUI = () => {\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach(([canvas, previousCanvasRect], loadingDiv) => {\r\n const currentCanvasRect = canvas.getBoundingClientRect();\r\n if (this._isCanvasLayoutChanged(previousCanvasRect, currentCanvasRect)) {\r\n const canvasPositioning = window.getComputedStyle(canvas).position;\r\n\r\n loadingDiv.style.position = canvasPositioning === \"fixed\" ? \"fixed\" : \"absolute\";\r\n loadingDiv.style.left = currentCanvasRect.left + window.scrollX + \"px\";\r\n loadingDiv.style.top = currentCanvasRect.top + window.scrollY + \"px\";\r\n loadingDiv.style.width = currentCanvasRect.width + \"px\";\r\n loadingDiv.style.height = currentCanvasRect.height + \"px\";\r\n\r\n this._loadingDivToRenderingCanvasMap.set(loadingDiv, [canvas, currentCanvasRect]);\r\n }\r\n });\r\n };\r\n}\r\n\r\nAbstractEngine.DefaultLoadingScreenFactory = (canvas: HTMLCanvasElement) => {\r\n return new DefaultLoadingScreen(canvas);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"loadingScreen.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/loadingScreen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAyBrD;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAkB7B;;;;;OAKG;IACH,YACY,gBAAmC,EACnC,eAAe,EAAE,EACjB,6BAA6B,OAAO;QAFpC,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,iBAAY,GAAZ,YAAY,CAAK;QACjB,+BAA0B,GAA1B,0BAA0B,CAAU;QAvBhD;;;WAGG;QACK,oCAA+B,GAA6D,IAAI,GAAG,EAAE,CAAC;QA0R9G,SAAS;QACD,qBAAgB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACnB,OAAO;YACX,CAAC;YAED,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE;gBACtF,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;gBACzD,IAAI,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EAAE,CAAC;oBACrE,MAAM,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAA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AC,MAAyB,EAAE,EAAE;IACvE,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Observer } from \"../Misc/observable\";\r\n/**\r\n * Interface used to present a loading screen while loading a scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\nexport interface ILoadingScreen {\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n displayLoadingUI: () => void;\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n hideLoadingUI: () => void;\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n loadingUIBackgroundColor: string;\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n loadingUIText: string;\r\n}\r\n\r\n/**\r\n * Class used for the default loading screen\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\r\n */\r\nexport class DefaultLoadingScreen implements ILoadingScreen {\r\n private _engine: Nullable<AbstractEngine>;\r\n private _resizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _isLoading: boolean;\r\n /**\r\n * Maps a loading `HTMLDivElement` to a tuple containing the associated `HTMLCanvasElement`\r\n * and its `DOMRect` (or `null` if not yet available).\r\n */\r\n private _loadingDivToRenderingCanvasMap: Map<HTMLDivElement, [HTMLCanvasElement, DOMRect | null]> = new Map();\r\n private _loadingTextDiv: Nullable<HTMLDivElement>;\r\n private _style: Nullable<HTMLStyleElement>;\r\n\r\n /** Gets or sets the logo url to use for the default loading screen */\r\n public static DefaultLogoUrl = \"\";\r\n\r\n /** Gets or sets the spinner url to use for the default loading screen */\r\n public static DefaultSpinnerUrl = \"\";\r\n\r\n /**\r\n * Creates a new default loading screen\r\n * @param _renderingCanvas defines the canvas used to render the scene\r\n * @param _loadingText defines the default text to display\r\n * @param _loadingDivBackgroundColor defines the default background color\r\n */\r\n constructor(\r\n private _renderingCanvas: HTMLCanvasElement,\r\n private _loadingText = \"\",\r\n private _loadingDivBackgroundColor = \"black\"\r\n ) {}\r\n\r\n /**\r\n * Function called to display the loading screen\r\n */\r\n public displayLoadingUI(): void {\r\n if (this._isLoading) {\r\n // Do not add a loading screen if it is already loading\r\n return;\r\n }\r\n\r\n this._isLoading = true;\r\n // get current engine by rendering canvas\r\n this._engine = EngineStore.Instances.find((engine) => engine.getRenderingCanvas() === this._renderingCanvas) as AbstractEngine;\r\n\r\n const loadingDiv = document.createElement(\"div\");\r\n\r\n loadingDiv.id = \"babylonjsLoadingDiv\";\r\n loadingDiv.style.opacity = \"0\";\r\n loadingDiv.style.transition = \"opacity 1.5s ease\";\r\n loadingDiv.style.pointerEvents = \"none\";\r\n loadingDiv.style.display = \"grid\";\r\n loadingDiv.style.gridTemplateRows = \"100%\";\r\n loadingDiv.style.gridTemplateColumns = \"100%\";\r\n loadingDiv.style.justifyItems = \"center\";\r\n loadingDiv.style.alignItems = \"center\";\r\n\r\n // Loading text\r\n this._loadingTextDiv = document.createElement(\"div\");\r\n this._loadingTextDiv.style.position = \"absolute\";\r\n this._loadingTextDiv.style.left = \"0\";\r\n this._loadingTextDiv.style.top = \"50%\";\r\n this._loadingTextDiv.style.marginTop = \"80px\";\r\n this._loadingTextDiv.style.width = \"100%\";\r\n this._loadingTextDiv.style.height = \"20px\";\r\n this._loadingTextDiv.style.fontFamily = \"Arial\";\r\n this._loadingTextDiv.style.fontSize = \"14px\";\r\n this._loadingTextDiv.style.color = \"white\";\r\n this._loadingTextDiv.style.textAlign = \"center\";\r\n this._loadingTextDiv.style.zIndex = \"1\";\r\n this._loadingTextDiv.innerHTML = \"Loading\";\r\n\r\n loadingDiv.appendChild(this._loadingTextDiv);\r\n\r\n //set the predefined text\r\n this._loadingTextDiv.innerHTML = this._loadingText;\r\n\r\n // Generating keyframes\r\n this._style = document.createElement(\"style\");\r\n this._style.type = \"text/css\";\r\n const keyFrames = `@-webkit-keyframes spin1 {\\\r\n 0% { -webkit-transform: rotate(0deg);}\r\n 100% { -webkit-transform: rotate(360deg);}\r\n }\\\r\n @keyframes spin1 {\\\r\n 0% { transform: rotate(0deg);}\r\n 100% { transform: rotate(360deg);}\r\n }`;\r\n this._style.innerHTML = keyFrames;\r\n document.getElementsByTagName(\"head\")[0].appendChild(this._style);\r\n\r\n const svgSupport = !!window.SVGSVGElement;\r\n // Loading img\r\n const imgBack = new Image();\r\n if (!DefaultLoadingScreen.DefaultLogoUrl) {\r\n imgBack.src = !svgSupport\r\n ? \"https://cdn.babylonjs.com/Assets/babylonLogo.png\"\r\n : `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+`;\r\n } else {\r\n imgBack.src = DefaultLoadingScreen.DefaultLogoUrl;\r\n }\r\n\r\n imgBack.style.width = \"150px\";\r\n imgBack.style.gridColumn = \"1\";\r\n imgBack.style.gridRow = \"1\";\r\n imgBack.style.top = \"50%\";\r\n imgBack.style.left = \"50%\";\r\n imgBack.style.transform = \"translate(-50%, -50%)\";\r\n imgBack.style.position = \"absolute\";\r\n\r\n const imageSpinnerContainer = document.createElement(\"div\");\r\n imageSpinnerContainer.style.width = \"300px\";\r\n imageSpinnerContainer.style.gridColumn = \"1\";\r\n imageSpinnerContainer.style.gridRow = \"1\";\r\n imageSpinnerContainer.style.top = \"50%\";\r\n imageSpinnerContainer.style.left = \"50%\";\r\n imageSpinnerContainer.style.transform = \"translate(-50%, -50%)\";\r\n imageSpinnerContainer.style.position = \"absolute\";\r\n\r\n // Loading spinner\r\n const imgSpinner = new Image();\r\n\r\n if (!DefaultLoadingScreen.DefaultSpinnerUrl) {\r\n imgSpinner.src = !svgSupport\r\n ? \"https://cdn.babylonjs.com/Assets/loadingIcon.png\"\r\n : `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==`;\r\n } else {\r\n imgSpinner.src = DefaultLoadingScreen.DefaultSpinnerUrl;\r\n }\r\n\r\n imgSpinner.style.animation = \"spin1 0.75s infinite linear\";\r\n imgSpinner.style.transformOrigin = \"50% 50%\";\r\n\r\n if (!svgSupport) {\r\n const logoSize = { w: 16, h: 18.5 };\r\n const loadingSize = { w: 30, h: 30 };\r\n // set styling correctly\r\n imgBack.style.width = `${logoSize.w}vh`;\r\n imgBack.style.height = `${logoSize.h}vh`;\r\n imgBack.style.left = `calc(50% - ${logoSize.w / 2}vh)`;\r\n imgBack.style.top = `calc(50% - ${logoSize.h / 2}vh)`;\r\n\r\n imgSpinner.style.width = `${loadingSize.w}vh`;\r\n imgSpinner.style.height = `${loadingSize.h}vh`;\r\n imgSpinner.style.left = `calc(50% - ${loadingSize.w / 2}vh)`;\r\n imgSpinner.style.top = `calc(50% - ${loadingSize.h / 2}vh)`;\r\n }\r\n\r\n imageSpinnerContainer.appendChild(imgSpinner);\r\n\r\n loadingDiv.appendChild(imgBack);\r\n loadingDiv.appendChild(imageSpinnerContainer);\r\n loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n loadingDiv.style.opacity = \"1\";\r\n\r\n const canvases: Array<HTMLCanvasElement> = [];\r\n const views = this._engine.views;\r\n if (views?.length) {\r\n for (const view of views) {\r\n if (view.enabled) {\r\n canvases.push(view.target);\r\n }\r\n }\r\n } else {\r\n canvases.push(this._renderingCanvas);\r\n }\r\n canvases.forEach((canvas, index) => {\r\n const clonedLoadingDiv = loadingDiv!.cloneNode(true) as HTMLDivElement;\r\n clonedLoadingDiv.id += `-${index}`;\r\n this._loadingDivToRenderingCanvasMap.set(clonedLoadingDiv, [canvas, null]);\r\n });\r\n\r\n this._resizeLoadingUI();\r\n\r\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._resizeLoadingUI();\r\n });\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n document.body.appendChild(loadingDiv);\r\n });\r\n }\r\n\r\n /**\r\n * Function called to hide the loading screen\r\n */\r\n public hideLoadingUI(): void {\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n let completedTransitions = 0;\r\n\r\n const onTransitionEnd = (event: TransitionEvent) => {\r\n const loadingDiv = event.target as HTMLDivElement;\r\n // ensure that ending transition event is generated by one of the current loadingDivs\r\n const isTransitionEndOnLoadingDiv = this._loadingDivToRenderingCanvasMap.has(loadingDiv);\r\n\r\n if (isTransitionEndOnLoadingDiv) {\r\n completedTransitions++;\r\n loadingDiv.remove();\r\n\r\n const allTransitionsCompleted = completedTransitions === this._loadingDivToRenderingCanvasMap.size;\r\n if (allTransitionsCompleted) {\r\n if (this._loadingTextDiv) {\r\n this._loadingTextDiv.remove();\r\n this._loadingTextDiv = null;\r\n }\r\n if (this._style) {\r\n this._style.remove();\r\n this._style = null;\r\n }\r\n\r\n window.removeEventListener(\"transitionend\", onTransitionEnd);\r\n this._engine!.onResizeObservable.remove(this._resizeObserver);\r\n this._loadingDivToRenderingCanvasMap.clear();\r\n this._engine = null;\r\n this._isLoading = false;\r\n }\r\n }\r\n };\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n loadingDiv.style.opacity = \"0\";\r\n });\r\n\r\n window.addEventListener(\"transitionend\", onTransitionEnd);\r\n }\r\n\r\n /**\r\n * Gets or sets the text to display while loading\r\n */\r\n public set loadingUIText(text: string) {\r\n this._loadingText = text;\r\n\r\n if (this._loadingTextDiv) {\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n // set loadingTextDiv of current loadingDiv\r\n loadingDiv.children[0].innerHTML = this._loadingText;\r\n });\r\n }\r\n }\r\n\r\n public get loadingUIText(): string {\r\n return this._loadingText;\r\n }\r\n\r\n /**\r\n * Gets or sets the color to use for the background\r\n */\r\n public get loadingUIBackgroundColor(): string {\r\n return this._loadingDivBackgroundColor;\r\n }\r\n\r\n public set loadingUIBackgroundColor(color: string) {\r\n this._loadingDivBackgroundColor = color;\r\n\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach((_, loadingDiv) => {\r\n loadingDiv.style.backgroundColor = this._loadingDivBackgroundColor;\r\n });\r\n }\r\n\r\n /**\r\n * Checks if the layout of the canvas has changed by comparing the current layout\r\n * rectangle with the previous one.\r\n *\r\n * This function compares of the two `DOMRect` objects to determine if any of the layout dimensions have changed.\r\n * If the layout has changed or if there is no previous layout (i.e., `previousCanvasRect` is `null`),\r\n * it returns `true`. Otherwise, it returns `false`.\r\n *\r\n * @param previousCanvasRect defines the previously recorded `DOMRect` of the canvas, or `null` if no previous state exists.\r\n * @param currentCanvasRect defines the current `DOMRect` of the canvas to compare against the previous layout.\r\n * @returns `true` if the layout has changed, otherwise `false`.\r\n */\r\n private _isCanvasLayoutChanged(previousCanvasRect: DOMRect | null, currentCanvasRect: DOMRect) {\r\n return (\r\n !previousCanvasRect ||\r\n previousCanvasRect.left !== currentCanvasRect.left ||\r\n previousCanvasRect.top !== currentCanvasRect.top ||\r\n previousCanvasRect.right !== currentCanvasRect.right ||\r\n previousCanvasRect.bottom !== currentCanvasRect.bottom ||\r\n previousCanvasRect.width !== currentCanvasRect.width ||\r\n previousCanvasRect.height !== currentCanvasRect.height ||\r\n previousCanvasRect.x !== currentCanvasRect.x ||\r\n previousCanvasRect.y !== currentCanvasRect.y\r\n );\r\n }\r\n\r\n // Resize\r\n private _resizeLoadingUI = () => {\r\n if (!this._isLoading) {\r\n return;\r\n }\r\n\r\n this._loadingDivToRenderingCanvasMap.forEach(([canvas, previousCanvasRect], loadingDiv) => {\r\n const currentCanvasRect = canvas.getBoundingClientRect();\r\n if (this._isCanvasLayoutChanged(previousCanvasRect, currentCanvasRect)) {\r\n const canvasPositioning = window.getComputedStyle(canvas).position;\r\n\r\n loadingDiv.style.position = canvasPositioning === \"fixed\" ? \"fixed\" : \"absolute\";\r\n loadingDiv.style.left = currentCanvasRect.left + window.scrollX + \"px\";\r\n loadingDiv.style.top = currentCanvasRect.top + window.scrollY + \"px\";\r\n loadingDiv.style.width = currentCanvasRect.width + \"px\";\r\n loadingDiv.style.height = currentCanvasRect.height + \"px\";\r\n\r\n this._loadingDivToRenderingCanvasMap.set(loadingDiv, [canvas, currentCanvasRect]);\r\n }\r\n });\r\n };\r\n}\r\n\r\nAbstractEngine.DefaultLoadingScreenFactory = (canvas: HTMLCanvasElement) => {\r\n return new DefaultLoadingScreen(canvas);\r\n};\r\n"]}
|
|
@@ -24,10 +24,10 @@ export class BoxBlock extends NodeGeometryBlock {
|
|
|
24
24
|
this.registerInput("width", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
25
25
|
this.registerInput("height", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
26
26
|
this.registerInput("depth", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
27
|
-
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
|
|
28
|
-
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
29
|
-
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
30
|
-
this.registerInput("subdivisionsZ", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
27
|
+
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);
|
|
28
|
+
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
29
|
+
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
30
|
+
this.registerInput("subdivisionsZ", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
31
31
|
this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boxBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/boxBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa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EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAtMU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iDAC1G;AAwMnC,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { CreateSegmentedBoxVertexData } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate box geometry data\r\n */\r\nexport class BoxBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new BoxBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"depth\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n this.registerInput(\"subdivisionsZ\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BoxBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the depth input component\r\n */\r\n public get depth(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsZ input component\r\n */\r\n public get subdivisionsZ(): NodeGeometryConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected && !this.depth.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n\r\n if (!this.depth.isConnected) {\r\n const depthInput = new GeometryInputBlock(\"Depth\");\r\n depthInput.value = 1;\r\n depthInput.output.connectTo(this.depth);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: {\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n segments?: number;\r\n widthSegments?: number;\r\n heightSegments?: number;\r\n depthSegments?: number;\r\n } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n options.depth = this.depth.getConnectedValue(state);\r\n\r\n const subdivisions = this.subdivisions.getConnectedValue(state);\r\n const subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n const subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n const subdivisionsZ = this.subdivisionsZ.getConnectedValue(state);\r\n\r\n if (subdivisions) {\r\n options.segments = subdivisions;\r\n }\r\n\r\n if (subdivisionsX) {\r\n options.widthSegments = subdivisionsX;\r\n }\r\n\r\n if (subdivisionsY) {\r\n options.heightSegments = subdivisionsY;\r\n }\r\n\r\n if (subdivisionsZ) {\r\n options.depthSegments = subdivisionsZ;\r\n }\r\n\r\n // Append vertex data from the plane builder\r\n return CreateSegmentedBoxVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxBlock\", BoxBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"boxBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/boxBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAA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,CAAC;YACzB,CAAC,CAAC;QACN,CAAC;IACL,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAtMU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;iDAC1G;AAwMnC,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { CreateSegmentedBoxVertexData } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate box geometry data\r\n */\r\nexport class BoxBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new BoxBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"depth\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n this.registerInput(\"subdivisionsZ\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BoxBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the depth input component\r\n */\r\n public get depth(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsZ input component\r\n */\r\n public get subdivisionsZ(): NodeGeometryConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected && !this.depth.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n\r\n if (!this.depth.isConnected) {\r\n const depthInput = new GeometryInputBlock(\"Depth\");\r\n depthInput.value = 1;\r\n depthInput.output.connectTo(this.depth);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: {\r\n size?: number;\r\n width?: number;\r\n height?: number;\r\n depth?: number;\r\n segments?: number;\r\n widthSegments?: number;\r\n heightSegments?: number;\r\n depthSegments?: number;\r\n } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n options.depth = this.depth.getConnectedValue(state);\r\n\r\n const subdivisions = this.subdivisions.getConnectedValue(state);\r\n const subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n const subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n const subdivisionsZ = this.subdivisionsZ.getConnectedValue(state);\r\n\r\n if (subdivisions) {\r\n options.segments = subdivisions;\r\n }\r\n\r\n if (subdivisionsX) {\r\n options.widthSegments = subdivisionsX;\r\n }\r\n\r\n if (subdivisionsY) {\r\n options.heightSegments = subdivisionsY;\r\n }\r\n\r\n if (subdivisionsZ) {\r\n options.depthSegments = subdivisionsZ;\r\n }\r\n\r\n // Append vertex data from the plane builder\r\n return CreateSegmentedBoxVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxBlock\", BoxBlock);\r\n"]}
|
|
@@ -22,9 +22,9 @@ export class GridBlock extends NodeGeometryBlock {
|
|
|
22
22
|
this.evaluateContext = false;
|
|
23
23
|
this.registerInput("width", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
24
24
|
this.registerInput("height", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
25
|
-
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
|
|
26
|
-
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
27
|
-
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
25
|
+
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);
|
|
26
|
+
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
27
|
+
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
28
28
|
this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gridBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/gridBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEtG;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,iBAAiB;IAQ5C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAq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AAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAhIU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC1G;AAkInC,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { CreateGroundVertexData } from \"../../../Builders/groundBuilder\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Defines a block used to generate grid geometry data\r\n */\r\nexport class GridBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new GridBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"GridBlock\";\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n options.subdivisions = this.subdivisions.getConnectedValue(state);\r\n options.subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n options.subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n\r\n // Append vertex data from the plane builder\r\n return CreateGroundVertexData(options);\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GridBlock\", GridBlock);\r\n"]}
|
|
@@ -25,9 +25,9 @@ export class PlaneBlock extends NodeGeometryBlock {
|
|
|
25
25
|
this.registerInput("size", NodeGeometryBlockConnectionPointTypes.Float, true, 1);
|
|
26
26
|
this.registerInput("width", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
27
27
|
this.registerInput("height", NodeGeometryBlockConnectionPointTypes.Float, true, 0);
|
|
28
|
-
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1);
|
|
29
|
-
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
30
|
-
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0);
|
|
28
|
+
this.registerInput("subdivisions", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);
|
|
29
|
+
this.registerInput("subdivisionsX", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
30
|
+
this.registerInput("subdivisionsY", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);
|
|
31
31
|
this.registerOutput("geometry", NodeGeometryBlockConnectionPointTypes.Geometry);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/planeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,2CAA2C;AAE5E;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAS7C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAbR,oBA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QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,GAAG,EAAE;gBACjC,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;gBAClC,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC,CAAC;QACN,CAAC;IACL,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAvKU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDAC1G;AAyKnC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Matrix } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { CreateGroundVertexData } from \"core/Meshes/Builders/groundBuilder\";\r\n\r\n/**\r\n * Defines a block used to generate plane geometry data\r\n */\r\nexport class PlaneBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new PlaneBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"PlaneBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: { size?: number; width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n\r\n const subdivisions = this.subdivisions.getConnectedValue(state);\r\n const subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n const subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n\r\n if (subdivisions) {\r\n options.subdivisions = subdivisions;\r\n }\r\n\r\n if (subdivisionsX) {\r\n options.subdivisionsX = subdivisionsX;\r\n }\r\n\r\n if (subdivisionsY) {\r\n options.subdivisionsY = subdivisionsY;\r\n }\r\n\r\n // Append vertex data from the ground builder (to get access to subdivisions)\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n Matrix.RotationYawPitchRollToRef(-Math.PI / 2, 0, Math.PI / 2, this._rotationMatrix);\r\n\r\n vertexData.transform(this._rotationMatrix);\r\n\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PlaneBlock\", PlaneBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"planeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Sources/planeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4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AAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDAC1G;AAyKnC,aAAa,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { GeometryInputBlock } from \"../geometryInputBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { Matrix } from \"../../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { CreateGroundVertexData } from \"core/Meshes/Builders/groundBuilder\";\r\n\r\n/**\r\n * Defines a block used to generate plane geometry data\r\n */\r\nexport class PlaneBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new PlaneBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"size\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"width\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"height\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 1, 0);\r\n this.registerInput(\"subdivisionsX\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n this.registerInput(\"subdivisionsY\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n\r\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"PlaneBlock\";\r\n }\r\n\r\n /**\r\n * Gets the size input component\r\n */\r\n public get size(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the width input component\r\n */\r\n public get width(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the height input component\r\n */\r\n public get height(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the subdivisions input component\r\n */\r\n public get subdivisions(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsX input component\r\n */\r\n public get subdivisionsX(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the subdivisionsY input component\r\n */\r\n public get subdivisionsY(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (this.size.isConnected) {\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected && !this.height.isConnected) {\r\n const sizeInput = new GeometryInputBlock(\"Size\");\r\n sizeInput.value = 1;\r\n sizeInput.output.connectTo(this.size);\r\n return;\r\n }\r\n\r\n if (!this.width.isConnected) {\r\n const widthInput = new GeometryInputBlock(\"Width\");\r\n widthInput.value = 1;\r\n widthInput.output.connectTo(this.width);\r\n }\r\n\r\n if (!this.height.isConnected) {\r\n const heightInput = new GeometryInputBlock(\"Height\");\r\n heightInput.value = 1;\r\n heightInput.output.connectTo(this.height);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const options: { size?: number; width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number } = {};\r\n const func = (state: NodeGeometryBuildState) => {\r\n options.size = this.size.getConnectedValue(state);\r\n options.width = this.width.getConnectedValue(state);\r\n options.height = this.height.getConnectedValue(state);\r\n\r\n const subdivisions = this.subdivisions.getConnectedValue(state);\r\n const subdivisionsX = this.subdivisionsX.getConnectedValue(state);\r\n const subdivisionsY = this.subdivisionsY.getConnectedValue(state);\r\n\r\n if (subdivisions) {\r\n options.subdivisions = subdivisions;\r\n }\r\n\r\n if (subdivisionsX) {\r\n options.subdivisionsX = subdivisionsX;\r\n }\r\n\r\n if (subdivisionsY) {\r\n options.subdivisionsY = subdivisionsY;\r\n }\r\n\r\n // Append vertex data from the ground builder (to get access to subdivisions)\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n Matrix.RotationYawPitchRollToRef(-Math.PI / 2, 0, Math.PI / 2, this._rotationMatrix);\r\n\r\n vertexData.transform(this._rotationMatrix);\r\n\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.geometry._storedFunction = func;\r\n } else {\r\n const value = func(state);\r\n this.geometry._storedFunction = () => {\r\n this.geometry._executionCount = 1;\r\n return value.clone();\r\n };\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PlaneBlock\", PlaneBlock);\r\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NodeGeometryBlock } from "../nodeGeometryBlock";
|
|
2
|
+
import type { NodeGeometryConnectionPoint } from "../nodeGeometryBlockConnectionPoint";
|
|
3
|
+
/**
|
|
4
|
+
* Block used to subdivide for a geometry using Catmull-Clark algorithm
|
|
5
|
+
*/
|
|
6
|
+
export declare class SubdivideBlock extends NodeGeometryBlock {
|
|
7
|
+
/**
|
|
8
|
+
* Gets or sets a boolean indicating that this block can evaluate context
|
|
9
|
+
*/
|
|
10
|
+
flatOnly: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Gets or sets a float defining the loop weight. i.e how much to weigh favoring heavy corners vs favoring Loop's formula
|
|
13
|
+
*/
|
|
14
|
+
loopWeight: number;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new ComputeNormalsBlock
|
|
17
|
+
* @param name defines the block name
|
|
18
|
+
*/
|
|
19
|
+
constructor(name: string);
|
|
20
|
+
/**
|
|
21
|
+
* Gets the current class name
|
|
22
|
+
* @returns the class name
|
|
23
|
+
*/
|
|
24
|
+
getClassName(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the geometry component
|
|
27
|
+
*/
|
|
28
|
+
get geometry(): NodeGeometryConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the level component
|
|
31
|
+
*/
|
|
32
|
+
get level(): NodeGeometryConnectionPoint;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the output component
|
|
35
|
+
*/
|
|
36
|
+
get output(): NodeGeometryConnectionPoint;
|
|
37
|
+
protected _buildBlock(): void;
|
|
38
|
+
protected _dumpPropertiesCode(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Serializes this block in a JSON representation
|
|
41
|
+
* @returns the serialized block object
|
|
42
|
+
*/
|
|
43
|
+
serialize(): any;
|
|
44
|
+
_deserialize(serializationObject: any): void;
|
|
45
|
+
}
|