ris-framework 0.2.0-dev.11 → 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 +22 -29
- package/README.md +13 -1
- package/dist/Framework.d.ts +26 -8
- package/dist/Framework.d.ts.map +1 -1
- package/dist/api/IFramework.d.ts +43 -0
- package/dist/api/IFramework.d.ts.map +1 -1
- package/dist/api/_export.d.ts +1 -1
- package/dist/api/_export.d.ts.map +1 -1
- package/dist/api/content/ContentManager.d.ts +5 -57
- package/dist/api/content/ContentManager.d.ts.map +1 -1
- package/dist/api/content/IContentManager.d.ts +24 -21
- package/dist/api/content/IContentManager.d.ts.map +1 -1
- package/dist/api/lights/LightsBuffer.d.ts +13 -6
- package/dist/api/lights/LightsBuffer.d.ts.map +1 -1
- package/dist/api/loaders/ObjGeometryMapper.d.ts +2 -2
- 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 +1 -0
- package/dist/api/loaders/_export.d.ts.map +1 -1
- package/dist/api/loaders/obj/{ObjLoader.d.ts → ObjParser.d.ts} +20 -5
- package/dist/api/loaders/obj/ObjParser.d.ts.map +1 -0
- package/dist/api/loaders/obj/ObjTypes.d.ts +17 -1
- package/dist/api/loaders/obj/ObjTypes.d.ts.map +1 -1
- package/dist/api/loaders/obj/index.d.ts +1 -1
- package/dist/api/material/ForwardBlinnPhongMaterial.d.ts +22 -11
- package/dist/api/material/ForwardBlinnPhongMaterial.d.ts.map +1 -1
- 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 +2 -8
- package/dist/api/material/IMaterial.d.ts.map +1 -1
- package/dist/api/material/InspectTextureMipsMaterial.d.ts +2 -2
- package/dist/api/material/InspectTextureMipsMaterial.d.ts.map +1 -1
- package/dist/api/material/SpriteMaterial.d.ts +2 -2
- package/dist/api/material/SpriteMaterial.d.ts.map +1 -1
- package/dist/api/material/UnlitMaterial.d.ts +4 -3
- package/dist/api/material/UnlitMaterial.d.ts.map +1 -1
- package/dist/api/material/_export.d.ts +2 -0
- package/dist/api/material/_export.d.ts.map +1 -1
- package/dist/api/meshes/IMesh.d.ts +29 -34
- package/dist/api/meshes/IMesh.d.ts.map +1 -1
- package/dist/api/meshes/IMeshFactory.d.ts +13 -8
- 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 +11 -57
- package/dist/api/meshes/Mesh.d.ts.map +1 -1
- package/dist/api/meshes/MeshFactory.d.ts +6 -3
- package/dist/api/meshes/MeshFactory.d.ts.map +1 -1
- package/dist/api/meshes/QuadMesh.d.ts +3 -5
- 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 -1
- 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/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 +30 -21
- package/dist/api/scene/Scene.d.ts.map +1 -1
- package/dist/api/scene/SceneMesh.d.ts +27 -0
- package/dist/api/scene/SceneMesh.d.ts.map +1 -0
- package/dist/api/utilities/AlignUtilities.d.ts.map +1 -1
- 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/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4006 -1355
- package/dist/webgl/WebGLGraphicsDeviceFeatures.d.ts +4 -0
- package/dist/webgl/WebGLGraphicsDeviceFeatures.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/WebGlLightsBuffer.d.ts +8 -4
- package/dist/webgl/lights/WebGlLightsBuffer.d.ts.map +1 -1
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.d.ts +2 -0
- package/dist/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.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/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/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 +2 -2
- package/shaders/glsl/main_render_target_flip_y_fs.glsl +35 -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 +121 -37
- package/src/api/IFramework.ts +55 -0
- package/src/api/_export.ts +1 -1
- package/src/api/content/ContentManager.ts +46 -180
- package/src/api/content/IContentManager.ts +25 -21
- package/src/api/lights/LightsBuffer.ts +13 -6
- package/src/api/loaders/ObjGeometryMapper.ts +2 -2
- package/src/api/loaders/ObjLoader.ts +126 -0
- package/src/api/loaders/_export.ts +1 -0
- package/src/api/loaders/obj/{ObjLoader.ts → ObjParser.ts} +35 -4
- package/src/api/loaders/obj/ObjTypes.ts +19 -1
- package/src/api/loaders/obj/index.ts +1 -1
- package/src/api/material/ForwardBlinnPhongMaterial.ts +48 -22
- package/src/api/material/ICameraMaterial.ts +22 -0
- package/src/api/material/ILightsMaterial.ts +32 -0
- package/src/api/material/IMaterial.ts +2 -9
- package/src/api/material/InspectTextureMipsMaterial.ts +2 -2
- package/src/api/material/SpriteMaterial.ts +2 -2
- package/src/api/material/UnlitMaterial.ts +4 -3
- package/src/api/material/_export.ts +2 -0
- package/src/api/meshes/IMesh.ts +32 -37
- package/src/api/meshes/IMeshFactory.ts +14 -8
- package/src/api/meshes/IRenderableMesh.ts +58 -0
- package/src/api/meshes/Mesh.ts +17 -132
- package/src/api/meshes/MeshFactory.ts +14 -5
- package/src/api/meshes/QuadMesh.ts +4 -6
- package/src/api/meshes/RenderableMesh.ts +207 -0
- package/src/api/meshes/_export.ts +6 -5
- 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/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 +102 -69
- package/src/api/scene/SceneMesh.ts +61 -0
- package/src/api/sprites/SpriteBatchMesh.ts +1 -1
- package/src/api/utilities/AlignUtilities.ts +2 -1
- package/src/api/window/WindowManager.ts +1 -1
- package/src/core/rendering/ARenderer.ts +24 -15
- package/src/index.ts +0 -1
- package/src/main.ts +2 -3
- package/src/webgl/WebGLGraphicsDeviceFeatures.ts +12 -2
- package/src/webgl/WebGlGpuInfo.ts +1 -1
- package/src/webgl/WebGlRenderer.ts +2 -5
- package/src/webgl/lights/WebGlLightsBuffer.ts +14 -4
- package/src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts +18 -1
- package/src/webgl/swap-chain/WebGlSwapChain.ts +7 -6
- 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/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/loaders/obj/ObjLoader.d.ts.map +0 -1
- package/dist/api/meshes/SubMesh.d.ts +0 -47
- package/dist/api/meshes/SubMesh.d.ts.map +0 -1
- package/src/api/FrameworkConfiguration.ts +0 -29
- package/src/api/IFrameworkConfiguration.ts +0 -30
- package/src/api/meshes/SubMesh.ts +0 -71
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BufferUsage,
|
|
3
|
+
CullMode,
|
|
4
|
+
FrontFace,
|
|
5
|
+
LoadAction,
|
|
6
|
+
MipMapSamplerFilter,
|
|
7
|
+
PrimitiveTopology,
|
|
8
|
+
SamplerAddressMode,
|
|
9
|
+
SamplerFilter,
|
|
10
|
+
StoreAction,
|
|
11
|
+
TextureFormat,
|
|
12
|
+
TextureUsage,
|
|
13
|
+
VertexStepMode,
|
|
14
|
+
type IVertexBufferLayout,
|
|
15
|
+
} from "../../api/index.ts";
|
|
16
|
+
import {VertexFormat} from "../../api/geometry/VertexFormat.ts";
|
|
17
|
+
import {BlendFactor, BlendOperation} from "../../core/rendering/blending/enums.ts";
|
|
18
|
+
import {
|
|
19
|
+
GpuBufferUsage,
|
|
20
|
+
GpuTextureUsage,
|
|
21
|
+
type GpuAddressMode,
|
|
22
|
+
type GpuBlendFactor,
|
|
23
|
+
type GpuBlendOperation,
|
|
24
|
+
type GpuCullMode,
|
|
25
|
+
type GpuFilterMode,
|
|
26
|
+
type GpuFrontFace,
|
|
27
|
+
type GpuLoadOp,
|
|
28
|
+
type GpuPrimitiveTopology,
|
|
29
|
+
type GpuStoreOp,
|
|
30
|
+
type GpuTextureFormat,
|
|
31
|
+
type GpuVertexBufferLayout,
|
|
32
|
+
type GpuVertexFormat,
|
|
33
|
+
} from "../WebGpuTypes.ts";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts framework enums to WebGPU values.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export class WebGpuConverter {
|
|
40
|
+
|
|
41
|
+
/** Converts buffer usage flags. */
|
|
42
|
+
public static convertBufferUsage(usage: BufferUsage): number {
|
|
43
|
+
let result = 0;
|
|
44
|
+
if (usage & BufferUsage.VERTEX) result |= GpuBufferUsage.VERTEX;
|
|
45
|
+
if (usage & BufferUsage.INDEX) result |= GpuBufferUsage.INDEX;
|
|
46
|
+
if (usage & BufferUsage.UNIFORM) result |= GpuBufferUsage.UNIFORM;
|
|
47
|
+
if (usage & BufferUsage.STORAGE) result |= GpuBufferUsage.STORAGE;
|
|
48
|
+
if (usage & BufferUsage.MAP_READ) result |= GpuBufferUsage.MAP_READ;
|
|
49
|
+
if (usage & BufferUsage.COPY_DST) result |= GpuBufferUsage.COPY_DST;
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Converts texture usage flags. `TextureUsage.NONE` maps to 0. */
|
|
54
|
+
public static convertTextureUsage(usage: TextureUsage): number {
|
|
55
|
+
let result = 0;
|
|
56
|
+
if (usage & TextureUsage.COPY_SRC) result |= GpuTextureUsage.COPY_SRC;
|
|
57
|
+
if (usage & TextureUsage.COPY_DST) result |= GpuTextureUsage.COPY_DST;
|
|
58
|
+
if (usage & TextureUsage.TEXTURE_BINDING) result |= GpuTextureUsage.TEXTURE_BINDING;
|
|
59
|
+
if (usage & TextureUsage.STORAGE_BINDING) result |= GpuTextureUsage.STORAGE_BINDING;
|
|
60
|
+
if (usage & TextureUsage.RENDER_ATTACHMENT) result |= GpuTextureUsage.RENDER_ATTACHMENT;
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Converts a texture format. Throws for formats the WebGPU backend does not support yet. */
|
|
65
|
+
public static convertTextureFormat(format: TextureFormat): GpuTextureFormat {
|
|
66
|
+
switch (format) {
|
|
67
|
+
case TextureFormat.RGBA_8_UNORM:
|
|
68
|
+
return "rgba8unorm";
|
|
69
|
+
case TextureFormat.RGBA_8_UNORM_SRGB:
|
|
70
|
+
return "rgba8unorm-srgb";
|
|
71
|
+
case TextureFormat.DEPTH_24_STENCIL_8:
|
|
72
|
+
return "depth24plus-stencil8";
|
|
73
|
+
case TextureFormat.DEPTH_32_FLOAT:
|
|
74
|
+
return "depth32float";
|
|
75
|
+
case TextureFormat.RED_32_FLOAT:
|
|
76
|
+
return "r32float";
|
|
77
|
+
|
|
78
|
+
// BC (texture-compression-bc). WebGPU has no BC1 RGB, the RGBA variant decodes the same blocks.
|
|
79
|
+
case TextureFormat.BC1_RGB_UNORM:
|
|
80
|
+
return "bc1-rgba-unorm";
|
|
81
|
+
case TextureFormat.BC1_RGB_SRGB:
|
|
82
|
+
return "bc1-rgba-unorm-srgb";
|
|
83
|
+
case TextureFormat.BC3_RGBA_UNORM:
|
|
84
|
+
return "bc3-rgba-unorm";
|
|
85
|
+
case TextureFormat.BC3_RGBA_SRGB:
|
|
86
|
+
return "bc3-rgba-unorm-srgb";
|
|
87
|
+
case TextureFormat.BC7_RGBA_UNORM:
|
|
88
|
+
return "bc7-rgba-unorm";
|
|
89
|
+
case TextureFormat.BC7_RGBA_SRGB:
|
|
90
|
+
return "bc7-rgba-unorm-srgb";
|
|
91
|
+
|
|
92
|
+
// ETC2 (texture-compression-etc2)
|
|
93
|
+
case TextureFormat.ETC2_RGB8_UNORM:
|
|
94
|
+
return "etc2-rgb8unorm";
|
|
95
|
+
case TextureFormat.ETC2_RGB8_SRGB:
|
|
96
|
+
return "etc2-rgb8unorm-srgb";
|
|
97
|
+
case TextureFormat.ETC2_RGBA8_UNORM:
|
|
98
|
+
return "etc2-rgba8unorm";
|
|
99
|
+
case TextureFormat.ETC2_RGBA8_SRGB:
|
|
100
|
+
return "etc2-rgba8unorm-srgb";
|
|
101
|
+
|
|
102
|
+
// ASTC (texture-compression-astc)
|
|
103
|
+
case TextureFormat.ASTC_4X4_RGBA_UNORM:
|
|
104
|
+
return "astc-4x4-unorm";
|
|
105
|
+
case TextureFormat.ASTC_4X4_RGBA_SRGB:
|
|
106
|
+
return "astc-4x4-unorm-srgb";
|
|
107
|
+
case TextureFormat.ASTC_5X4_RGBA_UNORM:
|
|
108
|
+
return "astc-5x4-unorm";
|
|
109
|
+
case TextureFormat.ASTC_5X4_RGBA_SRGB:
|
|
110
|
+
return "astc-5x4-unorm-srgb";
|
|
111
|
+
case TextureFormat.ASTC_5X5_RGBA_UNORM:
|
|
112
|
+
return "astc-5x5-unorm";
|
|
113
|
+
case TextureFormat.ASTC_5X5_RGBA_SRGB:
|
|
114
|
+
return "astc-5x5-unorm-srgb";
|
|
115
|
+
case TextureFormat.ASTC_6X5_RGBA_UNORM:
|
|
116
|
+
return "astc-6x5-unorm";
|
|
117
|
+
case TextureFormat.ASTC_6X5_RGBA_SRGB:
|
|
118
|
+
return "astc-6x5-unorm-srgb";
|
|
119
|
+
case TextureFormat.ASTC_6X6_RGBA_UNORM:
|
|
120
|
+
return "astc-6x6-unorm";
|
|
121
|
+
case TextureFormat.ASTC_6X6_RGBA_SRGB:
|
|
122
|
+
return "astc-6x6-unorm-srgb";
|
|
123
|
+
case TextureFormat.ASTC_8X5_RGBA_UNORM:
|
|
124
|
+
return "astc-8x5-unorm";
|
|
125
|
+
case TextureFormat.ASTC_8X5_RGBA_SRGB:
|
|
126
|
+
return "astc-8x5-unorm-srgb";
|
|
127
|
+
case TextureFormat.ASTC_8X6_RGBA_UNORM:
|
|
128
|
+
return "astc-8x6-unorm";
|
|
129
|
+
case TextureFormat.ASTC_8X6_RGBA_SRGB:
|
|
130
|
+
return "astc-8x6-unorm-srgb";
|
|
131
|
+
case TextureFormat.ASTC_8X8_RGBA_UNORM:
|
|
132
|
+
return "astc-8x8-unorm";
|
|
133
|
+
case TextureFormat.ASTC_8X8_RGBA_SRGB:
|
|
134
|
+
return "astc-8x8-unorm-srgb";
|
|
135
|
+
case TextureFormat.ASTC_10X5_RGBA_UNORM:
|
|
136
|
+
return "astc-10x5-unorm";
|
|
137
|
+
case TextureFormat.ASTC_10X5_RGBA_SRGB:
|
|
138
|
+
return "astc-10x5-unorm-srgb";
|
|
139
|
+
case TextureFormat.ASTC_10X6_RGBA_UNORM:
|
|
140
|
+
return "astc-10x6-unorm";
|
|
141
|
+
case TextureFormat.ASTC_10X6_RGBA_SRGB:
|
|
142
|
+
return "astc-10x6-unorm-srgb";
|
|
143
|
+
case TextureFormat.ASTC_10X8_RGBA_UNORM:
|
|
144
|
+
return "astc-10x8-unorm";
|
|
145
|
+
case TextureFormat.ASTC_10X8_RGBA_SRGB:
|
|
146
|
+
return "astc-10x8-unorm-srgb";
|
|
147
|
+
case TextureFormat.ASTC_10X10_RGBA_UNORM:
|
|
148
|
+
return "astc-10x10-unorm";
|
|
149
|
+
case TextureFormat.ASTC_10X10_RGBA_SRGB:
|
|
150
|
+
return "astc-10x10-unorm-srgb";
|
|
151
|
+
case TextureFormat.ASTC_12X10_RGBA_UNORM:
|
|
152
|
+
return "astc-12x10-unorm";
|
|
153
|
+
case TextureFormat.ASTC_12X10_RGBA_SRGB:
|
|
154
|
+
return "astc-12x10-unorm-srgb";
|
|
155
|
+
case TextureFormat.ASTC_12X12_RGBA_UNORM:
|
|
156
|
+
return "astc-12x12-unorm";
|
|
157
|
+
case TextureFormat.ASTC_12X12_RGBA_SRGB:
|
|
158
|
+
return "astc-12x12-unorm-srgb";
|
|
159
|
+
default:
|
|
160
|
+
throw new Error(`Texture format ${format} is not implemented for WebGPU.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Whether the format has a stencil aspect. */
|
|
165
|
+
public static hasStencil(format: TextureFormat): boolean {
|
|
166
|
+
return format === TextureFormat.DEPTH_24_STENCIL_8;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Whether the format is a depth (or depth-stencil) format. */
|
|
170
|
+
public static isDepthFormat(format: TextureFormat): boolean {
|
|
171
|
+
return format === TextureFormat.DEPTH_24_STENCIL_8 || format === TextureFormat.DEPTH_32_FLOAT;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Converts a load action. WebGPU has no "don't care", so `UNDEFINED` clears. */
|
|
175
|
+
public static convertLoadAction(action: LoadAction): GpuLoadOp {
|
|
176
|
+
return action === LoadAction.LOAD ? "load" : "clear";
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Converts a store action. */
|
|
180
|
+
public static convertStoreAction(action: StoreAction): GpuStoreOp {
|
|
181
|
+
return action === StoreAction.DISCARD ? "discard" : "store";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Converts a sampler address mode. WebGPU has no border clamp, so it falls back to clamp to edge. */
|
|
185
|
+
public static convertAddressMode(mode: SamplerAddressMode): GpuAddressMode {
|
|
186
|
+
switch (mode) {
|
|
187
|
+
case SamplerAddressMode.REPEAT:
|
|
188
|
+
return "repeat";
|
|
189
|
+
case SamplerAddressMode.MIRROR_REPEAT:
|
|
190
|
+
return "mirror-repeat";
|
|
191
|
+
default:
|
|
192
|
+
return "clamp-to-edge";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Converts a sampler filter. */
|
|
197
|
+
public static convertFilter(filter: SamplerFilter): GpuFilterMode {
|
|
198
|
+
return filter === SamplerFilter.LINEAR ? "linear" : "nearest";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Converts a mip map filter. `NONE` maps to nearest; the sampler then clamps to mip 0. */
|
|
202
|
+
public static convertMipMapFilter(filter: MipMapSamplerFilter): GpuFilterMode {
|
|
203
|
+
return filter === MipMapSamplerFilter.LINEAR ? "linear" : "nearest";
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Converts a blend factor. */
|
|
207
|
+
public static convertBlendFactor(factor: BlendFactor): GpuBlendFactor {
|
|
208
|
+
switch (factor) {
|
|
209
|
+
case BlendFactor.ONE:
|
|
210
|
+
return "one";
|
|
211
|
+
case BlendFactor.SRC_ALPHA:
|
|
212
|
+
return "src-alpha";
|
|
213
|
+
case BlendFactor.ONE_MINUS_SRC_ALPHA:
|
|
214
|
+
return "one-minus-src-alpha";
|
|
215
|
+
default:
|
|
216
|
+
throw new Error(`Blend factor ${factor} is not implemented for WebGPU.`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Converts a blend operation. */
|
|
221
|
+
public static convertBlendOperation(operation: BlendOperation): GpuBlendOperation {
|
|
222
|
+
switch (operation) {
|
|
223
|
+
case BlendOperation.ADD:
|
|
224
|
+
return "add";
|
|
225
|
+
case BlendOperation.SUBTRACT:
|
|
226
|
+
return "subtract";
|
|
227
|
+
case BlendOperation.REVERSE_SUBTRACT:
|
|
228
|
+
return "reverse-subtract";
|
|
229
|
+
case BlendOperation.MIN:
|
|
230
|
+
return "min";
|
|
231
|
+
case BlendOperation.MAX:
|
|
232
|
+
return "max";
|
|
233
|
+
default:
|
|
234
|
+
throw new Error(`Blend operation ${operation} is not implemented for WebGPU.`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Converts a primitive topology. */
|
|
239
|
+
public static convertTopology(topology: PrimitiveTopology): GpuPrimitiveTopology {
|
|
240
|
+
switch (topology) {
|
|
241
|
+
case PrimitiveTopology.LINE_LIST:
|
|
242
|
+
return "line-list";
|
|
243
|
+
case PrimitiveTopology.LINE_STRIP:
|
|
244
|
+
return "line-strip";
|
|
245
|
+
case PrimitiveTopology.POINT_LIST:
|
|
246
|
+
return "point-list";
|
|
247
|
+
case PrimitiveTopology.TRIANGLE_STRIP:
|
|
248
|
+
return "triangle-strip";
|
|
249
|
+
default:
|
|
250
|
+
return "triangle-list";
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Converts a cull mode. */
|
|
255
|
+
public static convertCullMode(mode: CullMode): GpuCullMode {
|
|
256
|
+
switch (mode) {
|
|
257
|
+
case CullMode.BACK:
|
|
258
|
+
return "back";
|
|
259
|
+
case CullMode.FRONT:
|
|
260
|
+
return "front";
|
|
261
|
+
default:
|
|
262
|
+
return "none";
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Converts a front face. */
|
|
267
|
+
public static convertFrontFace(face: FrontFace): GpuFrontFace {
|
|
268
|
+
return face === FrontFace.CW ? "cw" : "ccw";
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Converts a vertex format. */
|
|
272
|
+
public static convertVertexFormat(format: VertexFormat): GpuVertexFormat {
|
|
273
|
+
switch (format) {
|
|
274
|
+
case VertexFormat.FLOAT_32:
|
|
275
|
+
return "float32";
|
|
276
|
+
case VertexFormat.FLOAT_32X2:
|
|
277
|
+
return "float32x2";
|
|
278
|
+
case VertexFormat.FLOAT_32X3:
|
|
279
|
+
return "float32x3";
|
|
280
|
+
case VertexFormat.FLOAT_32X4:
|
|
281
|
+
return "float32x4";
|
|
282
|
+
default:
|
|
283
|
+
throw new Error(`Vertex format ${VertexFormat[format]} is not implemented for WebGPU.`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Converts a vertex buffer layout. */
|
|
288
|
+
public static convertVertexBufferLayout(layout: IVertexBufferLayout): GpuVertexBufferLayout {
|
|
289
|
+
return {
|
|
290
|
+
arrayStride: layout.arrayStride,
|
|
291
|
+
stepMode: layout.stepMode === VertexStepMode.INSTANCE ? "instance" : "vertex",
|
|
292
|
+
attributes: layout.attributes.map(attribute => ({
|
|
293
|
+
format: WebGpuConverter.convertVertexFormat(attribute.format),
|
|
294
|
+
offset: attribute.offset,
|
|
295
|
+
shaderLocation: attribute.shaderLocation,
|
|
296
|
+
})),
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { TextureSamplerFilteringPreset } from "../core/rendering/enums.js";
|
|
2
|
-
import { vec2 } from "gl-matrix";
|
|
3
|
-
import type { IFrameworkConfiguration } from "./IFrameworkConfiguration.js";
|
|
4
|
-
import { PowerPreferenceType } from "./rendering/PowerPreference.js";
|
|
5
|
-
/**
|
|
6
|
-
* The options for configuring the Framework.
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export declare class FrameworkConfiguration implements IFrameworkConfiguration {
|
|
10
|
-
/** @inheritDoc */
|
|
11
|
-
useKtx2: boolean;
|
|
12
|
-
/** @inheritDoc */
|
|
13
|
-
canvas?: HTMLCanvasElement;
|
|
14
|
-
/** @inheritDoc */
|
|
15
|
-
backBufferSize?: vec2;
|
|
16
|
-
/** @inheritDoc */
|
|
17
|
-
textureFiltering?: TextureSamplerFilteringPreset | undefined;
|
|
18
|
-
/** @inheritDoc */
|
|
19
|
-
alpha: boolean;
|
|
20
|
-
/** @inheritDoc */
|
|
21
|
-
powerPreference: PowerPreferenceType;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=FrameworkConfiguration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FrameworkConfiguration.d.ts","sourceRoot":"","sources":["../../src/api/FrameworkConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AAEnE;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,uBAAuB;IAElE,kBAAkB;IAClB,OAAO,UAAS;IAEhB,kBAAkB;IAClB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,kBAAkB;IAClB,cAAc,CAAC,EAAE,IAAI,CAAC;IAEtB,kBAAkB;IAClB,gBAAgB,CAAC,4CAA0C;IAE3D,kBAAkB;IAClB,KAAK,UAAS;IAEd,kBAAkB;IAClB,eAAe,sBAA+B;CACjD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PowerPreferenceType } from "./rendering/PowerPreference.js";
|
|
2
|
-
import type { vec2 } from "gl-matrix";
|
|
3
|
-
import type { TextureSamplerFilteringPreset } from "../core/rendering/enums.js";
|
|
4
|
-
/**
|
|
5
|
-
* The configuration for the framework.
|
|
6
|
-
* @public
|
|
7
|
-
**/
|
|
8
|
-
export declare class IFrameworkConfiguration {
|
|
9
|
-
/** If true, creates and makes the KTX2 factory available. */
|
|
10
|
-
useKtx2?: boolean;
|
|
11
|
-
/** The size of back buffer. */
|
|
12
|
-
backBufferSize?: vec2;
|
|
13
|
-
/** The texture filtering to configure */
|
|
14
|
-
textureFiltering?: TextureSamplerFilteringPreset;
|
|
15
|
-
/**
|
|
16
|
-
* The HTMLCanvasElement to use for rendering.
|
|
17
|
-
* If null, a new canvas will be created and added to the document body.
|
|
18
|
-
*/
|
|
19
|
-
canvas?: HTMLCanvasElement;
|
|
20
|
-
/** Should back buffer use alpha. */
|
|
21
|
-
alpha?: boolean;
|
|
22
|
-
/** The preference when it comes to selecting GPU device. Only makes sense to set on multi-GPU devices. */
|
|
23
|
-
powerPreference?: PowerPreferenceType;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=IFrameworkConfiguration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IFrameworkConfiguration.d.ts","sourceRoot":"","sources":["../../src/api/IFrameworkConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,4BAA4B,CAAC;AAE9E;;;IAGI;AACJ,qBAAa,uBAAuB;IAChC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,IAAI,CAAC;IAEtB,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IAEjD;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,0GAA0G;IAC1G,eAAgB,CAAC,EAAE,mBAAmB,CAAC;CAC1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObjLoader.d.ts","sourceRoot":"","sources":["../../../../src/api/loaders/obj/ObjLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAErB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEtB,MAAM,eAAe,CAAC;AAiBvB;;;GAGG;AACH,qBAAa,SAAS;IAElB;;;;OAIG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,EAAE;IAqEtD;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,qBAAqB,EAAO,GAAG,aAAa;IAiHrF;;;;;;OAMG;IACU,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAwC7F"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { mat4, vec3 } from "gl-matrix";
|
|
2
|
-
import type { IMesh } from "./IMesh.js";
|
|
3
|
-
import type { Mesh } from "./Mesh.js";
|
|
4
|
-
import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.js";
|
|
5
|
-
import type { IMaterial } from "../material/IMaterial.js";
|
|
6
|
-
import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.js";
|
|
7
|
-
import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.js";
|
|
8
|
-
/**
|
|
9
|
-
* A part of a mesh drawn with its own material.
|
|
10
|
-
* It shares the parent's vertex and index buffers and draws only its index range.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SubMesh implements IMesh {
|
|
13
|
-
readonly parent: Mesh;
|
|
14
|
-
material: IMaterial;
|
|
15
|
-
readonly indexStart: number;
|
|
16
|
-
readonly indexCount: number;
|
|
17
|
-
/**
|
|
18
|
-
* The constructor.
|
|
19
|
-
* @param parent The mesh that owns the buffers.
|
|
20
|
-
* @param material The material of this submesh.
|
|
21
|
-
* @param indexStart The first index of the range.
|
|
22
|
-
* @param indexCount The number of indices in the range.
|
|
23
|
-
*/
|
|
24
|
-
constructor(parent: Mesh, material: IMaterial, indexStart: number, indexCount: number);
|
|
25
|
-
/** The parent's vertex buffer. */
|
|
26
|
-
get vertexBuffer(): IVertexBuffer | undefined;
|
|
27
|
-
/** The parent's index buffer. */
|
|
28
|
-
get indexBuffer(): IIndexBuffer | undefined;
|
|
29
|
-
/** The parent's position; setting it sets the parent's. */
|
|
30
|
-
get position(): vec3;
|
|
31
|
-
set position(value: vec3);
|
|
32
|
-
/** The parent's rotation; setting it sets the parent's. */
|
|
33
|
-
get rotation(): vec3;
|
|
34
|
-
set rotation(value: vec3);
|
|
35
|
-
/** The parent's scale; setting it sets the parent's. */
|
|
36
|
-
get scale(): vec3;
|
|
37
|
-
set scale(value: vec3);
|
|
38
|
-
/** The parent's model matrix. */
|
|
39
|
-
get modelMatrix(): mat4;
|
|
40
|
-
/** The parent's model buffer. */
|
|
41
|
-
get modelBuffer(): IUniformBuffer;
|
|
42
|
-
/** Draws this submesh with its material, using the parent's transform (model buffer). */
|
|
43
|
-
render(): void;
|
|
44
|
-
/** Does nothing: the buffers belong to the parent and the material to the caller. */
|
|
45
|
-
dispose(): void;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=SubMesh.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubMesh.d.ts","sourceRoot":"","sources":["../../../src/api/meshes/SubMesh.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,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE;;;GAGG;AACH,qBAAa,OAAQ,YAAW,KAAK;aAUb,MAAM,EAAE,IAAI;IACrB,QAAQ,EAAE,SAAS;aACV,UAAU,EAAE,MAAM;aAClB,UAAU,EAAE,MAAM;IAXtC;;;;;;OAMG;gBAEiB,MAAM,EAAE,IAAI,EACrB,QAAQ,EAAE,SAAS,EACV,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM;IAGtC,kCAAkC;IAClC,IAAW,YAAY,IAAI,aAAa,GAAG,SAAS,CAEnD;IAED,iCAAiC;IACjC,IAAW,WAAW,IAAI,YAAY,GAAG,SAAS,CAEjD;IAED,2DAA2D;IAC3D,IAAW,QAAQ,IAAI,IAAI,CAAiC;IAC5D,IAAW,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAmC;IAElE,2DAA2D;IAC3D,IAAW,QAAQ,IAAI,IAAI,CAAiC;IAC5D,IAAW,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAmC;IAElE,wDAAwD;IACxD,IAAW,KAAK,IAAI,IAAI,CAA8B;IACtD,IAAW,KAAK,CAAC,KAAK,EAAE,IAAI,EAAgC;IAE5D,iCAAiC;IACjC,IAAW,WAAW,IAAI,IAAI,CAE7B;IAED,iCAAiC;IACjC,IAAW,WAAW,IAAI,cAAc,CAEvC;IAED,yFAAyF;IAClF,MAAM,IAAI,IAAI;IAMrB,qFAAqF;IAC9E,OAAO,IAAI,IAAI;CAEzB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { TextureSamplerFilteringPreset } from "../core/rendering/enums.ts";
|
|
2
|
-
import {vec2} from "gl-matrix";
|
|
3
|
-
import type {IFrameworkConfiguration} from "./IFrameworkConfiguration.ts";
|
|
4
|
-
import {PowerPreferenceType} from "./rendering/PowerPreference.ts";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The options for configuring the Framework.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export class FrameworkConfiguration implements IFrameworkConfiguration {
|
|
11
|
-
|
|
12
|
-
/** @inheritDoc */
|
|
13
|
-
useKtx2 = false;
|
|
14
|
-
|
|
15
|
-
/** @inheritDoc */
|
|
16
|
-
canvas?: HTMLCanvasElement;
|
|
17
|
-
|
|
18
|
-
/** @inheritDoc */
|
|
19
|
-
backBufferSize?: vec2;
|
|
20
|
-
|
|
21
|
-
/** @inheritDoc */
|
|
22
|
-
textureFiltering? = TextureSamplerFilteringPreset.BILINEAR;
|
|
23
|
-
|
|
24
|
-
/** @inheritDoc */
|
|
25
|
-
alpha = false;
|
|
26
|
-
|
|
27
|
-
/** @inheritDoc */
|
|
28
|
-
powerPreference = PowerPreferenceType.DEFAULT;
|
|
29
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {PowerPreferenceType} from "./rendering/PowerPreference.ts";
|
|
2
|
-
import type {vec2} from "gl-matrix";
|
|
3
|
-
import type {TextureSamplerFilteringPreset} from "../core/rendering/enums.ts";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The configuration for the framework.
|
|
7
|
-
* @public
|
|
8
|
-
**/
|
|
9
|
-
export class IFrameworkConfiguration {
|
|
10
|
-
/** If true, creates and makes the KTX2 factory available. */
|
|
11
|
-
useKtx2?: boolean;
|
|
12
|
-
|
|
13
|
-
/** The size of back buffer. */
|
|
14
|
-
backBufferSize?: vec2;
|
|
15
|
-
|
|
16
|
-
/** The texture filtering to configure */
|
|
17
|
-
textureFiltering?: TextureSamplerFilteringPreset;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The HTMLCanvasElement to use for rendering.
|
|
21
|
-
* If null, a new canvas will be created and added to the document body.
|
|
22
|
-
*/
|
|
23
|
-
canvas?: HTMLCanvasElement;
|
|
24
|
-
|
|
25
|
-
/** Should back buffer use alpha. */
|
|
26
|
-
alpha?: boolean;
|
|
27
|
-
|
|
28
|
-
/** The preference when it comes to selecting GPU device. Only makes sense to set on multi-GPU devices. */
|
|
29
|
-
powerPreference ?: PowerPreferenceType;
|
|
30
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { mat4, vec3 } from "gl-matrix";
|
|
2
|
-
import type { IMesh } from "./IMesh.ts";
|
|
3
|
-
import type { Mesh } from "./Mesh.ts";
|
|
4
|
-
import type { IUniformBuffer } from "../rendering/buffers/IUniformBuffer.ts";
|
|
5
|
-
import type { IMaterial } from "../material/IMaterial.ts";
|
|
6
|
-
import type { IVertexBuffer } from "../rendering/buffers/IVertexBuffer.ts";
|
|
7
|
-
import type { IIndexBuffer } from "../rendering/buffers/IIndexBuffer.ts";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A part of a mesh drawn with its own material.
|
|
11
|
-
* It shares the parent's vertex and index buffers and draws only its index range.
|
|
12
|
-
*/
|
|
13
|
-
export class SubMesh implements IMesh {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The constructor.
|
|
17
|
-
* @param parent The mesh that owns the buffers.
|
|
18
|
-
* @param material The material of this submesh.
|
|
19
|
-
* @param indexStart The first index of the range.
|
|
20
|
-
* @param indexCount The number of indices in the range.
|
|
21
|
-
*/
|
|
22
|
-
public constructor(
|
|
23
|
-
public readonly parent: Mesh,
|
|
24
|
-
public material: IMaterial,
|
|
25
|
-
public readonly indexStart: number,
|
|
26
|
-
public readonly indexCount: number) {
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** The parent's vertex buffer. */
|
|
30
|
-
public get vertexBuffer(): IVertexBuffer | undefined {
|
|
31
|
-
return this.parent.vertexBuffer;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** The parent's index buffer. */
|
|
35
|
-
public get indexBuffer(): IIndexBuffer | undefined {
|
|
36
|
-
return this.parent.indexBuffer;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** The parent's position; setting it sets the parent's. */
|
|
40
|
-
public get position(): vec3 { return this.parent.position; }
|
|
41
|
-
public set position(value: vec3) { this.parent.position = value; }
|
|
42
|
-
|
|
43
|
-
/** The parent's rotation; setting it sets the parent's. */
|
|
44
|
-
public get rotation(): vec3 { return this.parent.rotation; }
|
|
45
|
-
public set rotation(value: vec3) { this.parent.rotation = value; }
|
|
46
|
-
|
|
47
|
-
/** The parent's scale; setting it sets the parent's. */
|
|
48
|
-
public get scale(): vec3 { return this.parent.scale; }
|
|
49
|
-
public set scale(value: vec3) { this.parent.scale = value; }
|
|
50
|
-
|
|
51
|
-
/** The parent's model matrix. */
|
|
52
|
-
public get modelMatrix(): mat4 {
|
|
53
|
-
return this.parent.modelMatrix;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** The parent's model buffer. */
|
|
57
|
-
public get modelBuffer(): IUniformBuffer {
|
|
58
|
-
return this.parent.modelBuffer;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Draws this submesh with its material, using the parent's transform (model buffer). */
|
|
62
|
-
public render(): void {
|
|
63
|
-
this.parent.__assignModelBuffer(this.material);
|
|
64
|
-
this.material.beforeRender();
|
|
65
|
-
this.material.renderMesh(this);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Does nothing: the buffers belong to the parent and the material to the caller. */
|
|
69
|
-
public dispose(): void {
|
|
70
|
-
}
|
|
71
|
-
}
|