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,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ICameraMaterial } from "./ICameraMaterial.js";
|
|
2
|
+
import type { IRenderableMesh } from "../meshes/IRenderableMesh.js";
|
|
2
3
|
import type { ITexture2D } from "../rendering/texture/ITexture2D.js";
|
|
3
4
|
import type { ISampler } from "../rendering/sampler/ISampler.js";
|
|
4
|
-
import { mat4 } from "gl-matrix";
|
|
5
5
|
import { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
6
6
|
import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
|
|
7
7
|
import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
|
|
@@ -9,33 +9,49 @@ import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
|
|
|
9
9
|
import type { IFramework } from "../IFramework.js";
|
|
10
10
|
import { Color } from "../data/Color.js";
|
|
11
11
|
import type { IPrimitiveState } from "../rendering/primitive/IPrimitiveState.js";
|
|
12
|
+
import type { ICamera } from "../camera/ICamera.js";
|
|
12
13
|
/** The additional material config options */
|
|
13
14
|
export declare class UnlitMaterialDescriptor {
|
|
14
15
|
/** The primitive state. */
|
|
15
16
|
primitiveState?: IPrimitiveState;
|
|
16
|
-
/** The
|
|
17
|
-
|
|
17
|
+
/** The camera used to render this material. */
|
|
18
|
+
camera?: ICamera;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Unlit material.
|
|
21
22
|
*/
|
|
22
|
-
export declare class UnlitMaterial {
|
|
23
|
+
export declare class UnlitMaterial implements ICameraMaterial {
|
|
23
24
|
private readonly _framework;
|
|
24
25
|
private _color;
|
|
25
26
|
private _materialData;
|
|
26
|
-
|
|
27
|
+
/** Created when the model buffer is assigned (the pipeline requires one). */
|
|
28
|
+
private _pipeline?;
|
|
29
|
+
private readonly _primitiveState?;
|
|
30
|
+
/** Texture and sampler set before the pipeline exists; applied when it is created. */
|
|
31
|
+
private _pendingTexture?;
|
|
32
|
+
private _pendingSampler?;
|
|
33
|
+
private _samplerSet;
|
|
27
34
|
private _projectionViewBuffer;
|
|
28
35
|
/** False when the projection view buffer came from the descriptor. The caller owns that one. */
|
|
29
|
-
private
|
|
36
|
+
private _ownsProjectionViewBuffer;
|
|
37
|
+
private _camera?;
|
|
30
38
|
private _materialBuffer;
|
|
31
|
-
private _modelBuffer
|
|
32
|
-
private _previousModelMatrix;
|
|
39
|
+
private _modelBuffer?;
|
|
33
40
|
/**
|
|
34
41
|
* The constructor.
|
|
35
42
|
* @param framework The framework.
|
|
36
43
|
* @param config The optional material descriptor. A projection view buffer passed here is shared and is not disposed by this material.
|
|
37
44
|
*/
|
|
38
45
|
constructor(framework: IFramework, config?: UnlitMaterialDescriptor);
|
|
46
|
+
/** Creates the pipeline with the current bindings. */
|
|
47
|
+
private _createPipeline;
|
|
48
|
+
/**
|
|
49
|
+
* The camera. Setting it binds the camera's projection view buffer to the pipeline
|
|
50
|
+
* (the material's own placeholder buffer is disposed). Setting undefined keeps the last bound buffer.
|
|
51
|
+
*/
|
|
52
|
+
get camera(): ICamera | undefined;
|
|
53
|
+
/** @inheritDoc */
|
|
54
|
+
set camera(camera: ICamera | undefined);
|
|
39
55
|
/**
|
|
40
56
|
* The diffuse color.
|
|
41
57
|
*/
|
|
@@ -57,9 +73,12 @@ export declare class UnlitMaterial {
|
|
|
57
73
|
*/
|
|
58
74
|
set diffuseTextureSampler(value: ISampler | undefined);
|
|
59
75
|
/**
|
|
60
|
-
* The model
|
|
76
|
+
* The model buffer (std140 `mat4`). Owned by the mesh, which assigns it before drawing; never disposed by this material.
|
|
77
|
+
* Undefined until assigned: rendering without one throws.
|
|
61
78
|
*/
|
|
62
|
-
|
|
79
|
+
get modelBuffer(): IUniformBuffer | undefined;
|
|
80
|
+
/** Binds the model buffer to the pipeline. */
|
|
81
|
+
set modelBuffer(value: IUniformBuffer | undefined);
|
|
63
82
|
/**
|
|
64
83
|
* The geometry format.
|
|
65
84
|
*/
|
|
@@ -67,9 +86,9 @@ export declare class UnlitMaterial {
|
|
|
67
86
|
/** @inheritDoc */
|
|
68
87
|
beforeRender(): void;
|
|
69
88
|
/** @inheritDoc */
|
|
70
|
-
renderMesh(mesh:
|
|
89
|
+
renderMesh(mesh: IRenderableMesh): void;
|
|
71
90
|
/** @inheritDoc */
|
|
72
|
-
render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer): void;
|
|
91
|
+
render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
|
|
73
92
|
/** @inheritDoc */
|
|
74
93
|
dispose(): void;
|
|
75
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnlitMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/UnlitMaterial.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnlitMaterial.d.ts","sourceRoot":"","sources":["../../../src/api/material/UnlitMaterial.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,5 +2,9 @@ export * from "./IMaterial.js";
|
|
|
2
2
|
export * from "./IMaterialFactory.js";
|
|
3
3
|
export * from "./InspectTextureMipsMaterial.js";
|
|
4
4
|
export * from "./MaterialFactory.js";
|
|
5
|
+
export * from "./SpriteMaterial.js";
|
|
5
6
|
export * from "./UnlitMaterial.js";
|
|
7
|
+
export * from "./ForwardBlinnPhongMaterial.js";
|
|
8
|
+
export * from "./ICameraMaterial.js";
|
|
9
|
+
export * from "./ILightsMaterial.js";
|
|
6
10
|
//# sourceMappingURL=_export.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_export.d.ts","sourceRoot":"","sources":["../../../src/api/material/_export.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"_export.d.ts","sourceRoot":"","sources":["../../../src/api/material/_export.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
|
|
2
2
|
import type { IDisposable } from "../core/IDisposable.js";
|
|
3
3
|
import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
|
|
4
|
+
import type { IGeometry } from "../geometry/IGeometry.js";
|
|
5
|
+
import type { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
6
|
+
import type { State } from "../data/State.js";
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
8
|
+
* A mesh: geometry and the vertex and index buffers created from it.
|
|
9
|
+
* It has no material and no transform; see {@link IRenderableMesh} for a mesh that can be drawn.
|
|
10
|
+
* @public
|
|
6
11
|
*/
|
|
7
12
|
export interface IMesh extends IDisposable {
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
/** The state of the mesh. */
|
|
14
|
+
readonly state: State;
|
|
15
|
+
/** The positions, when set through `setMesh`. */
|
|
16
|
+
readonly positions?: number[];
|
|
17
|
+
/** The colors, when set through `setMesh`. */
|
|
18
|
+
readonly colors?: number[];
|
|
19
|
+
/** The texture coordinates, when set through `setMesh`. */
|
|
20
|
+
readonly textureCoords?: number[];
|
|
21
|
+
/** The normals, when set through `setMesh`. */
|
|
22
|
+
readonly normals?: number[];
|
|
23
|
+
/** The indices, when set through `setMesh`. */
|
|
24
|
+
readonly indices?: number[];
|
|
25
|
+
/** The geometry the buffers were created from with `setGeometry`, if any. */
|
|
26
|
+
readonly geometry?: IGeometry;
|
|
27
|
+
/** The vertex buffer, if created. */
|
|
11
28
|
readonly vertexBuffer?: IVertexBuffer;
|
|
29
|
+
/** The index buffer, if created. */
|
|
30
|
+
readonly indexBuffer?: IIndexBuffer;
|
|
31
|
+
/** Creates the buffers from the current data. */
|
|
32
|
+
initialize(): void;
|
|
12
33
|
/**
|
|
13
|
-
*
|
|
34
|
+
* Creates the vertex and index buffers from a geometry.
|
|
35
|
+
* @param geometry The geometry.
|
|
36
|
+
* @param geometryFormat The vertex layout.
|
|
14
37
|
*/
|
|
15
|
-
|
|
38
|
+
setGeometry(geometry: IGeometry, geometryFormat?: GeometryFormat): void;
|
|
39
|
+
/** Re-creates (or updates) the buffers from the current data. */
|
|
40
|
+
applyChanges(): void;
|
|
16
41
|
}
|
|
17
42
|
//# sourceMappingURL=IMesh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/IMesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"IMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/IMesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,KAAM,SAAQ,WAAW;IAEtC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAEtB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B,2DAA2D;IAC3D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAElC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAE9B,qCAAqC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IAEtC,oCAAoC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IAEpC,iDAAiD;IACjD,UAAU,IAAI,IAAI,CAAC;IAEnB;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAExE,iEAAiE;IACjE,YAAY,IAAI,IAAI,CAAC;CACxB"}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
|
+
import type { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
1
2
|
import type { IGeometry } from "../geometry/IGeometry.js";
|
|
2
|
-
import { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
3
3
|
import { QuadMesh } from "./QuadMesh.js";
|
|
4
4
|
import { vec2 } from "gl-matrix";
|
|
5
5
|
import type { IMesh } from "./IMesh.js";
|
|
6
|
+
import type { IMaterial } from "../material/IMaterial.js";
|
|
7
|
+
import type { IRenderableMesh } from "./IRenderableMesh.js";
|
|
8
|
+
/** Describes one submesh: a material and the index range it draws. */
|
|
9
|
+
export interface SubMeshDescriptor {
|
|
10
|
+
/** The material. */
|
|
11
|
+
readonly material: IMaterial;
|
|
12
|
+
/** The first index of the range. */
|
|
13
|
+
readonly indexStart: number;
|
|
14
|
+
/** The number of indices in the range. */
|
|
15
|
+
readonly indexCount: number;
|
|
16
|
+
}
|
|
6
17
|
/**
|
|
7
18
|
* The mesh factory.
|
|
8
19
|
*/
|
|
9
20
|
export interface IMeshFactory {
|
|
10
21
|
/**
|
|
11
|
-
* Creates a mesh.
|
|
22
|
+
* Creates a plain mesh (buffers only, no material or transform) from a geometry.
|
|
23
|
+
* @param geometry - The geometry.
|
|
24
|
+
* @param geometryFormat - The vertex layout.
|
|
25
|
+
* @returns The mesh.
|
|
26
|
+
*/
|
|
27
|
+
createMesh(geometry: IGeometry, geometryFormat: GeometryFormat): IMesh;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a renderable mesh with one material. Add it to a scene with `scene.add(mesh)`.
|
|
30
|
+
* @param geometry - The geometry.
|
|
31
|
+
* @param material - The material.
|
|
32
|
+
* @returns The mesh.
|
|
33
|
+
*/
|
|
34
|
+
create(geometry: IGeometry, material: IMaterial): IRenderableMesh;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a mesh made of submeshes that share one vertex and one index buffer.
|
|
37
|
+
* The root mesh has no material; `mesh.render()` draws its submeshes. Add the root to a scene with `scene.add(mesh)`.
|
|
12
38
|
* @param geometry - The geometry.
|
|
13
|
-
* @param
|
|
39
|
+
* @param subMeshes - One entry per submesh. All materials must use the same geometry format.
|
|
14
40
|
* @returns The mesh.
|
|
15
41
|
*/
|
|
16
|
-
|
|
42
|
+
createWithSubMeshes(geometry: IGeometry, subMeshes: SubMeshDescriptor[]): IRenderableMesh;
|
|
17
43
|
/**
|
|
18
44
|
* Creates the quad mesh.
|
|
19
45
|
* @param isUpdatable - Should mesh be updated after creation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IMeshFactory.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/IMeshFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"IMeshFactory.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/IMeshFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAC9B,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAEzB;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC;IAEvE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,eAAe,CAAC;IAElE;;;;;;OAMG;IACH,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,eAAe,CAAC;IAE1F;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;CAChE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { mat4, vec3 } from "gl-matrix";
|
|
2
|
+
import type { IMesh } from "./IMesh.js";
|
|
3
|
+
import type { IMaterial } from "../material/IMaterial.js";
|
|
4
|
+
import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
|
|
5
|
+
/**
|
|
6
|
+
* A mesh that can be drawn: a mesh plus an optional material, an index range and sub meshes.
|
|
7
|
+
*
|
|
8
|
+
* - A root mesh owns the vertex and index buffers. Sub meshes share them and only store their index range.
|
|
9
|
+
* - Rendering: a mesh with a material draws its range, then its sub meshes draw theirs.
|
|
10
|
+
* A root without a material only draws its sub meshes.
|
|
11
|
+
* - The transform (position, rotation, scale) and the model buffer live on the root and are shared by all sub meshes,
|
|
12
|
+
* so a mesh uploads its model matrix once per change, whatever the number of materials.
|
|
13
|
+
* - Disposing the root disposes the sub meshes and the buffers once. Materials are not disposed by the mesh
|
|
14
|
+
* (a `SceneMesh` does that).
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface IRenderableMesh extends IMesh {
|
|
18
|
+
/** The material, if any. A root mesh made only of sub meshes has none. */
|
|
19
|
+
material?: IMaterial;
|
|
20
|
+
/** The parent for a sub mesh; undefined for a root mesh. */
|
|
21
|
+
readonly parent?: IRenderableMesh;
|
|
22
|
+
/** The sub meshes. */
|
|
23
|
+
readonly subMeshes: readonly IRenderableMesh[];
|
|
24
|
+
/** First index of the range to draw. Defaults to 0. */
|
|
25
|
+
readonly indexStart: number;
|
|
26
|
+
/** Number of indices to draw; -1 (the default) draws all indices. */
|
|
27
|
+
readonly indexCount: number;
|
|
28
|
+
/** World position. Defaults to the origin. In-place edits are detected. A sub mesh uses the root's. */
|
|
29
|
+
position: vec3;
|
|
30
|
+
/**
|
|
31
|
+
* Euler rotation in radians, applied in Y, X, Z order (yaw, pitch, roll): `R = Ry * Rx * Rz`.
|
|
32
|
+
* Defaults to (0, 0, 0). In-place edits are detected. A sub mesh uses the root's.
|
|
33
|
+
*/
|
|
34
|
+
rotation: vec3;
|
|
35
|
+
/** Scale. Defaults to (1, 1, 1). In-place edits are detected. A sub mesh uses the root's. */
|
|
36
|
+
scale: vec3;
|
|
37
|
+
/** The model matrix `T * R * S`, recomputed only when position, rotation or scale changed. */
|
|
38
|
+
readonly modelMatrix: mat4;
|
|
39
|
+
/**
|
|
40
|
+
* The model buffer (std140 `mat4`) holding {@link modelMatrix}. Owned by the root mesh (sub meshes share it),
|
|
41
|
+
* uploaded when the transform changed and assigned to the material(s) before drawing. Created on first use.
|
|
42
|
+
*/
|
|
43
|
+
readonly modelBuffer: IUniformBuffer;
|
|
44
|
+
/** Draws the mesh's range with its material (if any), then the sub meshes. */
|
|
45
|
+
render(): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=IRenderableMesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRenderableMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/IRenderableMesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAE1C,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAElC,sBAAsB;IACtB,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAE/C,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,uGAAuG;IACvG,QAAQ,EAAE,IAAI,CAAC;IAEf;;;OAGG;IACH,QAAQ,EAAE,IAAI,CAAC;IAEf,6FAA6F;IAC7F,KAAK,EAAE,IAAI,CAAC;IAEZ,8FAA8F;IAC9F,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IAErC,8EAA8E;IAC9E,MAAM,IAAI,IAAI,CAAC;CAClB"}
|
|
@@ -8,10 +8,12 @@ import type { IFramework } from "../IFramework.js";
|
|
|
8
8
|
import type { IMesh } from "./IMesh.js";
|
|
9
9
|
import { BufferUsage } from "../rendering/buffers/BufferUsage.js";
|
|
10
10
|
import type { IGeometry } from "../geometry/IGeometry.js";
|
|
11
|
-
import { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
12
11
|
import { MeshParameters } from "./MeshParameters.js";
|
|
12
|
+
import type { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
13
13
|
/**
|
|
14
|
-
* The mesh.
|
|
14
|
+
* The base mesh: geometry and the vertex and index buffers created from it (C# `BaseMesh`).
|
|
15
|
+
* No material and no transform; {@link RenderableMesh} adds those.
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
18
|
export declare class Mesh implements IMesh {
|
|
17
19
|
protected readonly _framework: IFramework;
|
|
@@ -25,11 +27,16 @@ export declare class Mesh implements IMesh {
|
|
|
25
27
|
protected _normals?: number[];
|
|
26
28
|
protected _vertexBuffer?: IVertexBuffer;
|
|
27
29
|
protected _indexBuffer?: IIndexBuffer;
|
|
30
|
+
protected _geometry?: IGeometry;
|
|
28
31
|
/**
|
|
29
32
|
* The constructor.
|
|
30
|
-
* @param
|
|
33
|
+
* @param _framework The framework.
|
|
31
34
|
*/
|
|
32
|
-
constructor(
|
|
35
|
+
constructor(_framework: IFramework);
|
|
36
|
+
/** The geometry the buffers were created from with {@link setGeometry}, if any. */
|
|
37
|
+
get geometry(): IGeometry | undefined;
|
|
38
|
+
/** The geometry format used when {@link setGeometry} is called without one. Undefined for a plain mesh. */
|
|
39
|
+
protected get _defaultGeometryFormat(): GeometryFormat | undefined;
|
|
33
40
|
/**
|
|
34
41
|
* The state of a mesh.
|
|
35
42
|
*/
|
|
@@ -75,18 +82,17 @@ export declare class Mesh implements IMesh {
|
|
|
75
82
|
* Sets the mesh from a geometry.
|
|
76
83
|
*
|
|
77
84
|
* This will create vertex buffer and index buffer from geometry.
|
|
78
|
-
* Positions, Colors, TextureCoordinates and Normals will be ignored.
|
|
79
85
|
* @param geometry - The geometry.
|
|
80
|
-
* @param
|
|
86
|
+
* @param geometryFormat - The vertex layout. A `RenderableMesh` defaults to its material's geometry format.
|
|
81
87
|
*/
|
|
82
|
-
setGeometry(geometry: IGeometry,
|
|
88
|
+
setGeometry(geometry: IGeometry, geometryFormat?: GeometryFormat): void;
|
|
83
89
|
/**
|
|
84
90
|
* Sets the mesh from parameters.
|
|
85
91
|
* @param meshParameters - The parameters.
|
|
86
92
|
*/
|
|
87
93
|
setMesh(meshParameters: MeshParameters): void;
|
|
88
94
|
/**
|
|
89
|
-
*
|
|
95
|
+
* Disposes the vertex and index buffers.
|
|
90
96
|
*/
|
|
91
97
|
dispose(): void;
|
|
92
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/Mesh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Mesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/Mesh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AAChE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAElE;;;;GAIG;AACH,qBAAa,IAAK,YAAW,KAAK;IAkBX,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU;IAhB5D,SAAS,CAAC,YAAY,cAAsB;IAC5C,SAAS,CAAC,MAAM,QAAiB;IACjC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACxC,SAAS,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACtC,SAAS,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEhC;;;OAGG;gBACmC,UAAU,EAAE,UAAU;IAG5D,mFAAmF;IACnF,IAAW,QAAQ,IAAI,SAAS,GAAG,SAAS,CAE3C;IAED,2GAA2G;IAC3G,SAAS,KAAK,sBAAsB,IAAI,cAAc,GAAG,SAAS,CAEjE;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,KAAK,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,EAAE,GAAG,SAAS,CAE3C;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,MAAM,EAAE,GAAG,SAAS,CAEzC;IAED;;OAEG;IACH,IAAW,MAAM,IAAI,MAAM,EAAE,GAAG,SAAS,CAExC;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,MAAM,EAAE,GAAG,SAAS,CAE/C;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,MAAM,EAAE,GAAG,SAAS,CAEzC;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,aAAa,GAAG,SAAS,CAEnD;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,YAAY,GAAG,SAAS,CAEjD;IAED;;OAEG;IACI,UAAU,IAAI,IAAI;IAIzB,OAAO,CAAC,WAAW;IA2BnB;;OAEG;IACI,YAAY;IA2DnB;;;;;;OAMG;IACI,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IA+B9E;;;OAGG;IACI,OAAO,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAQpD;;OAEG;IACI,OAAO,IAAI,IAAI;CAOzB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { IRenderableMesh } from "./IRenderableMesh.js";
|
|
2
|
+
import type { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
1
3
|
import type { IMeshFactory } from "./IMeshFactory.js";
|
|
2
4
|
import type { IGeometry } from "../geometry/IGeometry.js";
|
|
3
|
-
import { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
4
5
|
import type { IMesh } from "./IMesh.js";
|
|
5
6
|
import { QuadMesh } from "./QuadMesh.js";
|
|
6
7
|
import type { IFramework } from "../IFramework.js";
|
|
7
8
|
import { vec2 } from "gl-matrix";
|
|
9
|
+
import type { IMaterial } from "../material/IMaterial.js";
|
|
10
|
+
import type { SubMeshDescriptor } from "./IMeshFactory.js";
|
|
8
11
|
/**
|
|
9
12
|
* The implementation of the mesh factory interface.
|
|
10
13
|
*/
|
|
@@ -16,8 +19,12 @@ export declare class MeshFactory implements IMeshFactory {
|
|
|
16
19
|
*/
|
|
17
20
|
constructor(_framework: IFramework);
|
|
18
21
|
/** @inheritDoc */
|
|
19
|
-
|
|
22
|
+
createMesh(geometry: IGeometry, geometryFormat: GeometryFormat): IMesh;
|
|
20
23
|
/** @inheritDoc */
|
|
21
|
-
|
|
24
|
+
create(geometry: IGeometry, material: IMaterial): IRenderableMesh;
|
|
25
|
+
/** @inheritDoc */
|
|
26
|
+
createWithSubMeshes(geometry: IGeometry, subMeshes: SubMeshDescriptor[]): IRenderableMesh;
|
|
27
|
+
/** @inheritDoc */
|
|
28
|
+
createQuadMesh(_isUpdatable: boolean, _scale?: vec2): QuadMesh;
|
|
22
29
|
}
|
|
23
30
|
//# sourceMappingURL=MeshFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MeshFactory.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/MeshFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MeshFactory.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/MeshFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;GAEG;AACH,qBAAa,WAAY,YAAW,YAAY;IAMzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ9C;;;OAGG;gBACiC,UAAU,EAAE,UAAU;IAG1D,kBAAkB;IACX,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,GAAG,KAAK;IAM7E,kBAAkB;IACX,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,eAAe;IAMxE,kBAAkB;IACX,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,eAAe;IAiBhG,kBAAkB;IACX,cAAc,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,QAAQ;CAUxE"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderableMesh } from "./RenderableMesh.js";
|
|
2
2
|
import { Rect } from "../data/Rect.js";
|
|
3
3
|
import type { IFramework } from "../IFramework.js";
|
|
4
4
|
import { vec2 } from "gl-matrix";
|
|
5
|
+
import type { IMaterial } from "../material/IMaterial.js";
|
|
5
6
|
/**
|
|
6
7
|
* The mesh of a quad.
|
|
7
8
|
*/
|
|
8
|
-
export declare class QuadMesh extends
|
|
9
|
+
export declare class QuadMesh extends RenderableMesh {
|
|
9
10
|
private _isUpdatable;
|
|
10
11
|
private readonly ELEMENTS_IN_VERTEX;
|
|
11
12
|
private readonly TEX_COORD_POS_S;
|
|
@@ -13,10 +14,11 @@ export declare class QuadMesh extends Mesh {
|
|
|
13
14
|
/**
|
|
14
15
|
* The constructor.
|
|
15
16
|
* @param framework The framework.
|
|
17
|
+
* @param material The material.
|
|
16
18
|
* @param _isUpdatable Makes mesh updatable.
|
|
17
19
|
* @param scale The scale factor for geometry. If not set, it is set to (1,1).
|
|
18
20
|
*/
|
|
19
|
-
constructor(framework: IFramework, _isUpdatable: boolean, scale?: vec2);
|
|
21
|
+
constructor(framework: IFramework, material: IMaterial, _isUpdatable: boolean, scale?: vec2);
|
|
20
22
|
/** @inheritDoc*/
|
|
21
23
|
initialize(): void;
|
|
22
24
|
/** @inheritDoc*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuadMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/QuadMesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"QuadMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/QuadMesh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAExD;;GAEG;AACH,qBAAa,QAAS,SAAQ,cAAc;IAauB,OAAO,CAAC,YAAY;IAXnF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAK;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;IACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;IAErC;;;;;;OAMG;gBACgB,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAU,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI;IA4C1G,iBAAiB;IACV,UAAU,IAAI,IAAI;IAKzB,iBAAiB;IACV,YAAY,IAAI,IAAI;IAS3B;;;;;;OAMG;IACI,mBAAmB,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI;CAetD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { mat4, vec3 } from "gl-matrix";
|
|
2
|
+
import { Mesh } from "./Mesh.js";
|
|
3
|
+
import type { IRenderableMesh } from "./IRenderableMesh.js";
|
|
4
|
+
import type { IFramework } from "../IFramework.js";
|
|
5
|
+
import type { IMaterial } from "../material/IMaterial.js";
|
|
6
|
+
import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
|
|
7
|
+
import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
|
|
8
|
+
import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
|
|
9
|
+
import type { GeometryFormat } from "../geometry/GeometryFormat.js";
|
|
10
|
+
/**
|
|
11
|
+
* A mesh that can be drawn (C# `RenderableMesh`). See {@link IRenderableMesh}.
|
|
12
|
+
*
|
|
13
|
+
* - Root: `new RenderableMesh(framework, material?)` owns the vertex and index buffers, the transform and the model buffer.
|
|
14
|
+
* - Sub mesh: `new RenderableMesh(framework, material, parent, indexStart, indexCount)` (or `parent.addSubMesh(...)`)
|
|
15
|
+
* shares the parent's buffers, transform and model buffer, and only stores its index range.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare class RenderableMesh extends Mesh implements IRenderableMesh {
|
|
19
|
+
private readonly _subMeshes;
|
|
20
|
+
private readonly _parent?;
|
|
21
|
+
private _position;
|
|
22
|
+
private _rotation;
|
|
23
|
+
private _scale;
|
|
24
|
+
private readonly _modelMatrix;
|
|
25
|
+
private readonly _rotationQuat;
|
|
26
|
+
private readonly _lastPosition;
|
|
27
|
+
private readonly _lastRotation;
|
|
28
|
+
private readonly _lastScale;
|
|
29
|
+
private _modelBuffer?;
|
|
30
|
+
/** The matrix last uploaded to the model buffer. */
|
|
31
|
+
private readonly _uploadedMatrix;
|
|
32
|
+
/** @inheritDoc */
|
|
33
|
+
material?: IMaterial;
|
|
34
|
+
/** @inheritDoc */
|
|
35
|
+
readonly indexStart: number;
|
|
36
|
+
/** @inheritDoc */
|
|
37
|
+
readonly indexCount: number;
|
|
38
|
+
/**
|
|
39
|
+
* The constructor.
|
|
40
|
+
* @param framework The framework.
|
|
41
|
+
* @param material The material. Optional for a root mesh drawn only through its sub meshes.
|
|
42
|
+
* @param parent The parent, for a sub mesh. A sub mesh shares the parent's buffers and transform and is added to `parent.subMeshes`.
|
|
43
|
+
* @param indexStart The first index of the range. Defaults to 0.
|
|
44
|
+
* @param indexCount The number of indices of the range. -1 (default) draws all indices.
|
|
45
|
+
*/
|
|
46
|
+
constructor(framework: IFramework, material?: IMaterial, parent?: RenderableMesh, indexStart?: number, indexCount?: number);
|
|
47
|
+
/** The root mesh: the one owning the buffers and the transform. */
|
|
48
|
+
private get _root();
|
|
49
|
+
/** @inheritDoc */
|
|
50
|
+
get parent(): RenderableMesh | undefined;
|
|
51
|
+
/** @inheritDoc */
|
|
52
|
+
get subMeshes(): readonly RenderableMesh[];
|
|
53
|
+
/**
|
|
54
|
+
* Adds a sub mesh that draws a range of this mesh's index buffer with its own material.
|
|
55
|
+
* @param material The material of the sub mesh.
|
|
56
|
+
* @param indexStart The first index of the range.
|
|
57
|
+
* @param indexCount The number of indices in the range; -1 draws all.
|
|
58
|
+
* @returns The sub mesh.
|
|
59
|
+
*/
|
|
60
|
+
addSubMesh(material: IMaterial | undefined, indexStart: number, indexCount: number): RenderableMesh;
|
|
61
|
+
/** The parent's vertex buffer for a sub mesh, else its own. */
|
|
62
|
+
get vertexBuffer(): IVertexBuffer | undefined;
|
|
63
|
+
/** The parent's index buffer for a sub mesh, else its own. */
|
|
64
|
+
get indexBuffer(): IIndexBuffer | undefined;
|
|
65
|
+
/** The material's geometry format. */
|
|
66
|
+
protected get _defaultGeometryFormat(): GeometryFormat | undefined;
|
|
67
|
+
/** @inheritDoc */
|
|
68
|
+
get position(): vec3;
|
|
69
|
+
set position(value: vec3);
|
|
70
|
+
/** @inheritDoc */
|
|
71
|
+
get rotation(): vec3;
|
|
72
|
+
set rotation(value: vec3);
|
|
73
|
+
/** @inheritDoc */
|
|
74
|
+
get scale(): vec3;
|
|
75
|
+
set scale(value: vec3);
|
|
76
|
+
/** @inheritDoc */
|
|
77
|
+
get modelMatrix(): mat4;
|
|
78
|
+
/** @inheritDoc Created on first access and disposed with the root mesh. */
|
|
79
|
+
get modelBuffer(): IUniformBuffer;
|
|
80
|
+
/** Uploads the root's model matrix when the transform changed since the last upload. */
|
|
81
|
+
private _updateModelBuffer;
|
|
82
|
+
/**
|
|
83
|
+
* Assigns the model buffer to a material that uses one (has a `modelBuffer` property), only when it differs.
|
|
84
|
+
* Materials without one (e.g. sprites) are skipped and no buffer is created for them.
|
|
85
|
+
*/
|
|
86
|
+
private _assignModelBuffer;
|
|
87
|
+
/** @inheritDoc */
|
|
88
|
+
render(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Disposes the sub meshes, then (for a root) the vertex, index and model buffers, once.
|
|
91
|
+
* A sub mesh never disposes the shared buffers. Materials are not disposed.
|
|
92
|
+
*/
|
|
93
|
+
dispose(): void;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=RenderableMesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderableMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/RenderableMesh.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./IMeshFactory.js";
|
|
2
2
|
export * from "./IMesh.js";
|
|
3
|
+
export * from "./IRenderableMesh.js";
|
|
3
4
|
export * from "./Mesh.js";
|
|
5
|
+
export * from "./RenderableMesh.js";
|
|
4
6
|
export * from "./QuadMesh.js";
|
|
5
7
|
export * from "./MeshParameters.js";
|
|
6
8
|
export * from "./MeshFactory.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_export.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/_export.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"_export.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/_export.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -6,9 +6,14 @@ export interface IGraphicsDeviceFeatures {
|
|
|
6
6
|
* Supports S3TC / DXT (BC1–BC3) texture compression.
|
|
7
7
|
*/
|
|
8
8
|
readonly supportsTextureCompressionS3TC: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Supports the sRGB variants of S3TC / DXT (BC1–BC3).
|
|
11
|
+
* In WebGL2 this needs WEBGL_compressed_texture_s3tc_srgb; in WebGPU it is part of texture-compression-bc.
|
|
12
|
+
*/
|
|
13
|
+
readonly supportsTextureCompressionS3TCSrgb: boolean;
|
|
9
14
|
/**
|
|
10
15
|
* Supports full Block Compression (BC1–BC7) textures.
|
|
11
|
-
|
|
16
|
+
Includes S3TC (BC1–BC3) plus BC4–BC7.
|
|
12
17
|
*/
|
|
13
18
|
readonly supportsTextureCompressionBC: boolean;
|
|
14
19
|
/**
|
|
@@ -20,7 +25,8 @@ export interface IGraphicsDeviceFeatures {
|
|
|
20
25
|
*/
|
|
21
26
|
readonly supportsTextureCompressionASTC: boolean;
|
|
22
27
|
/**
|
|
23
|
-
* Supports PVRTC (PowerVR Texture Compression) 1
|
|
28
|
+
* Supports PVRTC (PowerVR Texture Compression) 1.
|
|
29
|
+
* PVRTC 2 is not supported by either WebGL2 or WebGPU context.
|
|
24
30
|
*/
|
|
25
31
|
readonly supportsTextureCompressionPVRTC: boolean;
|
|
26
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IGraphicsDeviceFeatures.d.ts","sourceRoot":"","sources":["../../../src/api/rendering/IGraphicsDeviceFeatures.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"IGraphicsDeviceFeatures.d.ts","sourceRoot":"","sources":["../../../src/api/rendering/IGraphicsDeviceFeatures.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,uBAAuB;IAEpC;;OAEG;IACH,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAC;IAEjD;;;OAGG;IACH,QAAQ,CAAC,kCAAkC,EAAE,OAAO,CAAC;IAErD;;;OAGG;IACH,QAAQ,CAAC,4BAA4B,EAAE,OAAO,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAC;IAEjD;;OAEG;IACH,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAC;IAEjD;;;OAGG;IACH,QAAQ,CAAC,+BAA+B,EAAE,OAAO,CAAC;CAErD"}
|
|
@@ -3,8 +3,32 @@ import { TextureFormat } from "./texture/TextureFormat.js";
|
|
|
3
3
|
import { Color } from "../data/Color.js";
|
|
4
4
|
import { RenderingBackend } from "./RenderingBackend.js";
|
|
5
5
|
import { vec2 } from "gl-matrix";
|
|
6
|
+
import type { PowerPreferenceType } from "./PowerPreference.js";
|
|
7
|
+
import type { TextureSamplerFilteringPreset } from "../../core/rendering/enums.js";
|
|
8
|
+
import type { TextureColorSpace } from "./enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* The configuration for the renderer. This is used to initialize the renderer.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface IRendererConfiguration {
|
|
14
|
+
/**The size of the main frame buffer. */
|
|
15
|
+
backBufferSize: vec2;
|
|
16
|
+
/** Should back buffer use alpha. */
|
|
17
|
+
alpha: boolean;
|
|
18
|
+
/** The preference when it comes to selecting GPU device. Only makes sense to set on multi-GPU devices. */
|
|
19
|
+
powerPreference: PowerPreferenceType;
|
|
20
|
+
/**
|
|
21
|
+
* The preset for texture sampler filtering.
|
|
22
|
+
* This is used to configure the default texture sampler in the graphics device.
|
|
23
|
+
* The default texture sampler is used when a texture is sampled without a specific sampler being bound.
|
|
24
|
+
*/
|
|
25
|
+
textureFiltering: TextureSamplerFilteringPreset;
|
|
26
|
+
/** The desired texture color space. */
|
|
27
|
+
textureColorSpace: TextureColorSpace;
|
|
28
|
+
}
|
|
6
29
|
/**
|
|
7
30
|
* The interface for a renderer.
|
|
31
|
+
* @public
|
|
8
32
|
*/
|
|
9
33
|
export interface IRenderer {
|
|
10
34
|
/**
|
|
@@ -12,7 +36,10 @@ export interface IRenderer {
|
|
|
12
36
|
*/
|
|
13
37
|
readonly graphicsDevice: IGraphicsDevice;
|
|
14
38
|
/**
|
|
15
|
-
* The
|
|
39
|
+
* The preferred texture format.
|
|
40
|
+
* This will encode texture which do not specify texture format to:
|
|
41
|
+
* - {@link TextureFormat.} // TODO: describe SRGB depending on TextureSurfaceFormat requested
|
|
42
|
+
* - {@link TextureFormat.} // TODO: describe RGBA depending on TextureSurfaceFormat requested
|
|
16
43
|
*/
|
|
17
44
|
readonly preferredTextureFormat: TextureFormat;
|
|
18
45
|
/**
|