@onerjs/core 8.36.6 → 8.36.8
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/Cameras/geospatialClippingBehavior.d.ts +3 -4
- package/Behaviors/Cameras/geospatialClippingBehavior.js +9 -14
- package/Behaviors/Cameras/geospatialClippingBehavior.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +2 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Limits/geospatialLimits.d.ts +16 -0
- package/Cameras/Limits/geospatialLimits.js +38 -1
- package/Cameras/Limits/geospatialLimits.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +10 -9
- package/Cameras/geospatialCamera.js +5 -8
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +1 -3
- package/Cameras/geospatialCameraMovement.js +9 -4
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Meshes/Builders/tubeBuilder.d.ts +2 -0
- package/Meshes/Builders/tubeBuilder.js +19 -2
- package/Meshes/Builders/tubeBuilder.js.map +1 -1
- package/Misc/screenshotTools.js +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/package.json +1 -1
|
@@ -185,7 +185,7 @@ export class FragmentOutputBlock extends NodeMaterialBlock {
|
|
|
185
185
|
state.compilationString += `#endif\n`;
|
|
186
186
|
}
|
|
187
187
|
state.compilationString += `#ifdef ${this._linearDefineName}\n`;
|
|
188
|
-
state.compilationString += `${outputString} =
|
|
188
|
+
state.compilationString += `${outputString} = toLinearSpaceVec4(${outputString});\n`;
|
|
189
189
|
state.compilationString += `#endif\n`;
|
|
190
190
|
state.compilationString += `#ifdef ${this._gammaDefineName}\n`;
|
|
191
191
|
state.compilationString += `${outputString} = toGammaSpace(${outputString});\n`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragmentOutputBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAGtG,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;GAEG;AACH,MAAM,CAAN,IAAY,6BAOX;AAPD,WAAY,6BAA6B;IACrC,kBAAkB;IAClB,iGAAY,CAAA;IACZ,YAAY;IACZ,mFAAK,CAAA;IACL,aAAa;IACb,qFAAM,CAAA;AACV,CAAC,EAPW,6BAA6B,KAA7B,6BAA6B,QAOxC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAMtD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAc/D,wFAAwF;QACjF,wBAAmB,GAAG,KAAK,CAAC;QAEnC,yFAAyF;QAClF,yBAAoB,GAAG,KAAK,CAAC;QAEpC,4EAA4E;QAErE,wBAAmB,GAAG,KAAK,CAAC;QApB/B,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC9E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E,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,6BAA6B,CAAC,KAAK,EAAE;YAC9D,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC,MAAM,EAAE;SACnE;KACJ,CAAC;qDASD;AAkNL,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { BindLogDepth } from \"../../../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Color spaces supported by the fragment output block\r\n */\r\nexport enum FragmentOutputBlockColorSpace {\r\n /** Unspecified */\r\n NoColorSpace,\r\n /** Gamma */\r\n Gamma,\r\n /** Linear */\r\n Linear,\r\n}\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nexport class FragmentOutputBlock extends NodeMaterialBlock {\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n private _additionalColorDefineName: string;\r\n protected _outputString: string;\r\n\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment, true, true);\r\n\r\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3, true);\r\n this.registerInput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"glow\", NodeMaterialBlockConnectionPointTypes.Color3, true);\r\n\r\n this.rgb.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);\r\n this.rgb.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n\r\n this.additionalColor.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);\r\n this.additionalColor.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to gamma space */\r\n public convertToGammaSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to linear space */\r\n public convertToLinearSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if logarithmic depth should be used */\r\n @editableInPropertyPage(\"Use logarithmic depth\", PropertyTypeForEdition.Boolean, \"PROPERTIES\", { embedded: true })\r\n public useLogarithmicDepth = false;\r\n\r\n /**\r\n * Gets or sets the color space used for the block\r\n */\r\n @editableInPropertyPage(\"Color space\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"No color space\", value: FragmentOutputBlockColorSpace.NoColorSpace },\r\n { label: \"Gamma\", value: FragmentOutputBlockColorSpace.Gamma },\r\n { label: \"Linear\", value: FragmentOutputBlockColorSpace.Linear },\r\n ],\r\n })\r\n public get colorSpace() {\r\n if (this.convertToGammaSpace) {\r\n return FragmentOutputBlockColorSpace.Gamma;\r\n }\r\n if (this.convertToLinearSpace) {\r\n return FragmentOutputBlockColorSpace.Linear;\r\n }\r\n return FragmentOutputBlockColorSpace.NoColorSpace;\r\n }\r\n\r\n public set colorSpace(value: FragmentOutputBlockColorSpace) {\r\n this.convertToGammaSpace = value === FragmentOutputBlockColorSpace.Gamma;\r\n this.convertToLinearSpace = value === FragmentOutputBlockColorSpace.Linear;\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 \"FragmentOutputBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"logarithmicDepthConstant\");\r\n state._excludeVariableName(\"vFragmentDepth\");\r\n }\r\n\r\n /**\r\n * Gets the rgba input component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb input component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the a input component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the additionalColor input component (named glow in the UI for now)\r\n */\r\n public get additionalColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the glow input component\r\n */\r\n public get glow(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n protected _getOutputString(state: NodeMaterialBuildState): string {\r\n return state.shaderLanguage === ShaderLanguage.WGSL ? \"fragmentOutputsColor\" : \"gl_FragColor\";\r\n }\r\n\r\n public override prepareDefines(defines: NodeMaterialDefines, nodeMaterial: NodeMaterial) {\r\n defines.setValue(this._linearDefineName, this.convertToLinearSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToGammaSpace, true);\r\n defines.setValue(this._additionalColorDefineName, this.additionalColor.connectedPoint && nodeMaterial._useAdditionalColor, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if ((this.useLogarithmicDepth || nodeMaterial.useLogarithmicDepth) && mesh) {\r\n BindLogDepth(undefined, effect, mesh.getScene());\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const rgba = this.rgba;\r\n const rgb = this.rgb;\r\n const a = this.a;\r\n const additionalColor = this.additionalColor;\r\n\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state.sharedData.bindableBlocks.push(this);\r\n }\r\n\r\n if (additionalColor.connectedPoint) {\r\n state._excludeVariableName(\"useAdditionalColor\");\r\n state._emitUniformFromString(\"useAdditionalColor\", NodeMaterialBlockConnectionPointTypes.Float);\r\n this._additionalColorDefineName = state._getFreeDefineName(\"USEADDITIONALCOLOR\");\r\n }\r\n\r\n this._linearDefineName = state._getFreeDefineName(\"CONVERTTOLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"CONVERTTOGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n const outputString = this._getOutputString(state);\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `var ${outputString} : vec4<f32>;\\r\\n`;\r\n }\r\n\r\n const vec4 = state._getShaderType(NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n if (additionalColor.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n state.compilationString += `#ifdef ${this._additionalColorDefineName}\\n`;\r\n if (additionalColor.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${additionalColor.associatedVariableName}, ${additionalColor.associatedVariableName}, ${additionalColor.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${additionalColor.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n state.compilationString += `#else\\n`;\r\n }\r\n\r\n if (rgba.connectedPoint) {\r\n if (a.isConnected) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgba.associatedVariableName}.rgb, ${a.associatedVariableName});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${rgba.associatedVariableName};\\n`;\r\n }\r\n } else if (rgb.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n\r\n if (rgb.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n } else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n\r\n if (additionalColor.connectedPoint) {\r\n state.compilationString += `#endif\\n`;\r\n }\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${outputString} = toLinearSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${outputString} = toGammaSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `#if !defined(PREPASS)\\r\\n`;\r\n state.compilationString += `fragmentOutputs.color = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n }\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n const fragDepth = isWebGPU ? \"input.vFragmentDepth\" : \"vFragmentDepth\";\r\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\r\n const output = isWebGPU ? \"fragmentOutputs.fragDepth\" : \"gl_FragDepthEXT\";\r\n\r\n state.compilationString += `${output} = log2(${fragDepth}) * ${uniformP}logarithmicDepthConstant * 0.5;\\n`;\r\n }\r\n\r\n state.compilationString += `#if defined(PREPASS)\\r\\n`;\r\n state.compilationString += `${isWebGPU ? \"fragmentOutputs.fragData0\" : \"gl_FragData[0]\"} = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n\r\n return this;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode();\r\n codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\\n`;\r\n codeString += `${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\\n`;\r\n codeString += `${this._codeVariableName}.useLogarithmicDepth = ${this.useLogarithmicDepth};\\n`;\r\n\r\n return codeString;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = !!serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n this.useLogarithmicDepth = serializationObject.useLogarithmicDepth ?? false;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FragmentOutputBlock\", FragmentOutputBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"fragmentOutputBlock.js","sourceRoot":"","sources":["../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EAAE;SACnE;KACJ,CAAC;qDASD;AAkNL,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { BindLogDepth } from \"../../../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Color spaces supported by the fragment output block\r\n */\r\nexport enum FragmentOutputBlockColorSpace {\r\n /** Unspecified */\r\n NoColorSpace,\r\n /** Gamma */\r\n Gamma,\r\n /** Linear */\r\n Linear,\r\n}\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nexport class FragmentOutputBlock extends NodeMaterialBlock {\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n private _additionalColorDefineName: string;\r\n protected _outputString: string;\r\n\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment, true, true);\r\n\r\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3, true);\r\n this.registerInput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, true);\r\n this.registerInput(\"glow\", NodeMaterialBlockConnectionPointTypes.Color3, true);\r\n\r\n this.rgb.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);\r\n this.rgb.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n\r\n this.additionalColor.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);\r\n this.additionalColor.acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to gamma space */\r\n public convertToGammaSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to linear space */\r\n public convertToLinearSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if logarithmic depth should be used */\r\n @editableInPropertyPage(\"Use logarithmic depth\", PropertyTypeForEdition.Boolean, \"PROPERTIES\", { embedded: true })\r\n public useLogarithmicDepth = false;\r\n\r\n /**\r\n * Gets or sets the color space used for the block\r\n */\r\n @editableInPropertyPage(\"Color space\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"No color space\", value: FragmentOutputBlockColorSpace.NoColorSpace },\r\n { label: \"Gamma\", value: FragmentOutputBlockColorSpace.Gamma },\r\n { label: \"Linear\", value: FragmentOutputBlockColorSpace.Linear },\r\n ],\r\n })\r\n public get colorSpace() {\r\n if (this.convertToGammaSpace) {\r\n return FragmentOutputBlockColorSpace.Gamma;\r\n }\r\n if (this.convertToLinearSpace) {\r\n return FragmentOutputBlockColorSpace.Linear;\r\n }\r\n return FragmentOutputBlockColorSpace.NoColorSpace;\r\n }\r\n\r\n public set colorSpace(value: FragmentOutputBlockColorSpace) {\r\n this.convertToGammaSpace = value === FragmentOutputBlockColorSpace.Gamma;\r\n this.convertToLinearSpace = value === FragmentOutputBlockColorSpace.Linear;\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 \"FragmentOutputBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"logarithmicDepthConstant\");\r\n state._excludeVariableName(\"vFragmentDepth\");\r\n }\r\n\r\n /**\r\n * Gets the rgba input component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb input component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the a input component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the additionalColor input component (named glow in the UI for now)\r\n */\r\n public get additionalColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the glow input component\r\n */\r\n public get glow(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n protected _getOutputString(state: NodeMaterialBuildState): string {\r\n return state.shaderLanguage === ShaderLanguage.WGSL ? \"fragmentOutputsColor\" : \"gl_FragColor\";\r\n }\r\n\r\n public override prepareDefines(defines: NodeMaterialDefines, nodeMaterial: NodeMaterial) {\r\n defines.setValue(this._linearDefineName, this.convertToLinearSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToGammaSpace, true);\r\n defines.setValue(this._additionalColorDefineName, this.additionalColor.connectedPoint && nodeMaterial._useAdditionalColor, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if ((this.useLogarithmicDepth || nodeMaterial.useLogarithmicDepth) && mesh) {\r\n BindLogDepth(undefined, effect, mesh.getScene());\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const rgba = this.rgba;\r\n const rgb = this.rgb;\r\n const a = this.a;\r\n const additionalColor = this.additionalColor;\r\n\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state.sharedData.bindableBlocks.push(this);\r\n }\r\n\r\n if (additionalColor.connectedPoint) {\r\n state._excludeVariableName(\"useAdditionalColor\");\r\n state._emitUniformFromString(\"useAdditionalColor\", NodeMaterialBlockConnectionPointTypes.Float);\r\n this._additionalColorDefineName = state._getFreeDefineName(\"USEADDITIONALCOLOR\");\r\n }\r\n\r\n this._linearDefineName = state._getFreeDefineName(\"CONVERTTOLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"CONVERTTOGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n const outputString = this._getOutputString(state);\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `var ${outputString} : vec4<f32>;\\r\\n`;\r\n }\r\n\r\n const vec4 = state._getShaderType(NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n if (additionalColor.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n state.compilationString += `#ifdef ${this._additionalColorDefineName}\\n`;\r\n if (additionalColor.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${additionalColor.associatedVariableName}, ${additionalColor.associatedVariableName}, ${additionalColor.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${additionalColor.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n state.compilationString += `#else\\n`;\r\n }\r\n\r\n if (rgba.connectedPoint) {\r\n if (a.isConnected) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgba.associatedVariableName}.rgb, ${a.associatedVariableName});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${rgba.associatedVariableName};\\n`;\r\n }\r\n } else if (rgb.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n\r\n if (rgb.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n } else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n\r\n if (additionalColor.connectedPoint) {\r\n state.compilationString += `#endif\\n`;\r\n }\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${outputString} = toLinearSpaceVec4(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${outputString} = toGammaSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `#if !defined(PREPASS)\\r\\n`;\r\n state.compilationString += `fragmentOutputs.color = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n }\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n const fragDepth = isWebGPU ? \"input.vFragmentDepth\" : \"vFragmentDepth\";\r\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\r\n const output = isWebGPU ? \"fragmentOutputs.fragDepth\" : \"gl_FragDepthEXT\";\r\n\r\n state.compilationString += `${output} = log2(${fragDepth}) * ${uniformP}logarithmicDepthConstant * 0.5;\\n`;\r\n }\r\n\r\n state.compilationString += `#if defined(PREPASS)\\r\\n`;\r\n state.compilationString += `${isWebGPU ? \"fragmentOutputs.fragData0\" : \"gl_FragData[0]\"} = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n\r\n return this;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode();\r\n codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\\n`;\r\n codeString += `${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\\n`;\r\n codeString += `${this._codeVariableName}.useLogarithmicDepth = ${this.useLogarithmicDepth};\\n`;\r\n\r\n return codeString;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = !!serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n this.useLogarithmicDepth = serializationObject.useLogarithmicDepth ?? false;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FragmentOutputBlock\", FragmentOutputBlock);\r\n"]}
|
|
@@ -32,6 +32,7 @@ import { Mesh } from "../mesh.js";
|
|
|
32
32
|
* @param options.backUVs
|
|
33
33
|
* @param options.instance
|
|
34
34
|
* @param options.invertUV
|
|
35
|
+
* @param options.updateVertexData
|
|
35
36
|
* @param scene defines the hosting scene
|
|
36
37
|
* @returns the tube mesh
|
|
37
38
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
|
|
@@ -52,6 +53,7 @@ export declare function CreateTube(name: string, options: {
|
|
|
52
53
|
backUVs?: Vector4;
|
|
53
54
|
instance?: Mesh;
|
|
54
55
|
invertUV?: boolean;
|
|
56
|
+
updateVertexData?: boolean;
|
|
55
57
|
}, scene?: Nullable<Scene>): Mesh;
|
|
56
58
|
/**
|
|
57
59
|
* Class containing static functions to help procedurally build meshes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3, TmpVectors, Matrix } from "../../Maths/math.vector.js";
|
|
2
2
|
import { Mesh } from "../mesh.js";
|
|
3
|
-
import { CreateRibbon } from "./ribbonBuilder.js";
|
|
3
|
+
import { CreateRibbon, CreateRibbonVertexData } from "./ribbonBuilder.js";
|
|
4
4
|
import { Path3D } from "../../Maths/math.path.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a tube mesh.
|
|
@@ -31,6 +31,7 @@ import { Path3D } from "../../Maths/math.path.js";
|
|
|
31
31
|
* @param options.backUVs
|
|
32
32
|
* @param options.instance
|
|
33
33
|
* @param options.invertUV
|
|
34
|
+
* @param options.updateVertexData
|
|
34
35
|
* @param scene defines the hosting scene
|
|
35
36
|
* @returns the tube mesh
|
|
36
37
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
|
|
@@ -120,7 +121,23 @@ export function CreateTube(name, options, scene = null) {
|
|
|
120
121
|
const arc = options.arc || storage.arc;
|
|
121
122
|
path3D = storage.path3D.update(path);
|
|
122
123
|
pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);
|
|
123
|
-
|
|
124
|
+
if (options.updateVertexData) {
|
|
125
|
+
if (options.updatable) {
|
|
126
|
+
const vertexData = CreateRibbonVertexData({
|
|
127
|
+
pathArray: pathArray,
|
|
128
|
+
sideOrientation: instance._originalBuilderSideOrientation,
|
|
129
|
+
closePath: true,
|
|
130
|
+
closeArray: false,
|
|
131
|
+
invertUV: invertUV,
|
|
132
|
+
frontUVs: options.frontUVs,
|
|
133
|
+
backUVs: options.backUVs,
|
|
134
|
+
});
|
|
135
|
+
vertexData.applyToMesh(instance, true);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
instance = CreateRibbon("", { pathArray: pathArray, instance: instance });
|
|
140
|
+
}
|
|
124
141
|
// Update mode, no need to recreate the storage.
|
|
125
142
|
storage.path3D = path3D;
|
|
126
143
|
storage.pathArray = pathArray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tubeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/tubeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,UAAU,CACtB,IAAY,EACZ,OAaC,EACD,QAAyB,IAAI;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAChC,IAAI,MAAM,GAAG,GAAG,CAAC;IAEjB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5B,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QAClB,MAAM,GAAG,QAAQ,CAAC,oBAAqB,CAAC,MAAM,CAAC;IACnD,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,EAAE,GAAG,CAAC,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E,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overrides the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter. The `path`Array HAS to have the SAME number of points as the previous one: https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created. The NUMBER of points CAN'T CHANGE, only their positions.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.path\r\n * @param options.radius\r\n * @param options.tessellation\r\n * @param options.radiusFunction\r\n * @param options.cap\r\n * @param options.arc\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.instance\r\n * @param options.invertUV\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tube\r\n */\r\nexport function CreateTube(\r\n name: string,\r\n options: {\r\n path: Vector3[];\r\n radius?: number;\r\n tessellation?: number;\r\n radiusFunction?: { (i: number, distance: number): number };\r\n cap?: number;\r\n arc?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n let instance = options.instance;\r\n let radius = 1.0;\r\n\r\n if (options.radius !== undefined) {\r\n radius = options.radius;\r\n } else if (instance) {\r\n radius = instance._creationDataStorage!.radius;\r\n }\r\n\r\n const tessellation = options.tessellation || 64 | 0;\r\n const radiusFunction = options.radiusFunction || null;\r\n let cap = options.cap || Mesh.NO_CAP;\r\n const invertUV = options.invertUV || false;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;\r\n\r\n // tube geometry\r\n const tubePathArray = (\r\n path: Vector3[],\r\n path3D: Path3D,\r\n circlePaths: Vector3[][],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n arc: number\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const distances = path3D.getDistances();\r\n const pi2 = Math.PI * 2;\r\n const step = (pi2 / tessellation) * arc;\r\n const returnRadius: { (i: number, distance: number): number } = () => radius;\r\n const radiusFunctionFinal: { (i: number, distance: number): number } = radiusFunction || returnRadius;\r\n\r\n let circlePath: Vector3[];\r\n let rad: number;\r\n let normal: Vector3;\r\n let rotated: Vector3;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n for (let i = 0; i < path.length; i++) {\r\n rad = radiusFunctionFinal(i, distances[i]); // current radius\r\n circlePath = Array<Vector3>(); // current circle array\r\n normal = normals[i]; // current normal\r\n for (let t = 0; t < tessellation; t++) {\r\n Matrix.RotationAxisToRef(tangents[i], step * t, rotationMatrix);\r\n rotated = circlePath[t] ? circlePath[t] : Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(normal, rotationMatrix, rotated);\r\n rotated.scaleInPlace(rad).addInPlace(path[i]);\r\n circlePath[t] = rotated;\r\n }\r\n circlePaths[index] = circlePath;\r\n index++;\r\n }\r\n // cap\r\n const capPath = (nbPoints: number, pathIndex: number): Array<Vector3> => {\r\n const pointCap = Array<Vector3>();\r\n for (let i = 0; i < nbPoints; i++) {\r\n pointCap.push(path[pathIndex]);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n break;\r\n case Mesh.CAP_END:\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n case Mesh.CAP_ALL:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n default:\r\n break;\r\n }\r\n return circlePaths;\r\n };\r\n\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // tube update\r\n const storage = instance._creationDataStorage!;\r\n const arc = options.arc || storage.arc;\r\n path3D = storage.path3D.update(path);\r\n pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);\r\n instance = CreateRibbon(\"\", { pathArray: pathArray, instance: instance });\r\n // Update mode, no need to recreate the storage.\r\n storage.path3D = path3D;\r\n storage.pathArray = pathArray;\r\n storage.arc = arc;\r\n storage.radius = radius;\r\n\r\n return instance;\r\n }\r\n\r\n // tube creation\r\n path3D = <any>new Path3D(path);\r\n const newPathArray = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);\r\n const tube = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closePath: true,\r\n closeArray: false,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n invertUV: invertUV,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs,\r\n },\r\n scene\r\n );\r\n tube._creationDataStorage!.pathArray = pathArray;\r\n tube._creationDataStorage!.path3D = path3D;\r\n tube._creationDataStorage!.tessellation = tessellation;\r\n tube._creationDataStorage!.cap = cap;\r\n tube._creationDataStorage!.arc = options.arc;\r\n tube._creationDataStorage!.radius = radius;\r\n\r\n return tube;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTube directly\r\n */\r\nexport const TubeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTube,\r\n};\r\n\r\nMesh.CreateTube = (\r\n name: string,\r\n path: Vector3[],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: { (i: number, distance: number): number },\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n path: path,\r\n radius: radius,\r\n tessellation: tessellation,\r\n radiusFunction: radiusFunction,\r\n arc: 1,\r\n cap: cap,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n };\r\n return CreateTube(name, options, scene);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"tubeBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/tubeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,UAAU,CACtB,IAAY,EACZ,OAcC,EACD,QAAyB,IAAI;IAE7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAChC,IAAI,MAAM,GAAG,GAAG,CAAC;IAEjB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5B,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QAClB,MAAM,GAAG,QAAQ,CAAC,oBAAqB,CAAC,MAAM,CAAC;IACnD,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,CA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ACZ,IAAe,EACf,MAAc,EACd,YAAoB,EACpB,cAAyD,EACzD,GAAW,EACX,KAAY,EACZ,SAAmB,EACnB,eAAwB,EACxB,QAAe,EACX,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,YAAY;QAC1B,cAAc,EAAE,cAAc;QAC9B,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;QACR,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,eAAe;QAChC,QAAQ,EAAE,QAAQ;KACrB,CAAC;IACF,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { CreateRibbon, CreateRibbonVertexData } from \"./ribbonBuilder\";\r\nimport { Path3D } from \"../../Maths/math.path\";\r\n\r\n/**\r\n * Creates a tube mesh.\r\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\r\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\r\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\r\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\r\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overrides the parameter `radius`\r\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\r\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\r\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\r\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter. The `path`Array HAS to have the SAME number of points as the previous one: https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#tube\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\r\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created. The NUMBER of points CAN'T CHANGE, only their positions.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.path\r\n * @param options.radius\r\n * @param options.tessellation\r\n * @param options.radiusFunction\r\n * @param options.cap\r\n * @param options.arc\r\n * @param options.updatable\r\n * @param options.sideOrientation\r\n * @param options.frontUVs\r\n * @param options.backUVs\r\n * @param options.instance\r\n * @param options.invertUV\r\n * @param options.updateVertexData\r\n * @param scene defines the hosting scene\r\n * @returns the tube mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tube\r\n */\r\nexport function CreateTube(\r\n name: string,\r\n options: {\r\n path: Vector3[];\r\n radius?: number;\r\n tessellation?: number;\r\n radiusFunction?: { (i: number, distance: number): number };\r\n cap?: number;\r\n arc?: number;\r\n updatable?: boolean;\r\n sideOrientation?: number;\r\n frontUVs?: Vector4;\r\n backUVs?: Vector4;\r\n instance?: Mesh;\r\n invertUV?: boolean;\r\n updateVertexData?: boolean;\r\n },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const path = options.path;\r\n let instance = options.instance;\r\n let radius = 1.0;\r\n\r\n if (options.radius !== undefined) {\r\n radius = options.radius;\r\n } else if (instance) {\r\n radius = instance._creationDataStorage!.radius;\r\n }\r\n\r\n const tessellation = options.tessellation || 64 | 0;\r\n const radiusFunction = options.radiusFunction || null;\r\n let cap = options.cap || Mesh.NO_CAP;\r\n const invertUV = options.invertUV || false;\r\n const updatable = options.updatable;\r\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;\r\n\r\n // tube geometry\r\n const tubePathArray = (\r\n path: Vector3[],\r\n path3D: Path3D,\r\n circlePaths: Vector3[][],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: Nullable<{ (i: number, distance: number): number }>,\r\n cap: number,\r\n arc: number\r\n ) => {\r\n const tangents = path3D.getTangents();\r\n const normals = path3D.getNormals();\r\n const distances = path3D.getDistances();\r\n const pi2 = Math.PI * 2;\r\n const step = (pi2 / tessellation) * arc;\r\n const returnRadius: { (i: number, distance: number): number } = () => radius;\r\n const radiusFunctionFinal: { (i: number, distance: number): number } = radiusFunction || returnRadius;\r\n\r\n let circlePath: Vector3[];\r\n let rad: number;\r\n let normal: Vector3;\r\n let rotated: Vector3;\r\n const rotationMatrix: Matrix = TmpVectors.Matrix[0];\r\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\r\n for (let i = 0; i < path.length; i++) {\r\n rad = radiusFunctionFinal(i, distances[i]); // current radius\r\n circlePath = Array<Vector3>(); // current circle array\r\n normal = normals[i]; // current normal\r\n for (let t = 0; t < tessellation; t++) {\r\n Matrix.RotationAxisToRef(tangents[i], step * t, rotationMatrix);\r\n rotated = circlePath[t] ? circlePath[t] : Vector3.Zero();\r\n Vector3.TransformCoordinatesToRef(normal, rotationMatrix, rotated);\r\n rotated.scaleInPlace(rad).addInPlace(path[i]);\r\n circlePath[t] = rotated;\r\n }\r\n circlePaths[index] = circlePath;\r\n index++;\r\n }\r\n // cap\r\n const capPath = (nbPoints: number, pathIndex: number): Array<Vector3> => {\r\n const pointCap = Array<Vector3>();\r\n for (let i = 0; i < nbPoints; i++) {\r\n pointCap.push(path[pathIndex]);\r\n }\r\n return pointCap;\r\n };\r\n switch (cap) {\r\n case Mesh.NO_CAP:\r\n break;\r\n case Mesh.CAP_START:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n break;\r\n case Mesh.CAP_END:\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n case Mesh.CAP_ALL:\r\n circlePaths[0] = capPath(tessellation, 0);\r\n circlePaths[1] = circlePaths[2].slice(0);\r\n circlePaths[index] = circlePaths[index - 1].slice(0);\r\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\r\n break;\r\n default:\r\n break;\r\n }\r\n return circlePaths;\r\n };\r\n\r\n let path3D;\r\n let pathArray;\r\n if (instance) {\r\n // tube update\r\n const storage = instance._creationDataStorage!;\r\n const arc = options.arc || storage.arc;\r\n path3D = storage.path3D.update(path);\r\n pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);\r\n if (options.updateVertexData) {\r\n if (options.updatable) {\r\n const vertexData = CreateRibbonVertexData({\r\n pathArray: pathArray,\r\n sideOrientation: instance._originalBuilderSideOrientation,\r\n closePath: true,\r\n closeArray: false,\r\n invertUV: invertUV,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs,\r\n });\r\n vertexData.applyToMesh(instance, true);\r\n }\r\n } else {\r\n instance = CreateRibbon(\"\", { pathArray: pathArray, instance: instance });\r\n }\r\n // Update mode, no need to recreate the storage.\r\n storage.path3D = path3D;\r\n storage.pathArray = pathArray;\r\n storage.arc = arc;\r\n storage.radius = radius;\r\n\r\n return instance;\r\n }\r\n\r\n // tube creation\r\n path3D = <any>new Path3D(path);\r\n const newPathArray = new Array<Array<Vector3>>();\r\n cap = cap < 0 || cap > 3 ? 0 : cap;\r\n pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);\r\n const tube = CreateRibbon(\r\n name,\r\n {\r\n pathArray: pathArray,\r\n closePath: true,\r\n closeArray: false,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n invertUV: invertUV,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs,\r\n },\r\n scene\r\n );\r\n tube._creationDataStorage!.pathArray = pathArray;\r\n tube._creationDataStorage!.path3D = path3D;\r\n tube._creationDataStorage!.tessellation = tessellation;\r\n tube._creationDataStorage!.cap = cap;\r\n tube._creationDataStorage!.arc = options.arc;\r\n tube._creationDataStorage!.radius = radius;\r\n\r\n return tube;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use CreateTube directly\r\n */\r\nexport const TubeBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTube,\r\n};\r\n\r\nMesh.CreateTube = (\r\n name: string,\r\n path: Vector3[],\r\n radius: number,\r\n tessellation: number,\r\n radiusFunction: { (i: number, distance: number): number },\r\n cap: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n sideOrientation?: number,\r\n instance?: Mesh\r\n): Mesh => {\r\n const options = {\r\n path: path,\r\n radius: radius,\r\n tessellation: tessellation,\r\n radiusFunction: radiusFunction,\r\n arc: 1,\r\n cap: cap,\r\n updatable: updatable,\r\n sideOrientation: sideOrientation,\r\n instance: instance,\r\n };\r\n return CreateTube(name, options, scene);\r\n};\r\n"]}
|
package/Misc/screenshotTools.js
CHANGED
|
@@ -59,7 +59,7 @@ export function CreateScreenshot(engine, camera, size, successCallback, mimeType
|
|
|
59
59
|
else if (successCallback) {
|
|
60
60
|
successCallback(data);
|
|
61
61
|
}
|
|
62
|
-
}, mimeType, 1.0, engine.getCreationOptions().antialias, undefined, undefined,
|
|
62
|
+
}, mimeType, 1.0, engine.getCreationOptions().antialias, undefined, undefined, engine.getCreationOptions().stencil, undefined, quality);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
engine.onEndFrameObservable.addOnce(() => {
|