rhodonite 0.26.0 → 0.27.0
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/VERSION-FILE +1 -1
- package/dist/esm/foundation/core/MemoryManager.d.ts +19 -0
- package/dist/esm/foundation/core/MemoryManager.js +2 -2
- package/dist/esm/foundation/definitions/ShaderSemantics.d.ts +1 -0
- package/dist/esm/foundation/definitions/ShaderSemantics.js +2 -2
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
- package/dist/esm/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +1 -1
- package/dist/esm/foundation/helpers/materials/nodeBasedMaterialCommon.js +1 -1
- package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -1
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +2 -1
- package/dist/esm/foundation/importer/Gltf2Importer.js +1 -1
- package/dist/esm/foundation/importer/GltfImporter.js +1 -1
- package/dist/esm/foundation/importer/RhodoniteImportExtension.js +1 -1
- package/dist/esm/foundation/importer/Vrm0xImporter.js +1 -1
- package/dist/esm/foundation/importer/VrmImporter.js +1 -1
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +11 -11
- package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +6 -6
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/core/Material.d.ts +7 -2
- package/dist/esm/foundation/materials/core/Material.js +1 -1
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGL.js +2 -2
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGPU.js +2 -2
- package/dist/esm/foundation/memory/Accessor.js +6 -6
- package/dist/esm/foundation/memory/BufferView.js +1 -1
- package/dist/esm/foundation/misc/PngDecoder.d.ts +18 -0
- package/dist/esm/foundation/misc/PngDecoder.js +1 -0
- package/dist/esm/foundation/renderer/RenderPass.d.ts +7 -0
- package/dist/esm/foundation/renderer/RenderPass.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +2 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
- package/dist/esm/foundation/system/Engine.js +1 -1
- package/dist/esm/foundation/textures/CubeTexture.d.ts +11 -2
- package/dist/esm/foundation/textures/CubeTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
- package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webgl/MultiDraw.js +1 -1
- package/dist/esm/webgl/MultiDrawRepository.js +1 -1
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +5 -0
- package/dist/esm/webgl/WebGLResourceRepository.js +3 -3
- package/dist/esm/webgl/WebGLStereoUtil.js +1 -1
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +19 -14
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +67 -67
- package/dist/esm/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -1
- package/dist/esm/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +1 -0
- package/dist/esm/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -0
- package/dist/esm/webgl/shaderity_shaders/common/iblDefinition.glsl.js +11 -5
- package/dist/esm/webgl/shaders/nodes/BlockBeginShader.js +1 -1
- package/dist/esm/webgl/shaders/nodes/BlockEndShader.js +1 -1
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +5 -5
- package/dist/esm/webgl/shaders/nodes/RaymarchObjectIdUniform.js +3 -3
- package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.js +3 -3
- package/dist/esm/webgl/shaders/nodes/Texture2DShader.js +14 -14
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +13 -13
- package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
- package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuTimer.js +1 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +6 -0
- package/dist/esm/webgpu/WebGpuResourceRepository.js +5 -5
- package/dist/esm/webgpu/WebGpuStrategyBasic.js +2 -2
- package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -1
- package/dist/esm/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +10 -4
- package/dist/esmdev/foundation/core/MemoryManager.d.ts +19 -0
- package/dist/esmdev/foundation/core/MemoryManager.js +28 -3
- package/dist/esmdev/foundation/core/RnObject.js +37 -37
- package/dist/esmdev/foundation/definitions/Blend.js +3 -3
- package/dist/esmdev/foundation/definitions/ComponentType.js +7 -7
- package/dist/esmdev/foundation/definitions/CompositionType.js +50 -50
- package/dist/esmdev/foundation/definitions/CompressionTextureType.js +6 -6
- package/dist/esmdev/foundation/definitions/ShaderSemantics.d.ts +1 -0
- package/dist/esmdev/foundation/definitions/ShaderSemantics.js +12 -7
- package/dist/esmdev/foundation/definitions/TextureFormat.js +3 -3
- package/dist/esmdev/foundation/definitions/TextureParameter.js +3 -3
- package/dist/esmdev/foundation/definitions/VertexAttribute.js +30 -30
- package/dist/esmdev/foundation/enhanced_js_objects/Array.js +2 -2
- package/dist/esmdev/foundation/exporter/Gltf2Exporter.js +106 -106
- package/dist/esmdev/foundation/geometry/ComplexVertexAttribute.js +18 -18
- package/dist/esmdev/foundation/geometry/Frustum.js +39 -39
- package/dist/esmdev/foundation/geometry/Mesh.js +205 -205
- package/dist/esmdev/foundation/geometry/Primitive.js +124 -124
- package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +7 -7
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.js +3 -3
- package/dist/esmdev/foundation/geometry/shapes/Joint.js +33 -33
- package/dist/esmdev/foundation/gizmos/AABBGizmo.js +12 -12
- package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +23 -23
- package/dist/esmdev/foundation/gizmos/Gizmo.js +23 -23
- package/dist/esmdev/foundation/gizmos/JointGizmo.js +35 -35
- package/dist/esmdev/foundation/gizmos/LightGizmo.js +23 -23
- package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +22 -22
- package/dist/esmdev/foundation/gizmos/RotationGizmo.js +197 -197
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +129 -129
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +43 -43
- package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +24 -24
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +129 -129
- package/dist/esmdev/foundation/helpers/BloomHelper.js +28 -28
- package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
- package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +11 -11
- package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +5 -5
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +111 -111
- package/dist/esmdev/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +10 -1
- package/dist/esmdev/foundation/helpers/materials/nodeBasedMaterialCommon.js +11 -1
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +27 -27
- package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +2 -1
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +21 -17
- package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
- package/dist/esmdev/foundation/importer/ModelConverter.js +131 -131
- package/dist/esmdev/foundation/importer/RhodoniteImportExtension.js +6 -6
- package/dist/esmdev/foundation/importer/Vrm0xImporter.js +48 -48
- package/dist/esmdev/foundation/importer/VrmImporter.js +10 -10
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.js +37 -28
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +145 -137
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +27 -19
- package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +4 -4
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +47 -47
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +25 -25
- package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
- package/dist/esmdev/foundation/materials/core/Material.d.ts +7 -2
- package/dist/esmdev/foundation/materials/core/Material.js +113 -99
- package/dist/esmdev/foundation/materials/core/MaterialRepository.js +51 -51
- package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +38 -38
- package/dist/esmdev/foundation/materials/core/ShaderHandler.js +4 -4
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +14 -14
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/AlphaTestShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/AndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/Atan2ShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/AttributeColorShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeInstanceIdsShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeJointShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeNormalShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributePositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeTangentShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeTexcoordShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeWeightShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/BlockBeginShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/BlockEndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/BranchShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/ClassicShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/ConstantScalarVariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVariableShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ConstantVector2VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector3VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector4VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/CosShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +19 -19
- package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/OrShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/OutColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/OutPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyRotationShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/PbrBaseColorPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrClearcoatPropsShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/PbrDiffuseTransmissionPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrEmissivePropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrIridescencePropsShaderNode.js +8 -8
- package/dist/esmdev/foundation/materials/nodes/PbrMetallicRoughnessPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrNormalPropsShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/PbrOcclusionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrShaderShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/PbrSheenPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrSpecularPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrTransmissionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrVolumePropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/ProcessGeometryShaderNode.js +22 -22
- package/dist/esmdev/foundation/materials/nodes/ProjectionMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/Random_HashPRNGShaderNode.js +12 -12
- package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +12 -12
- package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/Texture2DShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/TimeShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/UniformDataShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ViewMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/WireframeMaterialNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/WorldMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/InitialPositionShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothIntersectionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothSubtractionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothUnionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSubtractionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpUnionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutDistanceShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchCameraPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitDistanceShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitNormalShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdUniformShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchRayDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchTBNShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchViewDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyTransformShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyWorldMatrixShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBoxShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdCapsuleShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRoundBoxShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdSphereShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTorusShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistZShaderNode.js +4 -4
- package/dist/esmdev/foundation/math/AABB.js +120 -120
- package/dist/esmdev/foundation/math/AnimatedQuaternion.js +53 -53
- package/dist/esmdev/foundation/math/AnimatedScalar.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +18 -18
- package/dist/esmdev/foundation/math/AnimatedVector2.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedVector3.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedVector4.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedVectorN.js +54 -54
- package/dist/esmdev/foundation/math/IdentityMatrix33.js +2 -2
- package/dist/esmdev/foundation/math/IdentityMatrix44.js +2 -2
- package/dist/esmdev/foundation/math/MathClassUtil.js +3 -3
- package/dist/esmdev/foundation/math/Quaternion.js +13 -13
- package/dist/esmdev/foundation/math/Transform3D.js +72 -72
- package/dist/esmdev/foundation/math/shapes/MathSphere.js +7 -7
- package/dist/esmdev/foundation/memory/Accessor.js +369 -369
- package/dist/esmdev/foundation/memory/Buffer.js +39 -39
- package/dist/esmdev/foundation/memory/BufferView.js +29 -29
- package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
- package/dist/esmdev/foundation/misc/EnumIO.js +8 -8
- package/dist/esmdev/foundation/misc/Logger.js +14 -14
- package/dist/esmdev/foundation/misc/PngDecoder.d.ts +18 -0
- package/dist/esmdev/foundation/misc/PngDecoder.js +113 -0
- package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
- package/dist/esmdev/foundation/misc/Time.js +23 -23
- package/dist/esmdev/foundation/misc/WeakOption.js +14 -14
- package/dist/esmdev/foundation/misc/cache/Cache.js +2 -2
- package/dist/esmdev/foundation/misc/cache/SymbolWeakMap.js +8 -8
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.js +10 -10
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +186 -186
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +221 -221
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
- package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +36 -36
- package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +26 -26
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +6 -6
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +39 -39
- package/dist/esmdev/foundation/renderer/Expression.js +6 -6
- package/dist/esmdev/foundation/renderer/Frame.js +6 -6
- package/dist/esmdev/foundation/renderer/FrameBuffer.js +25 -25
- package/dist/esmdev/foundation/renderer/RenderPass.d.ts +7 -0
- package/dist/esmdev/foundation/renderer/RenderPass.js +94 -86
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +6 -6
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +75 -75
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +146 -146
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
- package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +4 -4
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +2 -1
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +420 -420
- package/dist/esmdev/foundation/system/Engine.js +209 -209
- package/dist/esmdev/foundation/system/EventPubSub.js +8 -8
- package/dist/esmdev/foundation/system/InputManager.js +56 -56
- package/dist/esmdev/foundation/system/ModuleManager.js +3 -3
- package/dist/esmdev/foundation/textures/AbstractTexture.js +48 -48
- package/dist/esmdev/foundation/textures/CubeTexture.d.ts +11 -2
- package/dist/esmdev/foundation/textures/CubeTexture.js +47 -36
- package/dist/esmdev/foundation/textures/RenderBuffer.js +11 -11
- package/dist/esmdev/foundation/textures/RenderTargetTexture.js +24 -24
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +35 -35
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +25 -19
- package/dist/esmdev/foundation/textures/Sampler.js +24 -24
- package/dist/esmdev/foundation/textures/Texture.js +83 -83
- package/dist/esmdev/foundation/textures/TextureArray.js +8 -8
- package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
- package/dist/esmdev/foundation/textures/VideoTexture.js +24 -24
- package/dist/esmdev/version.js +2 -2
- package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
- package/dist/esmdev/webgl/MultiDraw.js +2 -2
- package/dist/esmdev/webgl/MultiDrawRepository.js +30 -30
- package/dist/esmdev/webgl/WebGLContextWrapper.js +146 -146
- package/dist/esmdev/webgl/WebGLGpuTimer.js +30 -30
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +5 -0
- package/dist/esmdev/webgl/WebGLResourceRepository.js +368 -307
- package/dist/esmdev/webgl/WebGLStereoUtil.js +39 -39
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +19 -14
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +294 -280
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +4 -4
- package/dist/esmdev/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/common/iblDefinition.glsl.js +2 -2
- package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +4 -4
- package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +14 -14
- package/dist/esmdev/webgl/shaders/StandardShaderPart.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/BlockBeginShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/BlockEndShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.js +21 -21
- package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +12 -12
- package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +23 -23
- package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +23 -23
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +24 -24
- package/dist/esmdev/webgpu/GpuCullingRegistry.js +91 -91
- package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
- package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
- package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
- package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
- package/dist/esmdev/webgpu/WebGpuGpuCulling.js +198 -198
- package/dist/esmdev/webgpu/WebGpuGpuTimer.js +51 -51
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +36 -36
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +6 -0
- package/dist/esmdev/webgpu/WebGpuResourceRepository.js +655 -593
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +123 -123
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
- package/dist/esmdev/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +2 -2
- package/dist/esmdev/xr/WebARSystem.js +69 -69
- package/dist/esmdev/xr/WebXRSystem.js +151 -151
- package/package.json +2 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as
|
|
1
|
+
import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as D}from"../foundation/components/BlendShape/BlendShapeComponent.js";import{CameraComponent as k}from"../foundation/components/Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as K}from"../foundation/components/CameraController/CameraControllerUpdateCount.js";import{LightComponent as z}from"../foundation/components/Light/LightComponent.js";import{MeshComponent as ne}from"../foundation/components/Mesh/MeshComponent.js";import{MeshRendererComponent as H}from"../foundation/components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as q}from"../foundation/components/SceneGraph/SceneGraphComponent.js";import{TransformComponent as J}from"../foundation/components/Transform/TransformComponent.js";import{WellKnownComponentTIDs as N}from"../foundation/components/WellKnownComponentTIDs.js";import{Component as w}from"../foundation/core/Component.js";import{BufferUse as V}from"../foundation/definitions/BufferUse.js";import{ComponentType as C}from"../foundation/definitions/ComponentType.js";import{CompositionType as p}from"../foundation/definitions/CompositionType.js";import{PixelFormat as Q}from"../foundation/definitions/PixelFormat.js";import{ShaderType as j}from"../foundation/definitions/ShaderType.js";import{TextureFormat as ae}from"../foundation/definitions/TextureFormat.js";import{VertexAttribute as $}from"../foundation/definitions/VertexAttribute.js";import{Primitive as A}from"../foundation/geometry/Primitive.js";import{Logger as ee}from"../foundation/misc/Logger.js";import{CGAPIResourceRepository as I}from"../foundation/renderer/CGAPIResourceRepository.js";import{subtractByteRanges as oe}from"../foundation/renderer/lightCluster/LightClusterLayout.js";import{isSkipDrawing as te}from"../foundation/renderer/RenderingCommonMethods.js";import{getMultiDrawStateKeyId as se,getPrimitiveMeshRendererFingerPrintId as ce,planMultiDrawRunsInto as le}from"./MultiDraw.js";import L,{setupShaderProgram as X}from"./WebGLStrategyCommonMethod.js";var ie=class P{constructor(t){this.__dataTextureUid=I.InvalidCGAPIResourceUid;this.bI=I.InvalidCGAPIResourceUid;this.gI=I.InvalidCGAPIResourceUid;this.yI=I.InvalidCGAPIResourceUid;this.SI=I.InvalidCGAPIResourceUid;this.kI=-1;this.S_=-1;this.vI=1;this.M_={starts:new Int32Array(0),counts:new Int32Array(0),keys:new Int32Array(0),count:0};this.RI=0;this.DI=0;this.PI=0;this._I=0;this.MI=0;this.GI=0;this._totalSizeOfGPUShaderDataStorageExceptMorphData=0;this.OI=0;this.VI=!0;this.HI=-1;this.jI=-1;this.XI=-1;this.YI=-1;this.or=-1;this.ZI=-1;this.KI=-1;this.nr=-1;this.qI=-1;this.dC=-1;this.sr=-1;this.JI=-1;this.LI=-1;this.QI=-1;this.LS=-1;this.i=t,this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)}static zS(t,e){let i="";return w.getMemberInfo(t).forEach((r,c)=>{r.forEach((s,m)=>{var d;if(s.shaderType!==e&&s.shaderType!==j.VertexAndPixelShader)return;let l=(d=w.getComponentCountPerBufferView(t).get(c))!=null?d:1;p.isArray(s.compositionType)?a(s,c,m,l):o(s,c,m,l)})}),i;function a(r,c,s,m){var b,y;let l="",d="";switch(r.compositionType){case p.Vec4Array:l="vec4",d="fetchVec4";break;case p.Mat4Array:l="mat4",d="fetchMat4";break;case p.Mat4x3Array:l="mat4x3",d="fetchMat4x3";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=r.compositionType.getVec4SizeOfProperty();if(r.isVariableLength===!0){let B=w._variableLengthLocationRadix;i+=`
|
|
2
2
|
${l} get_${s}(uint instanceId, uint idxOfArray) {
|
|
3
|
-
vec4 location = get_${
|
|
4
|
-
int index = int(location.x) * ${
|
|
3
|
+
vec4 location = get_${w._getVariableLengthLocationMemberName(s)}(instanceId);
|
|
4
|
+
int index = int(location.x) * ${B} + int(location.y) + ${h} * int(idxOfArray);
|
|
5
5
|
${l} value = ${d}(index);
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
|
-
`;return}let f=
|
|
8
|
+
`;return}let f=w.getLocationOffsetOfMemberOfComponent(t,c,s),v=`int arrayLength = ${(y=((b=w.getArrayLengthOfMember(t).get(c))!=null?b:new Map).get(s))!=null?y:0};`,u=`rnIndices_${s}`,R=`int index = ${u}[instanceIdOfBufferViews] + int(instanceIdInBufferView) * ${h} * arrayLength + ${h} * int(idxOfArray);`,S="";r.convertToBool&&(S="return (value > 0.5) ? true : false;"),i+=`
|
|
9
9
|
const int ${u}[${f.length}] = int[${f.length}](${f.join(", ")});
|
|
10
|
-
${
|
|
11
|
-
uint instanceIdOfBufferViews = instanceId / ${
|
|
12
|
-
uint instanceIdInBufferView = instanceId % ${
|
|
13
|
-
${
|
|
10
|
+
${r.convertToBool?"bool":l} get_${s}(uint instanceId, uint idxOfArray) {
|
|
11
|
+
uint instanceIdOfBufferViews = instanceId / ${m}u;
|
|
12
|
+
uint instanceIdInBufferView = instanceId % ${m}u;
|
|
13
|
+
${v}
|
|
14
14
|
${R}
|
|
15
15
|
${l} value = ${d}(index);
|
|
16
|
-
${
|
|
16
|
+
${r.convertToBool?S:"return value;"}
|
|
17
17
|
}
|
|
18
|
-
`}function o(
|
|
19
|
-
const int ${f}[${
|
|
20
|
-
${
|
|
21
|
-
uint instanceIdOfBufferViews = instanceId / ${
|
|
22
|
-
uint instanceIdInBufferView = instanceId % ${
|
|
23
|
-
${
|
|
18
|
+
`}function o(r,c,s,m){let l="",d="";switch(r.compositionType){case p.Mat4:l="mat4",d="fetchMat4";break;case p.Mat3:l="mat3",d="fetchMat3No16BytesAligned";break;case p.Vec4:l="vec4",d="fetchVec4";break;case p.Vec3:l="vec3",d="fetchVec3No16BytesAligned";break;case p.Scalar:l="float",d="fetchScalarNo16BytesAligned";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=w.getLocationOffsetOfMemberOfComponent(t,c,s),f=`rnIndices_${s}`,g="";switch(r.compositionType){case p.Mat4:g=`int index = ${f}[instanceIdOfBufferViews] + 4 * int(instanceIdInBufferView);`;break;case p.Mat3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 9 * int(instanceIdInBufferView);`;break;case p.Vec4:g=`int index = ${f}[instanceIdOfBufferViews] + 1 * int(instanceIdInBufferView);`;break;case p.Vec3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 3 * int(instanceIdInBufferView);`;break;case p.Scalar:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 1 * int(instanceIdInBufferView);`;break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let x="";r.convertToBool&&(x="return (value > 0.5) ? true : false;"),i+=`
|
|
19
|
+
const int ${f}[${h.length}] = int[${h.length}](${h.join(", ")});
|
|
20
|
+
${r.convertToBool?"bool":l} get_${s}(uint instanceId) {
|
|
21
|
+
uint instanceIdOfBufferViews = instanceId / ${m}u;
|
|
22
|
+
uint instanceIdInBufferView = instanceId % ${m}u;
|
|
23
|
+
${g}
|
|
24
24
|
${l} value = ${d}(index);
|
|
25
|
-
${
|
|
25
|
+
${r.convertToBool?x:"return value;"}
|
|
26
26
|
}
|
|
27
|
-
`}}static C_(t){let e=
|
|
27
|
+
`}}static C_(t){let e=A.getMorphUniformDataTargetNumbers(),i=`
|
|
28
28
|
const int rnMorphUniformDataTargetNumbers[${e.length}] = int[${e.length}](${e.join(", ")});
|
|
29
|
-
`,
|
|
30
|
-
const int rnMorphUniformDataOffsets[${
|
|
31
|
-
`,o=
|
|
29
|
+
`,n=A.getMorphUniformDataOffsets(),a=`
|
|
30
|
+
const int rnMorphUniformDataOffsets[${n.length}] = int[${n.length}](${n.join(", ")});
|
|
31
|
+
`,o=D.getOffsetsInUniform(t),r=`
|
|
32
32
|
const int rnBlendShapeUniformDataOffsets[${o.length}] = int[${o.length}](${o.join(", ")});
|
|
33
33
|
`,c=t._isPreviousMorphWeightsEnabled?`
|
|
34
34
|
vec3 get_previousMorphedPosition(uint vertexId, vec3 basePosition, uint blendShapeComponentSID) {
|
|
35
35
|
int currentPrimitiveIdx = u_currentPrimitiveIdx;
|
|
36
36
|
int offsetInUniform = rnMorphUniformDataOffsets[currentPrimitiveIdx];
|
|
37
|
-
int offsetInUniform2 = rnBlendShapeUniformDataOffsets[blendShapeComponentSID] + ${
|
|
37
|
+
int offsetInUniform2 = rnBlendShapeUniformDataOffsets[blendShapeComponentSID] + ${D._getPreviousMorphWeightsOffset(t)};
|
|
38
38
|
vec3 position = basePosition;
|
|
39
39
|
int scalar_idx = 3 * int(vertexId);
|
|
40
40
|
for (int i=0; i<rnMorphUniformDataTargetNumbers[currentPrimitiveIdx]; i++) {
|
|
@@ -53,7 +53,7 @@ import{AnimationComponent as re}from"../foundation/components/Animation/Animatio
|
|
|
53
53
|
#ifdef RN_IS_MORPHING
|
|
54
54
|
${i}
|
|
55
55
|
${a}
|
|
56
|
-
${
|
|
56
|
+
${r}
|
|
57
57
|
vec3 get_position(uint vertexId, vec3 basePosition, uint blendShapeComponentSID) {
|
|
58
58
|
int currentPrimitiveIdx = u_currentPrimitiveIdx;
|
|
59
59
|
int offsetInUniform = rnMorphUniformDataOffsets[currentPrimitiveIdx];
|
|
@@ -80,67 +80,67 @@ import{AnimationComponent as re}from"../foundation/components/Animation/Animatio
|
|
|
80
80
|
${c}
|
|
81
81
|
#endif
|
|
82
82
|
#endif
|
|
83
|
-
`}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,
|
|
84
|
-
`);let
|
|
85
|
-
`,
|
|
86
|
-
`,
|
|
87
|
-
`}let f="";e.componentType===
|
|
83
|
+
`}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper,[a,o]=t._createProgramWebGL(this.i,P.zS(this.i,j.VertexShader),P.zS(this.i,j.PixelShader),P.A_,P.B_,P.C_(this.i),e);return o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e)),i.setUniformBlockBindingForMorphOffsetsAndWeights(a,this.gI,this.yI)),a}_reSetupShaderForMaterialBySpector(t,e,i,n){let[a,o]=t._createProgramByUpdatedSources(i,e,n);return a===I.InvalidCGAPIResourceUid||(o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e)),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e))),a}static A_(t,e){var x,v;let i=e.compositionType.getGlslStr(e.componentType),n,a=p.isTexture(e.compositionType),o=e.semantic.replace(".","_"),r="",c=e.compositionType.getGlslStr(e.componentType),s="";e.arrayLength&&(s=`[${e.arrayLength}]`),(e.needUniformInDataTextureMode||a)&&(r=` uniform ${c} u_${o}${s};
|
|
84
|
+
`);let m=e.compositionType.getVec4SizeOfProperty(),l=e.compositionType.getNumberOfComponents(),d=P.getOffsetOfPropertyOfGlobalDataRepository(t,e.semantic);d===-1&&ee.default.error("Could not get the location offset of the property.");let h=m;if(n=`int vec4_idx = ${d} + ${h} * instanceId;
|
|
85
|
+
`,p.isArray(e.compositionType)){h=m*((x=e.arrayLength)!=null?x:1);let R=Math.ceil(l/4)*4*((v=e.arrayLength)!=null?v:1);n=`int vec4_idx = ${d} + ${h} * instanceId + ${m} * int(idxOfArray);
|
|
86
|
+
`,n+=`int scalar_idx = ${d*4} + ${R} * instanceId + ${l} * int(idxOfArray);
|
|
87
|
+
`}let f="";e.componentType===C.Int&&e.compositionType!==p.Scalar&&(f="i");let g="";if(!a&&!e.needUniformInDataTextureMode){g+=`
|
|
88
88
|
${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
|
|
89
89
|
int instanceId = int(_instanceId);
|
|
90
|
-
${
|
|
91
|
-
`;let u=`${
|
|
92
|
-
${
|
|
93
|
-
`;break;case
|
|
94
|
-
`,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case
|
|
95
|
-
`;break;case
|
|
96
|
-
`,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case
|
|
97
|
-
`;break;case
|
|
98
|
-
`,e.componentType===
|
|
99
|
-
`,e.componentType===
|
|
100
|
-
`;break;case
|
|
101
|
-
`;break;case
|
|
102
|
-
`;break;case
|
|
103
|
-
`;break;case
|
|
104
|
-
`;break;case
|
|
105
|
-
`;break;case
|
|
90
|
+
${n}
|
|
91
|
+
`;let u=`${r}
|
|
92
|
+
${g}`;switch(e.compositionType){case p.Vec4:case p.Vec4Array:u+=` highp vec4 val = fetchElement(vec4_idx);
|
|
93
|
+
`;break;case p.Vec3:u+=` vec4 col0 = fetchElement(vec4_idx);
|
|
94
|
+
`,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case p.Vec3Array:u+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
|
|
95
|
+
`;break;case p.Vec2:u+=` highp vec4 col0 = fetchElement(vec4_idx);
|
|
96
|
+
`,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case p.Vec2Array:u+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
|
|
97
|
+
`;break;case p.Scalar:u+=` vec4 col0 = fetchElement(vec4_idx);
|
|
98
|
+
`,e.componentType===C.Int?u+=" int val = int(col0.x);":e.componentType===C.Bool?u+=" bool val = bool(col0.x);":u+=" float val = col0.x;";break;case p.ScalarArray:u+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
|
|
99
|
+
`,e.componentType===C.Int?u+=" int val = int(col0);":e.componentType===C.Bool?u+=" bool val = bool(col0);":u+=" float val = col0;";break;case p.Mat4:u+=` mat4 val = fetchMat4(vec4_idx);
|
|
100
|
+
`;break;case p.Mat4Array:u+=` mat4 val = fetchMat4(vec4_idx);
|
|
101
|
+
`;break;case p.Mat3:u+=` mat3 val = fetchMat3(vec4_idx);
|
|
102
|
+
`;break;case p.Mat3Array:u+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
|
|
103
|
+
`;break;case p.Mat2:u+=` mat2 val = fetchMat2(vec4_idx);
|
|
104
|
+
`;break;case p.Mat2Array:u+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
|
|
105
|
+
`;break;case p.Mat4x3Array:u+=` mat4x3 val = fetchMat4x3(vec4_idx);
|
|
106
106
|
`;break;default:u+=""}return u+=`
|
|
107
107
|
return val;
|
|
108
108
|
}
|
|
109
|
-
`,u}if(!a&&e.needUniformInDataTextureMode){let u="";return e.arrayLength&&(u="[idxOfArray]"),`${
|
|
109
|
+
`,u}if(!a&&e.needUniformInDataTextureMode){let u="";return e.arrayLength&&(u="[idxOfArray]"),`${r}
|
|
110
110
|
${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
|
|
111
111
|
return u_${o}${u};
|
|
112
112
|
}
|
|
113
|
-
`}return
|
|
114
|
-
`);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),
|
|
115
|
-
`,
|
|
116
|
-
`,a+=`int scalar_idx = ${
|
|
117
|
-
`}let u="";i.componentType===
|
|
113
|
+
`}return r}static B_(t,e,i){var S,b;let n=i.compositionType.getGlslStr(i.componentType),a,o=p.isTexture(i.compositionType),r=i.semantic.replace(".","_"),c="",s=i.compositionType.getGlslStr(i.componentType),m="";i.arrayLength&&(m=`[${i.arrayLength}]`),(i.needUniformInDataTextureMode||o)&&(c=` uniform ${s} u_${r}${m};
|
|
114
|
+
`);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),h=P.getOffsetOfPropertyOfMaterial(t,i.semantic,e),f=t.materialRepository._getMaterialCountPerBufferView(e),g=`rnOffsets_${r}`,x=`const int ${g}[${h.length}] = int[${h.length}](${h.join(", ")});`,v=l;if(a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView);
|
|
115
|
+
`,p.isArray(i.compositionType)){v=l*((S=i.arrayLength)!=null?S:1);let B=Math.ceil(d/4)*4*((b=i.arrayLength)!=null?b:1);a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView) + ${l} * int(idxOfArray);
|
|
116
|
+
`,a+=`int scalar_idx = ${g}[instanceIdOfBufferViews] * 4 + ${B} * int(instanceIdInBufferView) + ${d} * int(idxOfArray);
|
|
117
|
+
`}let u="";i.componentType===C.Int&&i.compositionType!==p.Scalar&&(u="i");let R="";if(!o&&!i.needUniformInDataTextureMode){R+=`
|
|
118
118
|
${x}
|
|
119
|
-
${
|
|
119
|
+
${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
|
|
120
120
|
uint instanceId = _instanceId;
|
|
121
121
|
uint instanceIdOfBufferViews = instanceId / ${f}u;
|
|
122
122
|
uint instanceIdInBufferView = instanceId % ${f}u;
|
|
123
123
|
${a}
|
|
124
124
|
`;let y=`${c}
|
|
125
|
-
${R}`;switch(i.compositionType){case
|
|
126
|
-
`;break;case
|
|
127
|
-
`,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case
|
|
128
|
-
`;break;case
|
|
129
|
-
`,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case
|
|
130
|
-
`;break;case
|
|
131
|
-
`,i.componentType===
|
|
132
|
-
`,i.componentType===
|
|
133
|
-
`;break;case
|
|
134
|
-
`;break;case
|
|
135
|
-
`;break;case
|
|
136
|
-
`;break;case
|
|
137
|
-
`;break;case
|
|
138
|
-
`;break;case
|
|
125
|
+
${R}`;switch(i.compositionType){case p.Vec4:case p.Vec4Array:y+=` highp vec4 val = fetchElement(vec4_idx);
|
|
126
|
+
`;break;case p.Vec3:y+=` vec4 col0 = fetchElement(vec4_idx);
|
|
127
|
+
`,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case p.Vec3Array:y+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
|
|
128
|
+
`;break;case p.Vec2:y+=` highp vec4 col0 = fetchElement(vec4_idx);
|
|
129
|
+
`,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case p.Vec2Array:y+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
|
|
130
|
+
`;break;case p.Scalar:y+=` vec4 col0 = fetchElement(vec4_idx);
|
|
131
|
+
`,i.componentType===C.Int?y+=" int val = int(col0.x);":i.componentType===C.Bool?y+=" bool val = bool(col0.x);":y+=" float val = col0.x;";break;case p.ScalarArray:y+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
|
|
132
|
+
`,i.componentType===C.Int?y+=" int val = int(col0);":i.componentType===C.Bool?y+=" bool val = bool(col0);":y+=" float val = col0;";break;case p.Mat4:y+=` mat4 val = fetchMat4(vec4_idx);
|
|
133
|
+
`;break;case p.Mat4Array:y+=` mat4 val = fetchMat4(vec4_idx);
|
|
134
|
+
`;break;case p.Mat3:y+=` mat3 val = fetchMat3(vec4_idx);
|
|
135
|
+
`;break;case p.Mat3Array:y+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
|
|
136
|
+
`;break;case p.Mat2:y+=` mat2 val = fetchMat2(vec4_idx);
|
|
137
|
+
`;break;case p.Mat2Array:y+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
|
|
138
|
+
`;break;case p.Mat4x3Array:y+=` mat4x3 val = fetchMat4x3(vec4_idx);
|
|
139
139
|
`;break;default:y+=""}return y+=`
|
|
140
140
|
return val;
|
|
141
141
|
}
|
|
142
142
|
`,y}if(!o&&i.needUniformInDataTextureMode){let y="";return i.arrayLength&&(y="[idxOfArray]"),`${c}
|
|
143
|
-
${
|
|
144
|
-
return u_${
|
|
143
|
+
${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
|
|
144
|
+
return u_${r}${y};
|
|
145
145
|
}
|
|
146
|
-
`}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(this.deleteDataTexture(),e._updateVBOAndVAO()),!0)}zS(){let t=U.getMorphUniformDataOffsets();for(let i=0;i<U.getPrimitiveCountHasMorph();i++){let r=U.getPrimitiveHasMorph(i);if(r!=null)for(let a=0;a<r.targets.length;a++){let n=r.targets[a].get(E.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers($.GPUVertexData,n.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+n.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.U_()}U_(){let t=!1,e=U.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.VI){if(this.gI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.VI=i,this.gI===v.InvalidCGAPIResourceUid){let a=new Uint32Array(i);this.wI=a,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.zS()}this.VI=i,t=!0}let r=G._getMorphWeightsUniformBufferFloatCount(this.i);if(r!==this.JI){if(this.yI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid),this.yI===v.InvalidCGAPIResourceUid){let a=new Float32Array(r);this.II=a,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.HS(!0)}this.JI=r,t=!0}t&&this.D_()}D_(){this.gI!==v.InvalidCGAPIResourceUid&&this.yI!==v.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}P_(){let t=U.getPrimitiveCountHasMorph();(t!==this.HI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.ZI)&&(this.zS(),this.ZI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.HI=t)}G_(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers($.GPUInstanceData).reduce((c,s)=>c+s,0),r=t.getBuffers($.GPUInstanceData),a=r.length;a!==this.qI&&(this.qI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let n=o.getMaxTextureSize();if(this.__dataTextureUid!==v.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/n),p=n*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),m=0;for(let f=0;f<r.length;f++){let h=r[f],x=f===r.length-1?h.takenSizeInByte:h.byteLength;x>p&&ee.default.warn("The buffer size exceeds the size of the data texture.");let b=new Float32Array(h.getArrayBuffer());for(let[u,R]of se(m,m+Math.min(x,p),d))this.XS(b,m,u,R,n);B.GI||(oe.downloadTypedArray("Rhodonite_dataTextureBuffer.bin",b),B.GI=!0),m+=h.byteLength}for(let[f,h]of l._takeDirtyByteRanges()){let x=0;for(let b of r){let u=x+b.byteLength;if(f>=x&&h<=u){let R=new Float32Array(b.getArrayBuffer());this.XS(R,x,f,h,n);break}x=u}}}else{let c=t.getBuffers($.GPUVertexData),s=c.map(S=>S.getArrayBuffer()),p=n*4*4,l=r.map(S=>Math.ceil(S.byteLength/p)*p),d=l.reduce((S,M)=>S+M,0),m=c.reduce((S,M)=>S+M.byteLength,0),f=Math.max(Math.ceil((d+m)/p),1),h=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,x=this.i.webglResourceRepository.instanceSidTable,b=h?Math.max(x.usedEnd,1):0,u=h?Math.max(Math.ceil(b/n),1):0,R=h?Math.max(Math.ceil(Math.ceil(b/4)/n),1):0,_=f+u+R;this.RI=n,this.UI=f,this.DI=f+u,this._I=this.UI*n,this.MI=this.DI*n,this.PI=b,h&&x.markAllDirty();let I=p*_,y=new Uint8Array(I),A=0;r.forEach((S,M)=>{y.set(new Uint8Array(S.getArrayBuffer(),0,S.takenSizeInByte),A),A+=l[M]}),c.forEach((S,M)=>{y.set(new Uint8Array(s[M],0,S.byteLength),A),A+=S.byteLength});let W=new Float32Array(y.buffer);this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=d,this.__dataTextureUid=this.i.webglResourceRepository.createTextureFromTypedArray(W,{internalFormat:ae.RGBA32F,width:n,height:_,format:j.RGBA,type:T.Float,generateMipmap:!1}),this.i.lightClusterSystem._takeDirtyByteRanges()}}XS(t,e,i,r,a){let o=this.i.webglResourceRepository,n=Math.floor(i/16),c=Math.ceil(r/16),s=e/16,p=(l,d,m,f,h)=>{let x=(h-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+m*f*4),{level:0,offsetX:l,offsetY:d,width:m,height:f,format:j.RGBA,type:T.Float})};for(;n<c;){let l=n%a,d=Math.floor(n/a);if(l!==0||c-n<a){let m=Math.min(a-l,c-n);p(l,d,m,1,n),n+=m}else{let m=Math.floor((c-n)/a);p(0,d,a,m,n),n+=m*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.PI=0,this.RI=0,this.SI=v.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&e.usedEnd>this.PI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||Q.getUpdateCount(this.i)!==this.nr||J.getUpdateCount(this.i)!==this.KI||k.getCurrentCameraUpdateCount(this.i)!==this.dC||q(this.i)!==this.sr||this.i.materialRepository.stateVersion!==this.jI||this.i.lightClusterSystem.dataVersion!==this.XI||z.getUpdateCount(this.i)!==this.or||this.i._gpuInstanceDataVersion!==this.YI||this.__dataTextureUid===v.InvalidCGAPIResourceUid)&&(this.G_(),this.w_(),this.nr=Q.getUpdateCount(this.i),this.KI=J.getUpdateCount(this.i),this.dC=k.getCurrentCameraUpdateCount(this.i),this.sr=q(this.i),this.jI=this.i.materialRepository.stateVersion,this.XI=this.i.lightClusterSystem.dataVersion,this.or=z.getUpdateCount(this.i),this.YI=this.i._gpuInstanceDataVersion),G.updateCount!==this.zI||G.getCountOfBlendShapeComponents(this.i)!==this.QI?(this.HS(),this.zI=G.updateCount,this.QI=G.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()):this.O_(),this.P_(),this.kI=this.i.componentRepository.getComponentsWithType(z)}HS(t=!1){let i=this.i.memoryManager.getBuffer($.GPUVertexData);if(i==null||i.takenSizeInByte===0)return;let r=G._writeMorphWeightsUniformArray(this.i,this.II,t);this.OI=!1,r>0&&this.YS(r)}YS(t){this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.II,0,t)}O_(){if(this.OI||this.II==null)return;this.OI=!0;let t=G._settlePreviousMorphWeights(this.i,this.II);t>0&&this.YS(t)}V_(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}w_(){if(this.V_()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer($.GPUInstanceData);if(this.bI===v.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,r){}attachVertexDataInner(t,e,i,r,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)r.bindVertexArray(o);else{r.bindVertexArray(null);let n=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(n,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(n.iboHandle),s=r.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new B(t)}ZS(t,e,i){if(i){let r=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?r=a._getCameraComponentSIDAt(0):r=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=r}else{let r=t.cameraComponent;r==null&&(r=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),r?this.xI._v[N.CameraComponentTID]=r.componentSID:this.xI._v[N.CameraComponentTID]=-1}}KS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}W_(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let r=this.i.webglResourceRepository,a=r.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=r.instanceSidTable;if(!o.isSupported)return;let n=H._getInstanceCullingState(e),c=n!=null&&n.culledEntityCount>0;if(this.vI=c?0:1,!c){this.qS(o);return}let s=n.culledEntityStamp,p=n.cullTick,l=n.cullingId;for(let d=0;d<t.length;d++){let m=t[d];if(m===-1)continue;let f=i!=null?i[d]:U.getPrimitive(m);if(f==null)continue;let h=f.mesh;h==null||h._remapPrepassId===l||(h._remapPrepassId=l,h._packVisibleInstancesToVariationVBO(s,p))}this.qS(o)}qS(t){if(this.__dataTextureUid===v.InvalidCGAPIResourceUid||this.RI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.JS(this.UI,e,(i,r,a)=>t.writeSidTexels(i,r,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.JS(this.DI,Math.ceil(e/4),(i,r,a)=>t.writeRemapTexels(i,r,a)),t.clearRemapDirty())}JS(t,e,i){let r=this.RI,a=e,o=0,n=t;for(;a>0;){let c=Math.min(a,r),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:n,width:c,height:1,format:j.RGBA,type:T.Float}),a-=c,o+=c,n++}}common_$render(t,e,i,r){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),n=V.isVrMainPass(this.i,e),c=V.getDisplayCount(n,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.L_(o,e,n),o.depthMask(!0),!0;this.W_(t,e,s);let p=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),p=this.CI(t,s,e._lastOpaqueIndex,0,-1,a,e,n,c)||p),e._toRenderTranslucentPrimitives&&(p=this.CI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,n,c)||p),e._toRenderBlendWithZWritePrimitives&&(p=this.CI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,n,c)||p),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),p=this.CI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,n,c)||p),o.depthMask(!0),this.dettachVertexData(a),this.S_=i,p}L_(t,e,i){let r=e.material,a=e._dummyPrimitiveForBufferLessRendering;Y(r,a,this);let o=r.getShaderProgramUid(a),n=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(n),this.SI=o,this.bindDataTexture(t,n),this.KS(t,r,n),this.ZS(e,0,i),this.QS(t,n),this.l_(t,n),n.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,n._gl.uniform2iv(n.vrState,s._v)}V.setWebGLParameters(this.i,r,t),r._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:n,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.WI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui(E.MaterialSid.getAttributeSlot(),r.materialSID,0,0,0),t.vertexAttribI4ui(E.Instance.getAttributeSlot(),0,0,0,0),this.d_(t,n),this.g_(t,n)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}WI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}$_(t,e,i){let r=E.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(r,e.materialSID,0,0,0);return}let n=e===t.material,c=n?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}n||o.vertexAttribI4ui(r,e.materialSID,0,0,0)}CI(t,e,i,r,a,o,n,c,s){let p=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!p){for(let f=i;a>0?f<=r:f>=r;f+=a)l=this.AI(t[f],o,n,c,s,void 0,e==null?void 0:e[f])||l;return l}let m=fe(i,r,a,f=>{let h=t[f];if(h===-1)return null;let x=e!=null?e[f]:U.getPrimitive(h);if(x==null||x._multiDrawGroup==null)return null;let b=n.getAppropriateMaterial(x);return b._materialContent.isMultiDrawCompatible?ce(x,b,le(x)):null},this.M_);for(let f=0;f<m.count;f++){let h=m.starts[f],x=m.counts[f];if(m.keys[f]===-1||x<2)for(let b=0;b<x;b++){let u=h+b*a;l=this.AI(t[u],o,n,c,s,void 0,e==null?void 0:e[u])||l}else l=this.k_(t,e,h,x,a,o,n,s)||l}return l}k_(t,e,i,r,a,o,n,c){var S;let s=e!=null?e[i]:U.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let p=s.mesh,l={primitive:s,mesh:p,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this.AI(t[i],o,n,!1,c,l,s)){let M=!1;for(let D=1;D<r;D++){let C=i+D*a;M=this.AI(t[C],o,n,!1,c,void 0,e==null?void 0:e[C])||M}return M}let m=s._multiDrawGroup,f=m.counts,h=m.offsets,x=m.instanceCounts,b=m.firsts,u=m.vertexCounts,R=l.indexed,_=o.getRawContextAsWebGL2(),I=0;f[I]=l.count,h[I]=l.offset,b[I]=l.offset,u[I]=l.count,x[I]=l.instanceCount,I++;let y=H._getInstanceCullingState(n),A=y==null?void 0:y.culledEntityStamp,W=(S=y==null?void 0:y.cullTick)!=null?S:0;for(let M=1;M<r;M++){let D=i+M*a,C=e!=null?e[D]:U.getPrimitive(t[D]);if(C==null||C._multiDrawGroup!==m)continue;let L=n.getAppropriateMaterial(C);if(L.getShaderProgramUid(C)===-1&&Y(L,C,this),te(L,C))continue;let P=C.mesh._packVisibleInstancesToVariationVBO(A,W);if(P===0)continue;let w=C._multiDrawEntry;w!=null&&(f[I]=w.indexCount,h[I]=w.indexByteOffset,b[I]=w.vertexOffset,u[I]=w.vertexCount,x[I]=P,I++)}return I>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,_.UNSIGNED_INT,h,0,x,0,I):o.multiDrawArraysInstanced(l.mode,b,0,u,0,x,0,I):I===1&&(R?_.drawElementsInstanced(l.mode,f[0],_.UNSIGNED_INT,h[0],x[0]):_.drawArraysInstanced(l.mode,b[0],u[0],x[0])),!0}AI(t,e,i,r,a,o,n){var I,y,A,W;let c=e.getRawContextAsWebGL2(),s=n!=null?n:U.getPrimitive(t);if(s==null)return!1;let p=s.mesh,l=p.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);Y(d,s,this);let m=l.getMeshRenderer(),f=H._getInstanceCullingState(i),h=p._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(I=f==null?void 0:f.cullTick)!=null?I:0);if(h===0)return!1;let x=p.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(p,s,x,e,p._variationVBOUid),this.WI(e)&&this.$_(s,d,e);let b=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.SI||c.JA){if(te(d,s))return this.dettachVertexData(e),!1;let S=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(S),c.JA=!1,this.bindDataTexture(c,S),this.fI=S,b=!0,u=!0}((y=this.$I)==null?void 0:y.deref())!==d&&(u=!0,this.$I=new WeakRef(d)),this.EI!==d.stateVersion&&(u=!0,this.EI=d.stateVersion),this.WI(e)&&this.fI!=null&&(this.d_(c,this.fI),this.g_(c,this.fI));let _={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.kI,renderPass:i,primitive:s,diffuseCube:m.diffuseCubeMap,specularCube:m.specularCubeMap,sheenCube:m.sheenCubeMap,isVr:r,displayIdx:-1};b&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:b,args:_}),u&&(this.KS(c,d,this.fI),V.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:_})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:_});for(let S=0;S<a;S++){if(r&&V.setVRViewport(this.i,i,S),this.ZS(i,S,r),this.QS(c,this.fI),this.l_(c,this.fI),this.fI.vrState!=null&&r&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=r?1:0,F._v[1]=S,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui(E.Instance.getAttributeSlot(),Math.max(0,p._instanceSidBase),0,0,0);let D=s.indicesAccessor,C=D!=null,L=s.getRenderIndexBitSize(),Z=L==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,P=s._multiDrawEntry,w=(A=P==null?void 0:P.indexByteOffset)!=null?A:0,K=(W=P==null?void 0:P.vertexOffset)!=null?W:0;o!=null?(o.primitive=s,o.mesh=p,o.indexed=C,o.mode=s.primitiveMode.index,o.indexBitSize=L,o.count=C?D.elementCount:s.getVertexCountAsVerticesBased(),o.offset=C?w:K,o.instanceCount=h):C?c.drawElementsInstanced(s.primitiveMode.index,D.elementCount,Z,w,h):c.drawArraysInstanced(s.primitiveMode.index,K,s.getVertexCountAsVerticesBased(),h)}return this.SI=R,!0}l_(t,e){let i=e,r=i.lightClusterView;if(r==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,n=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===n||(t.uniform4fv(r,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=n)}QS(t,e){let i=this.xI._v,r=this.FI;if(this.NI===e&&r!=null&&r.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(r[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(r==null||r.length!==i.length)&&(r=new Float32Array(i.length),this.FI=r),r.set(i),this.NI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,r=i.currentWebGLContextWrapper;if(r==null||r.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.N_===void 0&&(o.TI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.LI=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.BI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.N_=null),o.TI!=null&&(t.uniform1i(o.TI,this._I),o.y_=this._I),o.LI!=null&&(t.uniform1i(o.LI,this.MI),o.x_=this.MI),o.BI!=null&&(t.uniform1i(o.BI,this.vI),o.I_=this.vI)}g_(t,e){let i=e;if(i.TI==null)return;let r=this._I;i.y_!==r&&(t.uniform1i(i.TI,r),i.y_=r);let a=this.MI;i.x_!==a&&(t.uniform1i(i.LI,a),i.x_=a)}d_(t,e){let i=e;if(i.BI==null)return;let r=this.vI;i.I_!==r&&(t.uniform1i(i.BI,r),i.I_=r)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.bI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=v.InvalidCGAPIResourceUid),this.gI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.yI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid)}};B.GI=!0;var ie=B;export{ie as WebGLStrategyWebGL2};
|
|
146
|
+
`}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(e._updateVBOAndVAO(),this.U_()),!0)}U_(){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid)return;let t=this.i.memoryManager.getBuffers(V.GPUVertexData),e=0;for(let i of t)e+=i.byteLength;e!==this.OI&&this.deleteDataTexture()}HS(){let t=A.getMorphUniformDataOffsets();for(let i=0;i<A.getPrimitiveCountHasMorph();i++){let n=A.getPrimitiveHasMorph(i);if(n!=null)for(let a=0;a<n.targets.length;a++){let r=n.targets[a].get($.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers(V.GPUVertexData,r.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+r.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.D_()}D_(){let t=!1,e=A.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.LI){if(this.gI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.LI=i,this.gI===I.InvalidCGAPIResourceUid){let a=new Uint32Array(i);this.wI=a,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.HS()}this.LI=i,t=!0}let n=D._getMorphWeightsUniformBufferFloatCount(this.i);if(n!==this.QI){if(this.yI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid),this.yI===I.InvalidCGAPIResourceUid){let a=new Float32Array(n);this.II=a,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.XS(!0)}this.QI=n,t=!0}t&&this.P_()}P_(){this.gI!==I.InvalidCGAPIResourceUid&&this.yI!==I.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}G_(){let t=A.getPrimitiveCountHasMorph();(t!==this.jI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.KI)&&(this.HS(),this.KI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.jI=t)}O_(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers(V.GPUInstanceData).reduce((c,s)=>c+s,0),n=t.getBuffers(V.GPUInstanceData),a=n.length;a!==this.JI&&(this.JI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let r=o.getMaxTextureSize();if(this.__dataTextureUid!==I.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/r),m=r*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),h=0;for(let f=0;f<n.length;f++){let g=n[f],x=g.takenSizeInByte;x>m&&ee.default.warn("The buffer size exceeds the size of the data texture.");let v=new Float32Array(g.getArrayBuffer());for(let[u,R]of oe(h,h+Math.min(x,m),d))this.CI(v,h,u,R,r);h+=g.byteLength}for(let[f,g]of l._takeDirtyByteRanges()){let x=0;for(let v of n){let u=x+v.byteLength;if(f>=x&&g<=u){let R=new Float32Array(v.getArrayBuffer());this.CI(R,x,f,g,r);break}x=u}}}else{let c=t.getBuffers(V.GPUVertexData),s=r*4*4,m=n.map(b=>Math.ceil(b.byteLength/s)*s),l=m.reduce((b,y)=>b+y,0),d=c.reduce((b,y)=>b+y.byteLength,0),h=Math.max(Math.ceil((l+d)/s),1),f=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,g=this.i.webglResourceRepository.instanceSidTable,x=f?Math.max(g.usedEnd,1):0,v=f?Math.max(Math.ceil(x/r),1):0,u=f?Math.max(Math.ceil(Math.ceil(x/4)/r),1):0,R=h+v+u;this.RI=r,this.DI=h,this.PI=h+v,this._I=this.DI*r,this.MI=this.PI*r,this.GI=x,this.OI=d,f&&g.markAllDirty(),this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=l,this.__dataTextureUid=this.i.webglResourceRepository.createTexStorage2D({levels:1,internalFormat:ae.RGBA32F,width:r,height:R});let S=0;n.forEach((b,y)=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.takenSizeInByte,r),S+=m[y]}),c.forEach(b=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.byteLength,r),S+=b.byteLength}),this.i.lightClusterSystem._takeDirtyByteRanges()}}CI(t,e,i,n,a){let o=this.i.webglResourceRepository,r=Math.floor(i/16),c=Math.ceil(n/16),s=e/16,m=(l,d,h,f,g)=>{let x=(g-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+h*f*4),{level:0,offsetX:l,offsetY:d,width:h,height:f,format:Q.RGBA,type:C.Float})};for(;r<c;){let l=r%a,d=Math.floor(r/a);if(l!==0||c-r<a){let h=Math.min(a-l,c-r);m(l,d,h,1,r),r+=h}else{let h=Math.floor((c-r)/a);m(0,d,a,h,r),r+=h*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.GI=0,this.RI=0,this.OI=0,this.SI=I.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&e.usedEnd>this.GI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||J.getUpdateCount(this.i)!==this.nr||q.getUpdateCount(this.i)!==this.qI||k.getCurrentCameraUpdateCount(this.i)!==this.dC||K(this.i)!==this.sr||this.i.materialRepository.stateVersion!==this.XI||this.i.lightClusterSystem.dataVersion!==this.YI||z.getUpdateCount(this.i)!==this.or||this.i._gpuInstanceDataVersion!==this.ZI||this.__dataTextureUid===I.InvalidCGAPIResourceUid)&&(this.O_(),this.w_(),this.nr=J.getUpdateCount(this.i),this.qI=q.getUpdateCount(this.i),this.dC=k.getCurrentCameraUpdateCount(this.i),this.sr=K(this.i),this.XI=this.i.materialRepository.stateVersion,this.YI=this.i.lightClusterSystem.dataVersion,this.or=z.getUpdateCount(this.i),this.ZI=this.i._gpuInstanceDataVersion),D.updateCount!==this.HI||D.getCountOfBlendShapeComponents(this.i)!==this.LS?(this.XS(),this.HI=D.updateCount,this.LS=D.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()):this.V_(),this.G_(),this.NI=this.i.componentRepository.getComponentsWithType(z)}XS(t=!1){let i=this.i.memoryManager.getBuffer(V.GPUVertexData);if(i==null||i.takenSizeInByte===0)return;let n=D._writeMorphWeightsUniformArray(this.i,this.II,t);this.VI=!1,n>0&&this.YS(n)}YS(t){this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.II,0,t)}V_(){if(this.VI||this.II==null)return;this.VI=!0;let t=D._settlePreviousMorphWeights(this.i,this.II);t>0&&this.YS(t)}L_(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}w_(){if(this.L_()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer(V.GPUInstanceData);if(this.bI===I.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,n){}attachVertexDataInner(t,e,i,n,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)n.bindVertexArray(o);else{n.bindVertexArray(null);let r=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(r,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(r.iboHandle),s=n.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new P(t)}ZS(t,e,i){if(i){let n=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?n=a._getCameraComponentSIDAt(0):n=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=n}else{let n=t.cameraComponent;n==null&&(n=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),n?this.xI._v[N.CameraComponentTID]=n.componentSID:this.xI._v[N.CameraComponentTID]=-1}}KS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}W_(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let n=this.i.webglResourceRepository,a=n.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=n.instanceSidTable;if(!o.isSupported)return;let r=H._getInstanceCullingState(e),c=r!=null&&r.culledEntityCount>0;if(this.vI=c?0:1,!c){this.qS(o);return}let s=r.culledEntityStamp,m=r.cullTick,l=r.cullingId;for(let d=0;d<t.length;d++){let h=t[d];if(h===-1)continue;let f=i!=null?i[d]:A.getPrimitive(h);if(f==null)continue;let g=f.mesh;g==null||g._remapPrepassId===l||(g._remapPrepassId=l,g._packVisibleInstancesToVariationVBO(s,m))}this.qS(o)}qS(t){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid||this.RI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.JS(this.DI,e,(i,n,a)=>t.writeSidTexels(i,n,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.JS(this.PI,Math.ceil(e/4),(i,n,a)=>t.writeRemapTexels(i,n,a)),t.clearRemapDirty())}JS(t,e,i){let n=this.RI,a=e,o=0,r=t;for(;a>0;){let c=Math.min(a,n),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:r,width:c,height:1,format:Q.RGBA,type:C.Float}),a-=c,o+=c,r++}}common_$render(t,e,i,n){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),r=L.isVrMainPass(this.i,e),c=L.getDisplayCount(r,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.$_(o,e,r),o.depthMask(!0),!0;this.W_(t,e,s);let m=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),m=this.AI(t,s,e._lastOpaqueIndex,0,-1,a,e,r,c)||m),e._toRenderTranslucentPrimitives&&(m=this.AI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,r,c)||m),e._toRenderBlendWithZWritePrimitives&&(m=this.AI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,r,c)||m),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),m=this.AI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,r,c)||m),o.depthMask(!0),this.dettachVertexData(a),this.S_=i,m}$_(t,e,i){let n=e.material,a=e._dummyPrimitiveForBufferLessRendering;X(n,a,this);let o=n.getShaderProgramUid(a),r=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(r),this.SI=o,this.bindDataTexture(t,r),this.KS(t,n,r),this.ZS(e,0,i),this.QS(t,r),this.l_(t,r),r.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,r._gl.uniform2iv(r.vrState,s._v)}L.setWebGLParameters(this.i,n,t),n._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:r,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.WI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui($.MaterialSid.getAttributeSlot(),n.materialSID,0,0,0),t.vertexAttribI4ui($.Instance.getAttributeSlot(),0,0,0,0),this.d_(t,r),this.g_(t,r)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}WI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}k_(t,e,i){let n=$.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(n,e.materialSID,0,0,0);return}let r=e===t.material,c=r?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}r||o.vertexAttribI4ui(n,e.materialSID,0,0,0)}AI(t,e,i,n,a,o,r,c,s){let m=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!m){for(let f=i;a>0?f<=n:f>=n;f+=a)l=this.TI(t[f],o,r,c,s,void 0,e==null?void 0:e[f])||l;return l}let h=le(i,n,a,f=>{let g=t[f];if(g===-1)return null;let x=e!=null?e[f]:A.getPrimitive(g);if(x==null||x._multiDrawGroup==null)return null;let v=r.getAppropriateMaterial(x);return v._materialContent.isMultiDrawCompatible?se(x,v,ce(x)):null},this.M_);for(let f=0;f<h.count;f++){let g=h.starts[f],x=h.counts[f];if(h.keys[f]===-1||x<2)for(let v=0;v<x;v++){let u=g+v*a;l=this.TI(t[u],o,r,c,s,void 0,e==null?void 0:e[u])||l}else l=this.N_(t,e,g,x,a,o,r,s)||l}return l}N_(t,e,i,n,a,o,r,c){var M;let s=e!=null?e[i]:A.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let m=s.mesh,l={primitive:s,mesh:m,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this.TI(t[i],o,r,!1,c,l,s)){let G=!1;for(let T=1;T<n;T++){let _=i+T*a;G=this.TI(t[_],o,r,!1,c,void 0,e==null?void 0:e[_])||G}return G}let h=s._multiDrawGroup,f=h.counts,g=h.offsets,x=h.instanceCounts,v=h.firsts,u=h.vertexCounts,R=l.indexed,S=o.getRawContextAsWebGL2(),b=0;f[b]=l.count,g[b]=l.offset,v[b]=l.offset,u[b]=l.count,x[b]=l.instanceCount,b++;let y=H._getInstanceCullingState(r),B=y==null?void 0:y.culledEntityStamp,E=(M=y==null?void 0:y.cullTick)!=null?M:0;for(let G=1;G<n;G++){let T=i+G*a,_=e!=null?e[T]:A.getPrimitive(t[T]);if(_==null||_._multiDrawGroup!==h)continue;let W=r.getAppropriateMaterial(_);if(W.getShaderProgramUid(_)===-1&&X(W,_,this),te(W,_))continue;let U=_.mesh._packVisibleInstancesToVariationVBO(B,E);if(U===0)continue;let O=_._multiDrawEntry;O!=null&&(f[b]=O.indexCount,g[b]=O.indexByteOffset,v[b]=O.vertexOffset,u[b]=O.vertexCount,x[b]=U,b++)}return b>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,S.UNSIGNED_INT,g,0,x,0,b):o.multiDrawArraysInstanced(l.mode,v,0,u,0,x,0,b):b===1&&(R?S.drawElementsInstanced(l.mode,f[0],S.UNSIGNED_INT,g[0],x[0]):S.drawArraysInstanced(l.mode,v[0],u[0],x[0])),!0}TI(t,e,i,n,a,o,r){var b,y,B,E;let c=e.getRawContextAsWebGL2(),s=r!=null?r:A.getPrimitive(t);if(s==null)return!1;let m=s.mesh,l=m.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);X(d,s,this);let h=l.getMeshRenderer(),f=H._getInstanceCullingState(i),g=m._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(b=f==null?void 0:f.cullTick)!=null?b:0);if(g===0)return!1;let x=m.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(m,s,x,e,m._variationVBOUid),this.WI(e)&&this.k_(s,d,e);let v=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.SI||c.$A){if(te(d,s))return this.dettachVertexData(e),!1;let M=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(M),c.$A=!1,this.bindDataTexture(c,M),this.fI=M,v=!0,u=!0}((y=this.EI)==null?void 0:y.deref())!==d&&(u=!0,this.EI=new WeakRef(d)),this.kI!==d.stateVersion&&(u=!0,this.kI=d.stateVersion),this.WI(e)&&this.fI!=null&&(this.d_(c,this.fI),this.g_(c,this.fI));let S={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.NI,renderPass:i,primitive:s,diffuseCube:h.diffuseCubeMap,specularCube:h.specularCubeMap,sheenCube:h.sheenCubeMap,isVr:n,displayIdx:-1};v&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:v,args:S}),u&&(this.KS(c,d,this.fI),L.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:S})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:S});for(let M=0;M<a;M++){if(n&&L.setVRViewport(this.i,i,M),this.ZS(i,M,n),this.QS(c,this.fI),this.l_(c,this.fI),this.fI.vrState!=null&&n&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=n?1:0,F._v[1]=M,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui($.Instance.getAttributeSlot(),Math.max(0,m._instanceSidBase),0,0,0);let T=s.indicesAccessor,_=T!=null,W=s.getRenderIndexBitSize(),Y=W==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,U=s._multiDrawEntry,O=(B=U==null?void 0:U.indexByteOffset)!=null?B:0,Z=(E=U==null?void 0:U.vertexOffset)!=null?E:0;o!=null?(o.primitive=s,o.mesh=m,o.indexed=_,o.mode=s.primitiveMode.index,o.indexBitSize=W,o.count=_?T.elementCount:s.getVertexCountAsVerticesBased(),o.offset=_?O:Z,o.instanceCount=g):_?c.drawElementsInstanced(s.primitiveMode.index,T.elementCount,Y,O,g):c.drawArraysInstanced(s.primitiveMode.index,Z,s.getVertexCountAsVerticesBased(),g)}return this.SI=R,!0}l_(t,e){let i=e,n=i.lightClusterView;if(n==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,r=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===r||(t.uniform4fv(n,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=r)}QS(t,e){let i=this.xI._v,n=this.zI;if(this.FI===e&&n!=null&&n.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(n[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(n==null||n.length!==i.length)&&(n=new Float32Array(i.length),this.zI=n),n.set(i),this.FI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper;if(n==null||n.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.F_===void 0&&(o.BI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.$I=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.UI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.F_=null),o.BI!=null&&(t.uniform1i(o.BI,this._I),o.y_=this._I),o.$I!=null&&(t.uniform1i(o.$I,this.MI),o.x_=this.MI),o.UI!=null&&(t.uniform1i(o.UI,this.vI),o.I_=this.vI)}g_(t,e){let i=e;if(i.BI==null)return;let n=this._I;i.y_!==n&&(t.uniform1i(i.BI,n),i.y_=n);let a=this.MI;i.x_!==a&&(t.uniform1i(i.$I,a),i.x_=a)}d_(t,e){let i=e;if(i.UI==null)return;let n=this.vI;i.I_!==n&&(t.uniform1i(i.UI,n),i.I_=n)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.bI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=I.InvalidCGAPIResourceUid),this.gI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.yI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid)}};export{ie as WebGLStrategyWebGL2};
|
package/dist/esm/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js
CHANGED
|
@@ -23,6 +23,7 @@ in vec3 v_normal_inView;
|
|
|
23
23
|
|
|
24
24
|
uniform bool u_inverseEnvironment; // initialValue=false
|
|
25
25
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
26
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
26
27
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
27
28
|
|
|
28
29
|
uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
|
|
@@ -291,4 +292,4 @@ void main (){
|
|
|
291
292
|
|
|
292
293
|
|
|
293
294
|
}
|
|
294
|
-
`,e="fragment",r=!0,
|
|
295
|
+
`,e="fragment",r=!0,a={code:t,shaderStage:e,isFragmentShader:r};export{t as code,a as default,r as isFragmentShader,e as shaderStage};
|
|
@@ -74,6 +74,7 @@ uniform float u_uvAnimationRotationSpeedFactor; // initialValue=0.0
|
|
|
74
74
|
|
|
75
75
|
uniform bool u_inverseEnvironment; // initialValue=false
|
|
76
76
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
77
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
77
78
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
78
79
|
uniform float u_alphaCutoff; // initialValue=0.5
|
|
79
80
|
uniform bool u_makeOutputSrgb; // initialValue=false
|
|
@@ -18,6 +18,7 @@ uniform sampler2D u_metallicRoughnessTexture; // initialValue=(2,white)
|
|
|
18
18
|
uniform bool u_isOutputHDR; // initialValue=0
|
|
19
19
|
uniform bool u_makeOutputSrgb; // initialValue=1
|
|
20
20
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
21
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
21
22
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
22
23
|
uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
|
|
23
24
|
uniform samplerCube u_specularEnvTexture; // initialValue=(7,black), isInternalSetting=true
|
|
@@ -777,6 +778,7 @@ vec3 emissiveFactor = get_emissiveFactor(materialSID, 0u);
|
|
|
777
778
|
/* shaderity: @{wireframe} */
|
|
778
779
|
|
|
779
780
|
/* shaderity: @{outputSrgb} */
|
|
781
|
+
|
|
780
782
|
rt0.rgb = rt0.rgb * rt0.a; // alpha premultiplied
|
|
781
783
|
rt1 = rt0;
|
|
782
784
|
rt2 = rt0;
|
|
@@ -131,10 +131,16 @@ struct IblResult
|
|
|
131
131
|
vec3 FssEss;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
vec3 getIBLRadianceGGX(float perceptualRoughness, vec4 iblParameter, ivec2 hdriFormat, vec3 reflection)
|
|
134
|
+
vec3 getIBLRadianceGGX(float perceptualRoughness, vec4 iblParameter, ivec2 hdriFormat, vec3 reflection, float iblMipLevelSkip)
|
|
135
135
|
{
|
|
136
136
|
// get radiance
|
|
137
|
-
|
|
137
|
+
// The roughness-to-LOD mapping uses the top levels only: the prefiltered cubemap's lowest iblMipLevelSkip
|
|
138
|
+
// levels (0 by default; 4 for mip-skip bakes, such as 8x8, 4x4, 2x2 and 1x1 pixels per face for a 512px
|
|
139
|
+
// base) produce visible streaks and banding at high roughness, so those bakes set 4 and the shader never
|
|
140
|
+
// samples them. The bake writes one extra level right after this range at
|
|
141
|
+
// a roughness above 1.0, which keeps the filtering at the top edge continuous (glTF-Sample-Viewer trick).
|
|
142
|
+
// See docs/design-notes/specular-ibl-mip-skip.md.
|
|
143
|
+
float mipCount = max(iblParameter.x - iblMipLevelSkip, 1.0);
|
|
138
144
|
float lod = (perceptualRoughness * (mipCount - 1.0));
|
|
139
145
|
vec3 radiance = get_radiance(reflection, lod, hdriFormat);
|
|
140
146
|
|
|
@@ -276,7 +282,7 @@ vec3 IBLContribution(uint materialSID, uint cameraSID,
|
|
|
276
282
|
#endif
|
|
277
283
|
|
|
278
284
|
// take account of anisotropy with reflection
|
|
279
|
-
vec3 specularMetal = getIBLRadianceGGX(perceptualRoughness, iblParameter, hdriFormat, reflection);
|
|
285
|
+
vec3 specularMetal = getIBLRadianceGGX(perceptualRoughness, iblParameter, hdriFormat, reflection, get_iblMipLevelSkip(materialSID, 0u));
|
|
280
286
|
vec3 specularDielectric = specularMetal;
|
|
281
287
|
|
|
282
288
|
// Calculate fresnel mix
|
|
@@ -292,7 +298,7 @@ vec3 IBLContribution(uint materialSID, uint cameraSID,
|
|
|
292
298
|
|
|
293
299
|
#ifdef RN_USE_CLEARCOAT
|
|
294
300
|
vec3 clearcoatReflection = getReflection(rotEnvMatrix, viewDirection, clearcoatProps.clearcoatNormal_inWorld, materialSID, clearcoatProps.clearcoatRoughness, 0.0, vec3(0.0));
|
|
295
|
-
vec3 clearcoatContrib = getIBLRadianceGGX(clearcoatProps.clearcoatRoughness, iblParameter, hdriFormat, clearcoatReflection);
|
|
301
|
+
vec3 clearcoatContrib = getIBLRadianceGGX(clearcoatProps.clearcoatRoughness, iblParameter, hdriFormat, clearcoatReflection, get_iblMipLevelSkip(materialSID, 0u));
|
|
296
302
|
#else
|
|
297
303
|
vec3 clearcoatContrib = vec3(0.0);
|
|
298
304
|
#endif
|
|
@@ -313,4 +319,4 @@ vec3 IBLContribution(uint materialSID, uint cameraSID,
|
|
|
313
319
|
}
|
|
314
320
|
|
|
315
321
|
#endif // RN_USE_PBR
|
|
316
|
-
`,
|
|
322
|
+
`,i="fragment",a=!0,o={code:r,shaderStage:i,isFragmentShader:a};export{r as code,o as default,a as isFragmentShader,i as shaderStage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{StandardShaderPart as s}from"../StandardShaderPart.js";var r=class extends s{constructor(o,e,t){super();this
|
|
1
|
+
import{StandardShaderPart as s}from"../StandardShaderPart.js";var r=class extends s{constructor(o,e,t){super();this.qA=o;this.oy=e;this.py=t}getVertexShaderDefinitions(o){let e=`void ${this.qA}(
|
|
2
2
|
in bool context,
|
|
3
3
|
`;for(let t=0;t<this.oy.length;t++){let i=this.oy[t],n=i.compositionType.getGlslStr(i.componentType);e+=`
|
|
4
4
|
in ${n} value${t},`}for(let t=0;t<this.py.length;t++){let i=this.py[t],n=i.compositionType.getGlslStr(i.componentType);e+=`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{StandardShaderPart as s}from"../StandardShaderPart.js";var r=class extends s{constructor(o,e,t){super();this
|
|
1
|
+
import{StandardShaderPart as s}from"../StandardShaderPart.js";var r=class extends s{constructor(o,e,t){super();this.qA=o;this.oy=e;this.py=t}getVertexShaderDefinitions(o){let e=`void ${this.qA}(`;for(let t=0;t<this.oy.length;t++){let i=this.oy[t],n=i.compositionType.getGlslStr(i.componentType);e+=`
|
|
2
2
|
in ${n} value${t},`}for(let t=0;t<this.py.length;t++){let i=this.py[t],n=i.compositionType.getGlslStr(i.componentType);e+=`
|
|
3
3
|
out ${n} outValue${t}${t===this.py.length-1?"":","}`}e+=`) {
|
|
4
4
|
`;for(let t=0;t<this.py.length;t++)e+=`
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{ComponentType as r}from"../../../foundation/definitions/ComponentType.js";import{ProcessApproach as i}from"../../../foundation/definitions/ProcessApproach.js";import{StandardShaderPart as n}from"../StandardShaderPart.js";var o=class extends n{constructor(t,e,p){super();this
|
|
2
|
-
fn ${this
|
|
1
|
+
import{ComponentType as r}from"../../../foundation/definitions/ComponentType.js";import{ProcessApproach as i}from"../../../foundation/definitions/ProcessApproach.js";import{StandardShaderPart as n}from"../StandardShaderPart.js";var o=class extends n{constructor(t,e,p){super();this.qA=t;this.p_=e;this.c_=p;this.oV=""}setConstantValue(t){let e="";this.c_.isFloatingPoint()?e=t.glslStrAsFloat:this.c_.isInteger()?e=t.glslStrAsInt:this.c_.isUnsignedInteger()?e=t.glslStrAsUint:this.c_===r.Bool&&(e=t.x?"true":"false"),this.oV=e}getVertexShaderDefinitions(t){return t.engineState.currentProcessApproach===i.WebGPU?`
|
|
2
|
+
fn ${this.qA}(
|
|
3
3
|
outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
|
|
4
4
|
*outValue = ${this.oV};
|
|
5
5
|
}
|
|
6
6
|
`:`
|
|
7
|
-
void ${this
|
|
7
|
+
void ${this.qA}(
|
|
8
8
|
out ${this.p_.getGlslStr(this.c_)} outValue) {
|
|
9
9
|
outValue = ${this.oV};
|
|
10
10
|
}
|
|
11
11
|
`}getPixelShaderDefinitions(t){return t.engineState.currentProcessApproach===i.WebGPU?`
|
|
12
|
-
fn ${this
|
|
12
|
+
fn ${this.qA}(
|
|
13
13
|
outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
|
|
14
14
|
*outValue = ${this.oV};
|
|
15
15
|
}
|
|
16
16
|
`:`
|
|
17
|
-
void ${this
|
|
17
|
+
void ${this.qA}(
|
|
18
18
|
out ${this.p_.getGlslStr(this.c_)} outValue) {
|
|
19
19
|
outValue = ${this.oV};
|
|
20
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{ProcessApproach as r}from"../../../foundation/definitions/ProcessApproach.js";import{RaymarchingShaderPart as i}from"../RaymarchingShaderPart.js";var e=class extends i{constructor(t){super();this.
|
|
1
|
+
import{ProcessApproach as r}from"../../../foundation/definitions/ProcessApproach.js";import{RaymarchingShaderPart as i}from"../RaymarchingShaderPart.js";var e=class extends i{constructor(t){super();this.QA="";this.gS="";this.gS=t}setVariableName(t){this.QA=t}getVertexShaderDefinitions(t){return""}get vertexShaderBody(){return""}getPixelShaderDefinitions(t){return t.engineState.currentProcessApproach===r.WebGPU?`
|
|
2
2
|
fn ${this.gS}(outValue: ptr<function, f32>) {
|
|
3
|
-
*outValue = get_${this.
|
|
3
|
+
*outValue = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
|
|
4
4
|
}
|
|
5
5
|
`:`
|
|
6
6
|
void ${this.gS}(out float outValue) {
|
|
7
7
|
${this.getMaterialSIDForWebGL()}
|
|
8
|
-
outValue = get_${this.
|
|
8
|
+
outValue = get_${this.QA}(materialSID, 0u);
|
|
9
9
|
}
|
|
10
10
|
`}getPixelShaderBody(){return""}get attributeNames(){return[]}get attributeSemantics(){return[]}get attributeCompositions(){return[]}};export{e as RaymarchObjectIdUniformShader};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{ProcessApproach as e}from"../../../foundation/definitions/ProcessApproach.js";import{RaymarchingShaderPart as i}from"../RaymarchingShaderPart.js";var r=class extends i{constructor(t){super();this.
|
|
1
|
+
import{ProcessApproach as e}from"../../../foundation/definitions/ProcessApproach.js";import{RaymarchingShaderPart as i}from"../RaymarchingShaderPart.js";var r=class extends i{constructor(t){super();this.QA="";this.gS="";this.gS=t}setVariableName(t){this.QA=t}getVertexShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU,""}get vertexShaderBody(){return""}getPixelShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU?`
|
|
2
2
|
fn ${this.gS}(position: vec3f, outTransformedPosition: ptr<function, vec3f>) {
|
|
3
|
-
let transform = get_${this.
|
|
3
|
+
let transform = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
|
|
4
4
|
let inv = inverseMat4(transform);
|
|
5
5
|
let tp = (inv * vec4f(position, 1.0)).xyz;
|
|
6
6
|
*outTransformedPosition = tp;
|
|
@@ -8,7 +8,7 @@ fn ${this.gS}(position: vec3f, outTransformedPosition: ptr<function, vec3f>) {
|
|
|
8
8
|
`:`
|
|
9
9
|
void ${this.gS}(in vec3 position, out vec3 outTransformedPosition) {
|
|
10
10
|
${this.getMaterialSIDForWebGL()}
|
|
11
|
-
mat4 transform = get_${this.
|
|
11
|
+
mat4 transform = get_${this.QA}(materialSID, 0u);
|
|
12
12
|
mat4 inv = inverse(transform);
|
|
13
13
|
vec3 tp = (inv * vec4(position, 1.0)).xyz;
|
|
14
14
|
outTransformedPosition = tp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{ProcessApproach as r}from"../../../foundation/definitions/ProcessApproach.js";import{getTextureAndSamplerNames as o}from"../../../foundation/helpers/ShaderHelper.js";import{StandardShaderPart as l}from"../StandardShaderPart.js";var u=class extends l{constructor(t){super();this
|
|
2
|
-
fn ${this
|
|
1
|
+
import{ProcessApproach as r}from"../../../foundation/definitions/ProcessApproach.js";import{getTextureAndSamplerNames as o}from"../../../foundation/helpers/ShaderHelper.js";import{StandardShaderPart as l}from"../StandardShaderPart.js";var u=class extends l{constructor(t){super();this.qA=t;this.QA="";this.uV=!0}setVariableName(t){this.QA=t}setSrgbFlag(t){this.uV=t}getVertexShaderDefinitions(t){if(t.engineState.currentProcessApproach===r.WebGPU){let{textureName:e,samplerName:a}=o(this.QA);return`
|
|
2
|
+
fn ${this.qA}(uv: vec2f, scale: vec2f, offset: vec2f, rotation: f32, lod: f32, rgba: ptr<function, vec4<f32>>, rgb: ptr<function, vec3<f32>>, r: ptr<function, f32>, g: ptr<function, f32>, b: ptr<function, f32>, a: ptr<function, f32>, uvOut: ptr<function, vec2f>) {
|
|
3
3
|
let materialSID = uniformDrawParameters.materialSid;
|
|
4
4
|
let ${e}TexUv = uvTransform(scale, offset, rotation, uv);
|
|
5
5
|
var lodFloat = lod;
|
|
@@ -17,15 +17,15 @@ fn ${this.$A}(uv: vec2f, scale: vec2f, offset: vec2f, rotation: f32, lod: f32, r
|
|
|
17
17
|
*uvOut = ${e}TexUv;
|
|
18
18
|
}
|
|
19
19
|
`}return`
|
|
20
|
-
void ${this
|
|
20
|
+
void ${this.qA}(vec2 uv, vec2 scale, vec2 offset, float rotation, float lod, out vec4 rgba, out vec3 rgb, out float r, out float g, out float b, out float a, out vec2 uvOut) {
|
|
21
21
|
${this.getMaterialSIDForWebGL()}
|
|
22
|
-
vec2 ${this.
|
|
22
|
+
vec2 ${this.QA}TexUv = uvTransform(scale, offset, rotation, uv);
|
|
23
23
|
float lodFloat = lod;
|
|
24
24
|
vec4 rgbaValue;
|
|
25
25
|
if (lodFloat < 0.0) {
|
|
26
|
-
rgbaValue = texture(u_${this.
|
|
26
|
+
rgbaValue = texture(u_${this.QA}, ${this.QA}TexUv);
|
|
27
27
|
} else {
|
|
28
|
-
rgbaValue = textureLod(u_${this.
|
|
28
|
+
rgbaValue = textureLod(u_${this.QA}, ${this.QA}TexUv, lodFloat);
|
|
29
29
|
}
|
|
30
30
|
${this.uV?"rgbaValue.rgb = srgbToLinear(rgbaValue.rgb);":""}
|
|
31
31
|
rgba = rgbaValue;
|
|
@@ -34,10 +34,10 @@ void ${this.$A}(vec2 uv, vec2 scale, vec2 offset, float rotation, float lod, out
|
|
|
34
34
|
g = rgbaValue.g;
|
|
35
35
|
b = rgbaValue.b;
|
|
36
36
|
a = rgbaValue.a;
|
|
37
|
-
uvOut = ${this.
|
|
37
|
+
uvOut = ${this.QA}TexUv;
|
|
38
38
|
}
|
|
39
|
-
`}getPixelShaderDefinitions(t){if(t.engineState.currentProcessApproach===r.WebGPU){let{textureName:e,samplerName:a}=o(this.
|
|
40
|
-
fn ${this
|
|
39
|
+
`}getPixelShaderDefinitions(t){if(t.engineState.currentProcessApproach===r.WebGPU){let{textureName:e,samplerName:a}=o(this.QA);return`
|
|
40
|
+
fn ${this.qA}(uv: vec2f, scale: vec2f, offset: vec2f, rotation: f32, lod: f32, rgba: ptr<function, vec4<f32>>, rgb: ptr<function, vec3<f32>>, r: ptr<function, f32>, g: ptr<function, f32>, b: ptr<function, f32>, a: ptr<function, f32>, uvOut: ptr<function, vec2f>) {
|
|
41
41
|
let materialSID = uniformDrawParameters.materialSid;
|
|
42
42
|
let ${e}TexUv = uvTransform(scale, offset, rotation, uv);
|
|
43
43
|
var lodFloat = lod;
|
|
@@ -63,15 +63,15 @@ fn ${this.$A}(uv: vec2f, scale: vec2f, offset: vec2f, rotation: f32, lod: f32, r
|
|
|
63
63
|
*uvOut = ${e}TexUv;
|
|
64
64
|
}
|
|
65
65
|
`}return`
|
|
66
|
-
void ${this
|
|
66
|
+
void ${this.qA}(vec2 uv, vec2 scale, vec2 offset, float rotation, float lod, out vec4 rgba, out vec3 rgb, out float r, out float g, out float b, out float a, out vec2 uvOut) {
|
|
67
67
|
${this.getMaterialSIDForWebGL()}
|
|
68
|
-
vec2 ${this.
|
|
68
|
+
vec2 ${this.QA}TexUv = uvTransform(scale, offset, rotation, uv);
|
|
69
69
|
float lodFloat = lod;
|
|
70
70
|
vec4 rgbaValue;
|
|
71
71
|
if (lodFloat < 0.0) {
|
|
72
|
-
rgbaValue = texture(u_${this.
|
|
72
|
+
rgbaValue = texture(u_${this.QA}, ${this.QA}TexUv);
|
|
73
73
|
} else {
|
|
74
|
-
rgbaValue = textureLod(u_${this.
|
|
74
|
+
rgbaValue = textureLod(u_${this.QA}, ${this.QA}TexUv, lodFloat);
|
|
75
75
|
}
|
|
76
76
|
${this.uV?"rgbaValue.rgb = srgbToLinear(rgbaValue.rgb);":""}
|
|
77
77
|
rgba = rgbaValue;
|
|
@@ -80,6 +80,6 @@ void ${this.$A}(vec2 uv, vec2 scale, vec2 offset, float rotation, float lod, out
|
|
|
80
80
|
g = rgbaValue.g;
|
|
81
81
|
b = rgbaValue.b;
|
|
82
82
|
a = rgbaValue.a;
|
|
83
|
-
uvOut = ${this.
|
|
83
|
+
uvOut = ${this.QA}TexUv;
|
|
84
84
|
}
|
|
85
85
|
`}get attributeNames(){return[]}get attributeSemantics(){return[]}get attributeCompositions(){return[]}};export{u as Texture2DShader};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{ProcessApproach as e}from"../../../foundation/definitions/ProcessApproach.js";import{StandardShaderPart as r}from"../StandardShaderPart.js";var i=class extends r{constructor(t,s,a){super();this
|
|
2
|
-
// #param ${this.
|
|
3
|
-
fn ${this
|
|
4
|
-
*outValue = get_${this.
|
|
1
|
+
import{ProcessApproach as e}from"../../../foundation/definitions/ProcessApproach.js";import{StandardShaderPart as r}from"../StandardShaderPart.js";var i=class extends r{constructor(t,s,a){super();this.qA=t;this.p_=s;this.c_=a;this.QA="";this.t$=""}setVariableName(t){this.QA=t}setDefaultValue(t){this.t$=t.toString()}getVertexShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU?`
|
|
2
|
+
// #param ${this.QA}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
|
|
3
|
+
fn ${this.qA}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
|
|
4
|
+
*outValue = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
|
|
5
5
|
}
|
|
6
6
|
`:`
|
|
7
|
-
uniform ${this.p_.getGlslStr(this.c_)} u_${this.
|
|
8
|
-
void ${this
|
|
7
|
+
uniform ${this.p_.getGlslStr(this.c_)} u_${this.QA}; // initialValue=${this.t$}
|
|
8
|
+
void ${this.qA}(out ${this.p_.getGlslStr(this.c_)} outValue) {
|
|
9
9
|
${this.getMaterialSIDForWebGL()}
|
|
10
10
|
|
|
11
|
-
outValue = get_${this.
|
|
11
|
+
outValue = get_${this.QA}(materialSID, 0u);
|
|
12
12
|
}
|
|
13
13
|
`}getPixelShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU?`
|
|
14
|
-
// #param ${this.
|
|
15
|
-
fn ${this
|
|
16
|
-
*outValue = get_${this.
|
|
14
|
+
// #param ${this.QA}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
|
|
15
|
+
fn ${this.qA}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
|
|
16
|
+
*outValue = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
|
|
17
17
|
}
|
|
18
18
|
`:`
|
|
19
|
-
uniform ${this.p_.getGlslStr(this.c_)} u_${this.
|
|
20
|
-
void ${this
|
|
19
|
+
uniform ${this.p_.getGlslStr(this.c_)} u_${this.QA}; // initialValue=${this.t$}
|
|
20
|
+
void ${this.qA}(out ${this.p_.getGlslStr(this.c_)} outValue) {
|
|
21
21
|
${this.getMaterialSIDForWebGL()}
|
|
22
22
|
|
|
23
|
-
outValue = get_${this.
|
|
23
|
+
outValue = get_${this.QA}(materialSID, 0u);
|
|
24
24
|
}
|
|
25
25
|
`}get attributeNames(){return[]}get attributeSemantics(){return[]}get attributeCompositions(){return[]}};export{i as UniformDataShader};
|