@onerjs/core 8.31.0 → 8.31.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.js +1 -4
- package/Animations/animationGroup.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +8 -2
- package/Behaviors/Cameras/interpolatingBehavior.js +58 -6
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +11 -9
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +8 -20
- package/Cameras/Inputs/geospatialCameraPointersInput.js +35 -75
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Limits/geospatialLimits.d.ts +60 -0
- package/Cameras/Limits/geospatialLimits.js +89 -0
- package/Cameras/Limits/geospatialLimits.js.map +1 -0
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +2 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/cameraMovement.js +1 -1
- package/Cameras/cameraMovement.js.map +1 -1
- package/Cameras/deviceOrientationCamera.js +5 -3
- package/Cameras/deviceOrientationCamera.js.map +1 -1
- package/Cameras/flyCamera.d.ts +2 -1
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +78 -49
- package/Cameras/geospatialCamera.js +210 -191
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
- package/Cameras/geospatialCameraInputsManager.js +9 -0
- package/Cameras/geospatialCameraInputsManager.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +66 -0
- package/Cameras/geospatialCameraMovement.js +199 -0
- package/Cameras/geospatialCameraMovement.js.map +1 -0
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js +2 -2
- package/Cameras/targetCamera.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +14 -6
- package/Engines/Native/nativeInterfaces.js +6 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
- package/FlowGraph/flowGraphMath.d.ts +25 -0
- package/FlowGraph/flowGraphMath.js +40 -0
- package/FlowGraph/flowGraphMath.js.map +1 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
- package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
- package/Materials/shaderMaterial.js +4 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +5 -24
- package/Maths/math.vector.functions.js +32 -35
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +15 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/tools.d.ts +3 -0
- package/Misc/tools.js +43 -4
- package/Misc/tools.js.map +1 -1
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
- package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +1 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +8 -8
- package/Particles/Node/Blocks/systemBlock.js +12 -12
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.d.ts +5 -5
- package/Particles/Node/nodeParticleBuildState.js +9 -7
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +288 -149
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +4 -0
- package/Particles/particle.js +2 -0
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -4
- package/Particles/thinParticleSystem.function.d.ts +1 -1
- package/Particles/thinParticleSystem.function.js +9 -6
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js +1 -3
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +3 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
- package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/XR/webXRCamera.d.ts +5 -1
- package/XR/webXRCamera.js +2 -2
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.js +1 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.
|
|
|
5
5
|
import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
|
|
6
6
|
import { Quaternion, Vector3, Vector4 } from "../../../../Maths/math.vector.js";
|
|
7
7
|
import { _GetClassNameOf } from "../../../utils.js";
|
|
8
|
-
import { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from "
|
|
8
|
+
import { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from "../../../flowGraphMath.js";
|
|
9
9
|
const AxisCacheName = "cachedOperationAxis";
|
|
10
10
|
const AngleCacheName = "cachedOperationAngle";
|
|
11
11
|
const CacheExecIdName = "cachedExecutionId";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphVectorMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,uCAA0C;AAC3C,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAItE,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAGvD,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAGlH,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,4BAAqD;IAC3F,YAAY,MAAqC;QAC7C,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,2DAA8B,MAAM,CAAC,CAAC;IAC9G,CAAC;IAEO,kBAAkB,CAAC,CAAkB;QACzC,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACtC,QAAQ,UAAU,EAAE,CAAC;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AC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,YAAY;QACxB,iGAAmD;IACvD,CAAC;CACJ;AAED,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,6BAA2D;IACnH,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,+FAAgD,MAAM,CAAC,CAAC;IACnK,CAAC;CACJ","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Quaternion, Vector3, Vector4 } from \"core/Maths/math.vector\";\nimport type { Matrix, Vector2 } from \"core/Maths/math.vector\";\nimport type { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport type { FlowGraphMatrix, FlowGraphVector } from \"core/FlowGraph/utils\";\nimport { _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from \"../../../../Maths/math.vector.functions\";\nimport type { Nullable } from \"../../../../types\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\n\n/**\n * Vector length block.\n */\nexport class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), FlowGraphBlockNames.Length, config);\n }\n\n private _polymorphicLength(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n\n/**\n * Configuration for normalized vector\n */\nexport interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * If true, the block will return NaN if the input vector has a length of 0.\n * This is the expected behavior for glTF interactivity graphs.\n */\n nanOnZeroLength?: boolean;\n}\n\n/**\n * Vector normalize block.\n */\nexport class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), FlowGraphBlockNames.Normalize, config);\n }\n\n private _polymorphicNormalize(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n let normalized: FlowGraphVector;\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n normalized = a.normalizeToNew();\n if (this.config?.nanOnZeroLength) {\n const length = a.length();\n if (length === 0) {\n normalized.setAll(NaN);\n }\n }\n return normalized;\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n\n/**\n * Dot product block.\n */\nexport class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), FlowGraphBlockNames.Dot, config);\n }\n\n private _polymorphicDot(a: FlowGraphVector, b: FlowGraphVector) {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n // casting is needed because dot requires both to be the same type\n return (a as Vector3).dot(b as Vector3);\n default:\n throw new Error(`Cannot get dot product of ${a} and ${b}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n\n/**\n * Cross product block.\n */\nexport class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), FlowGraphBlockNames.Cross, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n\n/**\n * 2D rotation block.\n */\nexport class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n\nfunction TransformVector(a: FlowGraphVector, b: FlowGraphMatrix): FlowGraphVector {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return (b as FlowGraphMatrix2D).transformVector(a as Vector2);\n case FlowGraphTypes.Vector3:\n return (b as FlowGraphMatrix3D).transformVector(a as Vector3);\n case FlowGraphTypes.Vector4:\n a = a as Vector4;\n // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3],\n a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7],\n a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11],\n a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]\n );\n default:\n throw new Error(`Cannot transform value ${a}`);\n }\n}\n\n/**\n * Configuration for the transform block.\n */\nexport interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The vector type\n */\n vectorType: FlowGraphTypes;\n}\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {\n constructor(config?: IFlowGraphTransformBlockConfiguration) {\n const vectorType = config?.vectorType || FlowGraphTypes.Vector3;\n const matrixType =\n vectorType === FlowGraphTypes.Vector2 ? FlowGraphTypes.Matrix2D : vectorType === FlowGraphTypes.Vector3 ? FlowGraphTypes.Matrix3D : FlowGraphTypes.Matrix;\n super(\n getRichTypeByFlowGraphType(vectorType),\n getRichTypeByFlowGraphType(matrixType),\n getRichTypeByFlowGraphType(vectorType),\n TransformVector,\n FlowGraphBlockNames.TransformVector,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), FlowGraphBlockNames.TransformCoordinates, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /** @override */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphVectorMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,mCAAsC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,uCAA0C;AAC3C,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAItE,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAIvD,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,kCAAqC;AAEvG,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,4BAAqD;IAC3F,YAAY,MAAqC;QAC7C,KAAK,CAAC,WAAW,EAAE,cAAc,E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AE,cAAc,EAAE,KAAK,CAAC,CAAC;gBAC3D,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;gBAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAClC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACL,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,YAAY;QACxB,iGAAmD;IACvD,CAAC;CACJ;AAED,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,6BAA2D;IACnH,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,+FAAgD,MAAM,CAAC,CAAC;IACnK,CAAC;CACJ","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Quaternion, Vector3, Vector4 } from \"core/Maths/math.vector\";\nimport type { Matrix, Vector2 } from \"core/Maths/math.vector\";\nimport type { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport type { FlowGraphMatrix, FlowGraphVector } from \"core/FlowGraph/utils\";\nimport { _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport type { FlowGraphDataConnection } from \"../../../flowGraphDataConnection\";\nimport type { FlowGraphContext } from \"../../../flowGraphContext\";\nimport type { Nullable } from \"../../../../types\";\nimport { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from \"core/FlowGraph/flowGraphMath\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\n\n/**\n * Vector length block.\n */\nexport class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), FlowGraphBlockNames.Length, config);\n }\n\n private _polymorphicLength(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n\n/**\n * Configuration for normalized vector\n */\nexport interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * If true, the block will return NaN if the input vector has a length of 0.\n * This is the expected behavior for glTF interactivity graphs.\n */\n nanOnZeroLength?: boolean;\n}\n\n/**\n * Vector normalize block.\n */\nexport class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), FlowGraphBlockNames.Normalize, config);\n }\n\n private _polymorphicNormalize(a: FlowGraphVector) {\n const aClassName = _GetClassNameOf(a);\n let normalized: FlowGraphVector;\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n normalized = a.normalizeToNew();\n if (this.config?.nanOnZeroLength) {\n const length = a.length();\n if (length === 0) {\n normalized.setAll(NaN);\n }\n }\n return normalized;\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n\n/**\n * Dot product block.\n */\nexport class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), FlowGraphBlockNames.Dot, config);\n }\n\n private _polymorphicDot(a: FlowGraphVector, b: FlowGraphVector) {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion:\n // casting is needed because dot requires both to be the same type\n return (a as Vector3).dot(b as Vector3);\n default:\n throw new Error(`Cannot get dot product of ${a} and ${b}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n\n/**\n * Cross product block.\n */\nexport class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), FlowGraphBlockNames.Cross, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n\n/**\n * 2D rotation block.\n */\nexport class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n\nfunction TransformVector(a: FlowGraphVector, b: FlowGraphMatrix): FlowGraphVector {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return (b as FlowGraphMatrix2D).transformVector(a as Vector2);\n case FlowGraphTypes.Vector3:\n return (b as FlowGraphMatrix3D).transformVector(a as Vector3);\n case FlowGraphTypes.Vector4:\n a = a as Vector4;\n // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3],\n a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7],\n a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11],\n a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]\n );\n default:\n throw new Error(`Cannot transform value ${a}`);\n }\n}\n\n/**\n * Configuration for the transform block.\n */\nexport interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The vector type\n */\n vectorType: FlowGraphTypes;\n}\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {\n constructor(config?: IFlowGraphTransformBlockConfiguration) {\n const vectorType = config?.vectorType || FlowGraphTypes.Vector3;\n const matrixType =\n vectorType === FlowGraphTypes.Vector2 ? FlowGraphTypes.Matrix2D : vectorType === FlowGraphTypes.Vector3 ? FlowGraphTypes.Matrix3D : FlowGraphTypes.Matrix;\n super(\n getRichTypeByFlowGraphType(vectorType),\n getRichTypeByFlowGraphType(matrixType),\n getRichTypeByFlowGraphType(vectorType),\n TransformVector,\n FlowGraphBlockNames.TransformVector,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), FlowGraphBlockNames.TransformCoordinates, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /** @override */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IQuaternionLike } from "../Maths/math.like.js";
|
|
2
|
+
import { Quaternion, Vector3 } from "../Maths/math.vector.js";
|
|
3
|
+
import type { DeepImmutable } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the angle in radians between two quaternions
|
|
6
|
+
* @param q1 defines the first quaternion
|
|
7
|
+
* @param q2 defines the second quaternion
|
|
8
|
+
* @returns the angle in radians between the two quaternions
|
|
9
|
+
*/
|
|
10
|
+
export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a quaternion from two direction vectors
|
|
13
|
+
* @param a defines the first direction vector
|
|
14
|
+
* @param b defines the second direction vector
|
|
15
|
+
* @returns the target quaternion
|
|
16
|
+
*/
|
|
17
|
+
export declare function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a quaternion from two direction vectors
|
|
20
|
+
* @param a defines the first direction vector
|
|
21
|
+
* @param b defines the second direction vector
|
|
22
|
+
* @param result defines the target quaternion
|
|
23
|
+
* @returns the target quaternion
|
|
24
|
+
*/
|
|
25
|
+
export declare function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Clamp } from "../Maths/math.scalar.functions.js";
|
|
2
|
+
import { Quaternion, Vector3 } from "../Maths/math.vector.js";
|
|
3
|
+
import { Vector3Dot, Vector4Dot } from "../Maths/math.vector.functions.js";
|
|
4
|
+
// *** NOTE ***
|
|
5
|
+
// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to
|
|
6
|
+
// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.
|
|
7
|
+
/**
|
|
8
|
+
* Returns the angle in radians between two quaternions
|
|
9
|
+
* @param q1 defines the first quaternion
|
|
10
|
+
* @param q2 defines the second quaternion
|
|
11
|
+
* @returns the angle in radians between the two quaternions
|
|
12
|
+
*/
|
|
13
|
+
export function GetAngleBetweenQuaternions(q1, q2) {
|
|
14
|
+
return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a quaternion from two direction vectors
|
|
18
|
+
* @param a defines the first direction vector
|
|
19
|
+
* @param b defines the second direction vector
|
|
20
|
+
* @returns the target quaternion
|
|
21
|
+
*/
|
|
22
|
+
export function GetQuaternionFromDirections(a, b) {
|
|
23
|
+
const result = new Quaternion();
|
|
24
|
+
GetQuaternionFromDirectionsToRef(a, b, result);
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a quaternion from two direction vectors
|
|
29
|
+
* @param a defines the first direction vector
|
|
30
|
+
* @param b defines the second direction vector
|
|
31
|
+
* @param result defines the target quaternion
|
|
32
|
+
* @returns the target quaternion
|
|
33
|
+
*/
|
|
34
|
+
export function GetQuaternionFromDirectionsToRef(a, b, result) {
|
|
35
|
+
const axis = Vector3.Cross(a, b);
|
|
36
|
+
const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));
|
|
37
|
+
Quaternion.RotationAxisToRef(axis, angle, result);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=flowGraphMath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphMath.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphMath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAe;AACf,oGAAoG;AACpG,sGAAsG;AAEtG;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,EAAkC,EAAE,EAAkC;IAC7G,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAoB,CAAmB,EAAE,CAAmB;IACnG,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,gCAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAgD,CAAmB,EAAE,CAAmB,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import type { IQuaternionLike } from \"../Maths/math.like\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport { Vector3Dot, Vector4Dot } from \"../Maths/math.vector.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\n\r\n// *** NOTE ***\r\n// These functions should ideally go in math.vector.functions.ts, but they require math.vector.ts to\r\n// be imported which is big. To avoid the larger bundle size, they are kept inside flow graph for now.\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2), -1, 1)) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
|
|
@@ -352,7 +352,7 @@ GaussianSplattingMaterial.KernelSize = 0.3;
|
|
|
352
352
|
* Compensation
|
|
353
353
|
*/
|
|
354
354
|
GaussianSplattingMaterial.Compensation = false;
|
|
355
|
-
GaussianSplattingMaterial._Attribs = [VertexBuffer.PositionKind, "
|
|
355
|
+
GaussianSplattingMaterial._Attribs = [VertexBuffer.PositionKind, "splatIndex0", "splatIndex1", "splatIndex2", "splatIndex3"];
|
|
356
356
|
GaussianSplattingMaterial._Samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture", "shTexture0", "shTexture1", "shTexture2"];
|
|
357
357
|
GaussianSplattingMaterial._UniformBuffers = ["Scene", "Mesh"];
|
|
358
358
|
GaussianSplattingMaterial._Uniforms = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oC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AAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"../../Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"../../Cameras/camera\";\r\nimport { ShadowDepthWrapper } from \"../../Materials/shadowDepthWrapper\";\r\nimport { ShaderMaterial } from \"../../Materials/shaderMaterial\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport \"../../Shaders/gaussianSplattingDepth.fragment\";\r\nimport \"../../Shaders/gaussianSplattingDepth.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplattingDepth.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplattingDepth.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public SH_DEGREE = 0;\r\n public COMPENSATION = false;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n this.shadowDepthWrapper = GaussianSplattingMaterial._MakeGaussianSplattingShadowDepthWrapper(scene!, this.shaderLanguage);\r\n }\r\n\r\n /**\r\n * Point spread function (default 0.3). Can be overriden per GS material\r\n */\r\n public static KernelSize: number = 0.3;\r\n\r\n /**\r\n * Compensation\r\n */\r\n public static Compensation: boolean = false;\r\n\r\n /**\r\n * Point spread function (default 0.3). Can be overriden per GS material, otherwise, using default static `KernelSize` value\r\n */\r\n public kernelSize = GaussianSplattingMaterial.KernelSize;\r\n private _compensation = GaussianSplattingMaterial.Compensation;\r\n\r\n // set to true when material defines are dirty\r\n private _isDirty = false;\r\n\r\n /**\r\n * Set compensation default value is `GaussianSplattingMaterial.Compensation`\r\n */\r\n public set compensation(value: boolean) {\r\n this._isDirty = this._isDirty != value;\r\n this._compensation = value;\r\n }\r\n\r\n /**\r\n * Get compensation\r\n */\r\n public get compensation(): boolean {\r\n return this._compensation;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n protected static _Attribs = [VertexBuffer.PositionKind, \"splatIndex\"];\r\n protected static _Samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\", \"shTexture0\", \"shTexture1\", \"shTexture2\"];\r\n protected static _UniformBuffers = [\"Scene\", \"Mesh\"];\r\n protected static _Uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"projection\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"logarithmicDepthConstant\",\r\n \"invViewport\",\r\n \"dataTextureSize\",\r\n \"focal\",\r\n \"eyePosition\",\r\n \"kernelSize\",\r\n \"viewDirectionFactor\",\r\n ];\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n let defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (defines && this._isDirty) {\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n defines = subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n false,\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // SH is disabled for webGL1\r\n if (engine.version > 1 || engine.isWebGPU) {\r\n defines[\"SH_DEGREE\"] = gsMesh.shDegree;\r\n }\r\n\r\n // Compensation\r\n const splatMaterial = gsMesh.material as GaussianSplattingMaterial;\r\n defines[\"COMPENSATION\"] = splatMaterial && splatMaterial.compensation ? splatMaterial.compensation : GaussianSplattingMaterial.Compensation;\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n PrepareAttributesForInstances(GaussianSplattingMaterial._Attribs, defines);\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: GaussianSplattingMaterial._Uniforms,\r\n uniformBuffersNames: GaussianSplattingMaterial._UniformBuffers,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n defines: defines,\r\n });\r\n\r\n AddClipPlaneUniforms(GaussianSplattingMaterial._Uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: GaussianSplattingMaterial._Attribs,\r\n uniformsNames: GaussianSplattingMaterial._Uniforms,\r\n uniformBuffersNames: GaussianSplattingMaterial._UniformBuffers,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n this._isDirty = false;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n const gsMaterial = gsMesh.material as GaussianSplattingMaterial;\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n effect.setVector3(\"viewDirectionFactor\", gsMesh.viewDirectionFactor);\r\n effect.setFloat(\"kernelSize\", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);\r\n scene.bindEyePosition(effect, \"eyePosition\", true);\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n\r\n if (gsMesh.shTextures) {\r\n for (let i = 0; i < gsMesh.shTextures?.length; i++) {\r\n effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n protected static _MakeGaussianSplattingShadowDepthWrapper(scene: Scene, shaderLanguage: ShaderLanguage): ShadowDepthWrapper {\r\n const shaderMaterial = new ShaderMaterial(\r\n \"gaussianSplattingDepth\",\r\n scene,\r\n {\r\n vertex: \"gaussianSplattingDepth\",\r\n fragment: \"gaussianSplattingDepth\",\r\n },\r\n {\r\n attributes: GaussianSplattingMaterial._Attribs,\r\n uniforms: GaussianSplattingMaterial._Uniforms,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n uniformBuffers: GaussianSplattingMaterial._UniformBuffers,\r\n shaderLanguage: shaderLanguage,\r\n }\r\n );\r\n\r\n const shadowDepthWrapper = new ShadowDepthWrapper(shaderMaterial, scene, {\r\n standalone: true,\r\n });\r\n\r\n shaderMaterial.onBindObservable.add((mesh: AbstractMesh) => {\r\n const effect = shaderMaterial.getEffect()!;\r\n const gsMaterial = mesh.material as GaussianSplattingMaterial;\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n shaderMaterial.bindView(effect);\r\n shaderMaterial.bindViewProjection(effect);\r\n\r\n const shadowmapWidth = scene.getEngine().getRenderWidth();\r\n const shadowmapHeight = scene.getEngine().getRenderHeight();\r\n effect.setFloat2(\"invViewport\", 1 / shadowmapWidth, 1 / shadowmapHeight);\r\n\r\n const projection = scene.getProjectionMatrix();\r\n const t = projection.m[5];\r\n const focal = (shadowmapWidth * t) / 2.0;\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n effect.setFloat(\"kernelSize\", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n }\r\n });\r\n\r\n return shadowDepthWrapper;\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,0CAA0C,CAAC;AAClD,OAAO,wCAAwC,CAAC;AAChD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4CAA4C,CAAC;AACpD,OAAO,+CAA+C,CAAC;AACvD,OAAO,6CAA6C,CAAC;AACrD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,iDAAiD,CAAC;AACzD,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,EACrB,8BAA8B,GACjC,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,MAAM,gCAAiC,SAAQ,eAAe;IAa1D;;OAEG;IACH;QACI,KAAK,EAAE,CAAC;QAhBL,QAAG,GAAG,KAAK,CAAC;QACZ,mBAAc,GAAG,IAAI,CAAC;QACtB,qBAAgB,GAAG,KAAK,CAAC;QACzB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,K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Y,KAAK,AAAjB,CAAkB;AAiD3B,kCAAQ,GAAG,CAAC,YAAY,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,AAA1F,CAA2F;AACnG,mCAAS,GAAG,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,AAA9H,CAA+H;AACxI,yCAAe,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,AAApB,CAAqB;AACpC,mCAAS,GAAG;IACzB,OAAO;IACP,MAAM;IACN,YAAY;IACZ,WAAW;IACX,WAAW;IACX,0BAA0B;IAC1B,aAAa;IACb,iBAAiB;IACjB,OAAO;IACP,aAAa;IACb,YAAY;IACZ,qBAAqB;CACxB,AAbyB,CAaxB;AAoUN,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"../../Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { AddClipPlaneUniforms, BindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"../../Cameras/camera\";\r\nimport { ShadowDepthWrapper } from \"../../Materials/shadowDepthWrapper\";\r\nimport { ShaderMaterial } from \"../../Materials/shaderMaterial\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport \"../../Shaders/gaussianSplattingDepth.fragment\";\r\nimport \"../../Shaders/gaussianSplattingDepth.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplattingDepth.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplattingDepth.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public SH_DEGREE = 0;\r\n public COMPENSATION = false;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n this.shadowDepthWrapper = GaussianSplattingMaterial._MakeGaussianSplattingShadowDepthWrapper(scene!, this.shaderLanguage);\r\n }\r\n\r\n /**\r\n * Point spread function (default 0.3). Can be overriden per GS material\r\n */\r\n public static KernelSize: number = 0.3;\r\n\r\n /**\r\n * Compensation\r\n */\r\n public static Compensation: boolean = false;\r\n\r\n /**\r\n * Point spread function (default 0.3). Can be overriden per GS material, otherwise, using default static `KernelSize` value\r\n */\r\n public kernelSize = GaussianSplattingMaterial.KernelSize;\r\n private _compensation = GaussianSplattingMaterial.Compensation;\r\n\r\n // set to true when material defines are dirty\r\n private _isDirty = false;\r\n\r\n /**\r\n * Set compensation default value is `GaussianSplattingMaterial.Compensation`\r\n */\r\n public set compensation(value: boolean) {\r\n this._isDirty = this._isDirty != value;\r\n this._compensation = value;\r\n }\r\n\r\n /**\r\n * Get compensation\r\n */\r\n public get compensation(): boolean {\r\n return this._compensation;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n protected static _Attribs = [VertexBuffer.PositionKind, \"splatIndex0\", \"splatIndex1\", \"splatIndex2\", \"splatIndex3\"];\r\n protected static _Samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\", \"shTexture0\", \"shTexture1\", \"shTexture2\"];\r\n protected static _UniformBuffers = [\"Scene\", \"Mesh\"];\r\n protected static _Uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"projection\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"logarithmicDepthConstant\",\r\n \"invViewport\",\r\n \"dataTextureSize\",\r\n \"focal\",\r\n \"eyePosition\",\r\n \"kernelSize\",\r\n \"viewDirectionFactor\",\r\n ];\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n let defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (defines && this._isDirty) {\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n defines = subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(\r\n mesh,\r\n scene,\r\n this._useLogarithmicDepth,\r\n this.pointsCloud,\r\n this.fogEnabled,\r\n false,\r\n defines,\r\n undefined,\r\n undefined,\r\n undefined,\r\n this._isVertexOutputInvariant\r\n );\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // SH is disabled for webGL1\r\n if (engine.version > 1 || engine.isWebGPU) {\r\n defines[\"SH_DEGREE\"] = gsMesh.shDegree;\r\n }\r\n\r\n // Compensation\r\n const splatMaterial = gsMesh.material as GaussianSplattingMaterial;\r\n defines[\"COMPENSATION\"] = splatMaterial && splatMaterial.compensation ? splatMaterial.compensation : GaussianSplattingMaterial.Compensation;\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n PrepareAttributesForInstances(GaussianSplattingMaterial._Attribs, defines);\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: GaussianSplattingMaterial._Uniforms,\r\n uniformBuffersNames: GaussianSplattingMaterial._UniformBuffers,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n defines: defines,\r\n });\r\n\r\n AddClipPlaneUniforms(GaussianSplattingMaterial._Uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: GaussianSplattingMaterial._Attribs,\r\n uniformsNames: GaussianSplattingMaterial._Uniforms,\r\n uniformBuffersNames: GaussianSplattingMaterial._UniformBuffers,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n this._isDirty = false;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n const gsMaterial = gsMesh.material as GaussianSplattingMaterial;\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n effect.setVector3(\"viewDirectionFactor\", gsMesh.viewDirectionFactor);\r\n effect.setFloat(\"kernelSize\", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);\r\n scene.bindEyePosition(effect, \"eyePosition\", true);\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n\r\n if (gsMesh.shTextures) {\r\n for (let i = 0; i < gsMesh.shTextures?.length; i++) {\r\n effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n BindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n protected static _MakeGaussianSplattingShadowDepthWrapper(scene: Scene, shaderLanguage: ShaderLanguage): ShadowDepthWrapper {\r\n const shaderMaterial = new ShaderMaterial(\r\n \"gaussianSplattingDepth\",\r\n scene,\r\n {\r\n vertex: \"gaussianSplattingDepth\",\r\n fragment: \"gaussianSplattingDepth\",\r\n },\r\n {\r\n attributes: GaussianSplattingMaterial._Attribs,\r\n uniforms: GaussianSplattingMaterial._Uniforms,\r\n samplers: GaussianSplattingMaterial._Samplers,\r\n uniformBuffers: GaussianSplattingMaterial._UniformBuffers,\r\n shaderLanguage: shaderLanguage,\r\n }\r\n );\r\n\r\n const shadowDepthWrapper = new ShadowDepthWrapper(shaderMaterial, scene, {\r\n standalone: true,\r\n });\r\n\r\n shaderMaterial.onBindObservable.add((mesh: AbstractMesh) => {\r\n const effect = shaderMaterial.getEffect()!;\r\n const gsMaterial = mesh.material as GaussianSplattingMaterial;\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n shaderMaterial.bindView(effect);\r\n shaderMaterial.bindViewProjection(effect);\r\n\r\n const shadowmapWidth = scene.getEngine().getRenderWidth();\r\n const shadowmapHeight = scene.getEngine().getRenderHeight();\r\n effect.setFloat2(\"invViewport\", 1 / shadowmapWidth, 1 / shadowmapHeight);\r\n\r\n const projection = scene.getProjectionMatrix();\r\n const t = projection.m[5];\r\n const focal = (shadowmapWidth * t) / 2.0;\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n effect.setFloat(\"kernelSize\", gsMaterial && gsMaterial.kernelSize ? gsMaterial.kernelSize : GaussianSplattingMaterial.KernelSize);\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n }\r\n });\r\n\r\n return shadowDepthWrapper;\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
|
|
@@ -111,6 +111,10 @@ export class GaussianSplattingBlock extends NodeMaterialBlock {
|
|
|
111
111
|
state._emitUniformFromString("eyePosition", NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
112
112
|
state._emitUniformFromString("viewDirectionFactor", NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
113
113
|
state.attributes.push(VertexBuffer.PositionKind);
|
|
114
|
+
state.attributes.push("splatIndex0");
|
|
115
|
+
state.attributes.push("splatIndex1");
|
|
116
|
+
state.attributes.push("splatIndex2");
|
|
117
|
+
state.attributes.push("splatIndex3");
|
|
114
118
|
state.sharedData.nodeMaterial.backFaceCulling = false;
|
|
115
119
|
const splatPosition = this.splatPosition;
|
|
116
120
|
const splatScale = this.splatScale;
|
|
@@ -152,7 +156,7 @@ export class GaussianSplattingBlock extends NodeMaterialBlock {
|
|
|
152
156
|
else {
|
|
153
157
|
state.compilationString += `${state._declareOutput(sh)} = vec3${addF}(0.,0.,0.);`;
|
|
154
158
|
}
|
|
155
|
-
state.compilationString += `${state._declareOutput(output)} = gaussianSplatting(${input}, ${splatPosition.associatedVariableName}, ${splatScaleParameter}, covA, covB, ${world.associatedVariableName}, ${view.associatedVariableName}, ${projection.associatedVariableName}${uniforms});\n`;
|
|
159
|
+
state.compilationString += `${state._declareOutput(output)} = gaussianSplatting(${input}.xy, ${splatPosition.associatedVariableName}, ${splatScaleParameter}, covA, covB, ${world.associatedVariableName}, ${view.associatedVariableName}, ${projection.associatedVariableName}${uniforms});\n`;
|
|
156
160
|
return this;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplattingBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.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;AAC3D,OAAO,EAAE,YAAY,EAAE,qCAA2B;AAMlD;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IACzD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAE7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,qCAAqC,CAAC,OAAO,EAAE,KAAK,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAC3H,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACvH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,MAAM,EAAE,KAAK,EAAE,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C;QAC7R,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,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 { VertexBuffer } from \"core/Meshes/buffer\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\n\r\n/**\r\n * Block used for the Gaussian Splatting\r\n */\r\nexport class GaussianSplattingBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new GaussianSplattingBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Vertex);\r\n\r\n this._isUnique = true;\r\n\r\n this.registerInput(\"splatPosition\", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"splatScale\", NodeMaterialBlockConnectionPointTypes.Vector2, true, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"world\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"projection\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n\r\n this.registerOutput(\"splatVertex\", NodeMaterialBlockConnectionPointTypes.Vector4, NodeMaterialBlockTargets.Vertex);\r\n this.registerOutput(\"SH\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Vertex);\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 \"GaussianSplattingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get splatPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get splatScale(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the View matrix input component\r\n */\r\n public get world(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the View matrix input component\r\n */\r\n public get view(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the projection matrix input component\r\n */\r\n public get projection(): NodeMaterialConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the splatVertex output component\r\n */\r\n public get splatVertex(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the SH output contribution\r\n */\r\n public get SH(): NodeMaterialConnectionPoint {\r\n return this._outputs[1];\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(\"focal\");\r\n state._excludeVariableName(\"invViewport\");\r\n state._excludeVariableName(\"kernelSize\");\r\n state._excludeVariableName(\"eyePosition\");\r\n }\r\n /**\r\n * Update defines for shader compilation\r\n * @param defines defines the material defines to update\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param mesh defines the mesh to be rendered\r\n */\r\n public override prepareDefines(defines: NodeMaterialDefines, nodeMaterial: NodeMaterial, mesh?: AbstractMesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n if (mesh.getClassName() == \"GaussianSplattingMesh\") {\r\n defines.setValue(\"SH_DEGREE\", (<GaussianSplattingMesh>mesh).shDegree, true);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"gaussianSplattingVertexDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"gaussianSplatting\", comments);\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitUniformFromString(\"focal\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n state._emitUniformFromString(\"invViewport\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n state._emitUniformFromString(\"kernelSize\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitUniformFromString(\"eyePosition\", NodeMaterialBlockConnectionPointTypes.Vector3);\r\n state._emitUniformFromString(\"viewDirectionFactor\", NodeMaterialBlockConnectionPointTypes.Vector3);\r\n state.attributes.push(VertexBuffer.PositionKind);\r\n state.sharedData.nodeMaterial.backFaceCulling = false;\r\n\r\n const splatPosition = this.splatPosition;\r\n const splatScale = this.splatScale;\r\n const world = this.world;\r\n const view = this.view;\r\n const projection = this.projection;\r\n const output = this.splatVertex;\r\n const sh = this.SH;\r\n\r\n const addF = state.fSuffix;\r\n let splatScaleParameter = `vec2${addF}(1.,1.)`;\r\n if (splatScale.isConnected) {\r\n splatScaleParameter = splatScale.associatedVariableName;\r\n }\r\n\r\n let input = \"position\";\r\n let uniforms = \"\";\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n input = \"input.position\";\r\n uniforms = \", uniforms.focal, uniforms.invViewport, uniforms.kernelSize\";\r\n }\r\n if (this.SH.isConnected) {\r\n state.compilationString += `#if SH_DEGREE > 0\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `let worldRot: mat3x3f = mat3x3f(${world.associatedVariableName}[0].xyz, ${world.associatedVariableName}[1].xyz, ${world.associatedVariableName}[2].xyz);`;\r\n state.compilationString += `let normWorldRot: mat3x3f = inverseMat3(worldRot);`;\r\n state.compilationString += `var dir: vec3f = normalize(normWorldRot * (${splatPosition.associatedVariableName}.xyz - uniforms.eyePosition));\\n`;\r\n state.compilationString += `dir *= uniforms.viewDirectionFactor;\\n`;\r\n } else {\r\n state.compilationString += `mat3 worldRot = mat3(${world.associatedVariableName});`;\r\n state.compilationString += `mat3 normWorldRot = inverseMat3(worldRot);`;\r\n state.compilationString += `vec3 dir = normalize(normWorldRot * (${splatPosition.associatedVariableName}.xyz - eyePosition));\\n`;\r\n state.compilationString += `dir *= viewDirectionFactor;\\n`;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(sh)} = computeSH(splat, dir);\\n`;\r\n state.compilationString += `#else\\n`;\r\n state.compilationString += `${state._declareOutput(sh)} = vec3${addF}(0.,0.,0.);\\n`;\r\n state.compilationString += `#endif;\\n`;\r\n } else {\r\n state.compilationString += `${state._declareOutput(sh)} = vec3${addF}(0.,0.,0.);`;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = gaussianSplatting(${input}, ${splatPosition.associatedVariableName}, ${splatScaleParameter}, covA, covB, ${world.associatedVariableName}, ${view.associatedVariableName}, ${projection.associatedVariableName}${uniforms});\\n`;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingBlock\", GaussianSplattingBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplattingBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAA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E,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,iBAAiB,IAAI,wBAAwB,KAAK,CAAC,sBAAsB,IAAI,CAAC;gBACpF,KAAK,CAAC,iBAAiB,IAAI,4CAA4C,CAAC;gBACxE,KAAK,CAAC,iBAAiB,IAAI,wCAAwC,aAAa,CAAC,sBAAsB,yBAAyB,CAAC;gBACjI,KAAK,CAAC,iBAAiB,IAAI,+BAA+B,CAAC;YAC/D,CAAC;YAED,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,6BAA6B,CAAC;YACpF,KAAK,CAAC,iBAAiB,IAAI,SAAS,CAAC;YACrC,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,IAAI,eAAe,CAAC;YACpF,KAAK,CAAC,iBAAiB,IAAI,WAAW,CAAC;QAC3C,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,IAAI,aAAa,CAAC;QACtF,CAAC;QAED,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,wBAAwB,KAAK,QAAQ,aAAa,CAAC,sBAAsB,KAAK,mBAAmB,iBAAiB,KAAK,CAAC,sBAAsB,KAAK,IAAI,CAAC,sBAAsB,KAAK,UAAU,CAAC,sBAAsB,GAAG,QAAQ,MAAM,CAAC;QAChS,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,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 { VertexBuffer } from \"core/Meshes/buffer\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\n\r\n/**\r\n * Block used for the Gaussian Splatting\r\n */\r\nexport class GaussianSplattingBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new GaussianSplattingBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Vertex);\r\n\r\n this._isUnique = true;\r\n\r\n this.registerInput(\"splatPosition\", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"splatScale\", NodeMaterialBlockConnectionPointTypes.Vector2, true, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"world\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n this.registerInput(\"projection\", NodeMaterialBlockConnectionPointTypes.Matrix, false, NodeMaterialBlockTargets.Vertex);\r\n\r\n this.registerOutput(\"splatVertex\", NodeMaterialBlockConnectionPointTypes.Vector4, NodeMaterialBlockTargets.Vertex);\r\n this.registerOutput(\"SH\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Vertex);\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 \"GaussianSplattingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get splatPosition(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get splatScale(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the View matrix input component\r\n */\r\n public get world(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the View matrix input component\r\n */\r\n public get view(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the projection matrix input component\r\n */\r\n public get projection(): NodeMaterialConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the splatVertex output component\r\n */\r\n public get splatVertex(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the SH output contribution\r\n */\r\n public get SH(): NodeMaterialConnectionPoint {\r\n return this._outputs[1];\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(\"focal\");\r\n state._excludeVariableName(\"invViewport\");\r\n state._excludeVariableName(\"kernelSize\");\r\n state._excludeVariableName(\"eyePosition\");\r\n }\r\n /**\r\n * Update defines for shader compilation\r\n * @param defines defines the material defines to update\r\n * @param nodeMaterial defines the node material requesting the update\r\n * @param mesh defines the mesh to be rendered\r\n */\r\n public override prepareDefines(defines: NodeMaterialDefines, nodeMaterial: NodeMaterial, mesh?: AbstractMesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n if (mesh.getClassName() == \"GaussianSplattingMesh\") {\r\n defines.setValue(\"SH_DEGREE\", (<GaussianSplattingMesh>mesh).shDegree, true);\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n\r\n state.sharedData.blocksWithDefines.push(this);\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"gaussianSplattingVertexDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"gaussianSplatting\", comments);\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n state._emitUniformFromString(\"focal\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n state._emitUniformFromString(\"invViewport\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n state._emitUniformFromString(\"kernelSize\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitUniformFromString(\"eyePosition\", NodeMaterialBlockConnectionPointTypes.Vector3);\r\n state._emitUniformFromString(\"viewDirectionFactor\", NodeMaterialBlockConnectionPointTypes.Vector3);\r\n state.attributes.push(VertexBuffer.PositionKind);\r\n state.attributes.push(\"splatIndex0\");\r\n state.attributes.push(\"splatIndex1\");\r\n state.attributes.push(\"splatIndex2\");\r\n state.attributes.push(\"splatIndex3\");\r\n state.sharedData.nodeMaterial.backFaceCulling = false;\r\n\r\n const splatPosition = this.splatPosition;\r\n const splatScale = this.splatScale;\r\n const world = this.world;\r\n const view = this.view;\r\n const projection = this.projection;\r\n const output = this.splatVertex;\r\n const sh = this.SH;\r\n\r\n const addF = state.fSuffix;\r\n let splatScaleParameter = `vec2${addF}(1.,1.)`;\r\n if (splatScale.isConnected) {\r\n splatScaleParameter = splatScale.associatedVariableName;\r\n }\r\n\r\n let input = \"position\";\r\n let uniforms = \"\";\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n input = \"input.position\";\r\n uniforms = \", uniforms.focal, uniforms.invViewport, uniforms.kernelSize\";\r\n }\r\n if (this.SH.isConnected) {\r\n state.compilationString += `#if SH_DEGREE > 0\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `let worldRot: mat3x3f = mat3x3f(${world.associatedVariableName}[0].xyz, ${world.associatedVariableName}[1].xyz, ${world.associatedVariableName}[2].xyz);`;\r\n state.compilationString += `let normWorldRot: mat3x3f = inverseMat3(worldRot);`;\r\n state.compilationString += `var dir: vec3f = normalize(normWorldRot * (${splatPosition.associatedVariableName}.xyz - uniforms.eyePosition));\\n`;\r\n state.compilationString += `dir *= uniforms.viewDirectionFactor;\\n`;\r\n } else {\r\n state.compilationString += `mat3 worldRot = mat3(${world.associatedVariableName});`;\r\n state.compilationString += `mat3 normWorldRot = inverseMat3(worldRot);`;\r\n state.compilationString += `vec3 dir = normalize(normWorldRot * (${splatPosition.associatedVariableName}.xyz - eyePosition));\\n`;\r\n state.compilationString += `dir *= viewDirectionFactor;\\n`;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(sh)} = computeSH(splat, dir);\\n`;\r\n state.compilationString += `#else\\n`;\r\n state.compilationString += `${state._declareOutput(sh)} = vec3${addF}(0.,0.,0.);\\n`;\r\n state.compilationString += `#endif;\\n`;\r\n } else {\r\n state.compilationString += `${state._declareOutput(sh)} = vec3${addF}(0.,0.,0.);`;\r\n }\r\n\r\n state.compilationString += `${state._declareOutput(output)} = gaussianSplatting(${input}.xy, ${splatPosition.associatedVariableName}, ${splatScaleParameter}, covA, covB, ${world.associatedVariableName}, ${view.associatedVariableName}, ${projection.associatedVariableName}${uniforms});\\n`;\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingBlock\", GaussianSplattingBlock);\r\n"]}
|
|
@@ -83,19 +83,20 @@ export class SplatReaderBlock extends NodeMaterialBlock {
|
|
|
83
83
|
state._emitFunctionFromInclude("gaussianSplatting", comments);
|
|
84
84
|
state._emitVaryingFromString("vPosition", NodeMaterialBlockConnectionPointTypes.Vector2);
|
|
85
85
|
state._emitUniformFromString("dataTextureSize", NodeMaterialBlockConnectionPointTypes.Vector2);
|
|
86
|
-
const splatIndex = this.splatIndex;
|
|
87
86
|
const splatPosition = this.splatPosition;
|
|
88
87
|
const splatColor = this.splatColor;
|
|
89
88
|
const splatVariablename = state._getFreeVariableName("splat");
|
|
90
89
|
if (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */) {
|
|
91
|
-
state.compilationString += `
|
|
90
|
+
state.compilationString += `let splatIndex: f32 = getSplatIndex(i32(input.position.z + 0.5), input.splatIndex0, input.splatIndex1, input.splatIndex2, input.splatIndex3);`;
|
|
91
|
+
state.compilationString += `var ${splatVariablename}: Splat = readSplat(splatIndex, uniforms.dataTextureSize);\n`;
|
|
92
92
|
state.compilationString += `var covA: vec3f = splat.covA.xyz; var covB: vec3f = vec3f(splat.covA.w, splat.covB.xy);\n`;
|
|
93
|
-
state.compilationString += "vertexOutputs.vPosition = input.position;\n";
|
|
93
|
+
state.compilationString += "vertexOutputs.vPosition = input.position.xy;\n";
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
state.compilationString += `
|
|
96
|
+
state.compilationString += `float splatIndex = getSplatIndex(int(position.z + 0.5));`;
|
|
97
|
+
state.compilationString += `Splat ${splatVariablename} = readSplat(splatIndex);\n`;
|
|
97
98
|
state.compilationString += `vec3 covA = splat.covA.xyz; vec3 covB = vec3(splat.covA.w, splat.covB.xy);\n`;
|
|
98
|
-
state.compilationString += "vPosition = position;\n";
|
|
99
|
+
state.compilationString += "vPosition = position.xy;\n";
|
|
99
100
|
}
|
|
100
101
|
state.compilationString += `${state._declareOutput(splatPosition)} = ${splatVariablename}.center.xyz;\n`;
|
|
101
102
|
state.compilationString += `${state._declareOutput(splatColor)} = ${splatVariablename}.color;\n`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splatReaderBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.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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AC;YAC3K,KAAK,CAAC,iBAAiB,IAAI,OAAO,iBAAiB,8DAA8D,CAAC;YAClH,KAAK,CAAC,iBAAiB,IAAI,2FAA2F,CAAC;YACvH,KAAK,CAAC,iBAAiB,IAAI,gDAAgD,CAAC;QAChF,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,iBAAiB,IAAI,0DAA0D,CAAC;YACtF,KAAK,CAAC,iBAAiB,IAAI,SAAS,iBAAiB,6BAA6B,CAAC;YACnF,KAAK,CAAC,iBAAiB,IAAI,8EAA8E,CAAC;YAC1G,KAAK,CAAC,iBAAiB,IAAI,4BAA4B,CAAC;QAC5D,CAAC;QACD,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,iBAAiB,gBAAgB,CAAC;QACzG,KAAK,CAAC,iBAAiB,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,iBAAiB,WAAW,CAAC;QAEjG,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,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 { GaussianSplattingMaterial } from \"core/Materials/GaussianSplatting/gaussianSplattingMaterial\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport type { NodeMaterial } from \"../../nodeMaterial\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Block used for Reading components of the Gaussian Splatting\r\n */\r\nexport class SplatReaderBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new SplatReaderBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Vertex);\r\n\r\n this._isUnique = true;\r\n\r\n this.registerInput(\"splatIndex\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Vertex);\r\n\r\n this.registerOutput(\"splatPosition\", NodeMaterialBlockConnectionPointTypes.Vector3, NodeMaterialBlockTargets.Vertex);\r\n this.registerOutput(\"splatColor\", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Vertex);\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 \"SplatReaderBlock\";\r\n }\r\n\r\n /**\r\n * Gets the splat index input component\r\n */\r\n public get splatIndex(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the splatPosition output component\r\n */\r\n public get splatPosition(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the splatColor output component\r\n */\r\n public get splatColor(): NodeMaterialConnectionPoint {\r\n return this._outputs[1];\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(\"covA\");\r\n state._excludeVariableName(\"covB\");\r\n state._excludeVariableName(\"vPosition\");\r\n state._excludeVariableName(\"covariancesATexture\");\r\n state._excludeVariableName(\"covariancesBTexture\");\r\n state._excludeVariableName(\"centersTexture\");\r\n state._excludeVariableName(\"colorsTexture\");\r\n state._excludeVariableName(\"dataTextureSize\");\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if (!mesh) {\r\n return;\r\n }\r\n const scene = mesh.getScene();\r\n GaussianSplattingMaterial.BindEffect(mesh, effect, scene);\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n return;\r\n }\r\n\r\n state.sharedData.bindableBlocks.push(this);\r\n\r\n // Emit code\r\n const comments = `//${this.name}`;\r\n state._emit2DSampler(\"covariancesATexture\");\r\n state._emit2DSampler(\"covariancesBTexture\");\r\n state._emit2DSampler(\"centersTexture\");\r\n state._emit2DSampler(\"colorsTexture\");\r\n state._emit2DSampler(\"shTexture0\", \"SH_DEGREE > 0\", undefined, undefined, true, \"highp\");\r\n state._emit2DSampler(\"shTexture1\", \"SH_DEGREE > 0\", undefined, undefined, true, \"highp\");\r\n state._emit2DSampler(\"shTexture2\", \"SH_DEGREE > 0\", undefined, undefined, true, \"highp\");\r\n\r\n state._emitFunctionFromInclude(\"gaussianSplattingVertexDeclaration\", comments);\r\n state._emitFunctionFromInclude(\"gaussianSplatting\", comments);\r\n state._emitVaryingFromString(\"vPosition\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n state._emitUniformFromString(\"dataTextureSize\", NodeMaterialBlockConnectionPointTypes.Vector2);\r\n const splatPosition = this.splatPosition;\r\n const splatColor = this.splatColor;\r\n\r\n const splatVariablename = state._getFreeVariableName(\"splat\");\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `let splatIndex: f32 = getSplatIndex(i32(input.position.z + 0.5), input.splatIndex0, input.splatIndex1, input.splatIndex2, input.splatIndex3);`;\r\n state.compilationString += `var ${splatVariablename}: Splat = readSplat(splatIndex, uniforms.dataTextureSize);\\n`;\r\n state.compilationString += `var covA: vec3f = splat.covA.xyz; var covB: vec3f = vec3f(splat.covA.w, splat.covB.xy);\\n`;\r\n state.compilationString += \"vertexOutputs.vPosition = input.position.xy;\\n\";\r\n } else {\r\n state.compilationString += `float splatIndex = getSplatIndex(int(position.z + 0.5));`;\r\n state.compilationString += `Splat ${splatVariablename} = readSplat(splatIndex);\\n`;\r\n state.compilationString += `vec3 covA = splat.covA.xyz; vec3 covB = vec3(splat.covA.w, splat.covB.xy);\\n`;\r\n state.compilationString += \"vPosition = position.xy;\\n\";\r\n }\r\n state.compilationString += `${state._declareOutput(splatPosition)} = ${splatVariablename}.center.xyz;\\n`;\r\n state.compilationString += `${state._declareOutput(splatColor)} = ${splatVariablename}.color;\\n`;\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SplatReaderBlock\", SplatReaderBlock);\r\n"]}
|
|
@@ -11,7 +11,7 @@ import { EngineStore } from "../Engines/engineStore.js";
|
|
|
11
11
|
|
|
12
12
|
import { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from "./clipPlaneMaterialHelper.js";
|
|
13
13
|
import { GetTypeByteLength } from "../Buffers/bufferUtils.js";
|
|
14
|
-
import { BindBonesParameters, BindFogParameters, BindLogDepth, BindMorphTargetParameters, BindSceneUniformBuffer,
|
|
14
|
+
import { BindBonesParameters, BindFogParameters, BindLogDepth, BindMorphTargetParameters, BindSceneUniformBuffer, PrepareDefinesAndAttributesForMorphTargets, PushAttributesForInstances, } from "./materialHelper.functions.js";
|
|
15
15
|
const OnCreatedEffectParameters = { effect: null, subMesh: null };
|
|
16
16
|
/**
|
|
17
17
|
* The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.
|
|
@@ -641,8 +641,10 @@ export class ShaderMaterial extends PushMaterial {
|
|
|
641
641
|
if (this._options.samplers.indexOf("bakedVertexAnimationTexture") === -1) {
|
|
642
642
|
this._options.samplers.push("bakedVertexAnimationTexture");
|
|
643
643
|
}
|
|
644
|
+
if (useInstances) {
|
|
645
|
+
attribs.push("bakedVertexAnimationSettingsInstanced");
|
|
646
|
+
}
|
|
644
647
|
}
|
|
645
|
-
PrepareAttributesForBakedVertexAnimation(attribs, mesh, defines);
|
|
646
648
|
}
|
|
647
649
|
// Textures
|
|
648
650
|
for (const name in this._textures) {
|