rhodonite 0.25.0 → 0.26.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/README.md +93 -19
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esm/foundation/components/Light/LightComponent.js +1 -1
- package/dist/esm/foundation/components/Mesh/MeshComponent.js +1 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.js +1 -1
- package/dist/esm/foundation/components/Shape/ShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +1 -1
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.js +1 -1
- package/dist/esm/foundation/components/Transform/TransformComponent.js +1 -1
- package/dist/esm/foundation/components/Trigger/TriggerComponent.js +1 -1
- package/dist/esm/foundation/components/Vrm/VrmComponent.js +1 -1
- package/dist/esm/foundation/constraints/VrmAimConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRollConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRotationConstraint.js +1 -1
- package/dist/esm/foundation/core/Component.js +1 -1
- package/dist/esm/foundation/core/ComponentRepository.js +1 -1
- package/dist/esm/foundation/core/Entity.js +1 -1
- package/dist/esm/foundation/core/EntityRepository.js +1 -1
- package/dist/esm/foundation/geometry/ComplexVertexAttribute.js +1 -1
- package/dist/esm/foundation/geometry/Mesh.js +1 -1
- package/dist/esm/foundation/geometry/Primitive.js +1 -1
- package/dist/esm/foundation/gizmos/AABBGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/CapsuleColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esm/foundation/gizmos/Gizmo.js +1 -1
- package/dist/esm/foundation/gizmos/JointGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esm/foundation/gizmos/LightGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LocatorGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/RotationGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/ScaleGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/ShapeGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/SphereColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/TranslationGizmo.js +1 -1
- package/dist/esm/foundation/helpers/BloomHelper.js +1 -1
- package/dist/esm/foundation/helpers/GaussianBlurHelper.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/PointShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.js +1 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.js +1 -0
- package/dist/esm/foundation/importer/AnimationAssigner.js +1 -1
- package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -1
- package/dist/esm/foundation/importer/Gltf2Importer.js +1 -1
- package/dist/esm/foundation/importer/GltfImporter.js +1 -1
- package/dist/esm/foundation/importer/ModelConverter.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 +18 -18
- package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +6 -6
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.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/materials/nodes/CastToFloatShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
- package/dist/esm/foundation/math/MathClassUtil.js +1 -1
- package/dist/esm/foundation/math/Quaternion.js +1 -1
- package/dist/esm/foundation/math/Transform3D.js +1 -1
- package/dist/esm/foundation/math/shapes/MathSphere.js +1 -1
- package/dist/esm/foundation/memory/Accessor.js +6 -6
- package/dist/esm/foundation/memory/BufferView.js +1 -1
- package/dist/esm/foundation/misc/cache/Cache.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/CapsuleCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/SphereCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/VRMSpringBone.js +1 -1
- package/dist/esm/foundation/renderer/Frame.js +1 -1
- package/dist/esm/foundation/renderer/RenderPass.js +1 -1
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +1 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -0
- package/dist/esm/foundation/renderer/pipelines/DeferredRenderPipeline.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +62 -16
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
- package/dist/esm/foundation/system/Engine.d.ts +37 -3
- package/dist/esm/foundation/system/Engine.js +1 -1
- package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
- package/dist/esm/foundation/textures/CubeTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
- package/dist/esm/foundation/textures/Texture.js +1 -1
- package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
- package/dist/esm/foundation/textures/VideoTexture.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/WebGLStereoUtil.js +1 -1
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +47 -28
- package/dist/esm/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +0 -3
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +35 -0
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +140 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +175 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +18 -0
- package/dist/esm/webgl/shaders/StandardShaderPart.js +3 -3
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +5 -5
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +9 -9
- package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
- package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuTimer.js +1 -1
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.js +3 -3
- package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esm/webgpu/WebGpuStrategyBasic.js +78 -59
- package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -1
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +30 -0
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +133 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +169 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +19 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.js +107 -1
- package/dist/esmdev/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esmdev/foundation/components/Camera/CameraComponent.js +118 -46
- package/dist/esmdev/foundation/components/CameraController/CameraControllerComponent.js +8 -8
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.js +74 -74
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.js +39 -39
- package/dist/esmdev/foundation/components/Constraint/ConstraintComponent.js +4 -4
- package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esmdev/foundation/components/Light/LightComponent.js +126 -121
- package/dist/esmdev/foundation/components/Mesh/MeshComponent.js +50 -50
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +96 -92
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.js +73 -73
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingComponent.js +54 -54
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingSdfEvaluator.js +251 -251
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.js +375 -343
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.js +31 -31
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +9 -9
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.js +337 -205
- package/dist/esmdev/foundation/components/Transform/TransformComponent.js +93 -93
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.js +61 -61
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.js +44 -44
- package/dist/esmdev/foundation/constraints/VrmAimConstraint.js +11 -11
- package/dist/esmdev/foundation/constraints/VrmRollConstraint.js +16 -16
- package/dist/esmdev/foundation/constraints/VrmRotationConstraint.js +10 -10
- package/dist/esmdev/foundation/core/Component.js +32 -32
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.js +42 -42
- package/dist/esmdev/foundation/core/ComponentRepository.js +37 -37
- package/dist/esmdev/foundation/core/Config.js +9 -9
- package/dist/esmdev/foundation/core/Entity.js +9 -9
- package/dist/esmdev/foundation/core/EntityRepository.js +19 -19
- package/dist/esmdev/foundation/core/GlobalDataRepository.js +17 -17
- package/dist/esmdev/foundation/core/MemoryManager.js +25 -25
- 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.js +6 -6
- 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 +112 -112
- package/dist/esmdev/foundation/geometry/ComplexVertexAttribute.js +24 -24
- package/dist/esmdev/foundation/geometry/Frustum.js +41 -41
- package/dist/esmdev/foundation/geometry/Mesh.js +218 -218
- package/dist/esmdev/foundation/geometry/Primitive.js +133 -133
- 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 +17 -20
- package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +24 -26
- package/dist/esmdev/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esmdev/foundation/gizmos/Gizmo.js +43 -21
- package/dist/esmdev/foundation/gizmos/JointGizmo.js +38 -40
- package/dist/esmdev/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esmdev/foundation/gizmos/LightGizmo.js +26 -30
- package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +26 -29
- package/dist/esmdev/foundation/gizmos/RotationGizmo.js +217 -219
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +135 -137
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +44 -47
- package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +25 -27
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +132 -134
- package/dist/esmdev/foundation/helpers/BloomHelper.js +34 -34
- package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
- package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +12 -12
- package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +5 -5
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +119 -119
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.js +61 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.js +127 -0
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +33 -33
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +14 -14
- 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 +27 -27
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +138 -138
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +19 -19
- package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +68 -53
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +26 -26
- package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
- package/dist/esmdev/foundation/materials/core/Material.js +115 -115
- package/dist/esmdev/foundation/materials/core/MaterialRepository.js +65 -65
- 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 +16 -17
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +17 -18
- 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 +16 -16
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +16 -16
- 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 +132 -132
- package/dist/esmdev/foundation/math/AnimatedQuaternion.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedScalar.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +20 -20
- package/dist/esmdev/foundation/math/AnimatedVector2.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector3.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector4.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVectorN.js +55 -55
- 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 +4 -4
- package/dist/esmdev/foundation/math/Quaternion.js +20 -20
- package/dist/esmdev/foundation/math/Transform3D.js +83 -83
- package/dist/esmdev/foundation/math/shapes/MathSphere.js +9 -9
- package/dist/esmdev/foundation/memory/Accessor.js +370 -370
- package/dist/esmdev/foundation/memory/Buffer.js +40 -40
- package/dist/esmdev/foundation/memory/BufferView.js +33 -33
- package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
- package/dist/esmdev/foundation/misc/EnumIO.js +10 -10
- package/dist/esmdev/foundation/misc/Logger.js +14 -14
- package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
- package/dist/esmdev/foundation/misc/Time.js +27 -27
- 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 +13 -13
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +203 -203
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +241 -241
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
- package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +42 -42
- package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +27 -27
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +10 -10
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +51 -51
- package/dist/esmdev/foundation/renderer/Expression.js +6 -6
- package/dist/esmdev/foundation/renderer/Frame.js +12 -12
- package/dist/esmdev/foundation/renderer/FrameBuffer.js +25 -25
- package/dist/esmdev/foundation/renderer/RenderPass.js +102 -99
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +66 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +275 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +153 -153
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
- package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +6 -6
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +62 -16
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +535 -428
- package/dist/esmdev/foundation/system/Engine.d.ts +37 -3
- package/dist/esmdev/foundation/system/Engine.js +266 -224
- 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 +6 -6
- package/dist/esmdev/foundation/textures/AbstractTexture.js +50 -50
- package/dist/esmdev/foundation/textures/CubeTexture.js +32 -32
- package/dist/esmdev/foundation/textures/RenderBuffer.js +11 -11
- package/dist/esmdev/foundation/textures/RenderTargetTexture.js +25 -25
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +37 -37
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +19 -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 +164 -164
- package/dist/esmdev/webgl/WebGLGpuTimer.js +32 -32
- package/dist/esmdev/webgl/WebGLResourceRepository.js +306 -306
- package/dist/esmdev/webgl/WebGLStereoUtil.js +42 -42
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +296 -261
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +4 -4
- package/dist/esmdev/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +12 -0
- 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/DiscardShader.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/EndShader.js +3 -3
- 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 +27 -27
- package/dist/esmdev/webgpu/GpuCullingRegistry.js +94 -94
- 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 +52 -52
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +37 -37
- package/dist/esmdev/webgpu/WebGpuResourceRepository.js +597 -597
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +170 -133
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +12 -0
- package/dist/esmdev/xr/WebARSystem.js +69 -69
- package/dist/esmdev/xr/WebXRSystem.js +153 -153
- package/package.json +1 -1
|
@@ -32,16 +32,16 @@ import { WebGLStereoUtil } from "./WebGLStereoUtil.js";
|
|
|
32
32
|
var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResourceRepository {
|
|
33
33
|
constructor() {
|
|
34
34
|
super();
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
35
|
+
this.VD = /* @__PURE__ */ new Map();
|
|
36
|
+
this.WD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
37
|
+
this.ED = /* @__PURE__ */ new Map();
|
|
38
|
+
this.ID = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
39
|
+
this.JD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
40
|
+
this.KD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
41
|
+
this.LD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
42
|
+
this.MD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
43
|
+
this.ND = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
44
|
+
this.OD = CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Gets the singleton instance of WebGLResourceRepository.
|
|
@@ -62,12 +62,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
62
62
|
addWebGLContext(config, gl, canvas, asCurrent) {
|
|
63
63
|
var _a;
|
|
64
64
|
const glw = new WebGLContextWrapper(config, gl, canvas);
|
|
65
|
-
this.
|
|
65
|
+
this.VD.set("default", glw);
|
|
66
66
|
if (asCurrent) {
|
|
67
|
-
(_a = this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
67
|
+
(_a = this.FD) == null ? void 0 : _a.invalidateAll();
|
|
68
|
+
this.FD = void 0;
|
|
69
|
+
this.GD = void 0;
|
|
70
|
+
this.CD = glw;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
@@ -90,20 +90,20 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
90
90
|
* @returns The current WebGLContextWrapper instance or undefined if none is set
|
|
91
91
|
*/
|
|
92
92
|
get currentWebGLContextWrapper() {
|
|
93
|
-
return this.
|
|
93
|
+
return this.CD;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Gets the engine-wide instance SID table used by multi-draw rendering.
|
|
97
97
|
* The table is created lazily for the current WebGL context.
|
|
98
98
|
*/
|
|
99
99
|
get instanceSidTable() {
|
|
100
|
-
if (this.
|
|
101
|
-
if (this.
|
|
100
|
+
if (this.GD == null) {
|
|
101
|
+
if (this.CD == null) {
|
|
102
102
|
throw new Error("No WebGL context is available for the instance SID table.");
|
|
103
103
|
}
|
|
104
|
-
this.
|
|
104
|
+
this.GD = new InstanceSidTable(this.CD);
|
|
105
105
|
}
|
|
106
|
-
return this.
|
|
106
|
+
return this.GD;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Whether this context can use the instance SID path used by multi-draw rendering.
|
|
@@ -112,17 +112,17 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
112
112
|
*/
|
|
113
113
|
get isInstanceSidTextureCapable() {
|
|
114
114
|
var _a;
|
|
115
|
-
return ((_a = this.
|
|
115
|
+
return ((_a = this.CD) == null ? void 0 : _a.isWebGL2) === true && this.CD.webgl2ExtMD != null;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Gets the engine-wide multi-draw group repository, creating it lazily.
|
|
119
119
|
* @param engine - The engine that owns the WebGL context
|
|
120
120
|
*/
|
|
121
121
|
getMultiDrawRepository(engine) {
|
|
122
|
-
if (this.
|
|
123
|
-
this.
|
|
122
|
+
if (this.FD == null) {
|
|
123
|
+
this.FD = new MultiDrawRepository(engine);
|
|
124
124
|
}
|
|
125
|
-
return this.
|
|
125
|
+
return this.FD;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Generates a unique resource handle for WebGL objects.
|
|
@@ -130,7 +130,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
130
130
|
* @returns A unique WebGL resource handle
|
|
131
131
|
*/
|
|
132
132
|
getResourceNumber() {
|
|
133
|
-
return ++this.
|
|
133
|
+
return ++this.WD;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Registers a WebGL object and assigns it a unique handle.
|
|
@@ -138,10 +138,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
138
138
|
* @param obj - The WebGL object to register
|
|
139
139
|
* @returns The assigned resource handle
|
|
140
140
|
*/
|
|
141
|
-
|
|
141
|
+
DD(obj) {
|
|
142
142
|
const handle = this.getResourceNumber();
|
|
143
143
|
obj._resourceUid = handle;
|
|
144
|
-
this
|
|
144
|
+
this.ED.set(handle, obj);
|
|
145
145
|
return handle;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
@@ -151,7 +151,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
151
151
|
* @returns The WebGL resource or null if not found
|
|
152
152
|
*/
|
|
153
153
|
getWebGLResource(WebGLResourceHandle) {
|
|
154
|
-
const result = this
|
|
154
|
+
const result = this.ED.get(WebGLResourceHandle);
|
|
155
155
|
return result != null ? result : null;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
@@ -162,13 +162,13 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
162
162
|
* @throws Error if no WebGL context is available
|
|
163
163
|
*/
|
|
164
164
|
createIndexBuffer(accessor) {
|
|
165
|
-
const gl = this.
|
|
165
|
+
const gl = this.CD.getRawContext();
|
|
166
166
|
if (gl == null) {
|
|
167
167
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
168
168
|
}
|
|
169
|
-
this.
|
|
169
|
+
this.CD.bindVertexArray(null);
|
|
170
170
|
const ibo = gl.createBuffer();
|
|
171
|
-
const resourceHandle = this.
|
|
171
|
+
const resourceHandle = this.DD(ibo);
|
|
172
172
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
|
|
173
173
|
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, accessor.getTypedArray(), gl.STATIC_DRAW);
|
|
174
174
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
@@ -182,12 +182,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
182
182
|
* @throws Error if no WebGL context is available or IBO not found
|
|
183
183
|
*/
|
|
184
184
|
updateIndexBuffer(accessor, resourceHandle) {
|
|
185
|
-
const glw = this.
|
|
185
|
+
const glw = this.CD;
|
|
186
186
|
const gl = glw == null ? void 0 : glw.getRawContext();
|
|
187
187
|
if (Is.not.exist(gl)) {
|
|
188
188
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
189
189
|
}
|
|
190
|
-
const ibo = this
|
|
190
|
+
const ibo = this.ED.get(resourceHandle);
|
|
191
191
|
if (Is.not.exist(ibo)) {
|
|
192
192
|
throw new Error("Not found IBO.");
|
|
193
193
|
}
|
|
@@ -204,13 +204,13 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
204
204
|
* @throws Error if no WebGL context is available
|
|
205
205
|
*/
|
|
206
206
|
createVertexBuffer(accessor) {
|
|
207
|
-
const gl = this.
|
|
207
|
+
const gl = this.CD.getRawContext();
|
|
208
208
|
if (gl == null) {
|
|
209
209
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
210
210
|
}
|
|
211
|
-
this.
|
|
211
|
+
this.CD.bindVertexArray(null);
|
|
212
212
|
const vbo = gl.createBuffer();
|
|
213
|
-
const resourceHandle = this.
|
|
213
|
+
const resourceHandle = this.DD(vbo);
|
|
214
214
|
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
215
215
|
gl.bufferData(gl.ARRAY_BUFFER, accessor.getUint8Array(), gl.STATIC_DRAW);
|
|
216
216
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
@@ -224,13 +224,13 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
224
224
|
* @throws Error if no WebGL context is available
|
|
225
225
|
*/
|
|
226
226
|
createVertexBufferFromTypedArray(typedArray) {
|
|
227
|
-
const gl = this.
|
|
227
|
+
const gl = this.CD.getRawContext();
|
|
228
228
|
if (gl == null) {
|
|
229
229
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
230
230
|
}
|
|
231
|
-
this.
|
|
231
|
+
this.CD.bindVertexArray(null);
|
|
232
232
|
const vbo = gl.createBuffer();
|
|
233
|
-
const resourceHandle = this.
|
|
233
|
+
const resourceHandle = this.DD(vbo);
|
|
234
234
|
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
235
235
|
gl.bufferData(gl.ARRAY_BUFFER, typedArray, gl.STATIC_DRAW);
|
|
236
236
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
@@ -243,13 +243,13 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
243
243
|
* @returns The handle of the created index buffer
|
|
244
244
|
*/
|
|
245
245
|
createIndexBufferFromTypedArray(typedArray) {
|
|
246
|
-
const gl = this.
|
|
246
|
+
const gl = this.CD.getRawContext();
|
|
247
247
|
if (gl == null) {
|
|
248
248
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
249
249
|
}
|
|
250
|
-
this.
|
|
250
|
+
this.CD.bindVertexArray(null);
|
|
251
251
|
const ibo = gl.createBuffer();
|
|
252
|
-
const resourceHandle = this.
|
|
252
|
+
const resourceHandle = this.DD(ibo);
|
|
253
253
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
|
|
254
254
|
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, typedArray, gl.STATIC_DRAW);
|
|
255
255
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
@@ -263,12 +263,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
263
263
|
* @throws Error if no WebGL context is available or VBO not found
|
|
264
264
|
*/
|
|
265
265
|
updateVertexBuffer(accessor, resourceHandle) {
|
|
266
|
-
const glw = this.
|
|
266
|
+
const glw = this.CD;
|
|
267
267
|
const gl = glw == null ? void 0 : glw.getRawContext();
|
|
268
268
|
if (!Is.exist(gl)) {
|
|
269
269
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
270
270
|
}
|
|
271
|
-
const vbo = this
|
|
271
|
+
const vbo = this.ED.get(resourceHandle);
|
|
272
272
|
if (!Is.exist(vbo)) {
|
|
273
273
|
throw new Error("Not found VBO.");
|
|
274
274
|
}
|
|
@@ -289,11 +289,11 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
289
289
|
*/
|
|
290
290
|
updateVertexBufferWithTypedArray(resourceHandle, typedArray) {
|
|
291
291
|
var _a;
|
|
292
|
-
const gl = (_a = this.
|
|
292
|
+
const gl = (_a = this.CD) == null ? void 0 : _a.getRawContext();
|
|
293
293
|
if (!Is.exist(gl)) {
|
|
294
294
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
295
295
|
}
|
|
296
|
-
const vbo = this
|
|
296
|
+
const vbo = this.ED.get(resourceHandle);
|
|
297
297
|
if (!Is.exist(vbo)) {
|
|
298
298
|
throw new Error("Not found VBO.");
|
|
299
299
|
}
|
|
@@ -308,15 +308,15 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
308
308
|
* @throws Error if no WebGL context is available
|
|
309
309
|
*/
|
|
310
310
|
createVertexArray() {
|
|
311
|
-
const gl = this.
|
|
311
|
+
const gl = this.CD;
|
|
312
312
|
if (gl == null) {
|
|
313
313
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
314
314
|
}
|
|
315
|
-
const vao = this.
|
|
315
|
+
const vao = this.CD.createVertexArray();
|
|
316
316
|
if (Is.not.exist(vao)) {
|
|
317
317
|
return void 0;
|
|
318
318
|
}
|
|
319
|
-
const resourceHandle = this.
|
|
319
|
+
const resourceHandle = this.DD(vao);
|
|
320
320
|
return resourceHandle;
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -326,8 +326,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
326
326
|
* @param textureUid - The handle of the texture to bind
|
|
327
327
|
*/
|
|
328
328
|
bindTexture2D(textureSlotIndex, textureUid) {
|
|
329
|
-
const texture = this
|
|
330
|
-
this.
|
|
329
|
+
const texture = this.ED.get(textureUid);
|
|
330
|
+
this.CD.bindTexture2D(textureSlotIndex, texture);
|
|
331
331
|
}
|
|
332
332
|
/**
|
|
333
333
|
* Binds a texture sampler to the specified texture slot.
|
|
@@ -337,10 +337,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
337
337
|
*/
|
|
338
338
|
bindTextureSampler(textureSlotIndex, samplerUid) {
|
|
339
339
|
if (samplerUid === -1) {
|
|
340
|
-
this.
|
|
340
|
+
this.CD.bindTextureSampler(textureSlotIndex, null);
|
|
341
341
|
} else {
|
|
342
342
|
const sampler = this.getWebGLResource(samplerUid);
|
|
343
|
-
this.
|
|
343
|
+
this.CD.bindTextureSampler(textureSlotIndex, sampler);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
@@ -351,7 +351,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
351
351
|
*/
|
|
352
352
|
bindTextureCube(textureSlotIndex, textureUid) {
|
|
353
353
|
const texture = this.getWebGLResource(textureUid);
|
|
354
|
-
this.
|
|
354
|
+
this.CD.bindTextureCube(textureSlotIndex, texture);
|
|
355
355
|
}
|
|
356
356
|
/**
|
|
357
357
|
* Binds a 2D texture array to the specified texture slot.
|
|
@@ -361,7 +361,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
361
361
|
*/
|
|
362
362
|
bindTexture2DArray(textureSlotIndex, textureUid) {
|
|
363
363
|
const texture = this.getWebGLResource(textureUid);
|
|
364
|
-
this.
|
|
364
|
+
this.CD.bindTexture2DArray(textureSlotIndex, texture);
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* Creates vertex buffers and index buffers for a primitive and returns handles for them.
|
|
@@ -437,7 +437,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
437
437
|
attributeSemantics,
|
|
438
438
|
onError
|
|
439
439
|
}) {
|
|
440
|
-
const gl = this.
|
|
440
|
+
const gl = this.CD.getRawContext();
|
|
441
441
|
if (gl == null) {
|
|
442
442
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
443
443
|
}
|
|
@@ -446,7 +446,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
446
446
|
gl.shaderSource(vertexShader, vertexShaderStr);
|
|
447
447
|
gl.compileShader(vertexShader);
|
|
448
448
|
if (isDebugMode) {
|
|
449
|
-
const result = this.
|
|
449
|
+
const result = this.TD(
|
|
450
450
|
engine,
|
|
451
451
|
material.materialTypeName,
|
|
452
452
|
vertexShader,
|
|
@@ -461,7 +461,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
461
461
|
gl.shaderSource(fragmentShader, fragmentShaderStr);
|
|
462
462
|
gl.compileShader(fragmentShader);
|
|
463
463
|
if (isDebugMode) {
|
|
464
|
-
this.
|
|
464
|
+
this.TD(engine, material.materialTypeName, fragmentShader, fragmentShaderStr, onError);
|
|
465
465
|
}
|
|
466
466
|
const shaderProgram = gl.createProgram();
|
|
467
467
|
shaderProgram._engine = engine;
|
|
@@ -490,7 +490,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
490
490
|
bindAttribLocation(VertexAttribute.MaterialSid.getAttributeSlot(), "a_materialSid");
|
|
491
491
|
gl.linkProgram(shaderProgram);
|
|
492
492
|
if (isDebugMode) {
|
|
493
|
-
const result = this.
|
|
493
|
+
const result = this.XD(
|
|
494
494
|
engine,
|
|
495
495
|
material.materialTypeName,
|
|
496
496
|
shaderProgram,
|
|
@@ -501,8 +501,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
501
501
|
return CGAPIResourceRepository.InvalidCGAPIResourceUid;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
shaderProgram.
|
|
505
|
-
const resourceHandle = this.
|
|
504
|
+
shaderProgram.ZD = this.rebuildProgramBySpector.bind(shaderProgram);
|
|
505
|
+
const resourceHandle = this.DD(shaderProgram);
|
|
506
506
|
gl.deleteShader(vertexShader);
|
|
507
507
|
gl.deleteShader(fragmentShader);
|
|
508
508
|
return resourceHandle;
|
|
@@ -517,8 +517,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
517
517
|
* @param onError - Optional error callback function
|
|
518
518
|
* @returns True if compilation succeeded, false otherwise
|
|
519
519
|
*/
|
|
520
|
-
|
|
521
|
-
const glw = this.
|
|
520
|
+
TD(engine, materialTypeName, shader, shaderText, onError) {
|
|
521
|
+
const glw = this.CD;
|
|
522
522
|
const gl = glw.getRawContext();
|
|
523
523
|
if (Is.false(gl.getShaderParameter(shader, gl.COMPILE_STATUS)) && Is.false(gl.isContextLost())) {
|
|
524
524
|
engine.logger.info(`MaterialTypeName: ${materialTypeName}`);
|
|
@@ -544,8 +544,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
544
544
|
* @param fragmentShaderText - The fragment shader source code for error reporting
|
|
545
545
|
* @returns True if linking succeeded, false otherwise
|
|
546
546
|
*/
|
|
547
|
-
|
|
548
|
-
const glw = this.
|
|
547
|
+
XD(engine, materialTypeName, shaderProgram, vertexShaderText, fragmentShaderText) {
|
|
548
|
+
const glw = this.CD;
|
|
549
549
|
const gl = glw.getRawContext();
|
|
550
550
|
if (Is.false(gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) && Is.false(gl.isContextLost())) {
|
|
551
551
|
engine.logger.info(`MaterialTypeName: ${materialTypeName}`);
|
|
@@ -570,7 +570,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
570
570
|
* @returns The WebGL program object with configured uniform locations
|
|
571
571
|
*/
|
|
572
572
|
setupUniformLocations(config, shaderProgramUid, infoArray) {
|
|
573
|
-
const glw = this.
|
|
573
|
+
const glw = this.CD;
|
|
574
574
|
const gl = glw.getRawContext();
|
|
575
575
|
const shaderProgram = this.getWebGLResource(shaderProgramUid);
|
|
576
576
|
const infoArrayLen = infoArray.length;
|
|
@@ -629,7 +629,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
629
629
|
}
|
|
630
630
|
const textureUnit = value[0];
|
|
631
631
|
if (textureUnits.get(semanticStr) !== textureUnit) {
|
|
632
|
-
const gl = this.
|
|
632
|
+
const gl = this.CD.getRawContext();
|
|
633
633
|
const loc = shaderProgram[semanticStr];
|
|
634
634
|
gl.uniform1i(loc, textureUnit);
|
|
635
635
|
textureUnits.set(semanticStr, textureUnit);
|
|
@@ -778,7 +778,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
778
778
|
return false;
|
|
779
779
|
}
|
|
780
780
|
const uLocation = loc;
|
|
781
|
-
const gl = this.
|
|
781
|
+
const gl = this.CD.getRawContext();
|
|
782
782
|
if (isMatrix) {
|
|
783
783
|
if (componentNumber === 4) {
|
|
784
784
|
gl.uniformMatrix4fv(uLocation, false, x);
|
|
@@ -859,9 +859,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
859
859
|
iboHandle,
|
|
860
860
|
vboHandles
|
|
861
861
|
}, primitive, instanceIDBufferUid = CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
862
|
-
const gl = this.
|
|
862
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
863
863
|
const vao = this.getWebGLResource(vaoHandle);
|
|
864
|
-
this.
|
|
864
|
+
this.CD.bindVertexArray(vao);
|
|
865
865
|
if (iboHandle != null) {
|
|
866
866
|
const ibo = this.getWebGLResource(iboHandle);
|
|
867
867
|
if (ibo != null) {
|
|
@@ -925,10 +925,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
925
925
|
0,
|
|
926
926
|
0
|
|
927
927
|
);
|
|
928
|
-
this.
|
|
928
|
+
this.CD.vertexAttribDivisor(VertexAttribute.Instance.getAttributeSlot(), 1);
|
|
929
929
|
}
|
|
930
930
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
931
|
-
this.
|
|
931
|
+
this.CD.bindVertexArray(null);
|
|
932
932
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
933
933
|
}
|
|
934
934
|
/**
|
|
@@ -942,9 +942,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
942
942
|
if (handles == null) {
|
|
943
943
|
return;
|
|
944
944
|
}
|
|
945
|
-
const gl = this.
|
|
945
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
946
946
|
const vao = this.getWebGLResource(vaoHandle);
|
|
947
|
-
this.
|
|
947
|
+
this.CD.bindVertexArray(vao);
|
|
948
948
|
if (handles.iboHandle != null) {
|
|
949
949
|
const ibo = this.getWebGLResource(handles.iboHandle);
|
|
950
950
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo);
|
|
@@ -992,20 +992,20 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
992
992
|
const instanceSlot = VertexAttribute.Instance.getAttributeSlot();
|
|
993
993
|
gl.enableVertexAttribArray(instanceSlot);
|
|
994
994
|
gl.vertexAttribIPointer(instanceSlot, 1, ComponentType.UnsignedInt.index, 4, 0);
|
|
995
|
-
this.
|
|
995
|
+
this.CD.vertexAttribDivisor(instanceSlot, 0);
|
|
996
996
|
const materialSidSlot = VertexAttribute.MaterialSid.getAttributeSlot();
|
|
997
997
|
if (useMaterialSidAttribute) {
|
|
998
998
|
const materialSidVbo = this.getWebGLResource(group.materialSidVboHandle);
|
|
999
999
|
gl.bindBuffer(gl.ARRAY_BUFFER, materialSidVbo);
|
|
1000
1000
|
gl.enableVertexAttribArray(materialSidSlot);
|
|
1001
1001
|
gl.vertexAttribIPointer(materialSidSlot, 1, ComponentType.UnsignedInt.index, 4, 0);
|
|
1002
|
-
this.
|
|
1002
|
+
this.CD.vertexAttribDivisor(materialSidSlot, 0);
|
|
1003
1003
|
} else {
|
|
1004
1004
|
gl.disableVertexAttribArray(materialSidSlot);
|
|
1005
1005
|
gl.vertexAttribI4ui(materialSidSlot, 0, 0, 0, 0);
|
|
1006
1006
|
}
|
|
1007
1007
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
1008
|
-
this.
|
|
1008
|
+
this.CD.bindVertexArray(null);
|
|
1009
1009
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
1010
1010
|
}
|
|
1011
1011
|
/**
|
|
@@ -1025,12 +1025,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1025
1025
|
width,
|
|
1026
1026
|
height
|
|
1027
1027
|
}) {
|
|
1028
|
-
const gl = this.
|
|
1028
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1029
1029
|
const texture = gl.createTexture();
|
|
1030
|
-
this.
|
|
1030
|
+
this.CD.bindTexture2D(15, texture);
|
|
1031
1031
|
gl.texStorage2D(GL_TEXTURE_2D, levels, internalFormat.index, width, height);
|
|
1032
|
-
const resourceHandle = this.
|
|
1033
|
-
this.
|
|
1032
|
+
const resourceHandle = this.DD(texture);
|
|
1033
|
+
this.CD.unbindTexture2D(15);
|
|
1034
1034
|
return resourceHandle;
|
|
1035
1035
|
}
|
|
1036
1036
|
/**
|
|
@@ -1055,9 +1055,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1055
1055
|
anisotropy,
|
|
1056
1056
|
shadowCompareMode
|
|
1057
1057
|
}) {
|
|
1058
|
-
const gl = this.
|
|
1058
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1059
1059
|
const sampler = gl.createSampler();
|
|
1060
|
-
const resourceHandle = this.
|
|
1060
|
+
const resourceHandle = this.DD(sampler);
|
|
1061
1061
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, minFilter.index);
|
|
1062
1062
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, magFilter.index);
|
|
1063
1063
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, wrapS.index);
|
|
@@ -1068,8 +1068,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1068
1068
|
gl.samplerParameteri(sampler, gl.TEXTURE_COMPARE_FUNC, gl.LESS);
|
|
1069
1069
|
}
|
|
1070
1070
|
if (anisotropy) {
|
|
1071
|
-
if (this.
|
|
1072
|
-
gl.samplerParameteri(sampler, this.
|
|
1071
|
+
if (this.CD.webgl2ExtTFA) {
|
|
1072
|
+
gl.samplerParameteri(sampler, this.CD.webgl2ExtTFA.TEXTURE_MAX_ANISOTROPY_EXT, 4);
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
return resourceHandle;
|
|
@@ -1081,18 +1081,18 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1081
1081
|
* @returns The handle of the clamp-to-edge linear sampler
|
|
1082
1082
|
*/
|
|
1083
1083
|
createOrGetTextureSamplerClampToEdgeLinear() {
|
|
1084
|
-
if (this.
|
|
1085
|
-
const gl = this.
|
|
1084
|
+
if (this.ID === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1085
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1086
1086
|
const sampler = gl.createSampler();
|
|
1087
|
-
const resourceHandle = this.
|
|
1088
|
-
this.
|
|
1087
|
+
const resourceHandle = this.DD(sampler);
|
|
1088
|
+
this.ID = resourceHandle;
|
|
1089
1089
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
1090
1090
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
1091
1091
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
1092
1092
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
1093
1093
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.CLAMP_TO_EDGE);
|
|
1094
1094
|
}
|
|
1095
|
-
return this.
|
|
1095
|
+
return this.ID;
|
|
1096
1096
|
}
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Creates or returns an existing texture sampler with clamp-to-edge wrapping and nearest filtering.
|
|
@@ -1101,18 +1101,18 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1101
1101
|
* @returns The handle of the clamp-to-edge nearest sampler
|
|
1102
1102
|
*/
|
|
1103
1103
|
createOrGetTextureSamplerClampToEdgeNearest() {
|
|
1104
|
-
if (this.
|
|
1105
|
-
const gl = this.
|
|
1104
|
+
if (this.JD === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1105
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1106
1106
|
const sampler = gl.createSampler();
|
|
1107
|
-
const resourceHandle = this.
|
|
1108
|
-
this.
|
|
1107
|
+
const resourceHandle = this.DD(sampler);
|
|
1108
|
+
this.JD = resourceHandle;
|
|
1109
1109
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
1110
1110
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
1111
1111
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
1112
1112
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
1113
1113
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.CLAMP_TO_EDGE);
|
|
1114
1114
|
}
|
|
1115
|
-
return this.
|
|
1115
|
+
return this.JD;
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
1118
|
* Creates or returns an existing texture sampler with repeat wrapping and nearest filtering.
|
|
@@ -1121,18 +1121,18 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1121
1121
|
* @returns The handle of the repeat nearest sampler
|
|
1122
1122
|
*/
|
|
1123
1123
|
createOrGetTextureSamplerRepeatNearest() {
|
|
1124
|
-
if (this.
|
|
1125
|
-
const gl = this.
|
|
1124
|
+
if (this.KD === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1125
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1126
1126
|
const sampler = gl.createSampler();
|
|
1127
|
-
const resourceHandle = this.
|
|
1128
|
-
this.
|
|
1127
|
+
const resourceHandle = this.DD(sampler);
|
|
1128
|
+
this.KD = resourceHandle;
|
|
1129
1129
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
1130
1130
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
1131
1131
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.REPEAT);
|
|
1132
1132
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.REPEAT);
|
|
1133
1133
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.REPEAT);
|
|
1134
1134
|
}
|
|
1135
|
-
return this.
|
|
1135
|
+
return this.KD;
|
|
1136
1136
|
}
|
|
1137
1137
|
/**
|
|
1138
1138
|
* Creates or returns an existing texture sampler with repeat wrapping and linear filtering.
|
|
@@ -1141,18 +1141,18 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1141
1141
|
* @returns The handle of the repeat linear sampler
|
|
1142
1142
|
*/
|
|
1143
1143
|
createOrGetTextureSamplerRepeatLinear() {
|
|
1144
|
-
if (this.
|
|
1145
|
-
const gl = this.
|
|
1144
|
+
if (this.LD === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1145
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1146
1146
|
const sampler = gl.createSampler();
|
|
1147
|
-
const resourceHandle = this.
|
|
1148
|
-
this.
|
|
1147
|
+
const resourceHandle = this.DD(sampler);
|
|
1148
|
+
this.LD = resourceHandle;
|
|
1149
1149
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
1150
1150
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
1151
1151
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.REPEAT);
|
|
1152
1152
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.REPEAT);
|
|
1153
1153
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.REPEAT);
|
|
1154
1154
|
}
|
|
1155
|
-
return this.
|
|
1155
|
+
return this.LD;
|
|
1156
1156
|
}
|
|
1157
1157
|
/**
|
|
1158
1158
|
* Creates or returns an existing texture sampler with repeat wrapping and trilinear filtering.
|
|
@@ -1161,18 +1161,18 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1161
1161
|
* @returns The handle of the repeat trilinear sampler
|
|
1162
1162
|
*/
|
|
1163
1163
|
createOrGetTextureSamplerRepeatTriLinear() {
|
|
1164
|
-
if (this.
|
|
1165
|
-
const gl = this.
|
|
1164
|
+
if (this.ND === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1165
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1166
1166
|
const sampler = gl.createSampler();
|
|
1167
|
-
const resourceHandle = this.
|
|
1168
|
-
this.
|
|
1167
|
+
const resourceHandle = this.DD(sampler);
|
|
1168
|
+
this.ND = resourceHandle;
|
|
1169
1169
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
1170
1170
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
1171
1171
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.REPEAT);
|
|
1172
1172
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.REPEAT);
|
|
1173
1173
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.REPEAT);
|
|
1174
1174
|
}
|
|
1175
|
-
return this.
|
|
1175
|
+
return this.ND;
|
|
1176
1176
|
}
|
|
1177
1177
|
/**
|
|
1178
1178
|
* Creates or returns an existing texture sampler configured for shadow mapping.
|
|
@@ -1181,11 +1181,11 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1181
1181
|
* @returns The handle of the shadow sampler
|
|
1182
1182
|
*/
|
|
1183
1183
|
createOrGetTextureSamplerShadow() {
|
|
1184
|
-
if (this.
|
|
1185
|
-
const gl = this.
|
|
1184
|
+
if (this.MD === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1185
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1186
1186
|
const sampler = gl.createSampler();
|
|
1187
|
-
const resourceHandle = this.
|
|
1188
|
-
this.
|
|
1187
|
+
const resourceHandle = this.DD(sampler);
|
|
1188
|
+
this.MD = resourceHandle;
|
|
1189
1189
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
1190
1190
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
1191
1191
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
@@ -1193,7 +1193,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1193
1193
|
gl.samplerParameteri(sampler, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
|
|
1194
1194
|
gl.samplerParameteri(sampler, gl.TEXTURE_COMPARE_FUNC, gl.LESS);
|
|
1195
1195
|
}
|
|
1196
|
-
return this.
|
|
1196
|
+
return this.MD;
|
|
1197
1197
|
}
|
|
1198
1198
|
/**
|
|
1199
1199
|
* Creates or returns an existing texture sampler with repeat wrapping, anisotropic filtering, and linear filtering.
|
|
@@ -1202,19 +1202,19 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1202
1202
|
* @returns The handle of the repeat anisotropy linear sampler
|
|
1203
1203
|
*/
|
|
1204
1204
|
createOrGetTextureSamplerRepeatAnisotropyLinear() {
|
|
1205
|
-
if (this.
|
|
1206
|
-
const gl = this.
|
|
1205
|
+
if (this.OD === CGAPIResourceRepository.InvalidCGAPIResourceUid) {
|
|
1206
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1207
1207
|
const sampler = gl.createSampler();
|
|
1208
|
-
const resourceHandle = this.
|
|
1209
|
-
this.
|
|
1208
|
+
const resourceHandle = this.DD(sampler);
|
|
1209
|
+
this.OD = resourceHandle;
|
|
1210
1210
|
gl.samplerParameteri(sampler, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
1211
1211
|
gl.samplerParameteri(sampler, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
1212
1212
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_S, gl.REPEAT);
|
|
1213
1213
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_T, gl.REPEAT);
|
|
1214
1214
|
gl.samplerParameteri(sampler, gl.TEXTURE_WRAP_R, gl.REPEAT);
|
|
1215
|
-
gl.samplerParameteri(sampler, this.
|
|
1215
|
+
gl.samplerParameteri(sampler, this.CD.webgl2ExtTFA.TEXTURE_MAX_ANISOTROPY_EXT, 4);
|
|
1216
1216
|
}
|
|
1217
|
-
return this.
|
|
1217
|
+
return this.OD;
|
|
1218
1218
|
}
|
|
1219
1219
|
/**
|
|
1220
1220
|
* Creates a 2D texture from ImageBitmap data with specified parameters.
|
|
@@ -1238,7 +1238,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1238
1238
|
type,
|
|
1239
1239
|
generateMipmap
|
|
1240
1240
|
}) {
|
|
1241
|
-
const gl = this.
|
|
1241
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1242
1242
|
let finalImageData = imageData;
|
|
1243
1243
|
let finalWidth = width;
|
|
1244
1244
|
let finalHeight = height;
|
|
@@ -1251,12 +1251,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1251
1251
|
finalImageData = await createImageBitmap(canvas);
|
|
1252
1252
|
}
|
|
1253
1253
|
const texture = gl.createTexture();
|
|
1254
|
-
const textureHandle = this.
|
|
1255
|
-
this.
|
|
1254
|
+
const textureHandle = this.DD(texture);
|
|
1255
|
+
this.CD.bindTexture2D(15, texture);
|
|
1256
1256
|
const levels = Math.floor(Math.log2(Math.max(finalWidth, finalHeight))) + 1;
|
|
1257
1257
|
gl.texStorage2D(GL_TEXTURE_2D, levels, internalFormat.index, finalWidth, finalHeight);
|
|
1258
1258
|
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, format.index, type.index, finalImageData);
|
|
1259
|
-
this.
|
|
1259
|
+
this.PD(gl, finalWidth, finalHeight, generateMipmap);
|
|
1260
1260
|
return textureHandle;
|
|
1261
1261
|
}
|
|
1262
1262
|
/**
|
|
@@ -1268,9 +1268,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1268
1268
|
* @param height - Height of the texture
|
|
1269
1269
|
* @param generateMipmap - Whether to generate mipmaps
|
|
1270
1270
|
*/
|
|
1271
|
-
|
|
1271
|
+
PD(gl, _width, _height, _generateMipmap) {
|
|
1272
1272
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
1273
|
-
this.
|
|
1273
|
+
this.CD.unbindTexture2D(15);
|
|
1274
1274
|
}
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Creates a 2D texture from an HTML image element with specified parameters.
|
|
@@ -1294,7 +1294,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1294
1294
|
type,
|
|
1295
1295
|
generateMipmap
|
|
1296
1296
|
}) {
|
|
1297
|
-
const gl = this.
|
|
1297
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1298
1298
|
let finalImageData = imageData;
|
|
1299
1299
|
let finalWidth = width;
|
|
1300
1300
|
let finalHeight = height;
|
|
@@ -1307,12 +1307,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1307
1307
|
finalImageData = await createImageBitmap(canvas);
|
|
1308
1308
|
}
|
|
1309
1309
|
const texture = gl.createTexture();
|
|
1310
|
-
const resourceHandle = this.
|
|
1311
|
-
this.
|
|
1310
|
+
const resourceHandle = this.DD(texture);
|
|
1311
|
+
this.CD.bindTexture2D(15, texture);
|
|
1312
1312
|
const levels = generateMipmap ? Math.max(Math.log2(finalWidth), Math.log2(finalHeight)) : 1;
|
|
1313
1313
|
gl.texStorage2D(GL_TEXTURE_2D, levels, internalFormat.index, finalWidth, finalHeight);
|
|
1314
1314
|
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, format.index, type.index, finalImageData);
|
|
1315
|
-
this.
|
|
1315
|
+
this.PD(gl, finalWidth, finalHeight, generateMipmap);
|
|
1316
1316
|
return resourceHandle;
|
|
1317
1317
|
}
|
|
1318
1318
|
/**
|
|
@@ -1330,10 +1330,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1330
1330
|
* @returns The handle of the created texture array
|
|
1331
1331
|
*/
|
|
1332
1332
|
createTextureArray(width, height, arrayLength, mipLevelCount, internalFormat, format, type, imageData) {
|
|
1333
|
-
const gl = this.
|
|
1333
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1334
1334
|
const texture = gl.createTexture();
|
|
1335
|
-
const resourceHandle = this.
|
|
1336
|
-
this.
|
|
1335
|
+
const resourceHandle = this.DD(texture);
|
|
1336
|
+
this.CD.bindTexture2DArray(15, texture);
|
|
1337
1337
|
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, mipLevelCount, internalFormat.index, width, height, arrayLength);
|
|
1338
1338
|
for (let layer = 0; layer < arrayLength; layer++) {
|
|
1339
1339
|
gl.texSubImage3D(
|
|
@@ -1355,7 +1355,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1355
1355
|
imageData
|
|
1356
1356
|
);
|
|
1357
1357
|
}
|
|
1358
|
-
this.
|
|
1358
|
+
this.CD.unbindTexture2DArray(15);
|
|
1359
1359
|
return resourceHandle;
|
|
1360
1360
|
}
|
|
1361
1361
|
/**
|
|
@@ -1375,12 +1375,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1375
1375
|
height,
|
|
1376
1376
|
mipLevelCount
|
|
1377
1377
|
}) {
|
|
1378
|
-
const gl = this.
|
|
1378
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1379
1379
|
const texture = gl.createTexture();
|
|
1380
|
-
const resourceHandle = this.
|
|
1381
|
-
this.
|
|
1380
|
+
const resourceHandle = this.DD(texture);
|
|
1381
|
+
this.CD.bindTexture2D(15, texture);
|
|
1382
1382
|
gl.texStorage2D(GL_TEXTURE_2D, mipLevelCount, format.index, width, height);
|
|
1383
|
-
this.
|
|
1383
|
+
this.CD.unbindTexture2D(15);
|
|
1384
1384
|
return resourceHandle;
|
|
1385
1385
|
}
|
|
1386
1386
|
/**
|
|
@@ -1411,7 +1411,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1411
1411
|
rowSizeByPixel,
|
|
1412
1412
|
data
|
|
1413
1413
|
}) {
|
|
1414
|
-
const gl = this.
|
|
1414
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1415
1415
|
const texture = this.getWebGLResource(textureUid);
|
|
1416
1416
|
const pixelFormat = TextureFormat.getPixelFormatFromTextureFormat(format);
|
|
1417
1417
|
const compositionNum = PixelFormat.getCompositionNumFromPixelFormat(pixelFormat);
|
|
@@ -1426,7 +1426,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1426
1426
|
);
|
|
1427
1427
|
}
|
|
1428
1428
|
}
|
|
1429
|
-
this.
|
|
1429
|
+
this.CD.bindTexture2D(15, texture);
|
|
1430
1430
|
gl.texSubImage2D(
|
|
1431
1431
|
gl.TEXTURE_2D,
|
|
1432
1432
|
mipLevel,
|
|
@@ -1438,7 +1438,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1438
1438
|
type.index,
|
|
1439
1439
|
reducedData
|
|
1440
1440
|
);
|
|
1441
|
-
this.
|
|
1441
|
+
this.CD.unbindTexture2D(15);
|
|
1442
1442
|
}
|
|
1443
1443
|
/**
|
|
1444
1444
|
* Creates a 2D texture from a typed array with specified parameters.
|
|
@@ -1462,10 +1462,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1462
1462
|
type,
|
|
1463
1463
|
generateMipmap
|
|
1464
1464
|
}) {
|
|
1465
|
-
const gl = this.
|
|
1465
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1466
1466
|
const texture = gl.createTexture();
|
|
1467
|
-
const resourceHandle = this.
|
|
1468
|
-
this.
|
|
1467
|
+
const resourceHandle = this.DD(texture);
|
|
1468
|
+
this.CD.bindTexture2D(15, texture);
|
|
1469
1469
|
const levels = generateMipmap ? Math.max(Math.log2(width), Math.log2(height)) : 1;
|
|
1470
1470
|
gl.texStorage2D(GL_TEXTURE_2D, levels, internalFormat.index, width, height);
|
|
1471
1471
|
gl.texSubImage2D(
|
|
@@ -1479,7 +1479,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1479
1479
|
type.index,
|
|
1480
1480
|
imageData
|
|
1481
1481
|
);
|
|
1482
|
-
this.
|
|
1482
|
+
this.PD(gl, width, height, generateMipmap);
|
|
1483
1483
|
return resourceHandle;
|
|
1484
1484
|
}
|
|
1485
1485
|
/**
|
|
@@ -1491,10 +1491,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1491
1491
|
* @returns Promise that resolves to the handle of the created compressed texture
|
|
1492
1492
|
*/
|
|
1493
1493
|
async createCompressedTexture(textureDataArray, compressionTextureType) {
|
|
1494
|
-
const gl = this.
|
|
1494
|
+
const gl = this.CD.getRawContext();
|
|
1495
1495
|
const texture = gl.createTexture();
|
|
1496
|
-
const resourceHandle = this.
|
|
1497
|
-
this.
|
|
1496
|
+
const resourceHandle = this.DD(texture);
|
|
1497
|
+
this.CD.bindTexture2D(15, texture);
|
|
1498
1498
|
const internalFormat = compressionTextureType.index;
|
|
1499
1499
|
for (const textureData of textureDataArray) {
|
|
1500
1500
|
gl.compressedTexImage2D(
|
|
@@ -1507,7 +1507,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1507
1507
|
textureData.buffer
|
|
1508
1508
|
);
|
|
1509
1509
|
}
|
|
1510
|
-
this.
|
|
1510
|
+
this.CD.unbindTexture2D(15);
|
|
1511
1511
|
return resourceHandle;
|
|
1512
1512
|
}
|
|
1513
1513
|
/**
|
|
@@ -1525,10 +1525,10 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1525
1525
|
}) {
|
|
1526
1526
|
let basisCompressionType;
|
|
1527
1527
|
let compressionType;
|
|
1528
|
-
const gl = this.
|
|
1528
|
+
const gl = this.CD.getRawContext();
|
|
1529
1529
|
const texture = gl.createTexture();
|
|
1530
|
-
const resourceHandle = this.
|
|
1531
|
-
this.
|
|
1530
|
+
const resourceHandle = this.DD(texture);
|
|
1531
|
+
this.CD.bindTexture2D(15, texture);
|
|
1532
1532
|
const s3tc = gl.getExtension("WEBGL_compressed_texture_s3tc");
|
|
1533
1533
|
if (s3tc) {
|
|
1534
1534
|
basisCompressionType = BasisCompressionType.BC3;
|
|
@@ -1566,7 +1566,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1566
1566
|
const textureSource = this.decodeBasisImage(basisFile, basisCompressionType, 0, i);
|
|
1567
1567
|
gl.compressedTexImage2D(gl.TEXTURE_2D, i, compressionType, width, height, border, textureSource);
|
|
1568
1568
|
}
|
|
1569
|
-
this.
|
|
1569
|
+
this.CD.unbindTexture2D(15);
|
|
1570
1570
|
return resourceHandle;
|
|
1571
1571
|
}
|
|
1572
1572
|
/**
|
|
@@ -1594,9 +1594,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1594
1594
|
* @returns The handle of the created framebuffer object
|
|
1595
1595
|
*/
|
|
1596
1596
|
createFrameBufferObject() {
|
|
1597
|
-
const gl = this.
|
|
1597
|
+
const gl = this.CD.getRawContext();
|
|
1598
1598
|
const fbo = gl.createFramebuffer();
|
|
1599
|
-
const resourceHandle = this.
|
|
1599
|
+
const resourceHandle = this.DD(fbo);
|
|
1600
1600
|
return resourceHandle;
|
|
1601
1601
|
}
|
|
1602
1602
|
/**
|
|
@@ -1608,15 +1608,15 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1608
1608
|
* @param renderable - The texture or renderbuffer to attach
|
|
1609
1609
|
*/
|
|
1610
1610
|
attachColorBufferToFrameBufferObject(framebuffer, attachmentIndex, renderable) {
|
|
1611
|
-
const gl = this.
|
|
1611
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1612
1612
|
const fbo = this.getWebGLResource(framebuffer.framebufferUID);
|
|
1613
1613
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
1614
1614
|
const renderableWebGLResource = this.getWebGLResource(renderable._textureResourceUid);
|
|
1615
|
-
const attachmentId = this.
|
|
1615
|
+
const attachmentId = this.CD.colorAttachment(attachmentIndex);
|
|
1616
1616
|
if (renderable instanceof RenderTargetTexture2DArray) {
|
|
1617
1617
|
renderable._fbo = framebuffer;
|
|
1618
|
-
if (this.
|
|
1619
|
-
this.
|
|
1618
|
+
if (this.CD.webgl2ExtMLTVIEW.is_multisample) {
|
|
1619
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultisampleMultiviewOVR(
|
|
1620
1620
|
gl.DRAW_FRAMEBUFFER,
|
|
1621
1621
|
attachmentId,
|
|
1622
1622
|
renderableWebGLResource,
|
|
@@ -1627,7 +1627,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1627
1627
|
renderable.arrayLength
|
|
1628
1628
|
);
|
|
1629
1629
|
} else {
|
|
1630
|
-
this.
|
|
1630
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultiviewOVR(
|
|
1631
1631
|
gl.DRAW_FRAMEBUFFER,
|
|
1632
1632
|
attachmentId,
|
|
1633
1633
|
renderableWebGLResource,
|
|
@@ -1661,11 +1661,11 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1661
1661
|
* @param mipLevel - The mip level to attach
|
|
1662
1662
|
*/
|
|
1663
1663
|
attachColorBufferLayerToFrameBufferObject(framebuffer, attachmentIndex, renderable, layerIndex, mipLevel) {
|
|
1664
|
-
const gl = this.
|
|
1664
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1665
1665
|
const fbo = this.getWebGLResource(framebuffer.framebufferUID);
|
|
1666
1666
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
1667
1667
|
const renderableWebGLResource = this.getWebGLResource(renderable._textureResourceUid);
|
|
1668
|
-
const attachmentId = this.
|
|
1668
|
+
const attachmentId = this.CD.colorAttachment(attachmentIndex);
|
|
1669
1669
|
renderable._fbo = framebuffer;
|
|
1670
1670
|
gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachmentId, renderableWebGLResource, mipLevel, layerIndex);
|
|
1671
1671
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -1681,11 +1681,11 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1681
1681
|
* @param renderable - The cube texture to attach
|
|
1682
1682
|
*/
|
|
1683
1683
|
attachColorBufferCubeToFrameBufferObject(framebuffer, attachmentIndex, faceIndex, mipLevel, renderable) {
|
|
1684
|
-
const gl = this.
|
|
1684
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1685
1685
|
const fbo = this.getWebGLResource(framebuffer.framebufferUID);
|
|
1686
1686
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
1687
1687
|
const renderableWebGLResource = this.getWebGLResource(renderable._textureResourceUid);
|
|
1688
|
-
const attachmentId = this.
|
|
1688
|
+
const attachmentId = this.CD.colorAttachment(attachmentIndex);
|
|
1689
1689
|
renderable._fbo = framebuffer;
|
|
1690
1690
|
gl.framebufferTexture2D(
|
|
1691
1691
|
gl.FRAMEBUFFER,
|
|
@@ -1703,7 +1703,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1703
1703
|
* @param renderable - The depth texture or renderbuffer to attach
|
|
1704
1704
|
*/
|
|
1705
1705
|
attachDepthBufferToFrameBufferObject(framebuffer, renderable) {
|
|
1706
|
-
this.
|
|
1706
|
+
this.QD(framebuffer, renderable, 36096);
|
|
1707
1707
|
}
|
|
1708
1708
|
/**
|
|
1709
1709
|
* Attaches a stencil buffer to a framebuffer object.
|
|
@@ -1712,7 +1712,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1712
1712
|
* @param renderable - The stencil texture or renderbuffer to attach
|
|
1713
1713
|
*/
|
|
1714
1714
|
attachStencilBufferToFrameBufferObject(framebuffer, renderable) {
|
|
1715
|
-
this.
|
|
1715
|
+
this.QD(framebuffer, renderable, 36128);
|
|
1716
1716
|
}
|
|
1717
1717
|
/**
|
|
1718
1718
|
* Attaches a combined depth-stencil buffer to a framebuffer object.
|
|
@@ -1721,7 +1721,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1721
1721
|
* @param renderable - The depth-stencil texture or renderbuffer to attach
|
|
1722
1722
|
*/
|
|
1723
1723
|
attachDepthStencilBufferToFrameBufferObject(framebuffer, renderable) {
|
|
1724
|
-
this.
|
|
1724
|
+
this.QD(framebuffer, renderable, 33306);
|
|
1725
1725
|
}
|
|
1726
1726
|
/**
|
|
1727
1727
|
* Internal method for attaching depth or stencil buffers to framebuffers.
|
|
@@ -1731,15 +1731,15 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1731
1731
|
* @param renderable - The texture or renderbuffer to attach
|
|
1732
1732
|
* @param attachmentType - The WebGL attachment type constant
|
|
1733
1733
|
*/
|
|
1734
|
-
|
|
1735
|
-
const gl = this.
|
|
1734
|
+
QD(framebuffer, renderable, attachmentType) {
|
|
1735
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1736
1736
|
const fbo = this.getWebGLResource(framebuffer.framebufferUID);
|
|
1737
1737
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
1738
1738
|
const renderableWebGLResource = this.getWebGLResource(renderable._textureResourceUid);
|
|
1739
1739
|
if (renderable instanceof RenderTargetTexture2DArray) {
|
|
1740
1740
|
renderable._fbo = framebuffer;
|
|
1741
|
-
if (this.
|
|
1742
|
-
this.
|
|
1741
|
+
if (this.CD.webgl2ExtMLTVIEW.is_multisample) {
|
|
1742
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultisampleMultiviewOVR(
|
|
1743
1743
|
gl.DRAW_FRAMEBUFFER,
|
|
1744
1744
|
attachmentType,
|
|
1745
1745
|
renderableWebGLResource,
|
|
@@ -1750,7 +1750,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1750
1750
|
renderable.arrayLength
|
|
1751
1751
|
);
|
|
1752
1752
|
} else {
|
|
1753
|
-
this.
|
|
1753
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultiviewOVR(
|
|
1754
1754
|
gl.DRAW_FRAMEBUFFER,
|
|
1755
1755
|
attachmentType,
|
|
1756
1756
|
renderableWebGLResource,
|
|
@@ -1777,9 +1777,9 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1777
1777
|
* create Renderbuffer
|
|
1778
1778
|
*/
|
|
1779
1779
|
createRenderBuffer(width, height, internalFormat, isMSAA, sampleCountMSAA) {
|
|
1780
|
-
const gl = this.
|
|
1780
|
+
const gl = this.CD.getRawContext();
|
|
1781
1781
|
const renderBuffer = gl.createRenderbuffer();
|
|
1782
|
-
const resourceHandle = this.
|
|
1782
|
+
const resourceHandle = this.DD(renderBuffer);
|
|
1783
1783
|
gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);
|
|
1784
1784
|
if (isMSAA) {
|
|
1785
1785
|
gl.renderbufferStorageMultisample(
|
|
@@ -1804,12 +1804,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1804
1804
|
if (framebuffer) {
|
|
1805
1805
|
const renderBufferTargetEnums = renderPass.getRenderTargetColorAttachments();
|
|
1806
1806
|
if (Is.exist(renderBufferTargetEnums)) {
|
|
1807
|
-
this.
|
|
1807
|
+
this.CD.drawBuffers(renderBufferTargetEnums);
|
|
1808
1808
|
} else {
|
|
1809
|
-
this.
|
|
1809
|
+
this.CD.drawBuffers(framebuffer.colorAttachmentsRenderBufferTargets);
|
|
1810
1810
|
}
|
|
1811
1811
|
} else {
|
|
1812
|
-
this.
|
|
1812
|
+
this.CD.drawBuffers([RenderBufferTarget.Back]);
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
1815
|
/**
|
|
@@ -1817,7 +1817,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1817
1817
|
* @param framebuffer
|
|
1818
1818
|
*/
|
|
1819
1819
|
bindFramebuffer(framebuffer) {
|
|
1820
|
-
const gl = this.
|
|
1820
|
+
const gl = this.CD.getRawContext();
|
|
1821
1821
|
if (framebuffer) {
|
|
1822
1822
|
const fboUid = framebuffer.cgApiResourceUid;
|
|
1823
1823
|
const fbo = this.getWebGLResource(fboUid);
|
|
@@ -1830,7 +1830,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1830
1830
|
* unbind Framebuffer
|
|
1831
1831
|
*/
|
|
1832
1832
|
unbindFramebuffer() {
|
|
1833
|
-
const gl = this.
|
|
1833
|
+
const gl = this.CD.getRawContext();
|
|
1834
1834
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
1835
1835
|
}
|
|
1836
1836
|
/**
|
|
@@ -1844,12 +1844,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1844
1844
|
mipLevelCount,
|
|
1845
1845
|
format
|
|
1846
1846
|
}) {
|
|
1847
|
-
const gl = this.
|
|
1847
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1848
1848
|
const texture = gl.createTexture();
|
|
1849
|
-
const resourceHandle = this.
|
|
1850
|
-
this.
|
|
1849
|
+
const resourceHandle = this.DD(texture);
|
|
1850
|
+
this.CD.bindTexture2D(15, texture);
|
|
1851
1851
|
gl.texStorage2D(gl.TEXTURE_2D, mipLevelCount, format.index, width, height);
|
|
1852
|
-
this.
|
|
1852
|
+
this.CD.unbindTexture2D(15);
|
|
1853
1853
|
return resourceHandle;
|
|
1854
1854
|
}
|
|
1855
1855
|
/**
|
|
@@ -1863,12 +1863,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1863
1863
|
internalFormat,
|
|
1864
1864
|
arrayLength
|
|
1865
1865
|
}) {
|
|
1866
|
-
const gl = this.
|
|
1866
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1867
1867
|
const texture = gl.createTexture();
|
|
1868
|
-
const resourceHandle = this.
|
|
1869
|
-
this.
|
|
1868
|
+
const resourceHandle = this.DD(texture);
|
|
1869
|
+
this.CD.bindTexture2DArray(15, texture);
|
|
1870
1870
|
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, internalFormat.index, width, height, arrayLength);
|
|
1871
|
-
this.
|
|
1871
|
+
this.CD.unbindTexture2DArray(15);
|
|
1872
1872
|
return resourceHandle;
|
|
1873
1873
|
}
|
|
1874
1874
|
/**
|
|
@@ -1882,12 +1882,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1882
1882
|
mipLevelCount,
|
|
1883
1883
|
format
|
|
1884
1884
|
}) {
|
|
1885
|
-
const gl = this.
|
|
1885
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
1886
1886
|
const texture = gl.createTexture();
|
|
1887
|
-
const resourceHandle = this.
|
|
1888
|
-
this.
|
|
1887
|
+
const resourceHandle = this.DD(texture);
|
|
1888
|
+
this.CD.bindTextureCube(15, texture);
|
|
1889
1889
|
gl.texStorage2D(gl.TEXTURE_CUBE_MAP, mipLevelCount, format.index, width, height);
|
|
1890
|
-
this.
|
|
1890
|
+
this.CD.unbindTextureCube(15);
|
|
1891
1891
|
return resourceHandle;
|
|
1892
1892
|
}
|
|
1893
1893
|
/**
|
|
@@ -1900,15 +1900,15 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1900
1900
|
* @returns resource handle
|
|
1901
1901
|
*/
|
|
1902
1902
|
createCubeTexture(engine, mipLevelCount, images, width, height) {
|
|
1903
|
-
const gl = this.
|
|
1903
|
+
const gl = this.CD.getRawContext();
|
|
1904
1904
|
const texture = gl.createTexture();
|
|
1905
|
-
const resourceHandle = this.
|
|
1906
|
-
this.
|
|
1905
|
+
const resourceHandle = this.DD(texture);
|
|
1906
|
+
this.CD.bindTextureCube(15, texture);
|
|
1907
1907
|
const wrapS = TextureParameter.ClampToEdge;
|
|
1908
1908
|
const wrapT = TextureParameter.ClampToEdge;
|
|
1909
1909
|
let minFilter = TextureParameter.Linear;
|
|
1910
1910
|
let magFilter = TextureParameter.Linear;
|
|
1911
|
-
if (images[0].posX.hdriFormat === HdriFormat.HDR_LINEAR && this.
|
|
1911
|
+
if (images[0].posX.hdriFormat === HdriFormat.HDR_LINEAR && this.CD.isNotSupportWebGL1Extension(engine.config, WebGLExtension.TextureFloatLinear)) {
|
|
1912
1912
|
if (mipLevelCount >= 2) {
|
|
1913
1913
|
minFilter = TextureParameter.NearestMipmapNearest;
|
|
1914
1914
|
} else {
|
|
@@ -1927,7 +1927,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1927
1927
|
sampler.create();
|
|
1928
1928
|
const loadImageToGPU = (image, cubeMapSide, i) => {
|
|
1929
1929
|
if (image.hdriFormat === HdriFormat.HDR_LINEAR) {
|
|
1930
|
-
const gl2 = this.
|
|
1930
|
+
const gl2 = this.CD.getRawContextAsWebGL2();
|
|
1931
1931
|
gl2.texImage2D(
|
|
1932
1932
|
cubeMapSide,
|
|
1933
1933
|
i,
|
|
@@ -1964,7 +1964,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1964
1964
|
loadImageToGPU(image.posZ, gl.TEXTURE_CUBE_MAP_POSITIVE_Z, i);
|
|
1965
1965
|
loadImageToGPU(image.negZ, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, i);
|
|
1966
1966
|
}
|
|
1967
|
-
this.
|
|
1967
|
+
this.CD.unbindTextureCube(15);
|
|
1968
1968
|
return [resourceHandle, sampler];
|
|
1969
1969
|
}
|
|
1970
1970
|
/**
|
|
@@ -1974,7 +1974,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
1974
1974
|
* @returns the WebGLResourceHandle for the generated Cube Texture
|
|
1975
1975
|
*/
|
|
1976
1976
|
async createCubeTextureFromFiles(engine, baseUri, mipLevelCount, isNamePosNeg, hdriFormat) {
|
|
1977
|
-
const gl = this.
|
|
1977
|
+
const gl = this.CD.getRawContext();
|
|
1978
1978
|
const imageArgs = [];
|
|
1979
1979
|
let width = 0;
|
|
1980
1980
|
let height = 0;
|
|
@@ -2088,12 +2088,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2088
2088
|
wrapT = TextureParameter.Repeat,
|
|
2089
2089
|
border = 0
|
|
2090
2090
|
}) {
|
|
2091
|
-
const gl = this.
|
|
2091
|
+
const gl = this.CD.getRawContext();
|
|
2092
2092
|
let basisCompressionType;
|
|
2093
2093
|
let compressionType;
|
|
2094
2094
|
const texture = gl.createTexture();
|
|
2095
|
-
const resourceHandle = this.
|
|
2096
|
-
this.
|
|
2095
|
+
const resourceHandle = this.DD(texture);
|
|
2096
|
+
this.CD.bindTextureCube(15, texture);
|
|
2097
2097
|
const s3tc = gl.getExtension("WEBGL_compressed_texture_s3tc");
|
|
2098
2098
|
if (s3tc) {
|
|
2099
2099
|
basisCompressionType = BasisCompressionType.BC3;
|
|
@@ -2157,12 +2157,12 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2157
2157
|
);
|
|
2158
2158
|
}
|
|
2159
2159
|
}
|
|
2160
|
-
this.
|
|
2160
|
+
this.CD.unbindTextureCube(15);
|
|
2161
2161
|
return { resourceHandle, width: baseLevelWidth, height: baseLevelHeight };
|
|
2162
2162
|
}
|
|
2163
2163
|
createDummyBlackCubeTexture(engine) {
|
|
2164
2164
|
const base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg==";
|
|
2165
|
-
const arrayBuffer = this.
|
|
2165
|
+
const arrayBuffer = this.HD(base64);
|
|
2166
2166
|
const typedArray = new Uint8Array(arrayBuffer);
|
|
2167
2167
|
return this.createCubeTexture(
|
|
2168
2168
|
engine,
|
|
@@ -2207,7 +2207,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2207
2207
|
}
|
|
2208
2208
|
setWebGLTextureDirectly(webGLTexture) {
|
|
2209
2209
|
const texture = webGLTexture;
|
|
2210
|
-
const resourceHandle = this.
|
|
2210
|
+
const resourceHandle = this.DD(texture);
|
|
2211
2211
|
return resourceHandle;
|
|
2212
2212
|
}
|
|
2213
2213
|
async createTextureFromDataUri(dataUri, {
|
|
@@ -2244,8 +2244,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2244
2244
|
type
|
|
2245
2245
|
}) {
|
|
2246
2246
|
const texture = this.getWebGLResource(textureUid);
|
|
2247
|
-
this.
|
|
2248
|
-
const gl = this.
|
|
2247
|
+
this.CD.bindTexture2D(15, texture);
|
|
2248
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2249
2249
|
gl.texSubImage2D(
|
|
2250
2250
|
gl.TEXTURE_2D,
|
|
2251
2251
|
0,
|
|
@@ -2258,7 +2258,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2258
2258
|
textureData
|
|
2259
2259
|
);
|
|
2260
2260
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
2261
|
-
this.
|
|
2261
|
+
this.CD.unbindTexture2D(15);
|
|
2262
2262
|
}
|
|
2263
2263
|
updateTexture(textureUid, textureData, {
|
|
2264
2264
|
level,
|
|
@@ -2270,8 +2270,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2270
2270
|
type
|
|
2271
2271
|
}) {
|
|
2272
2272
|
const texture = this.getWebGLResource(textureUid);
|
|
2273
|
-
this.
|
|
2274
|
-
const gl = this.
|
|
2273
|
+
this.CD.bindTexture2D(15, texture);
|
|
2274
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2275
2275
|
gl.texSubImage2D(
|
|
2276
2276
|
gl.TEXTURE_2D,
|
|
2277
2277
|
level,
|
|
@@ -2283,28 +2283,28 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2283
2283
|
type.index,
|
|
2284
2284
|
textureData
|
|
2285
2285
|
);
|
|
2286
|
-
this.
|
|
2286
|
+
this.CD.unbindTexture2D(15);
|
|
2287
2287
|
}
|
|
2288
2288
|
deleteFrameBufferObject(frameBufferObjectHandle) {
|
|
2289
2289
|
const fbo = this.getWebGLResource(frameBufferObjectHandle);
|
|
2290
|
-
const gl = this.
|
|
2290
|
+
const gl = this.CD.getRawContext();
|
|
2291
2291
|
if (fbo != null) {
|
|
2292
2292
|
gl.deleteFramebuffer(fbo);
|
|
2293
|
-
this
|
|
2293
|
+
this.ED.delete(frameBufferObjectHandle);
|
|
2294
2294
|
}
|
|
2295
2295
|
}
|
|
2296
2296
|
deleteRenderBuffer(renderBufferUid) {
|
|
2297
|
-
const gl = this.
|
|
2297
|
+
const gl = this.CD.getRawContext();
|
|
2298
2298
|
const renderBuffer = this.getWebGLResource(renderBufferUid);
|
|
2299
2299
|
gl.deleteRenderbuffer(renderBuffer);
|
|
2300
|
-
this
|
|
2300
|
+
this.ED.delete(renderBufferUid);
|
|
2301
2301
|
}
|
|
2302
2302
|
deleteTexture(textureHandle) {
|
|
2303
2303
|
const texture = this.getWebGLResource(textureHandle);
|
|
2304
|
-
const gl = this.
|
|
2304
|
+
const gl = this.CD.getRawContext();
|
|
2305
2305
|
if (texture != null) {
|
|
2306
2306
|
gl.deleteTexture(texture);
|
|
2307
|
-
this
|
|
2307
|
+
this.ED.delete(textureHandle);
|
|
2308
2308
|
Logger.default.debug(`gl.deleteTexture called: ${textureHandle}`);
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
@@ -2326,17 +2326,17 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2326
2326
|
}
|
|
2327
2327
|
createDummyBlackTexture() {
|
|
2328
2328
|
const base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg==";
|
|
2329
|
-
return this.
|
|
2329
|
+
return this.HD(base64);
|
|
2330
2330
|
}
|
|
2331
2331
|
createDummyWhiteTexture() {
|
|
2332
2332
|
const base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5/hPwAIAgL/4d1j8wAAAABJRU5ErkJggg==";
|
|
2333
|
-
return this.
|
|
2333
|
+
return this.HD(base64);
|
|
2334
2334
|
}
|
|
2335
2335
|
createDummyNormalTexture() {
|
|
2336
2336
|
const base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOsr///HwAGgAL+v1RumAAAAABJRU5ErkJggg==";
|
|
2337
|
-
return this.
|
|
2337
|
+
return this.HD(base64);
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
HD(base64) {
|
|
2340
2340
|
const arrayBuffer = DataUtil.base64ToArrayBuffer(base64);
|
|
2341
2341
|
return this.createTextureFromTypedArray(new Uint8Array(arrayBuffer), {
|
|
2342
2342
|
internalFormat: TextureFormat.RGBA8,
|
|
@@ -2351,21 +2351,21 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2351
2351
|
if (!MathUtil.isPowerOfTwoTexture(width, height) && MiscUtil.isIOS()) {
|
|
2352
2352
|
return;
|
|
2353
2353
|
}
|
|
2354
|
-
const gl = this.
|
|
2354
|
+
const gl = this.CD.getRawContext();
|
|
2355
2355
|
const texture = this.getWebGLResource(textureHandle);
|
|
2356
|
-
this.
|
|
2356
|
+
this.CD.bindTexture2D(15, texture);
|
|
2357
2357
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
2358
|
-
this.
|
|
2358
|
+
this.CD.unbindTexture2D(15);
|
|
2359
2359
|
}
|
|
2360
2360
|
generateMipmapsCube(textureHandle, _width, _height) {
|
|
2361
|
-
const gl = this.
|
|
2361
|
+
const gl = this.CD.getRawContext();
|
|
2362
2362
|
const texture = this.getWebGLResource(textureHandle);
|
|
2363
|
-
this.
|
|
2363
|
+
this.CD.bindTextureCube(15, texture);
|
|
2364
2364
|
gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
|
|
2365
|
-
this.
|
|
2365
|
+
this.CD.unbindTextureCube(15);
|
|
2366
2366
|
}
|
|
2367
2367
|
async getTexturePixelData(_textureHandle, width, height, frameBufferUid, colorAttachmentIndex) {
|
|
2368
|
-
const gl = this.
|
|
2368
|
+
const gl = this.CD.getRawContext();
|
|
2369
2369
|
const fbo = this.getWebGLResource(frameBufferUid);
|
|
2370
2370
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
2371
2371
|
const data = new Uint8Array(width * height * 4);
|
|
@@ -2388,7 +2388,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2388
2388
|
* @returns Promise resolving to the pixel data as a Uint8Array (RGBA format)
|
|
2389
2389
|
*/
|
|
2390
2390
|
async getCubeTexturePixelData(textureHandle, width, height, faceIndex) {
|
|
2391
|
-
const gl = this.
|
|
2391
|
+
const gl = this.CD.getRawContext();
|
|
2392
2392
|
const texture = this.getWebGLResource(textureHandle);
|
|
2393
2393
|
const fbo = gl.createFramebuffer();
|
|
2394
2394
|
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
@@ -2398,7 +2398,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2398
2398
|
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
2399
2399
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
2400
2400
|
gl.deleteFramebuffer(fbo);
|
|
2401
|
-
return this.
|
|
2401
|
+
return this.YD(gl, texture, width, height, faceIndex, true);
|
|
2402
2402
|
}
|
|
2403
2403
|
const data = new Uint8Array(width * height * 4);
|
|
2404
2404
|
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, data);
|
|
@@ -2417,7 +2417,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2417
2417
|
* @param faceIndex - Index of the cube face (0=+X, 1=-X, 2=+Y, 3=-Y, 4=+Z, 5=-Z)
|
|
2418
2418
|
* @param isHdrFormat - Whether the texture is HDR format (applies tone mapping and gamma correction if true)
|
|
2419
2419
|
*/
|
|
2420
|
-
|
|
2420
|
+
YD(gl, cubeTexture, width, height, faceIndex, isHdrFormat) {
|
|
2421
2421
|
const prevViewport = gl.getParameter(gl.VIEWPORT);
|
|
2422
2422
|
const prevProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
2423
2423
|
const prevVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING);
|
|
@@ -2523,35 +2523,35 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2523
2523
|
return data;
|
|
2524
2524
|
}
|
|
2525
2525
|
createUniformBuffer() {
|
|
2526
|
-
const gl = this.
|
|
2526
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2527
2527
|
if (gl == null) {
|
|
2528
2528
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
2529
2529
|
}
|
|
2530
2530
|
const ubo = gl.createBuffer();
|
|
2531
|
-
const resourceHandle = this.
|
|
2531
|
+
const resourceHandle = this.DD(ubo);
|
|
2532
2532
|
return resourceHandle;
|
|
2533
2533
|
}
|
|
2534
2534
|
createUniformBufferWithBufferView(bufferView) {
|
|
2535
|
-
const gl = this.
|
|
2535
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2536
2536
|
if (gl == null) {
|
|
2537
2537
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
2538
2538
|
}
|
|
2539
2539
|
const ubo = gl.createBuffer();
|
|
2540
|
-
const resourceHandle = this.
|
|
2540
|
+
const resourceHandle = this.DD(ubo);
|
|
2541
2541
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
2542
2542
|
gl.bufferData(gl.UNIFORM_BUFFER, bufferView, gl.DYNAMIC_DRAW);
|
|
2543
2543
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
2544
2544
|
return resourceHandle;
|
|
2545
2545
|
}
|
|
2546
2546
|
updateUniformBuffer(uboUid, typedArray, offsetByte, arrayLength) {
|
|
2547
|
-
const gl = this.
|
|
2547
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2548
2548
|
const ubo = this.getWebGLResource(uboUid);
|
|
2549
2549
|
gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
|
|
2550
2550
|
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, typedArray, offsetByte, arrayLength);
|
|
2551
2551
|
gl.bindBuffer(gl.UNIFORM_BUFFER, null);
|
|
2552
2552
|
}
|
|
2553
2553
|
bindUniformBlock(shaderProgramUid, blockName, blockIndex) {
|
|
2554
|
-
const gl = this.
|
|
2554
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2555
2555
|
if (gl == null) {
|
|
2556
2556
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
2557
2557
|
}
|
|
@@ -2560,7 +2560,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2560
2560
|
gl.uniformBlockBinding(shaderProgram, block, blockIndex);
|
|
2561
2561
|
}
|
|
2562
2562
|
bindUniformBufferBase(blockIndex, uboUid) {
|
|
2563
|
-
const gl = this.
|
|
2563
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2564
2564
|
if (gl == null) {
|
|
2565
2565
|
throw new Error("No WebGLRenderingContext set as Default.");
|
|
2566
2566
|
}
|
|
@@ -2568,23 +2568,23 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2568
2568
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, blockIndex, ubo);
|
|
2569
2569
|
}
|
|
2570
2570
|
deleteUniformBuffer(uboUid) {
|
|
2571
|
-
const gl = this.
|
|
2571
|
+
const gl = this.CD.getRawContext();
|
|
2572
2572
|
if (gl == null) {
|
|
2573
2573
|
new Error("No WebGLRenderingContext set as Default.");
|
|
2574
2574
|
}
|
|
2575
2575
|
const ubo = this.getWebGLResource(uboUid);
|
|
2576
|
-
this
|
|
2576
|
+
this.ED.delete(uboUid);
|
|
2577
2577
|
gl.deleteBuffer(ubo);
|
|
2578
2578
|
}
|
|
2579
2579
|
setupUniformBufferDataArea(typedArray) {
|
|
2580
|
-
const gl = this.
|
|
2580
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2581
2581
|
if (gl == null) {
|
|
2582
2582
|
new Error("No WebGLRenderingContext set as Default.");
|
|
2583
2583
|
}
|
|
2584
2584
|
const ubo = gl.createBuffer();
|
|
2585
|
-
const resourceHandle = this.
|
|
2586
|
-
const maxConventionBlocks = this.
|
|
2587
|
-
const alignedMaxUniformBlockSize = this.
|
|
2585
|
+
const resourceHandle = this.DD(ubo);
|
|
2586
|
+
const maxConventionBlocks = this.CD.getMaxConventionUniformBlocks();
|
|
2587
|
+
const alignedMaxUniformBlockSize = this.CD.getAlignedMaxUniformBlockSize();
|
|
2588
2588
|
const realSize = alignedMaxUniformBlockSize * maxConventionBlocks;
|
|
2589
2589
|
const array = new Float32Array(realSize / 4);
|
|
2590
2590
|
if (Is.exist(typedArray)) {
|
|
@@ -2599,7 +2599,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2599
2599
|
return resourceHandle;
|
|
2600
2600
|
}
|
|
2601
2601
|
setUniformBlockBindingForMorphOffsetsAndWeights(shaderProgramUid, morphOffsetsUBOUid, morphWeightsUBOUid) {
|
|
2602
|
-
const gl = this.
|
|
2602
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2603
2603
|
const shaderProgram = this.getWebGLResource(shaderProgramUid);
|
|
2604
2604
|
const morphOffsetsUBO = this.getWebGLResource(morphOffsetsUBOUid);
|
|
2605
2605
|
const morphWeightsUBO = this.getWebGLResource(morphWeightsUBOUid);
|
|
@@ -2611,7 +2611,7 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2611
2611
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, 1, morphWeightsUBO);
|
|
2612
2612
|
}
|
|
2613
2613
|
setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(morphOffsetsUBOUid, morphWeightsUBOUid) {
|
|
2614
|
-
const gl = this.
|
|
2614
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2615
2615
|
const morphOffsetsUBO = this.getWebGLResource(morphOffsetsUBOUid);
|
|
2616
2616
|
const morphWeightsUBO = this.getWebGLResource(morphWeightsUBOUid);
|
|
2617
2617
|
gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, morphOffsetsUBO);
|
|
@@ -2626,8 +2626,8 @@ var WebGLResourceRepository = class _WebGLResourceRepository extends CGAPIResour
|
|
|
2626
2626
|
}
|
|
2627
2627
|
getGlslDataUBODefinitionString() {
|
|
2628
2628
|
let text = "";
|
|
2629
|
-
const maxConventionblocks = this.
|
|
2630
|
-
const alignedMaxUniformBlockSize = this.
|
|
2629
|
+
const maxConventionblocks = this.CD.getMaxConventionUniformBlocks();
|
|
2630
|
+
const alignedMaxUniformBlockSize = this.CD.getAlignedMaxUniformBlockSize();
|
|
2631
2631
|
for (let i = 0; i < maxConventionblocks; i++) {
|
|
2632
2632
|
text += `
|
|
2633
2633
|
layout (std140) uniform Vec4Block${i} {
|
|
@@ -2651,23 +2651,23 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2651
2651
|
return text;
|
|
2652
2652
|
}
|
|
2653
2653
|
getGlslDataUBOVec4SizeString() {
|
|
2654
|
-
const alignedMaxUniformBlockSize = this.
|
|
2654
|
+
const alignedMaxUniformBlockSize = this.CD.getAlignedMaxUniformBlockSize();
|
|
2655
2655
|
return `const int dataUBOVec4Size = ${alignedMaxUniformBlockSize / 4 / 4};`;
|
|
2656
2656
|
}
|
|
2657
2657
|
createMultiviewFramebuffer(width, height, samples) {
|
|
2658
|
-
if (Is.not.exist(this.
|
|
2658
|
+
if (Is.not.exist(this.CD.webgl2ExtMLTVIEW)) {
|
|
2659
2659
|
return [-1, -1];
|
|
2660
2660
|
}
|
|
2661
|
-
const gl = this.
|
|
2661
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2662
2662
|
const framebuffer = gl.createFramebuffer();
|
|
2663
|
-
const framebufferHandle = this.
|
|
2663
|
+
const framebufferHandle = this.DD(framebuffer);
|
|
2664
2664
|
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);
|
|
2665
2665
|
const colorTexture = gl.createTexture();
|
|
2666
|
-
const colorTextureHandle = this.
|
|
2666
|
+
const colorTextureHandle = this.DD(colorTexture);
|
|
2667
2667
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, colorTexture);
|
|
2668
2668
|
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, width, height, 2);
|
|
2669
|
-
if (!this.
|
|
2670
|
-
this.
|
|
2669
|
+
if (!this.CD.webgl2ExtMLTVIEW.is_multisample)
|
|
2670
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultiviewOVR(
|
|
2671
2671
|
gl.DRAW_FRAMEBUFFER,
|
|
2672
2672
|
gl.COLOR_ATTACHMENT0,
|
|
2673
2673
|
colorTexture,
|
|
@@ -2676,7 +2676,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2676
2676
|
2
|
|
2677
2677
|
);
|
|
2678
2678
|
else
|
|
2679
|
-
this.
|
|
2679
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultisampleMultiviewOVR(
|
|
2680
2680
|
gl.DRAW_FRAMEBUFFER,
|
|
2681
2681
|
gl.COLOR_ATTACHMENT0,
|
|
2682
2682
|
colorTexture,
|
|
@@ -2688,8 +2688,8 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2688
2688
|
const depthStencilTex = gl.createTexture();
|
|
2689
2689
|
gl.bindTexture(gl.TEXTURE_2D_ARRAY, depthStencilTex);
|
|
2690
2690
|
gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.DEPTH32F_STENCIL8, width, height, 2);
|
|
2691
|
-
if (!this.
|
|
2692
|
-
this.
|
|
2691
|
+
if (!this.CD.webgl2ExtMLTVIEW.is_multisample)
|
|
2692
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultiviewOVR(
|
|
2693
2693
|
gl.DRAW_FRAMEBUFFER,
|
|
2694
2694
|
gl.DEPTH_STENCIL_ATTACHMENT,
|
|
2695
2695
|
depthStencilTex,
|
|
@@ -2698,7 +2698,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2698
2698
|
2
|
|
2699
2699
|
);
|
|
2700
2700
|
else
|
|
2701
|
-
this.
|
|
2701
|
+
this.CD.webgl2ExtMLTVIEW.framebufferTextureMultisampleMultiviewOVR(
|
|
2702
2702
|
gl.DRAW_FRAMEBUFFER,
|
|
2703
2703
|
gl.DEPTH_STENCIL_ATTACHMENT,
|
|
2704
2704
|
depthStencilTex,
|
|
@@ -2710,26 +2710,26 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2710
2710
|
return [framebufferHandle, colorTextureHandle];
|
|
2711
2711
|
}
|
|
2712
2712
|
createTransformFeedback() {
|
|
2713
|
-
const gl = this.
|
|
2713
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2714
2714
|
const transformFeedback = gl.createTransformFeedback();
|
|
2715
|
-
const resourceHandle = this.
|
|
2715
|
+
const resourceHandle = this.DD(transformFeedback);
|
|
2716
2716
|
gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, transformFeedback);
|
|
2717
2717
|
return resourceHandle;
|
|
2718
2718
|
}
|
|
2719
2719
|
deleteTransformFeedback(transformFeedbackUid) {
|
|
2720
|
-
const gl = this.
|
|
2720
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2721
2721
|
const transformFeedback = this.getWebGLResource(transformFeedbackUid);
|
|
2722
2722
|
gl.deleteTransformFeedback(transformFeedback);
|
|
2723
|
-
this
|
|
2723
|
+
this.ED.delete(transformFeedbackUid);
|
|
2724
2724
|
}
|
|
2725
2725
|
setViewport(engine, viewport) {
|
|
2726
2726
|
var _a, _b;
|
|
2727
2727
|
if (viewport) {
|
|
2728
|
-
(_a = this.
|
|
2728
|
+
(_a = this.CD) == null ? void 0 : _a.setViewportAsVector4(viewport);
|
|
2729
2729
|
engine.engineState.viewportAspectRatio = (viewport.z - viewport.x) / (viewport.w - viewport.y);
|
|
2730
2730
|
} else {
|
|
2731
|
-
(_b = this.
|
|
2732
|
-
engine.engineState.viewportAspectRatio = this.
|
|
2731
|
+
(_b = this.CD) == null ? void 0 : _b.setViewport(0, 0, this.CD.width, this.CD.height);
|
|
2732
|
+
engine.engineState.viewportAspectRatio = this.CD.width / this.CD.height;
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
2735
|
/**
|
|
@@ -2743,31 +2743,31 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2743
2743
|
*/
|
|
2744
2744
|
setScissorRect(renderPass) {
|
|
2745
2745
|
var _a;
|
|
2746
|
-
const gl = this.
|
|
2746
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2747
2747
|
const rect = renderPass == null ? void 0 : renderPass.getScissorRect();
|
|
2748
2748
|
if (rect == null) {
|
|
2749
2749
|
gl.disable(gl.SCISSOR_TEST);
|
|
2750
2750
|
return;
|
|
2751
2751
|
}
|
|
2752
2752
|
const framebuffer = renderPass.getFramebuffer();
|
|
2753
|
-
const targetHeight = (_a = framebuffer == null ? void 0 : framebuffer.height) != null ? _a : this.
|
|
2753
|
+
const targetHeight = (_a = framebuffer == null ? void 0 : framebuffer.height) != null ? _a : this.CD.canvas.height;
|
|
2754
2754
|
gl.enable(gl.SCISSOR_TEST);
|
|
2755
2755
|
gl.scissor(rect.x, targetHeight - (rect.y + rect.height), rect.width, rect.height);
|
|
2756
2756
|
}
|
|
2757
2757
|
clearFrameBuffer(engine, renderPass, _ = 0) {
|
|
2758
2758
|
var _a, _b;
|
|
2759
|
-
const gl = this.
|
|
2759
|
+
const gl = this.CD.getRawContext();
|
|
2760
2760
|
const isCanvasTarget = renderPass.getFramebuffer() == null && !(((_a = engine._webXRSystemIfEnabled) == null ? void 0 : _a.isWebXRMode) && renderPass.isOutputForVr) && !((_b = engine._webARSystemIfEnabled) == null ? void 0 : _b.isWebARMode);
|
|
2761
2761
|
let bufferBit = 0;
|
|
2762
2762
|
if (renderPass.toClearColorBuffer) {
|
|
2763
2763
|
gl.clearColor(renderPass.clearColor.x, renderPass.clearColor.y, renderPass.clearColor.z, renderPass.clearColor.w);
|
|
2764
2764
|
bufferBit |= gl.COLOR_BUFFER_BIT;
|
|
2765
2765
|
}
|
|
2766
|
-
if (renderPass.toClearDepthBuffer && !(isCanvasTarget && !this.
|
|
2766
|
+
if (renderPass.toClearDepthBuffer && !(isCanvasTarget && !this.UD().depth)) {
|
|
2767
2767
|
gl.clearDepth(renderPass.clearDepth);
|
|
2768
2768
|
bufferBit |= gl.DEPTH_BUFFER_BIT;
|
|
2769
2769
|
}
|
|
2770
|
-
if (renderPass.toClearStencilBuffer && !(isCanvasTarget && !this.
|
|
2770
|
+
if (renderPass.toClearStencilBuffer && !(isCanvasTarget && !this.UD().stencil)) {
|
|
2771
2771
|
gl.clearStencil(renderPass.clearStencil);
|
|
2772
2772
|
bufferBit |= gl.STENCIL_BUFFER_BIT;
|
|
2773
2773
|
}
|
|
@@ -2780,62 +2780,62 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2780
2780
|
* getContextAttributes() allocates a new object on every call. While the context is lost the
|
|
2781
2781
|
* attributes are unknown, so both are reported as present and nothing is skipped.
|
|
2782
2782
|
*/
|
|
2783
|
-
|
|
2784
|
-
const glw = this.
|
|
2785
|
-
let attributes = this.
|
|
2786
|
-
if (attributes == null || this.
|
|
2783
|
+
UD() {
|
|
2784
|
+
const glw = this.CD;
|
|
2785
|
+
let attributes = this.RD;
|
|
2786
|
+
if (attributes == null || this.SD !== glw) {
|
|
2787
2787
|
const contextAttributes = glw.getRawContext().getContextAttributes();
|
|
2788
2788
|
if (contextAttributes == null) {
|
|
2789
2789
|
return { depth: true, stencil: true };
|
|
2790
2790
|
}
|
|
2791
2791
|
attributes = { depth: contextAttributes.depth !== false, stencil: contextAttributes.stencil === true };
|
|
2792
|
-
this.
|
|
2793
|
-
this.
|
|
2792
|
+
this.RD = attributes;
|
|
2793
|
+
this.SD = glw;
|
|
2794
2794
|
}
|
|
2795
2795
|
return attributes;
|
|
2796
2796
|
}
|
|
2797
2797
|
deleteVertexDataResources(vertexHandles) {
|
|
2798
|
-
const gl = this.
|
|
2798
|
+
const gl = this.CD.getRawContext();
|
|
2799
2799
|
const iboHandle = vertexHandles.iboHandle;
|
|
2800
2800
|
if (iboHandle) {
|
|
2801
2801
|
const ibo = this.getWebGLResource(iboHandle);
|
|
2802
2802
|
gl.deleteBuffer(ibo);
|
|
2803
|
-
this
|
|
2803
|
+
this.ED.delete(iboHandle);
|
|
2804
2804
|
}
|
|
2805
2805
|
const vboHandles = vertexHandles.vboHandles;
|
|
2806
2806
|
for (const vboHandle of vboHandles) {
|
|
2807
2807
|
const vbo = this.getWebGLResource(vboHandle);
|
|
2808
2808
|
gl.deleteBuffer(vbo);
|
|
2809
|
-
this
|
|
2809
|
+
this.ED.delete(vboHandle);
|
|
2810
2810
|
}
|
|
2811
2811
|
const vaoHandle = vertexHandles.vaoHandle;
|
|
2812
2812
|
const vao = this.getWebGLResource(vaoHandle);
|
|
2813
|
-
this.
|
|
2814
|
-
this
|
|
2813
|
+
this.CD.deleteVertexArray(vao);
|
|
2814
|
+
this.ED.delete(vaoHandle);
|
|
2815
2815
|
}
|
|
2816
2816
|
deleteVertexArray(vaoHandle) {
|
|
2817
2817
|
const vao = this.getWebGLResource(vaoHandle);
|
|
2818
|
-
this.
|
|
2819
|
-
this
|
|
2818
|
+
this.CD.deleteVertexArray(vao);
|
|
2819
|
+
this.ED.delete(vaoHandle);
|
|
2820
2820
|
}
|
|
2821
2821
|
deleteVertexBuffer(vboUid) {
|
|
2822
|
-
const gl = this.
|
|
2822
|
+
const gl = this.CD.getRawContext();
|
|
2823
2823
|
const vbo = this.getWebGLResource(vboUid);
|
|
2824
2824
|
gl.deleteBuffer(vbo);
|
|
2825
|
-
this
|
|
2825
|
+
this.ED.delete(vboUid);
|
|
2826
2826
|
}
|
|
2827
2827
|
resizeCanvas(width, height) {
|
|
2828
|
-
this.
|
|
2829
|
-
this.
|
|
2830
|
-
this.
|
|
2831
|
-
this.
|
|
2832
|
-
this.
|
|
2828
|
+
this.CD.width = width;
|
|
2829
|
+
this.CD.height = height;
|
|
2830
|
+
this.CD.canvas.width = width;
|
|
2831
|
+
this.CD.canvas.height = height;
|
|
2832
|
+
this.CD.setViewportAsVector4(Vector4.fromCopyArray([0, 0, width, height]));
|
|
2833
2833
|
}
|
|
2834
2834
|
getCanvasSize() {
|
|
2835
|
-
return [this.
|
|
2835
|
+
return [this.CD.canvas.width, this.CD.canvas.height];
|
|
2836
2836
|
}
|
|
2837
2837
|
switchDepthTest(flag) {
|
|
2838
|
-
const gl = this.
|
|
2838
|
+
const gl = this.CD.getRawContext();
|
|
2839
2839
|
if (flag) {
|
|
2840
2840
|
gl.enable(gl.DEPTH_TEST);
|
|
2841
2841
|
} else {
|
|
@@ -2874,7 +2874,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2874
2874
|
return true;
|
|
2875
2875
|
}
|
|
2876
2876
|
getPixelDataFromTexture(texUid, x, y, width, height) {
|
|
2877
|
-
const gl = this.
|
|
2877
|
+
const gl = this.CD.getRawContext();
|
|
2878
2878
|
const pixels = new Uint8Array((width - x) * (height - y) * 4);
|
|
2879
2879
|
const texture = this.getWebGLResource(texUid);
|
|
2880
2880
|
const fbo = gl.createFramebuffer();
|
|
@@ -2900,7 +2900,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2900
2900
|
return this.getPixelDataFromTexture(texUid, x, y, width, height);
|
|
2901
2901
|
}
|
|
2902
2902
|
getCurrentTexture2DBindingsForEffekseer() {
|
|
2903
|
-
const gl = this.
|
|
2903
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2904
2904
|
const maxTextureUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
2905
2905
|
const textureBindings = [];
|
|
2906
2906
|
for (let i = 0; i < maxTextureUnits; i++) {
|
|
@@ -2934,7 +2934,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2934
2934
|
elementArrayBuffer,
|
|
2935
2935
|
currentProgram
|
|
2936
2936
|
}) {
|
|
2937
|
-
const gl = this.
|
|
2937
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2938
2938
|
for (let i = 0; i < textureBindings.length; i++) {
|
|
2939
2939
|
gl.activeTexture(gl.TEXTURE0 + i);
|
|
2940
2940
|
gl.bindTexture(gl.TEXTURE_2D, textureBindings[i].texture2D);
|
|
@@ -2945,12 +2945,12 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2945
2945
|
gl.bindBuffer(gl.ARRAY_BUFFER, arrayBuffer);
|
|
2946
2946
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, elementArrayBuffer);
|
|
2947
2947
|
gl.useProgram(currentProgram);
|
|
2948
|
-
gl.
|
|
2948
|
+
gl._D = true;
|
|
2949
2949
|
}
|
|
2950
2950
|
setWebGLStateToDefaultForEffekseer() {
|
|
2951
2951
|
}
|
|
2952
2952
|
setWebGLStateToDefault() {
|
|
2953
|
-
const gl = this.
|
|
2953
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
2954
2954
|
gl.bindVertexArray(null);
|
|
2955
2955
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
2956
2956
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
@@ -2995,7 +2995,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
2995
2995
|
gl.colorMask(true, true, true, true);
|
|
2996
2996
|
gl.polygonOffset(0, 0);
|
|
2997
2997
|
gl.sampleCoverage(1, false);
|
|
2998
|
-
const canvas = this.
|
|
2998
|
+
const canvas = this.CD.canvas;
|
|
2999
2999
|
const maxTextureUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
3000
3000
|
gl.scissor(0, 0, canvas.width, canvas.height);
|
|
3001
3001
|
gl.viewport(0, 0, canvas.width, canvas.height);
|
|
@@ -3011,7 +3011,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3011
3011
|
gl.activeTexture(gl.TEXTURE0);
|
|
3012
3012
|
}
|
|
3013
3013
|
restoreWebGLStates(webGLStates) {
|
|
3014
|
-
const gl = this.
|
|
3014
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3015
3015
|
if (webGLStates.depthTest) {
|
|
3016
3016
|
gl.enable(gl.DEPTH_TEST);
|
|
3017
3017
|
} else {
|
|
@@ -3150,7 +3150,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3150
3150
|
gl.useProgram(webGLStates.currentProgram);
|
|
3151
3151
|
}
|
|
3152
3152
|
getCurrentWebGLStates() {
|
|
3153
|
-
const gl = this.
|
|
3153
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3154
3154
|
const depthTest = gl.isEnabled(gl.DEPTH_TEST);
|
|
3155
3155
|
const stencilTest = gl.isEnabled(gl.STENCIL_TEST);
|
|
3156
3156
|
const blend = gl.isEnabled(gl.BLEND);
|
|
@@ -3335,7 +3335,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3335
3335
|
};
|
|
3336
3336
|
}
|
|
3337
3337
|
unbindTextureSamplers() {
|
|
3338
|
-
const gl = this.
|
|
3338
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3339
3339
|
const maxTextureUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
3340
3340
|
for (let i = 0; i < maxTextureUnits; i++) {
|
|
3341
3341
|
gl.bindSampler(i, null);
|
|
@@ -3343,12 +3343,12 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
isSupportMultiViewVRRendering(engine) {
|
|
3345
3345
|
if (engine.engineState.currentProcessApproach === ProcessApproach.WebGL2) {
|
|
3346
|
-
return this.
|
|
3346
|
+
return this.CD.isMultiview(engine.config);
|
|
3347
3347
|
}
|
|
3348
3348
|
return false;
|
|
3349
3349
|
}
|
|
3350
3350
|
blitToTexture2dFromTexture2dArray(srcTextureUid, dstFboUid, dstWidth, dstHeight) {
|
|
3351
|
-
const gl = this.
|
|
3351
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3352
3352
|
const srcTexture = this.getWebGLResource(srcTextureUid);
|
|
3353
3353
|
const dstFbo = this.getWebGLResource(dstFboUid);
|
|
3354
3354
|
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, dstFbo);
|
|
@@ -3357,7 +3357,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3357
3357
|
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
|
|
3358
3358
|
}
|
|
3359
3359
|
blitToTexture2dFromTexture2dArrayFake(srcTextureUid, dstFboUid, dstWidth, dstHeight) {
|
|
3360
|
-
const gl = this.
|
|
3360
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3361
3361
|
const srcTexture = this.getWebGLResource(srcTextureUid);
|
|
3362
3362
|
const dstFbo = this.getWebGLResource(dstFboUid);
|
|
3363
3363
|
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, dstFbo);
|
|
@@ -3366,7 +3366,7 @@ vec4 fetchVec4FromVec4Block(int vec4Idx) {
|
|
|
3366
3366
|
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
|
|
3367
3367
|
}
|
|
3368
3368
|
blitToTexture2dFromTexture2dArray2(srcTextureUid, dstTextureUid, dstWidth, dstHeight) {
|
|
3369
|
-
const gl = this.
|
|
3369
|
+
const gl = this.CD.getRawContextAsWebGL2();
|
|
3370
3370
|
const srcTexture = this.getWebGLResource(srcTextureUid);
|
|
3371
3371
|
const dstTexture = this.getWebGLResource(dstTextureUid);
|
|
3372
3372
|
const webStereoUtil = WebGLStereoUtil.getInstance(gl);
|