ris-framework 0.1.0 → 0.2.0-dev.12
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/CHANGELOG.md +42 -1
- package/README.md +27 -4
- package/dist/Framework.d.ts +34 -10
- package/dist/Framework.d.ts.map +1 -1
- package/dist/api/IFramework.d.ts +50 -6
- package/dist/api/IFramework.d.ts.map +1 -1
- package/dist/api/_export.d.ts +3 -1
- package/dist/api/_export.d.ts.map +1 -1
- package/dist/api/camera/CameraFactory.d.ts +3 -2
- package/dist/api/camera/CameraFactory.d.ts.map +1 -1
- package/dist/api/camera/ICamera.d.ts +5 -0
- package/dist/api/camera/ICamera.d.ts.map +1 -1
- package/dist/api/camera/ICameraFactory.d.ts +5 -6
- package/dist/api/camera/ICameraFactory.d.ts.map +1 -1
- package/dist/api/camera/OrthographicCamera.d.ts +7 -0
- package/dist/api/camera/OrthographicCamera.d.ts.map +1 -1
- package/dist/api/camera/PerspectiveCamera.d.ts +30 -6
- package/dist/api/camera/PerspectiveCamera.d.ts.map +1 -1
- package/dist/api/content/ContentManager.d.ts +15 -2
- package/dist/api/content/ContentManager.d.ts.map +1 -1
- package/dist/api/content/IContentManager.d.ts +35 -1
- package/dist/api/content/IContentManager.d.ts.map +1 -1
- package/dist/api/content/ShaderModuleContent.d.ts.map +1 -1
- package/dist/api/data/Color.d.ts +5 -0
- package/dist/api/data/Color.d.ts.map +1 -1
- package/dist/api/geometry/BaseGeometry.d.ts +9 -0
- package/dist/api/geometry/BaseGeometry.d.ts.map +1 -1
- package/dist/api/geometry/GeometryBuilder.d.ts +3 -1
- package/dist/api/geometry/GeometryBuilder.d.ts.map +1 -1
- package/dist/api/geometry/IGeometryBuilder.d.ts +24 -0
- package/dist/api/geometry/IGeometryBuilder.d.ts.map +1 -1
- package/dist/api/geometry/_export-geometry.d.ts +1 -0
- package/dist/api/geometry/_export-geometry.d.ts.map +1 -1
- package/dist/api/input/InputManager.d.ts +4 -0
- package/dist/api/input/InputManager.d.ts.map +1 -1
- package/dist/api/lights/AmbientLight.d.ts +35 -0
- package/dist/api/lights/AmbientLight.d.ts.map +1 -0
- package/dist/api/lights/DirectionalLight.d.ts +40 -0
- package/dist/api/lights/DirectionalLight.d.ts.map +1 -0
- package/dist/api/lights/LightFactory.d.ts +18 -0
- package/dist/api/lights/LightFactory.d.ts.map +1 -0
- package/dist/api/lights/LightId.d.ts +6 -0
- package/dist/api/lights/LightId.d.ts.map +1 -0
- package/dist/api/lights/LightsBuffer.d.ts +77 -0
- package/dist/api/lights/LightsBuffer.d.ts.map +1 -0
- package/dist/api/lights/PointLight.d.ts +59 -0
- package/dist/api/lights/PointLight.d.ts.map +1 -0
- package/dist/api/lights/_export.d.ts +6 -0
- package/dist/api/lights/_export.d.ts.map +1 -0
- package/dist/api/loaders/ObjGeometryMapper.d.ts +19 -0
- package/dist/api/loaders/ObjGeometryMapper.d.ts.map +1 -0
- package/dist/api/loaders/ObjLoader.d.ts +61 -0
- package/dist/api/loaders/ObjLoader.d.ts.map +1 -0
- package/dist/api/loaders/_export.d.ts +2 -0
- package/dist/api/loaders/_export.d.ts.map +1 -1
- package/dist/api/loaders/obj/ObjParser.d.ts +44 -0
- package/dist/api/loaders/obj/ObjParser.d.ts.map +1 -0
- package/dist/api/loaders/obj/ObjTypes.d.ts +119 -0
- package/dist/api/loaders/obj/ObjTypes.d.ts.map +1 -0
- package/dist/api/loaders/obj/index.d.ts +3 -0
- package/dist/api/loaders/obj/index.d.ts.map +1 -0
- package/dist/api/material/ForwardBlinnPhongMaterial.d.ts +138 -0
- package/dist/api/material/ForwardBlinnPhongMaterial.d.ts.map +1 -0
- package/dist/api/material/ICameraMaterial.d.ts +18 -0
- package/dist/api/material/ICameraMaterial.d.ts.map +1 -0
- package/dist/api/material/ILightsMaterial.d.ts +26 -0
- package/dist/api/material/ILightsMaterial.d.ts.map +1 -0
- package/dist/api/material/IMaterial.d.ts +13 -10
- package/dist/api/material/IMaterial.d.ts.map +1 -1
- package/dist/api/material/IMaterialFactory.d.ts +17 -2
- package/dist/api/material/IMaterialFactory.d.ts.map +1 -1
- package/dist/api/material/InspectTextureMipsMaterial.d.ts +18 -9
- package/dist/api/material/InspectTextureMipsMaterial.d.ts.map +1 -1
- package/dist/api/material/MaterialFactory.d.ts +6 -0
- package/dist/api/material/MaterialFactory.d.ts.map +1 -1
- package/dist/api/material/SpriteMaterial.d.ts +51 -0
- package/dist/api/material/SpriteMaterial.d.ts.map +1 -0
- package/dist/api/material/UnlitMaterial.d.ts +32 -13
- package/dist/api/material/UnlitMaterial.d.ts.map +1 -1
- package/dist/api/material/_export.d.ts +4 -0
- package/dist/api/material/_export.d.ts.map +1 -1
- package/dist/api/meshes/IMesh.d.ts +31 -6
- package/dist/api/meshes/IMesh.d.ts.map +1 -1
- package/dist/api/meshes/IMeshFactory.d.ts +30 -4
- package/dist/api/meshes/IMeshFactory.d.ts.map +1 -1
- package/dist/api/meshes/IRenderableMesh.d.ts +47 -0
- package/dist/api/meshes/IRenderableMesh.d.ts.map +1 -0
- package/dist/api/meshes/Mesh.d.ts +14 -8
- package/dist/api/meshes/Mesh.d.ts.map +1 -1
- package/dist/api/meshes/MeshFactory.d.ts +10 -3
- package/dist/api/meshes/MeshFactory.d.ts.map +1 -1
- package/dist/api/meshes/QuadMesh.d.ts +5 -3
- package/dist/api/meshes/QuadMesh.d.ts.map +1 -1
- package/dist/api/meshes/RenderableMesh.d.ts +95 -0
- package/dist/api/meshes/RenderableMesh.d.ts.map +1 -0
- package/dist/api/meshes/_export.d.ts +2 -0
- package/dist/api/meshes/_export.d.ts.map +1 -1
- package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts +8 -2
- package/dist/api/rendering/IGraphicsDeviceFeatures.d.ts.map +1 -1
- package/dist/api/rendering/IRenderer.d.ts +28 -1
- package/dist/api/rendering/IRenderer.d.ts.map +1 -1
- package/dist/api/rendering/enums.d.ts +7 -0
- package/dist/api/rendering/enums.d.ts.map +1 -1
- package/dist/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.d.ts +56 -0
- package/dist/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.d.ts.map +1 -0
- package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts +3 -0
- package/dist/api/rendering/render-pipelines/IRenderPipeline.d.ts.map +1 -1
- package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts +29 -0
- package/dist/api/rendering/render-pipelines/IRenderPipelineFactory.d.ts.map +1 -1
- package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts +1 -0
- package/dist/api/rendering/render-pipelines/_export-render-pipelines.d.ts.map +1 -1
- package/dist/api/rendering/renderer-interface.d.ts +1 -31
- package/dist/api/rendering/renderer-interface.d.ts.map +1 -1
- package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts +2 -6
- package/dist/api/rendering/renderpass/RenderPassDescriptor.d.ts.map +1 -1
- package/dist/api/rendering/swapchain/ISwapChain.d.ts +1 -3
- package/dist/api/rendering/swapchain/ISwapChain.d.ts.map +1 -1
- package/dist/api/rendering/texture/TextureFormat.d.ts +88 -14
- package/dist/api/rendering/texture/TextureFormat.d.ts.map +1 -1
- package/dist/api/rendering/texture/TextureUtilities.d.ts +23 -0
- package/dist/api/rendering/texture/TextureUtilities.d.ts.map +1 -1
- package/dist/api/scene/Scene.d.ts +113 -0
- package/dist/api/scene/Scene.d.ts.map +1 -0
- package/dist/api/scene/SceneMesh.d.ts +27 -0
- package/dist/api/scene/SceneMesh.d.ts.map +1 -0
- package/dist/api/shader/IShaderModuleLoader.d.ts +4 -1
- package/dist/api/shader/IShaderModuleLoader.d.ts.map +1 -1
- package/dist/api/shader/{shader-loader.d.ts → ShaderLoader.d.ts} +1 -1
- package/dist/api/shader/ShaderLoader.d.ts.map +1 -0
- package/dist/api/sprites/SpriteBatchDrawable.d.ts +1 -1
- package/dist/api/sprites/SpriteBatchDrawable.d.ts.map +1 -1
- package/dist/api/sprites/SpriteBatchMesh.d.ts +14 -1
- package/dist/api/sprites/SpriteBatchMesh.d.ts.map +1 -1
- package/dist/api/utilities/AlignUtilities.d.ts.map +1 -1
- package/dist/api/utilities/GeometryUtilities.d.ts.map +1 -1
- package/dist/api/window/WindowManager.d.ts +4 -0
- package/dist/api/window/WindowManager.d.ts.map +1 -1
- package/dist/core/rendering/ARenderer.d.ts +5 -5
- package/dist/core/rendering/ARenderer.d.ts.map +1 -1
- package/dist/core/rendering/vertex-buffer-layout.d.ts +1 -0
- package/dist/core/rendering/vertex-buffer-layout.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9238 -4595
- package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts +4 -0
- package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts.map +1 -1
- package/dist/webgl/WebGlGraphicsDevice.d.ts.map +1 -1
- package/dist/webgl/WebGlRenderer.d.ts +1 -3
- package/dist/webgl/WebGlRenderer.d.ts.map +1 -1
- package/dist/webgl/lights/WebGlAmbientLightFactory.d.ts +17 -0
- package/dist/webgl/lights/WebGlAmbientLightFactory.d.ts.map +1 -0
- package/dist/webgl/lights/WebGlLightsBuffer.d.ts +59 -0
- package/dist/webgl/lights/WebGlLightsBuffer.d.ts.map +1 -0
- package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts +3 -1
- package/dist/webgl/render-pipelines/AWebGlRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts +5 -0
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts +3 -1
- package/dist/webgl/render-pipelines/WebGlRenderPipelineFactory.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts +3 -1
- package/dist/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.d.ts +88 -0
- package/dist/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.d.ts.map +1 -0
- package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts +3 -1
- package/dist/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts +3 -1
- package/dist/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.d.ts.map +1 -1
- package/dist/webgl/shader/WebGlShaderModule.d.ts +4 -1
- package/dist/webgl/shader/WebGlShaderModule.d.ts.map +1 -1
- package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts +16 -5
- package/dist/webgl/shader/WebGlShaderModuleLoader.d.ts.map +1 -1
- package/dist/webgl/swap-chain/WebGlSwapChain.d.ts +3 -2
- package/dist/webgl/swap-chain/WebGlSwapChain.d.ts.map +1 -1
- package/dist/webgl/texture/WebGlTexture2D.d.ts +8 -1
- package/dist/webgl/texture/WebGlTexture2D.d.ts.map +1 -1
- package/dist/webgl/texture/WebGlTextureFactory.d.ts +7 -0
- package/dist/webgl/texture/WebGlTextureFactory.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlConstants.d.ts +91 -0
- package/dist/webgl/utilities/WebGlConstants.d.ts.map +1 -0
- package/dist/webgl/utilities/WebGlConverter.d.ts +0 -7
- package/dist/webgl/utilities/WebGlConverter.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlErrorUtilities.d.ts +10 -0
- package/dist/webgl/utilities/WebGlErrorUtilities.d.ts.map +1 -0
- package/dist/webgl/utilities/WebGlTextureUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/WebGlUtilities.d.ts +3 -0
- package/dist/webgl/utilities/WebGlUtilities.d.ts.map +1 -1
- package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts +0 -1
- package/dist/webgl/utilities/webgl-filter-anisotropic-utilities.d.ts.map +1 -1
- package/dist/webgpu/WebGpuGpuInfo.d.ts +28 -0
- package/dist/webgpu/WebGpuGpuInfo.d.ts.map +1 -0
- package/dist/webgpu/WebGpuGraphicsDevice.d.ts +80 -0
- package/dist/webgpu/WebGpuGraphicsDevice.d.ts.map +1 -0
- package/dist/webgpu/WebGpuGraphicsDeviceFeatures.d.ts +26 -0
- package/dist/webgpu/WebGpuGraphicsDeviceFeatures.d.ts.map +1 -0
- package/dist/webgpu/WebGpuRenderer.d.ts +26 -0
- package/dist/webgpu/WebGpuRenderer.d.ts.map +1 -0
- package/dist/webgpu/WebGpuTypes.d.ts +355 -0
- package/dist/webgpu/WebGpuTypes.d.ts.map +1 -0
- package/dist/webgpu/blending/WebGpuBlendState.d.ts +30 -0
- package/dist/webgpu/blending/WebGpuBlendState.d.ts.map +1 -0
- package/dist/webgpu/buffers/WebGpuBuffersFactory.d.ts +20 -0
- package/dist/webgpu/buffers/WebGpuBuffersFactory.d.ts.map +1 -0
- package/dist/webgpu/buffers/WebGpuIndexBuffer.d.ts +46 -0
- package/dist/webgpu/buffers/WebGpuIndexBuffer.d.ts.map +1 -0
- package/dist/webgpu/buffers/WebGpuUniformBuffer.d.ts +43 -0
- package/dist/webgpu/buffers/WebGpuUniformBuffer.d.ts.map +1 -0
- package/dist/webgpu/buffers/WebGpuVertexBuffer.d.ts +49 -0
- package/dist/webgpu/buffers/WebGpuVertexBuffer.d.ts.map +1 -0
- package/dist/webgpu/primitive/WebGpuPrimitiveState.d.ts +32 -0
- package/dist/webgpu/primitive/WebGpuPrimitiveState.d.ts.map +1 -0
- package/dist/webgpu/render-pass/WebGpuRenderPass.d.ts +28 -0
- package/dist/webgpu/render-pass/WebGpuRenderPass.d.ts.map +1 -0
- package/dist/webgpu/render-pipelines/AWebGpuRenderPipeline.d.ts +50 -0
- package/dist/webgpu/render-pipelines/AWebGpuRenderPipeline.d.ts.map +1 -0
- package/dist/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.d.ts +34 -0
- package/dist/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.d.ts.map +1 -0
- package/dist/webgpu/render-pipelines/WebGpuRenderPipelineFactory.d.ts +26 -0
- package/dist/webgpu/render-pipelines/WebGpuRenderPipelineFactory.d.ts.map +1 -0
- package/dist/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.d.ts +72 -0
- package/dist/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.d.ts.map +1 -0
- package/dist/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.d.ts +40 -0
- package/dist/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.d.ts.map +1 -0
- package/dist/webgpu/sampler/WebGpuSampler.d.ts +39 -0
- package/dist/webgpu/sampler/WebGpuSampler.d.ts.map +1 -0
- package/dist/webgpu/shader/WebGpuShaderModule.d.ts +29 -0
- package/dist/webgpu/shader/WebGpuShaderModule.d.ts.map +1 -0
- package/dist/webgpu/shader/WebGpuShaderModuleLoader.d.ts +21 -0
- package/dist/webgpu/shader/WebGpuShaderModuleLoader.d.ts.map +1 -0
- package/dist/webgpu/shader/WgslShaderContent.d.ts +9 -0
- package/dist/webgpu/shader/WgslShaderContent.d.ts.map +1 -0
- package/dist/webgpu/swap-chain/WebGpuSwapChain.d.ts +41 -0
- package/dist/webgpu/swap-chain/WebGpuSwapChain.d.ts.map +1 -0
- package/dist/webgpu/texture/WebGpuTexture2D.d.ts +47 -0
- package/dist/webgpu/texture/WebGpuTexture2D.d.ts.map +1 -0
- package/dist/webgpu/texture/WebGpuTextureFactory.d.ts +21 -0
- package/dist/webgpu/texture/WebGpuTextureFactory.d.ts.map +1 -0
- package/dist/webgpu/texture/WebGpuTextureView.d.ts +25 -0
- package/dist/webgpu/texture/WebGpuTextureView.d.ts.map +1 -0
- package/dist/webgpu/utilities/WebGpuConverter.d.ts +45 -0
- package/dist/webgpu/utilities/WebGpuConverter.d.ts.map +1 -0
- package/package.json +4 -4
- package/shaders/glsl/forward_blinn_phong_material_fs.glsl +110 -0
- package/shaders/glsl/forward_blinn_phong_material_vs.glsl +32 -0
- package/shaders/glsl/main_render_target_flip_y_fs.glsl +35 -1
- package/shaders/glsl/sprite_fs.glsl +1 -1
- package/shaders/glsl/unlit_material_fs.glsl +1 -1
- package/shaders/wgsl/forward_blinn_phong_material.wgsl +150 -0
- package/shaders/wgsl/inspect_texture_mips.wgsl +51 -0
- package/shaders/wgsl/main_frame_buffer.wgsl +35 -0
- package/shaders/wgsl/main_render_target_flip_y.wgsl +35 -0
- package/shaders/wgsl/sprite.wgsl +40 -0
- package/shaders/wgsl/unlit_material.wgsl +49 -0
- package/src/Framework.ts +156 -48
- package/src/api/IFramework.ts +63 -6
- package/src/api/_export.ts +3 -1
- package/src/api/camera/CameraFactory.ts +6 -6
- package/src/api/camera/ICamera.ts +6 -0
- package/src/api/camera/ICameraFactory.ts +5 -10
- package/src/api/camera/OrthographicCamera.ts +23 -1
- package/src/api/camera/PerspectiveCamera.ts +60 -15
- package/src/api/content/ContentManager.ts +78 -16
- package/src/api/content/IContentManager.ts +37 -1
- package/src/api/content/ShaderModuleContent.ts +9 -0
- package/src/api/data/Color.ts +7 -1
- package/src/api/geometry/BaseGeometry.ts +23 -0
- package/src/api/geometry/GeometryBuilder.ts +14 -2
- package/src/api/geometry/IGeometryBuilder.ts +31 -1
- package/src/api/geometry/_export-geometry.ts +2 -1
- package/src/api/input/InputManager.ts +14 -5
- package/src/api/lights/AmbientLight.ts +53 -0
- package/src/api/lights/DirectionalLight.ts +60 -0
- package/src/api/lights/LightFactory.ts +21 -0
- package/src/api/lights/LightId.ts +9 -0
- package/src/api/lights/LightsBuffer.ts +94 -0
- package/src/api/lights/PointLight.ts +91 -0
- package/src/api/lights/_export.ts +5 -0
- package/src/api/loaders/ObjGeometryMapper.ts +28 -0
- package/src/api/loaders/ObjLoader.ts +126 -0
- package/src/api/loaders/_export.ts +3 -1
- package/src/api/loaders/obj/ObjParser.ts +301 -0
- package/src/api/loaders/obj/ObjTypes.ts +142 -0
- package/src/api/loaders/obj/index.ts +5 -0
- package/src/api/material/ForwardBlinnPhongMaterial.ts +328 -0
- package/src/api/material/ICameraMaterial.ts +22 -0
- package/src/api/material/ILightsMaterial.ts +32 -0
- package/src/api/material/IMaterial.ts +13 -10
- package/src/api/material/IMaterialFactory.ts +19 -2
- package/src/api/material/InspectTextureMipsMaterial.ts +65 -26
- package/src/api/material/MaterialFactory.ts +12 -0
- package/src/api/material/SpriteMaterial.ts +83 -0
- package/src/api/material/UnlitMaterial.ts +105 -32
- package/src/api/material/_export.ts +5 -1
- package/src/api/meshes/IMesh.ts +40 -6
- package/src/api/meshes/IMeshFactory.ts +33 -4
- package/src/api/meshes/IRenderableMesh.ts +58 -0
- package/src/api/meshes/Mesh.ts +50 -43
- package/src/api/meshes/MeshFactory.ts +37 -4
- package/src/api/meshes/QuadMesh.ts +6 -4
- package/src/api/meshes/RenderableMesh.ts +207 -0
- package/src/api/meshes/_export.ts +6 -4
- package/src/api/rendering/IGraphicsDeviceFeatures.ts +28 -21
- package/src/api/rendering/IRenderer.ts +34 -1
- package/src/api/rendering/enums.ts +10 -0
- package/src/api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.ts +66 -0
- package/src/api/rendering/render-pipelines/IRenderPipeline.ts +4 -0
- package/src/api/rendering/render-pipelines/IRenderPipelineFactory.ts +39 -0
- package/src/api/rendering/render-pipelines/_export-render-pipelines.ts +2 -1
- package/src/api/rendering/renderer-interface.ts +1 -36
- package/src/api/rendering/renderpass/RenderPassDescriptor.ts +10 -14
- package/src/api/rendering/swapchain/ISwapChain.ts +1 -3
- package/src/api/rendering/texture/TextureFormat.ts +128 -14
- package/src/api/rendering/texture/TextureUtilities.ts +225 -10
- package/src/api/scene/Scene.ts +297 -0
- package/src/api/scene/SceneMesh.ts +61 -0
- package/src/api/shader/IShaderModuleLoader.ts +2 -1
- package/src/api/sprites/SpriteBatchDrawable.ts +12 -16
- package/src/api/sprites/SpriteBatchMesh.ts +22 -3
- package/src/api/utilities/AlignUtilities.ts +2 -1
- package/src/api/utilities/GeometryUtilities.ts +2 -0
- package/src/api/window/WindowManager.ts +23 -3
- package/src/core/rendering/ARenderer.ts +24 -15
- package/src/core/rendering/vertex-buffer-layout.ts +32 -1
- package/src/index.ts +0 -1
- package/src/main.ts +2 -4
- package/src/webgl/WebGLGraphicsDeviceFeatures.ts +12 -2
- package/src/webgl/WebGlGpuInfo.ts +1 -1
- package/src/webgl/WebGlGraphicsDevice.ts +0 -1
- package/src/webgl/WebGlRenderer.ts +2 -5
- package/src/webgl/lights/WebGlAmbientLightFactory.ts +35 -0
- package/src/webgl/lights/WebGlLightsBuffer.ts +225 -0
- package/src/webgl/render-pipelines/AWebGlRenderPipeline.ts +7 -1
- package/src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts +21 -1
- package/src/webgl/render-pipelines/WebGlRenderPipelineFactory.ts +24 -2
- package/src/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.ts +16 -6
- package/src/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.ts +300 -0
- package/src/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.ts +16 -6
- package/src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts +11 -7
- package/src/webgl/shader/WebGlShaderModule.ts +11 -4
- package/src/webgl/shader/WebGlShaderModuleLoader.ts +29 -10
- package/src/webgl/swap-chain/WebGlSwapChain.ts +7 -6
- package/src/webgl/texture/WebGlTexture2D.ts +19 -5
- package/src/webgl/texture/WebGlTextureFactory.ts +49 -7
- package/src/webgl/utilities/WebGlConstants.ts +136 -0
- package/src/webgl/utilities/WebGlConverter.ts +91 -22
- package/src/webgl/utilities/WebGlErrorUtilities.ts +15 -0
- package/src/webgl/utilities/WebGlTextureUtilities.ts +5 -2
- package/src/webgl/utilities/WebGlUtilities.ts +4 -0
- package/src/webgl/utilities/webgl-filter-anisotropic-utilities.ts +9 -6
- package/src/webgpu/WebGpuGpuInfo.ts +61 -0
- package/src/webgpu/WebGpuGraphicsDevice.ts +199 -0
- package/src/webgpu/WebGpuGraphicsDeviceFeatures.ts +41 -0
- package/src/webgpu/WebGpuRenderer.ts +49 -0
- package/src/webgpu/WebGpuTypes.ts +288 -0
- package/src/webgpu/blending/WebGpuBlendState.ts +53 -0
- package/src/webgpu/buffers/WebGpuBuffersFactory.ts +46 -0
- package/src/webgpu/buffers/WebGpuIndexBuffer.ts +118 -0
- package/src/webgpu/buffers/WebGpuUniformBuffer.ts +102 -0
- package/src/webgpu/buffers/WebGpuVertexBuffer.ts +119 -0
- package/src/webgpu/primitive/WebGpuPrimitiveState.ts +52 -0
- package/src/webgpu/render-pass/WebGpuRenderPass.ts +131 -0
- package/src/webgpu/render-pipelines/AWebGpuRenderPipeline.ts +123 -0
- package/src/webgpu/render-pipelines/WebGpuMainRenderTargetRenderPipeline.ts +119 -0
- package/src/webgpu/render-pipelines/WebGpuRenderPipelineFactory.ts +66 -0
- package/src/webgpu/render-pipelines/material/AWebGpuMeshRenderPipeline.ts +249 -0
- package/src/webgpu/render-pipelines/material/WebGpuUnlitRenderPipeline.ts +101 -0
- package/src/webgpu/sampler/WebGpuSampler.ts +84 -0
- package/src/webgpu/shader/WebGpuShaderModule.ts +65 -0
- package/src/webgpu/shader/WebGpuShaderModuleLoader.ts +38 -0
- package/src/webgpu/shader/WgslShaderContent.ts +20 -0
- package/src/webgpu/swap-chain/WebGpuSwapChain.ts +93 -0
- package/src/webgpu/texture/WebGpuTexture2D.ts +197 -0
- package/src/webgpu/texture/WebGpuTextureFactory.ts +118 -0
- package/src/webgpu/texture/WebGpuTextureView.ts +43 -0
- package/src/webgpu/utilities/WebGpuConverter.ts +299 -0
- package/src/wgsl-raw.d.ts +4 -0
- package/dist/api/FrameworkConfiguration.d.ts +0 -23
- package/dist/api/FrameworkConfiguration.d.ts.map +0 -1
- package/dist/api/IFrameworkConfiguration.d.ts +0 -25
- package/dist/api/IFrameworkConfiguration.d.ts.map +0 -1
- package/dist/api/shader/shader-loader.d.ts.map +0 -1
- package/src/api/FrameworkConfiguration.ts +0 -29
- package/src/api/IFrameworkConfiguration.ts +0 -30
- /package/src/api/shader/{shader-loader.ts → ShaderLoader.ts} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
GeometryFormat,
|
|
3
|
+
type IFramework, type IPrimitiveState,
|
|
4
|
+
type ISampler,
|
|
5
|
+
type ITexture2D,
|
|
6
|
+
type IUniformBuffer, type IUnlitRenderPipeline,
|
|
7
|
+
type IVertexBuffer
|
|
7
8
|
} from "../../../api/index.ts";
|
|
8
9
|
import {VertexBufferLayout} from "../../../core/rendering/vertex-buffer-layout";
|
|
9
10
|
import type {WebGlUniformBuffer} from "../../buffers/WebGlUniformBuffer.ts";
|
|
@@ -50,12 +51,18 @@ export class WebGlUnlitRenderPipeline extends AWebGlRenderPipeline implements IU
|
|
|
50
51
|
materialBuffer: IUniformBuffer,
|
|
51
52
|
primitiveState?: IPrimitiveState,
|
|
52
53
|
) {
|
|
54
|
+
// Validated before super(), which touches WebGL.
|
|
55
|
+
if (!modelBuffer) {
|
|
56
|
+
throw new Error("WebGlUnlitRenderPipeline: modelBuffer is required (the mesh's model buffer, std140 mat4).");
|
|
57
|
+
}
|
|
53
58
|
super(framework, primitiveState);
|
|
54
59
|
this._projectionViewBuffer = projectionViewBuffer as WebGlUniformBuffer;
|
|
55
60
|
this._modelBuffer = modelBuffer as WebGlUniformBuffer;
|
|
56
61
|
this._materialBuffer = materialBuffer as WebGlUniformBuffer;
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
/** @inheritDoc */
|
|
65
|
+
public readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
59
66
|
|
|
60
67
|
/** @inheritdoc */
|
|
61
68
|
public get projectionViewBuffer(): IUniformBuffer {
|
|
@@ -74,6 +81,9 @@ export class WebGlUnlitRenderPipeline extends AWebGlRenderPipeline implements IU
|
|
|
74
81
|
|
|
75
82
|
/** @inheritdoc */
|
|
76
83
|
public set modelBuffer(value: IUniformBuffer) {
|
|
84
|
+
if (!value) {
|
|
85
|
+
throw new Error("WebGlUnlitRenderPipeline: modelBuffer is required (the mesh's model buffer, std140 mat4).");
|
|
86
|
+
}
|
|
77
87
|
this._modelBuffer = asWebGLUniformBuffer(value);
|
|
78
88
|
}
|
|
79
89
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import {
|
|
2
|
+
GeometryFormat,
|
|
3
|
+
type IFramework,
|
|
4
|
+
type ISampler,
|
|
5
|
+
type ISpriteRenderPipeline,
|
|
6
|
+
type ITexture2D,
|
|
7
|
+
type IUniformBuffer,
|
|
8
|
+
type IVertexBuffer
|
|
8
9
|
} from "../../../api/index.ts";
|
|
9
10
|
import {VertexBufferLayout} from "../../../core/rendering/vertex-buffer-layout";
|
|
10
11
|
import type {WebGlUniformBuffer} from "../../buffers/WebGlUniformBuffer.ts";
|
|
@@ -41,6 +42,9 @@ export class WebGlSpriteRenderPipeline extends AWebGlRenderPipeline implements I
|
|
|
41
42
|
this._projectionViewBuffer = asWebGLUniformBuffer(projectionViewBuffer);
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/** @inheritDoc */
|
|
46
|
+
public readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
47
|
+
|
|
44
48
|
/** @inheritdoc */
|
|
45
49
|
public get projectionViewBuffer(): IUniformBuffer {
|
|
46
50
|
return this._projectionViewBuffer;
|
|
@@ -22,12 +22,12 @@ export class WebGlShaderModule implements IShaderModule {
|
|
|
22
22
|
* The constructor of the WebGL shader module.
|
|
23
23
|
* @param framework The framework.
|
|
24
24
|
* @param shaderFilePath
|
|
25
|
+
* @param @param keyValueDictionary - If present, tries to find key in shader such that it replaced ##DIRECTIONAL_LIGHT_COUNT## by given value for key DIRECTIONAL_LIGHST_COUNT.
|
|
25
26
|
*/
|
|
26
|
-
public constructor(framework: IFramework, shaderFilePath: string) {
|
|
27
|
+
public constructor(framework: IFramework, shaderFilePath: string, keyValueDictionary?: {[id:string]: number} ) {
|
|
27
28
|
this._graphicsDevice = framework.renderer.graphicsDevice as WebGlGraphicsDevice;
|
|
28
29
|
this._gl = this._graphicsDevice.gl;
|
|
29
|
-
this._program = this._loadShaders(shaderFilePath);
|
|
30
|
-
|
|
30
|
+
this._program = this._loadShaders(shaderFilePath, keyValueDictionary);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** @inheritDoc */
|
|
@@ -63,7 +63,7 @@ export class WebGlShaderModule implements IShaderModule {
|
|
|
63
63
|
return this._program;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
private _loadShaders(shaderFilePath: string): WebGLProgram {
|
|
66
|
+
private _loadShaders(shaderFilePath: string, keyValueDictionary?: {[id:string]: number} ): WebGLProgram {
|
|
67
67
|
|
|
68
68
|
const internalShader = this._tryResolveFrameworkShader(shaderFilePath);
|
|
69
69
|
|
|
@@ -72,6 +72,7 @@ export class WebGlShaderModule implements IShaderModule {
|
|
|
72
72
|
if (internalShader) {
|
|
73
73
|
vertexShaderSource = internalShader.vertex;
|
|
74
74
|
fragmentShaderSource = internalShader.fragment;
|
|
75
|
+
|
|
75
76
|
} else {
|
|
76
77
|
|
|
77
78
|
throw new Error("Not implemented");
|
|
@@ -84,6 +85,12 @@ export class WebGlShaderModule implements IShaderModule {
|
|
|
84
85
|
// fragmentShaderSource = await this._shaderLoader.load(shaderFilePath, RenderingBackend.WEB_GL, [ShaderStage.FRAGMENT]);
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
if(keyValueDictionary) {
|
|
89
|
+
for(const key in keyValueDictionary) {
|
|
90
|
+
vertexShaderSource = vertexShaderSource.replace(`##${key}##`, String(keyValueDictionary[key]));
|
|
91
|
+
fragmentShaderSource = fragmentShaderSource.replace(`##${key}##`, String(keyValueDictionary[key]));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
87
94
|
|
|
88
95
|
const vertexShader = WebGlUtilities.shader.createVertexShader(this._gl, vertexShaderSource);
|
|
89
96
|
const fragmentShader = WebGlUtilities.shader.createFragmentShader(this._gl, fragmentShaderSource);
|
|
@@ -2,6 +2,21 @@ import WebGlShaderModule from "./WebGlShaderModule.ts";
|
|
|
2
2
|
import type {IFramework, IShaderModule} from "../../api/index.ts";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Builds the cache key of a shader module: the id plus the sorted replacement values,
|
|
7
|
+
* so the same shader with different `##KEY##` values (e.g. light counts) is compiled separately.
|
|
8
|
+
* @param id The shader module id.
|
|
9
|
+
* @param keyValueDictionary The optional replacement values.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function shaderModuleCacheKey(id: string, keyValueDictionary?: {[id: string]: number}): string {
|
|
13
|
+
if (!keyValueDictionary) {
|
|
14
|
+
return id;
|
|
15
|
+
}
|
|
16
|
+
const entries = Object.keys(keyValueDictionary).sort().map(key => `${key}=${keyValueDictionary[key]}`);
|
|
17
|
+
return entries.length === 0 ? id : `${id}?${entries.join("&")}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
5
20
|
/**
|
|
6
21
|
* The content WebGL implementation of ShaderContentModule.
|
|
7
22
|
*/
|
|
@@ -17,24 +32,28 @@ export class WebGlShaderModuleLoader {
|
|
|
17
32
|
this._framework = framework;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
* @param assetFilePathOrIdentifier The asset file path or identifier of the content to load.
|
|
23
|
-
*/
|
|
24
|
-
public load(assetFilePathOrIdentifier: string): IShaderModule {
|
|
35
|
+
/** @inheritDoc */
|
|
36
|
+
public load(assetFilePathOrIdentifier: string, keyValueDictionary?: {[id:string]: number} ): IShaderModule {
|
|
25
37
|
|
|
26
38
|
// Here something like 'sprite' is provided, we must resolve it.
|
|
27
39
|
|
|
28
40
|
// Is it already cached?
|
|
29
|
-
|
|
41
|
+
const cacheKey = shaderModuleCacheKey(assetFilePathOrIdentifier, keyValueDictionary);
|
|
42
|
+
let shaderModule = this._shaderModules.get(cacheKey);
|
|
30
43
|
if (!shaderModule) {
|
|
31
44
|
|
|
32
45
|
// If it does not exist create one and set it.
|
|
33
|
-
shaderModule = new WebGlShaderModule(this._framework, assetFilePathOrIdentifier);
|
|
34
|
-
this._shaderModules.set(
|
|
46
|
+
shaderModule = new WebGlShaderModule(this._framework, assetFilePathOrIdentifier, keyValueDictionary);
|
|
47
|
+
this._shaderModules.set(cacheKey, shaderModule);
|
|
35
48
|
}
|
|
36
49
|
return shaderModule;
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
/** Deletes every cached shader program and clears the cache. */
|
|
53
|
+
public dispose(): void {
|
|
54
|
+
for (const shaderModule of this._shaderModules.values()) {
|
|
55
|
+
shaderModule.dispose();
|
|
56
|
+
}
|
|
57
|
+
this._shaderModules.clear();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {vec2} from "gl-matrix";
|
|
2
2
|
import {type IGraphicsDevice, type ISwapChain, TextureFormat} from "../../api/index.ts";
|
|
3
3
|
import type {WebGlGraphicsDevice} from "../WebGlGraphicsDevice.ts";
|
|
4
4
|
|
|
@@ -16,8 +16,9 @@ export class WebGlSwapChain implements ISwapChain {
|
|
|
16
16
|
* The WebGLSwapChain constructor.
|
|
17
17
|
* @param canvas The HTML canvas element that the swap chain will use for rendering.
|
|
18
18
|
* @param graphicsDevice The graphics device.
|
|
19
|
+
* @param srgb Prefer use of
|
|
19
20
|
*/
|
|
20
|
-
public constructor(canvas: HTMLCanvasElement, graphicsDevice: IGraphicsDevice) {
|
|
21
|
+
public constructor(canvas: HTMLCanvasElement, graphicsDevice: IGraphicsDevice, srgb = true) {
|
|
21
22
|
this._canvas = canvas;
|
|
22
23
|
this._graphicsDevice = graphicsDevice as WebGlGraphicsDevice;
|
|
23
24
|
this._backBufferSize = vec2.fromValues(this._canvas.width, this._canvas.height);
|
|
@@ -25,13 +26,13 @@ export class WebGlSwapChain implements ISwapChain {
|
|
|
25
26
|
this._backBufferSize[0] = this._canvas.width;
|
|
26
27
|
this._backBufferSize[1] = this._canvas.height;
|
|
27
28
|
});
|
|
28
|
-
}
|
|
29
29
|
|
|
30
|
+
// Nothing else to do. Typically, framebuffer should be srgb, but that is already handled through canvas.
|
|
31
|
+
this.textureFormat = srgb ? TextureFormat.RGBA_8_UNORM_SRGB : TextureFormat.RGBA_8_UNORM;
|
|
32
|
+
}
|
|
30
33
|
|
|
31
34
|
/** @inheritdoc */
|
|
32
|
-
public
|
|
33
|
-
return TextureFormat.RGBA_8_UNORM;
|
|
34
|
-
}
|
|
35
|
+
public readonly textureFormat: TextureFormat;
|
|
35
36
|
|
|
36
37
|
/** @inheritdoc */
|
|
37
38
|
public get backBufferSize(): vec2 {
|
|
@@ -107,16 +107,19 @@ export class WebGlTexture2D extends ATexture2D {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
/** One default texture per framework, so a new framework (and GL context) never gets a texture of an old one. */
|
|
111
|
+
private static readonly _defaultFilled = new WeakMap<IFramework, WebGlTexture2D>();
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* Creates a default 1x1 white texture if it doesn't already exist and returns it.
|
|
114
115
|
* This can be used as a placeholder texture when a texture is expected but not available.
|
|
115
116
|
* @param framework The framework instance.
|
|
117
|
+
* The texture belongs to that framework's GL context; each framework gets its own.
|
|
116
118
|
* @returns The default 1x1 white texture.
|
|
117
119
|
*/
|
|
118
120
|
public static getOrCreateDefault(framework: IFramework): WebGlTexture2D {
|
|
119
|
-
|
|
121
|
+
let texture = WebGlTexture2D._defaultFilled.get(framework);
|
|
122
|
+
if (!texture || texture.state === State.DISPOSED) {
|
|
120
123
|
|
|
121
124
|
const desc = new TextureDescriptor();
|
|
122
125
|
desc.width = 1;
|
|
@@ -125,11 +128,22 @@ export class WebGlTexture2D extends ATexture2D {
|
|
|
125
128
|
desc.textureFormat = framework.renderer.preferredTextureFormat;
|
|
126
129
|
desc.label = "RisDefaultFilledTexture";
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
texture = new WebGlTexture2D(framework, desc);
|
|
132
|
+
texture.initialize();
|
|
133
|
+
WebGlTexture2D._defaultFilled.set(framework, texture);
|
|
130
134
|
}
|
|
131
135
|
|
|
132
|
-
return
|
|
136
|
+
return texture;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Disposes and forgets the default texture of a framework. Called from `Framework.dispose()`.
|
|
141
|
+
* @param framework The framework instance.
|
|
142
|
+
*/
|
|
143
|
+
public static disposeDefault(framework: IFramework): void {
|
|
144
|
+
const texture = WebGlTexture2D._defaultFilled.get(framework);
|
|
145
|
+
WebGlTexture2D._defaultFilled.delete(framework);
|
|
146
|
+
texture?.dispose();
|
|
133
147
|
}
|
|
134
148
|
|
|
135
149
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
TextureUtilities
|
|
10
10
|
} from "../../api/index.ts"
|
|
11
11
|
import {WebGlTexture2D} from "./WebGlTexture2D.ts";
|
|
12
|
-
import {type IKtx2Texture, KtxTranscodeFlags, KtxTranscodeFormat,
|
|
12
|
+
import {type IKtx2Texture, KtxTranscodeFlags, KtxTranscodeFormat, VkFormat} from "ris-ktx2";
|
|
13
13
|
import {vec2} from "gl-matrix";
|
|
14
14
|
|
|
15
15
|
export class WebGlTextureFactory implements ITextureFactory {
|
|
@@ -31,13 +31,13 @@ export class WebGlTextureFactory implements ITextureFactory {
|
|
|
31
31
|
let transcodeFormat = KtxTranscodeFormat.NO_SELECTION;
|
|
32
32
|
let textureFormat = descriptor.textureFormat;
|
|
33
33
|
const gpuFeatures = this._framework.graphicsDevice.features;
|
|
34
|
-
let texFormatInfo: TextureFormatInfo | null = null;
|
|
35
34
|
|
|
36
35
|
if (ktxTexture.needsTranscoding && vkFormat == VkFormat.UNDEFINED)
|
|
37
36
|
{
|
|
38
37
|
// If descriptor format is UNDEFINED, we will use format according to the GPU features.
|
|
39
38
|
if(descriptor.textureFormat == TextureFormat.UNDEFINED)
|
|
40
39
|
{
|
|
40
|
+
// BC7 needs BPTC (supportsTextureCompressionBC), BC3 needs S3TC.
|
|
41
41
|
if(gpuFeatures.supportsTextureCompressionBC)
|
|
42
42
|
{
|
|
43
43
|
transcodeFormat = KtxTranscodeFormat.BC7_RGBA;
|
|
@@ -46,7 +46,7 @@ export class WebGlTextureFactory implements ITextureFactory {
|
|
|
46
46
|
else if(gpuFeatures.supportsTextureCompressionASTC)
|
|
47
47
|
{
|
|
48
48
|
transcodeFormat = KtxTranscodeFormat.ASTC_4X4_RGBA;
|
|
49
|
-
textureFormat = TextureFormat.
|
|
49
|
+
textureFormat = TextureFormat.ASTC_4X4_RGBA_UNORM
|
|
50
50
|
}
|
|
51
51
|
else if(gpuFeatures.supportsTextureCompressionS3TC)
|
|
52
52
|
{
|
|
@@ -58,6 +58,16 @@ export class WebGlTextureFactory implements ITextureFactory {
|
|
|
58
58
|
transcodeFormat = KtxTranscodeFormat.ETC2_RGBA;
|
|
59
59
|
textureFormat = TextureFormat.ETC2_RGBA8_UNORM;
|
|
60
60
|
}
|
|
61
|
+
else if(gpuFeatures.supportsTextureCompressionPVRTC)
|
|
62
|
+
{
|
|
63
|
+
transcodeFormat = KtxTranscodeFormat.PVRTC1_4_RGBA;
|
|
64
|
+
textureFormat = TextureFormat.PVRTC_4BPPV1_RGBA;
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
{
|
|
68
|
+
transcodeFormat = KtxTranscodeFormat.RGBA32;
|
|
69
|
+
textureFormat = TextureFormat.RGBA_8_UNORM;
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
72
|
else
|
|
63
73
|
{
|
|
@@ -65,12 +75,23 @@ export class WebGlTextureFactory implements ITextureFactory {
|
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
ktxTexture.transcodeBasis(transcodeFormat, KtxTranscodeFlags.HIGH_QUALITY);
|
|
68
|
-
|
|
78
|
+
|
|
79
|
+
// After transcoding, libktx reports the sRGB vkFormat when the file's DFD transfer function is sRGB.
|
|
80
|
+
if (descriptor.textureFormat == TextureFormat.UNDEFINED && WebGlTextureFactory._isSrgbVkFormat(ktxTexture.vkFormat))
|
|
81
|
+
{
|
|
82
|
+
textureFormat = TextureUtilities.toSrgbFormat(textureFormat);
|
|
83
|
+
}
|
|
69
84
|
}
|
|
70
85
|
else {
|
|
71
|
-
// No transcoding path,
|
|
86
|
+
// No transcoding path, the vkFormat already says linear or sRGB.
|
|
72
87
|
textureFormat = TextureUtilities.convertVkFormatToTextureFormat(vkFormat);
|
|
73
|
-
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
textureFormat = this._ensureSrgbSupported(textureFormat, ktxTexture.filePath);
|
|
91
|
+
|
|
92
|
+
const blockSize = TextureUtilities.getBlockSize(textureFormat);
|
|
93
|
+
if (!blockSize) {
|
|
94
|
+
throw new Error(`Unknown block size for texture format ${textureFormat}.`);
|
|
74
95
|
}
|
|
75
96
|
|
|
76
97
|
const data: Uint8Array[] = [];
|
|
@@ -85,13 +106,34 @@ export class WebGlTextureFactory implements ITextureFactory {
|
|
|
85
106
|
textureDescriptor.data = data;
|
|
86
107
|
textureDescriptor.textureFormat = textureFormat;
|
|
87
108
|
textureDescriptor.generateMipmaps = descriptor.generateMipmaps;
|
|
88
|
-
textureDescriptor.blockSize = vec2.fromValues(
|
|
109
|
+
textureDescriptor.blockSize = vec2.fromValues(blockSize[0], blockSize[1]);
|
|
89
110
|
|
|
90
111
|
const texture = new WebGlTexture2D(this._framework, textureDescriptor);
|
|
91
112
|
texture.initialize();
|
|
92
113
|
return texture;
|
|
93
114
|
}
|
|
94
115
|
|
|
116
|
+
/** Whether the Vulkan format is an sRGB format. */
|
|
117
|
+
private static _isSrgbVkFormat(vkFormat: VkFormat): boolean {
|
|
118
|
+
const name = (VkFormat as unknown as Record<number, string>)[vkFormat];
|
|
119
|
+
return typeof name === "string" && name.includes("_SRGB");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Falls back to the linear variant (with a warning) when the GPU cannot sample the sRGB format.
|
|
124
|
+
* Only S3TC sRGB (BC1/BC3) has its own WebGL extension; BC7, ETC2 and ASTC sRGB ship with their base extension.
|
|
125
|
+
*/
|
|
126
|
+
private _ensureSrgbSupported(textureFormat: TextureFormat, source?: string): TextureFormat {
|
|
127
|
+
const isS3tcSrgb = textureFormat === TextureFormat.BC3_RGBA_SRGB || textureFormat === TextureFormat.BC1_RGB_SRGB;
|
|
128
|
+
if (isS3tcSrgb && !this._framework.graphicsDevice.features.supportsTextureCompressionS3TCSrgb) {
|
|
129
|
+
const linear = TextureUtilities.toLinearFormat(textureFormat);
|
|
130
|
+
console.warn(`sRGB S3TC is not supported (WEBGL_compressed_texture_s3tc_srgb missing); ` +
|
|
131
|
+
`loading ${source ?? "texture"} as ${linear}. Colours will look washed out.`);
|
|
132
|
+
return linear;
|
|
133
|
+
}
|
|
134
|
+
return textureFormat;
|
|
135
|
+
}
|
|
136
|
+
|
|
95
137
|
/** @inheritdoc */
|
|
96
138
|
public create(
|
|
97
139
|
width: number, height: number,
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGL extension constants that WebGL2RenderingContext does not expose.
|
|
3
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
|
|
4
|
+
*/
|
|
5
|
+
export class WebGlConstants {
|
|
6
|
+
|
|
7
|
+
/** BC1 RGB */
|
|
8
|
+
public static readonly GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
|
9
|
+
|
|
10
|
+
/** BC1 RGB sRGB (WEBGL_compressed_texture_s3tc_srgb) */
|
|
11
|
+
public static readonly GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
|
|
12
|
+
|
|
13
|
+
/** BC3 sRGB (WEBGL_compressed_texture_s3tc_srgb) */
|
|
14
|
+
public static readonly GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
|
|
15
|
+
|
|
16
|
+
/** BC7 sRGB (EXT_texture_compression_bptc) */
|
|
17
|
+
public static readonly GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D;
|
|
18
|
+
|
|
19
|
+
/** ETC2 RGB8 */
|
|
20
|
+
public static readonly GL_COMPRESSED_RGB8_ETC2 = 0x9274;
|
|
21
|
+
|
|
22
|
+
/** ETC2 RGB8 sRGB */
|
|
23
|
+
public static readonly GL_COMPRESSED_SRGB8_ETC2 = 0x9275;
|
|
24
|
+
|
|
25
|
+
/** ETC2 RGBA8 sRGB */
|
|
26
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
|
|
27
|
+
|
|
28
|
+
/** BC3 */
|
|
29
|
+
public static readonly GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
|
30
|
+
|
|
31
|
+
/** BC7 */
|
|
32
|
+
public static readonly GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C;
|
|
33
|
+
|
|
34
|
+
/** ETC2 */
|
|
35
|
+
public static readonly GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
|
|
36
|
+
|
|
37
|
+
// ASTC (WEBGL_compressed_texture_astc).
|
|
38
|
+
|
|
39
|
+
/** ASTC 4x4 */
|
|
40
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
|
41
|
+
|
|
42
|
+
/** ASTC 4x4 sRGB */
|
|
43
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
|
|
44
|
+
|
|
45
|
+
/** ASTC 5x4 */
|
|
46
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
|
|
47
|
+
|
|
48
|
+
/** ASTC 5x4 sRGB */
|
|
49
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
|
|
50
|
+
|
|
51
|
+
/** ASTC 5x5 */
|
|
52
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
|
|
53
|
+
|
|
54
|
+
/** ASTC 5x5 sRGB */
|
|
55
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
|
|
56
|
+
|
|
57
|
+
/** ASTC 6x5 */
|
|
58
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
|
|
59
|
+
|
|
60
|
+
/** ASTC 6x5 sRGB */
|
|
61
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
|
|
62
|
+
|
|
63
|
+
/** ASTC 6x6 */
|
|
64
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
|
|
65
|
+
|
|
66
|
+
/** ASTC 6x6 sRGB */
|
|
67
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
|
|
68
|
+
|
|
69
|
+
/** ASTC 8x5 */
|
|
70
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
|
|
71
|
+
|
|
72
|
+
/** ASTC 8x5 sRGB */
|
|
73
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
|
|
74
|
+
|
|
75
|
+
/** ASTC 8x6 */
|
|
76
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
|
|
77
|
+
|
|
78
|
+
/** ASTC 8x6 sRGB */
|
|
79
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
|
|
80
|
+
|
|
81
|
+
/** ASTC 8x8 */
|
|
82
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
|
|
83
|
+
|
|
84
|
+
/** ASTC 8x8 sRGB */
|
|
85
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
|
|
86
|
+
|
|
87
|
+
/** ASTC 10x5 */
|
|
88
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
|
|
89
|
+
|
|
90
|
+
/** ASTC 10x5 sRGB */
|
|
91
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
|
|
92
|
+
|
|
93
|
+
/** ASTC 10x6 */
|
|
94
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
|
|
95
|
+
|
|
96
|
+
/** ASTC 10x6 sRGB */
|
|
97
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
|
|
98
|
+
|
|
99
|
+
/** ASTC 10x8 */
|
|
100
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
|
|
101
|
+
|
|
102
|
+
/** ASTC 10x8 sRGB */
|
|
103
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
|
|
104
|
+
|
|
105
|
+
/** ASTC 10x10 */
|
|
106
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
|
|
107
|
+
|
|
108
|
+
/** ASTC 10x10 sRGB */
|
|
109
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
|
|
110
|
+
|
|
111
|
+
/** ASTC 12x10 */
|
|
112
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
|
|
113
|
+
|
|
114
|
+
/** ASTC 12x10 sRGB */
|
|
115
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
|
|
116
|
+
|
|
117
|
+
/** ASTC 12x12 */
|
|
118
|
+
public static readonly GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
|
|
119
|
+
|
|
120
|
+
/** ASTC 12x12 sRGB */
|
|
121
|
+
public static readonly GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
|
|
122
|
+
|
|
123
|
+
// PVRTC (WEBGL_compressed_texture_pvrtc).
|
|
124
|
+
|
|
125
|
+
/** PVRTC 4 bits per pixel, RGB */
|
|
126
|
+
public static readonly GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
|
|
127
|
+
|
|
128
|
+
/** PVRTC 2 bits per pixel, RGB */
|
|
129
|
+
public static readonly GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
|
|
130
|
+
|
|
131
|
+
/** PVRTC 4 bits per pixel, RGBA */
|
|
132
|
+
public static readonly GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
|
|
133
|
+
|
|
134
|
+
/** PVRTC 2 bits per pixel, RGBA */
|
|
135
|
+
public static readonly GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
|
|
136
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {WebGlConstants} from "./WebGlConstants.ts";
|
|
1
2
|
import {Culling} from "../../api/rendering/enums.ts";
|
|
2
3
|
import {BlendFactor, BlendOperation} from "../../core/rendering/blending/enums";
|
|
3
4
|
import {VertexFormat} from "../../api/geometry/VertexFormat.ts";
|
|
@@ -14,20 +15,6 @@ import {
|
|
|
14
15
|
|
|
15
16
|
export class WebGlConverter {
|
|
16
17
|
|
|
17
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
|
|
18
|
-
|
|
19
|
-
/** BC3 */
|
|
20
|
-
private static GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
|
21
|
-
|
|
22
|
-
/** BC7 */
|
|
23
|
-
private static GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** ETC2 */
|
|
27
|
-
private static GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
|
|
28
|
-
|
|
29
|
-
private static GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
|
30
|
-
|
|
31
18
|
/**
|
|
32
19
|
* Converts PrimitiveTopology to WebGL enum.
|
|
33
20
|
* @param topology The PrimitiveTopology.
|
|
@@ -65,7 +52,8 @@ export class WebGlConverter {
|
|
|
65
52
|
return WebGL2RenderingContext.BACK;
|
|
66
53
|
case CullMode.FRONT:
|
|
67
54
|
return WebGL2RenderingContext.FRONT;
|
|
68
|
-
default:
|
|
55
|
+
default:
|
|
56
|
+
throw new Error("Method not implemented.");
|
|
69
57
|
}
|
|
70
58
|
|
|
71
59
|
}
|
|
@@ -95,13 +83,13 @@ export class WebGlConverter {
|
|
|
95
83
|
|
|
96
84
|
let bufferUsage: number = WebGL2RenderingContext.STATIC_DRAW;
|
|
97
85
|
|
|
98
|
-
if((usage & BufferUsage.COPY_DST) == BufferUsage.COPY_DST)
|
|
99
|
-
{
|
|
86
|
+
if ((usage & BufferUsage.COPY_DST) == BufferUsage.COPY_DST) {
|
|
100
87
|
bufferUsage = WebGL2RenderingContext.DYNAMIC_DRAW;
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
return bufferUsage;
|
|
104
91
|
}
|
|
92
|
+
|
|
105
93
|
/**
|
|
106
94
|
* Converts BlendOperation to WebGL enum.
|
|
107
95
|
* @param gl The WebGL2RenderingContext.
|
|
@@ -195,13 +183,94 @@ export class WebGlConverter {
|
|
|
195
183
|
case TextureFormat.DEPTH_24_STENCIL_8:
|
|
196
184
|
return gl.DEPTH24_STENCIL8;
|
|
197
185
|
case TextureFormat.BC3_RGBA_UNORM:
|
|
198
|
-
return
|
|
186
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
199
187
|
case TextureFormat.ETC2_RGBA8_UNORM:
|
|
200
|
-
return
|
|
188
|
+
return WebGlConstants.GL_COMPRESSED_RGBA8_ETC2_EAC;
|
|
201
189
|
case TextureFormat.BC7_RGBA_UNORM:
|
|
202
|
-
return
|
|
203
|
-
case TextureFormat.
|
|
204
|
-
return
|
|
190
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_BPTC_UNORM;
|
|
191
|
+
case TextureFormat.BC7_RGBA_SRGB:
|
|
192
|
+
return WebGlConstants.GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
|
|
193
|
+
case TextureFormat.BC3_RGBA_SRGB:
|
|
194
|
+
return WebGlConstants.GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
|
|
195
|
+
case TextureFormat.BC1_RGB_UNORM:
|
|
196
|
+
return WebGlConstants.GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
197
|
+
case TextureFormat.BC1_RGB_SRGB:
|
|
198
|
+
return WebGlConstants.GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
|
|
199
|
+
case TextureFormat.ETC2_RGBA8_SRGB:
|
|
200
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
|
|
201
|
+
case TextureFormat.ETC2_RGB8_UNORM:
|
|
202
|
+
return WebGlConstants.GL_COMPRESSED_RGB8_ETC2;
|
|
203
|
+
case TextureFormat.ETC2_RGB8_SRGB:
|
|
204
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ETC2;
|
|
205
|
+
|
|
206
|
+
// ASTC
|
|
207
|
+
case TextureFormat.ASTC_4X4_RGBA_UNORM:
|
|
208
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
209
|
+
case TextureFormat.ASTC_4X4_RGBA_SRGB:
|
|
210
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
|
|
211
|
+
case TextureFormat.ASTC_5X4_RGBA_UNORM:
|
|
212
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
213
|
+
case TextureFormat.ASTC_5X4_RGBA_SRGB:
|
|
214
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
|
|
215
|
+
case TextureFormat.ASTC_5X5_RGBA_UNORM:
|
|
216
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
217
|
+
case TextureFormat.ASTC_5X5_RGBA_SRGB:
|
|
218
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
|
|
219
|
+
case TextureFormat.ASTC_6X5_RGBA_UNORM:
|
|
220
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
221
|
+
case TextureFormat.ASTC_6X5_RGBA_SRGB:
|
|
222
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
|
|
223
|
+
case TextureFormat.ASTC_6X6_RGBA_UNORM:
|
|
224
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
225
|
+
case TextureFormat.ASTC_6X6_RGBA_SRGB:
|
|
226
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
|
|
227
|
+
case TextureFormat.ASTC_8X5_RGBA_UNORM:
|
|
228
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
229
|
+
case TextureFormat.ASTC_8X5_RGBA_SRGB:
|
|
230
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
|
|
231
|
+
case TextureFormat.ASTC_8X6_RGBA_UNORM:
|
|
232
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
233
|
+
case TextureFormat.ASTC_8X6_RGBA_SRGB:
|
|
234
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
|
|
235
|
+
case TextureFormat.ASTC_8X8_RGBA_UNORM:
|
|
236
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
237
|
+
case TextureFormat.ASTC_8X8_RGBA_SRGB:
|
|
238
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
|
|
239
|
+
case TextureFormat.ASTC_10X5_RGBA_UNORM:
|
|
240
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
241
|
+
case TextureFormat.ASTC_10X5_RGBA_SRGB:
|
|
242
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
|
|
243
|
+
case TextureFormat.ASTC_10X6_RGBA_UNORM:
|
|
244
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
245
|
+
case TextureFormat.ASTC_10X6_RGBA_SRGB:
|
|
246
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
|
|
247
|
+
case TextureFormat.ASTC_10X8_RGBA_UNORM:
|
|
248
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
249
|
+
case TextureFormat.ASTC_10X8_RGBA_SRGB:
|
|
250
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
|
|
251
|
+
case TextureFormat.ASTC_10X10_RGBA_UNORM:
|
|
252
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
253
|
+
case TextureFormat.ASTC_10X10_RGBA_SRGB:
|
|
254
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
|
|
255
|
+
case TextureFormat.ASTC_12X10_RGBA_UNORM:
|
|
256
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
257
|
+
case TextureFormat.ASTC_12X10_RGBA_SRGB:
|
|
258
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
|
|
259
|
+
case TextureFormat.ASTC_12X12_RGBA_UNORM:
|
|
260
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
|
|
261
|
+
case TextureFormat.ASTC_12X12_RGBA_SRGB:
|
|
262
|
+
return WebGlConstants.GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
|
|
263
|
+
|
|
264
|
+
// PVRTC
|
|
265
|
+
case TextureFormat.PVRTC_4BPPV1_RGBA:
|
|
266
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
267
|
+
case TextureFormat.PVRTC_4BPPV1_RGB:
|
|
268
|
+
return WebGlConstants.GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
269
|
+
|
|
270
|
+
case TextureFormat.PVRTC_2BPPV1_RGBA:
|
|
271
|
+
return WebGlConstants.GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
272
|
+
case TextureFormat.PVRTC_2BPPV1_RGB:
|
|
273
|
+
return WebGlConstants.GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
205
274
|
|
|
206
275
|
default:
|
|
207
276
|
throw new Error("NotImplementedException");
|