ris-framework 0.1.0-dev.9 → 0.2.0-dev.11
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 +49 -1
- package/README.md +15 -4
- package/dist/Framework.d.ts +9 -3
- package/dist/Framework.d.ts.map +1 -1
- package/dist/api/IFramework.d.ts +7 -6
- package/dist/api/IFramework.d.ts.map +1 -1
- package/dist/api/_export.d.ts +2 -0
- 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 +67 -2
- package/dist/api/content/ContentManager.d.ts.map +1 -1
- package/dist/api/content/IContentManager.d.ts +32 -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 +70 -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/_export.d.ts +1 -0
- package/dist/api/loaders/_export.d.ts.map +1 -1
- package/dist/api/loaders/obj/ObjLoader.d.ts +29 -0
- package/dist/api/loaders/obj/ObjLoader.d.ts.map +1 -0
- package/dist/api/loaders/obj/ObjTypes.d.ts +103 -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 +127 -0
- package/dist/api/material/ForwardBlinnPhongMaterial.d.ts.map +1 -0
- package/dist/api/material/IMaterial.d.ts +15 -6
- 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 +16 -7
- 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 +28 -10
- 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 +35 -5
- package/dist/api/meshes/IMesh.d.ts.map +1 -1
- package/dist/api/meshes/IMeshFactory.d.ts +25 -4
- package/dist/api/meshes/IMeshFactory.d.ts.map +1 -1
- package/dist/api/meshes/Mesh.d.ts +58 -6
- package/dist/api/meshes/Mesh.d.ts.map +1 -1
- package/dist/api/meshes/MeshFactory.d.ts +7 -3
- package/dist/api/meshes/MeshFactory.d.ts.map +1 -1
- package/dist/api/meshes/QuadMesh.d.ts +5 -1
- package/dist/api/meshes/QuadMesh.d.ts.map +1 -1
- package/dist/api/meshes/SubMesh.d.ts +47 -0
- package/dist/api/meshes/SubMesh.d.ts.map +1 -0
- package/dist/api/meshes/_export.d.ts +1 -0
- package/dist/api/meshes/_export.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/scene/Scene.d.ts +104 -0
- package/dist/api/scene/Scene.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/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/vertex-buffer-layout.d.ts +1 -0
- package/dist/core/rendering/vertex-buffer-layout.d.ts.map +1 -1
- package/dist/index.js +2252 -260
- package/dist/webgl/WebGlGraphicsDevice.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 +55 -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 +3 -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/texture/WebGlTexture2D.d.ts +8 -1
- package/dist/webgl/texture/WebGlTexture2D.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/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/sprite_fs.glsl +1 -1
- package/shaders/glsl/unlit_material_fs.glsl +1 -1
- package/src/Framework.ts +37 -13
- package/src/api/IFramework.ts +8 -6
- package/src/api/_export.ts +2 -0
- 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 +201 -5
- package/src/api/content/IContentManager.ts +33 -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 +87 -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/_export.ts +2 -1
- package/src/api/loaders/obj/ObjLoader.ts +270 -0
- package/src/api/loaders/obj/ObjTypes.ts +124 -0
- package/src/api/loaders/obj/index.ts +5 -0
- package/src/api/material/ForwardBlinnPhongMaterial.ts +302 -0
- package/src/api/material/IMaterial.ts +16 -6
- package/src/api/material/IMaterialFactory.ts +19 -2
- package/src/api/material/InspectTextureMipsMaterial.ts +63 -24
- package/src/api/material/MaterialFactory.ts +12 -0
- package/src/api/material/SpriteMaterial.ts +83 -0
- package/src/api/material/UnlitMaterial.ts +101 -29
- package/src/api/material/_export.ts +3 -1
- package/src/api/meshes/IMesh.ts +45 -6
- package/src/api/meshes/IMeshFactory.ts +27 -4
- package/src/api/meshes/Mesh.ts +163 -41
- package/src/api/meshes/MeshFactory.ts +30 -6
- package/src/api/meshes/QuadMesh.ts +6 -2
- package/src/api/meshes/SubMesh.ts +71 -0
- package/src/api/meshes/_export.ts +1 -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/scene/Scene.ts +264 -0
- package/src/api/shader/IShaderModuleLoader.ts +2 -1
- package/src/api/sprites/SpriteBatchDrawable.ts +12 -16
- package/src/api/sprites/SpriteBatchMesh.ts +23 -4
- package/src/api/utilities/GeometryUtilities.ts +2 -0
- package/src/api/window/WindowManager.ts +22 -2
- package/src/core/rendering/vertex-buffer-layout.ts +32 -1
- package/src/main.ts +0 -1
- package/src/webgl/WebGlGraphicsDevice.ts +0 -1
- package/src/webgl/lights/WebGlAmbientLightFactory.ts +35 -0
- package/src/webgl/lights/WebGlLightsBuffer.ts +215 -0
- package/src/webgl/render-pipelines/AWebGlRenderPipeline.ts +7 -1
- package/src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts +3 -0
- 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/texture/WebGlTexture2D.ts +19 -5
- package/src/webgl/utilities/webgl-filter-anisotropic-utilities.ts +9 -6
- package/dist/api/shader/shader-loader.d.ts.map +0 -1
- /package/src/api/shader/{shader-loader.ts → ShaderLoader.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlGraphicsDevice.d.ts","sourceRoot":"","sources":["../../src/webgl/WebGlGraphicsDevice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAE,KAAK,yBAAyB,EAAC,MAAM,sCAAsC,CAAC;AACrG,OAAO,EAAC,KAAK,oBAAoB,EAAC,MAAM,mDAAmD,CAAC;AAG5F,OAAO,EAAC,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AAG7E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iDAAiD,CAAC;AACvF,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,QAAQ,EAAE,KAAK,eAAe,EACnC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BAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;IAG7C,kBAAkB,IAAI,IAAI;IAI1B,QAAQ,IAAI,IAAI;IAIhB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAI5B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,GAAG,CAAiC;IAC5C,OAAO,CAAC,SAAS,CAAsC;IACvD,OAAO,CAAC,QAAQ,CAAuB;IAEvC;;;;OAIG;gBACgB,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,yBAAyB;IAMvF;;OAEG;IACH,IAAW,EAAE,IAAI,sBAAsB,CAEtC;IAED,kBAAkB;IAClB,IAAW,QAAQ,gCAElB;IAED,kBAAkB;IAClB,IAAW,OAAO,IAAI,QAAQ,CAE7B;IAED,kBAAkB;IACX,UAAU,IAAI,IAAI;IA0BzB,kBAAkB;IACX,eAAe,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,mBAAmB,GAAG,UAAU;IAIrF,kBAAkB;IACX,aAAa,CAAC,UAAU,CAAC,EAAE,iBAAiB,GAAG,QAAQ;IAI9D,kBAAkB;IACX,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,WAAW;IAItE,kBAAkB;IACX,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,WAAW;IAItE,kBAAkB;IACX,oBAAoB,CAAC,UAAU,CAAC,EAAE,wBAAwB,GAAG,eAAe;CAItF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AmbientLight, Color, type AmbientLightDescriptor, type AmbientLightFactory, type IFramework, type LightsBuffer, type LightsBufferDescriptor, type Scene } from "../../api/index.js";
|
|
2
|
+
/** The WebGL implementation of the light factory. */
|
|
3
|
+
export declare class WebGlAmbientLightFactory implements AmbientLightFactory {
|
|
4
|
+
private readonly _framework;
|
|
5
|
+
/** The colour used when no descriptor is given. */
|
|
6
|
+
static readonly DEFAULT_COLOR: Color;
|
|
7
|
+
/**
|
|
8
|
+
* The constructor.
|
|
9
|
+
* @param _framework The framework.
|
|
10
|
+
*/
|
|
11
|
+
constructor(_framework: IFramework);
|
|
12
|
+
/** @inheritDoc */
|
|
13
|
+
createAmbientLight(desc?: AmbientLightDescriptor, scene?: Scene): AmbientLight;
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
__createLightsBuffer(desc?: LightsBufferDescriptor): LightsBuffer;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=WebGlAmbientLightFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGlAmbientLightFactory.d.ts","sourceRoot":"","sources":["../../../src/webgl/lights/WebGlAmbientLightFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,KAAK,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,KAAK,EACb,MAAM,oBAAoB,CAAC;AAG5B,qDAAqD;AACrD,qBAAa,wBAAyB,YAAW,mBAAmB;IAS7C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAP9C,mDAAmD;IACnD,gBAAuB,aAAa,QAA4B;IAEhE;;;OAGG;gBACiC,UAAU,EAAE,UAAU;IAG1D,kBAAkB;IACX,kBAAkB,CAAC,IAAI,CAAC,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,YAAY;IAIrF,kBAAkB;IACX,oBAAoB,CAAC,IAAI,CAAC,EAAE,sBAAsB,GAAG,YAAY;CAG3E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AmbientLight, DirectionalLight, PointLight, type IFramework, type IUniformBuffer, type LightsBuffer, type LightsBufferDescriptor } from "../../api/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The WebGL lights buffer. Owns a std140 uniform buffer for the `LightsBuffer` block.
|
|
4
|
+
* See {@link LightsBuffer} for the layout.
|
|
5
|
+
*/
|
|
6
|
+
export declare class WebGlLightsBuffer implements LightsBuffer {
|
|
7
|
+
/** Floats for the ambient light: vec3 padded to 16 bytes. */
|
|
8
|
+
static readonly AMBIENT_FLOAT_COUNT = 4;
|
|
9
|
+
/** Floats per directional light: two vec3, each padded to 16 bytes. */
|
|
10
|
+
static readonly DIRECTIONAL_LIGHT_FLOAT_COUNT = 8;
|
|
11
|
+
/** Floats per point light: vec3 light + float constant, vec3 position + float linear, float quadratic, padded to 48 bytes. */
|
|
12
|
+
static readonly POINT_LIGHT_FLOAT_COUNT = 12;
|
|
13
|
+
private _ambientLight;
|
|
14
|
+
private readonly _buffer;
|
|
15
|
+
private readonly _data;
|
|
16
|
+
private readonly _uploaded;
|
|
17
|
+
private readonly _directionalLights;
|
|
18
|
+
private readonly _pointLights;
|
|
19
|
+
private _disposed;
|
|
20
|
+
/**
|
|
21
|
+
* The constructor.
|
|
22
|
+
* @param framework The framework, used to create the uniform buffer.
|
|
23
|
+
* @param descriptor The optional initial lights and directional light count.
|
|
24
|
+
*/
|
|
25
|
+
constructor(framework: IFramework, descriptor?: LightsBufferDescriptor);
|
|
26
|
+
/** @inheritDoc */
|
|
27
|
+
get ambientLight(): AmbientLight;
|
|
28
|
+
/** @inheritDoc */
|
|
29
|
+
set ambientLight(ambientLight: AmbientLight);
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
get directionalLights(): readonly DirectionalLight[];
|
|
32
|
+
/** @inheritDoc */
|
|
33
|
+
readonly maxDirectionalLights: number;
|
|
34
|
+
/** @inheritDoc */
|
|
35
|
+
get pointLights(): readonly PointLight[];
|
|
36
|
+
/** @inheritDoc */
|
|
37
|
+
add(light: DirectionalLight | PointLight): void;
|
|
38
|
+
/** @inheritDoc */
|
|
39
|
+
remove(light: DirectionalLight | PointLight): boolean;
|
|
40
|
+
/** @inheritDoc */
|
|
41
|
+
readonly maxPointLights: number;
|
|
42
|
+
/** @inheritDoc */
|
|
43
|
+
get buffer(): IUniformBuffer;
|
|
44
|
+
/** @inheritDoc */
|
|
45
|
+
update(): void;
|
|
46
|
+
/** @inheritDoc */
|
|
47
|
+
dispose(): void;
|
|
48
|
+
private _writeAmbientLight;
|
|
49
|
+
private _listFor;
|
|
50
|
+
/** Writes color * intensity as vec3 at offset (the fourth float is left to the caller). */
|
|
51
|
+
private _writeColor;
|
|
52
|
+
private _hasChanged;
|
|
53
|
+
private _writeData;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=WebGlLightsBuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGlLightsBuffer.d.ts","sourceRoot":"","sources":["../../../src/webgl/lights/WebGlLightsBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EAEZ,gBAAgB,EAChB,UAAU,EAGV,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAE9B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IAElD,6DAA6D;IAC7D,gBAAuB,mBAAmB,KAAK;IAE/C,uEAAuE;IACvE,gBAAuB,6BAA6B,KAAK;IAEzD,8HAA8H;IAC9H,gBAAuB,uBAAuB,MAAM;IAEpD,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;IAC7D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;OAIG;gBACgB,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,sBAAsB;IAoB7E,kBAAkB;IAClB,IAAW,YAAY,IAAI,YAAY,CAEtC;IAED,kBAAkB;IAClB,IAAW,YAAY,CAAC,YAAY,EAAE,YAAY,EAEjD;IAED,kBAAkB;IAClB,IAAW,iBAAiB,IAAI,SAAS,gBAAgB,EAAE,CAE1D;IAED,kBAAkB;IAClB,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAE7C,kBAAkB;IAClB,IAAW,WAAW,IAAI,SAAS,UAAU,EAAE,CAE9C;IAED,kBAAkB;IACX,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,UAAU,GAAG,IAAI;IAWtD,kBAAkB;IACX,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,UAAU,GAAG,OAAO;IAU5D,kBAAkB;IAClB,SAAgB,cAAc,EAAE,MAAM,CAAC;IAEvC,kBAAkB;IAClB,IAAW,MAAM,IAAI,cAAc,CAElC;IAED,kBAAkB;IACX,MAAM,IAAI,IAAI;IAcrB,kBAAkB;IACX,OAAO,IAAI,IAAI;IAQtB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,QAAQ;IAUhB,2FAA2F;IAC3F,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,UAAU;CA2CrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GeometryFormat, type IBlendState, type IFramework, type IIndexBuffer, type IPrimitiveState, type IRenderPipeline, type IVertexBuffer } from "../../api/index.js";
|
|
2
2
|
import type { VertexBufferLayout } from '../../core/rendering/vertex-buffer-layout';
|
|
3
3
|
import type { WebGlBlendState } from '../blending/webgl-blend-state';
|
|
4
4
|
import type { WebGlPrimitiveState } from '../primitive/WebGlPrimitiveState.js';
|
|
@@ -21,6 +21,8 @@ export declare abstract class AWebGlRenderPipeline implements IRenderPipeline {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(framework: IFramework, primitiveState?: IPrimitiveState);
|
|
23
23
|
/** @inheritDoc */
|
|
24
|
+
abstract readonly geometryFormat: GeometryFormat;
|
|
25
|
+
/** @inheritDoc */
|
|
24
26
|
get blendState(): IBlendState;
|
|
25
27
|
/** @inheritDoc */
|
|
26
28
|
readonly primitiveState: WebGlPrimitiveState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWebGlRenderPipeline.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/AWebGlRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AWebGlRenderPipeline.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/AWebGlRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EACvH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAI3D;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,eAAe;IAEjE,8BAA8B;IAC9B,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IAC/C,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAC;IACxD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IAChD,SAAS,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IAGnE,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAS;IAEzC;;;;OAIG;gBACgB,SAAS,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,eAAe;IAS1E,kBAAkB;IAClB,kBAAyB,cAAc,EAAE,cAAc,CAAC;IAExD,kBAAkB;IAClB,IAAW,UAAU,IAAI,WAAW,CAEnC;IAED,kBAAkB;IAClB,SAAgB,cAAc,EAAE,mBAAmB,CAAC;IAEpD,kBAAkB;IACX,MAAM,CACT,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,aAAa,SAAK,EAClB,cAAc,SAAI,GACnB,IAAI;IAQP,kBAAkB;IACX,mBAAmB,EAAE,kBAAkB,EAAE,CAAS;IAEzD;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,IAAI,GAAG,SAAS;IAEtE;;;OAGG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IA4B1C;;;OAGG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAIhC,kBAAkB;IACX,UAAU,IAAI,IAAI;IASzB,kBAAkB;IACX,OAAO,IAAI,IAAI;CAOzB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GeometryFormat } from "../../api/geometry/GeometryFormat.js";
|
|
1
2
|
import { AWebGlRenderPipeline } from "./AWebGlRenderPipeline.js";
|
|
2
3
|
import { type IFramework, type IMainRenderTargetRenderPipeline, type ITexture2D } from "../../api/index.js";
|
|
3
4
|
/**
|
|
@@ -13,6 +14,8 @@ export declare class WebGlMainRenderTargetRenderPipeline extends AWebGlRenderPip
|
|
|
13
14
|
* @param mainRenderTarget The main render target texture. This is the texture that will be rendered to by this render pipeline. It should be the same texture as the one used in the swap chain's render pass descriptor for the main render target.
|
|
14
15
|
*/
|
|
15
16
|
constructor(framework: IFramework, mainRenderTarget: ITexture2D);
|
|
17
|
+
/** @inheritDoc */
|
|
18
|
+
readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
16
19
|
/** @inheritdoc */
|
|
17
20
|
protected _provideBuffers(): WebGLBuffer[];
|
|
18
21
|
/** @inheritdoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlMainRenderTargetRenderPipeline.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebGlMainRenderTargetRenderPipeline.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/WebGlMainRenderTargetRenderPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAKpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,+BAA+B,EAAE,KAAK,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEvH;;GAEG;AACH,qBAAa,mCAAoC,SAAQ,oBAAqB,YAAW,+BAA+B;IAEpH,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,iBAAiB,CAAyB;IAElD;;;;OAIG;gBACgB,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU;IAKtE,kBAAkB;IAClB,SAAgB,cAAc,6CAA6C;IAE3E,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE;IAI1C,kBAAkB;IAClB,IAAW,gBAAgB,IAAI,UAAU,CAKxC;IAED,kBAAkB;IAClB,IAAW,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAE5C;IAED,kBAAkB;IACX,UAAU,IAAI,IAAI;IAQzB,OAAO,CAAC,gBAAgB;IAmBxB,kBAAkB;IACX,MAAM,IAAI,IAAI;IAmBrB,kBAAkB;IACF,OAAO,IAAI,IAAI;CAMlC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IFramework, IInspectTextureMipsRenderPipeline, IMainRenderTargetRenderPipeline, IPrimitiveState, IRenderPipelineFactory, ISpriteRenderPipeline, ITexture2D, IUniformBuffer, IUnlitRenderPipeline } from "../../api
|
|
1
|
+
import type { IFramework, IInspectTextureMipsRenderPipeline, IMainRenderTargetRenderPipeline, IPrimitiveState, IRenderPipelineFactory, ISpriteRenderPipeline, ITexture2D, IUniformBuffer, IUnlitRenderPipeline, IForwardBlinnPhongRenderPipeline, ForwardBlinnPhongRenderPipelineDescriptor } from "../../api";
|
|
2
2
|
/**
|
|
3
3
|
* The WebGL implementation of the IRenderPipelineFactory interface.
|
|
4
4
|
* This factory is responsible for creating render pipelines for WebGL rendering.
|
|
@@ -13,6 +13,8 @@ export declare class WebGlRenderPipelineFactory implements IRenderPipelineFactor
|
|
|
13
13
|
/** @inheritDoc */
|
|
14
14
|
createUnlitRenderPipeline(projectionViewBuffer: IUniformBuffer, modelBuffer: IUniformBuffer, materialBuffer: IUniformBuffer, primitiveState?: IPrimitiveState): IUnlitRenderPipeline;
|
|
15
15
|
/** @inheritDoc */
|
|
16
|
+
createForwardBlinnPhongRenderPipeline(descriptor: ForwardBlinnPhongRenderPipelineDescriptor): IForwardBlinnPhongRenderPipeline;
|
|
17
|
+
/** @inheritDoc */
|
|
16
18
|
createMainFrameBufferPipeline(mainFrameBuffer: ITexture2D): IMainRenderTargetRenderPipeline;
|
|
17
19
|
/** @inheritDoc */
|
|
18
20
|
createInspectTextureMipsRenderPipeline(projectionViewBuffer: IUniformBuffer, modelBuffer: IUniformBuffer, textureConstantsBuffer: IUniformBuffer, primitiveState?: IPrimitiveState): IInspectTextureMipsRenderPipeline;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlRenderPipelineFactory.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/WebGlRenderPipelineFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,UAAU,EACV,iCAAiC,EACjC,+BAA+B,EAAE,eAAe,EAAE,sBAAsB,EACxE,qBAAqB,EAAE,UAAU,EACjC,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"WebGlRenderPipelineFactory.d.ts","sourceRoot":"","sources":["../../../src/webgl/render-pipelines/WebGlRenderPipelineFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,UAAU,EACV,iCAAiC,EACjC,+BAA+B,EAAE,eAAe,EAAE,sBAAsB,EACxE,qBAAqB,EAAE,UAAU,EACjC,cAAc,EACd,oBAAoB,EACpB,gCAAgC,EAChC,yCAAyC,EAC5C,MAAM,WAAW,CAAC;AAKnB;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,sBAAsB;IAMzD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJvC;;;OAGG;gBAC0B,UAAU,EAAE,UAAU;IAGnD,kBAAkB;IACX,yBAAyB,CAAC,oBAAoB,EAAE,cAAc,EACpC,WAAW,EAAE,cAAc,EAC3B,cAAc,EAAE,cAAc,EAC9B,cAAc,CAAC,EAAE,eAAe,GAC7B,oBAAoB;IAQxD,kBAAkB;IACX,qCAAqC,CAAC,UAAU,EAAE,yCAAyC,GAAG,gCAAgC;IAkBrI,kBAAkB;IACX,6BAA6B,CAAC,eAAe,EAAE,UAAU,GAAG,+BAA+B;IAMlG,kBAAkB;IACX,sCAAsC,CACzC,oBAAoB,EAAE,cAAc,EACpC,WAAW,EAAE,cAAc,EAC3B,sBAAsB,EAAE,cAAc,EACtC,cAAc,CAAC,EAAE,eAAe,GAC7B,iCAAiC;IAQxC,kBAAkB;IACX,0BAA0B,CAAC,oBAAoB,EAAE,cAAc,GAAG,qBAAqB;IAM9F,kBAAkB;IACX,oCAAoC,CAAC,YAAY,EAAE,UAAU,GAAG,+BAA+B;CAMzG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GeometryFormat, type IFramework, type IPrimitiveState, type ISampler, type ITexture2D, type IUniformBuffer, type IVertexBuffer } from "../../../api/index.js";
|
|
2
2
|
import { AWebGlRenderPipeline } from "../AWebGlRenderPipeline.js";
|
|
3
3
|
import { type IIndexBuffer } from "../../../api/index.js";
|
|
4
4
|
import type { IInspectTextureMipsRenderPipeline } from "../../../api/index.js";
|
|
@@ -27,6 +27,8 @@ export declare class WebGlInspectTextureMipsRenderPipeline extends AWebGlRenderP
|
|
|
27
27
|
* @param textureConstantsBuffer The texture constants buffer.
|
|
28
28
|
*/
|
|
29
29
|
constructor(framework: IFramework, projectionViewBuffer: IUniformBuffer, modelBuffer: IUniformBuffer, textureConstantsBuffer: IUniformBuffer, primitiveState?: IPrimitiveState);
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
30
32
|
/** @inheritdoc */
|
|
31
33
|
get projectionViewBuffer(): IUniformBuffer;
|
|
32
34
|
/** @inheritdoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlInspectTextureMipsRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WebGlInspectTextureMipsRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/inspect/WebGlInspectTextureMipsRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,UAAU,EAAE,KAAK,eAAe,EACrC,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EACrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAC,KAAK,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EACR,iCAAiC,EACpC,MAAM,uBAAuB,CAAC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ED,kBAAkB;IAClB,IAAW,cAAc,IAAI,QAAQ,GAAG,SAAS,CAEhD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAEpD;IAED,kBAAkB;IACF,UAAU,IAAI,IAAI;IASlC,OAAO,CAAC,gBAAgB;IAgBxB,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAS7D,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAE,MAAW,EAAE,aAAa,GAAE,MAAU,GAAG,IAAI;CAoDpI"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { GeometryFormat, type IFramework, type IPrimitiveState, type ISampler, type ITexture2D, type IUniformBuffer, type IVertexBuffer } from "../../../api";
|
|
2
|
+
import { AWebGlRenderPipeline } from "../AWebGlRenderPipeline.js";
|
|
3
|
+
import { type IIndexBuffer } from "../../../api";
|
|
4
|
+
import type { IForwardBlinnPhongRenderPipeline } from "../../../api/rendering/render-pipelines/IForwardBlinnPhongRenderPipeline.js";
|
|
5
|
+
/**
|
|
6
|
+
* The WebGL implementation of Blinn-Phong with forward calculated lighting.
|
|
7
|
+
* @internal
|
|
8
|
+
**/
|
|
9
|
+
export declare class WebGlForwardBlinnPhongRenderPipeline extends AWebGlRenderPipeline implements IForwardBlinnPhongRenderPipeline {
|
|
10
|
+
private static readonly CAMERA_BINDING_POINT;
|
|
11
|
+
private static readonly MODEL_BINDING_POINT;
|
|
12
|
+
private static readonly MATERIAL_BINDING_POINT;
|
|
13
|
+
private static readonly LIGHTS_BINDING_POINT;
|
|
14
|
+
private static readonly CAMERA_POSITION_BINDING_POINT;
|
|
15
|
+
private _texture;
|
|
16
|
+
private _sampler?;
|
|
17
|
+
private _projectionViewBuffer;
|
|
18
|
+
private _modelBuffer;
|
|
19
|
+
private _materialBuffer;
|
|
20
|
+
private _lightsBuffer;
|
|
21
|
+
private _cameraBlockIndex;
|
|
22
|
+
private _modelBlockIndex;
|
|
23
|
+
private _materialBlockIndex;
|
|
24
|
+
private _lightsBlockIndex;
|
|
25
|
+
private _cameraPositionBuffer;
|
|
26
|
+
private _cameraPositionBlockIndex;
|
|
27
|
+
private _maxDirectionalLights;
|
|
28
|
+
private _maxPointLights;
|
|
29
|
+
private _initialized;
|
|
30
|
+
private _buffersArray;
|
|
31
|
+
private _lastVertexBuffer;
|
|
32
|
+
/**
|
|
33
|
+
* The constructor.
|
|
34
|
+
* @param framework The framework.
|
|
35
|
+
* @param projectionViewBuffer The projection view buffer.
|
|
36
|
+
* @param modelBuffer The model buffer.
|
|
37
|
+
* @param materialBuffer The material buffer.
|
|
38
|
+
* @param lightsBuffer The lights buffer (`LightsBuffer.buffer`). May be set later.
|
|
39
|
+
* @param cameraPositionBuffer The camera position buffer (world-space eye).
|
|
40
|
+
* @param primitiveState The primitive state.
|
|
41
|
+
*/
|
|
42
|
+
constructor(framework: IFramework, projectionViewBuffer: IUniformBuffer, modelBuffer: IUniformBuffer, materialBuffer: IUniformBuffer, lightsBuffer: IUniformBuffer | undefined, cameraPositionBuffer: IUniformBuffer, primitiveState?: IPrimitiveState);
|
|
43
|
+
/** @inheritDoc */
|
|
44
|
+
readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2_NORMAL3;
|
|
45
|
+
/** @inheritdoc */
|
|
46
|
+
get projectionViewBuffer(): IUniformBuffer;
|
|
47
|
+
/** @inheritdoc */
|
|
48
|
+
set projectionViewBuffer(value: IUniformBuffer);
|
|
49
|
+
/** @inheritdoc */
|
|
50
|
+
get modelBuffer(): IUniformBuffer;
|
|
51
|
+
/** @inheritdoc */
|
|
52
|
+
set modelBuffer(value: IUniformBuffer);
|
|
53
|
+
/** @inheritdoc */
|
|
54
|
+
get materialBuffer(): IUniformBuffer;
|
|
55
|
+
/** @inheritdoc */
|
|
56
|
+
set materialBuffer(value: IUniformBuffer);
|
|
57
|
+
/** @inheritdoc */
|
|
58
|
+
get lightsBuffer(): IUniformBuffer;
|
|
59
|
+
/** @inheritdoc */
|
|
60
|
+
set lightsBuffer(value: IUniformBuffer);
|
|
61
|
+
/** @inheritdoc */
|
|
62
|
+
get maxDirectionalLights(): number;
|
|
63
|
+
/** @inheritdoc */
|
|
64
|
+
get maxPointLights(): number;
|
|
65
|
+
/** @inheritdoc */
|
|
66
|
+
setLightCounts(maxDirectionalLights: number, maxPointLights: number): void;
|
|
67
|
+
/** @inheritdoc */
|
|
68
|
+
get cameraPositionBuffer(): IUniformBuffer;
|
|
69
|
+
/** @inheritdoc */
|
|
70
|
+
set cameraPositionBuffer(value: IUniformBuffer);
|
|
71
|
+
/** @inheritdoc */
|
|
72
|
+
get diffuseTexture(): ITexture2D;
|
|
73
|
+
/** @inheritdoc */
|
|
74
|
+
set diffuseTexture(value: ITexture2D);
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
get diffuseTextureSampler(): ISampler | undefined;
|
|
77
|
+
set diffuseTextureSampler(value: ISampler | undefined);
|
|
78
|
+
/** @inheritdoc */
|
|
79
|
+
initialize(): void;
|
|
80
|
+
/** Loads the shader variant for the current light counts (cached per counts by the shader loader). */
|
|
81
|
+
private _loadProgram;
|
|
82
|
+
private _createResources;
|
|
83
|
+
/** @inheritdoc */
|
|
84
|
+
protected _provideBuffers(): WebGLBuffer[] | undefined | null;
|
|
85
|
+
/** @inheritdoc */
|
|
86
|
+
render(vertexBuffer: IVertexBuffer, indexBuffer: IIndexBuffer, indicesCount?: number, indicesOffset?: number): void;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=WebGlBlinnPhongRenderPipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGlBlinnPhongRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/material/WebGlBlinnPhongRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,UAAU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EAE3D;IAED,kBAAkB;IACF,UAAU,IAAI,IAAI;IAQlC,sGAAsG;IACtG,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,gBAAgB;IAsBxB,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAS7D,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAE,MAAW,EAAE,aAAa,GAAE,MAAU,GAAG,IAAI;CA8DpI"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GeometryFormat, type IFramework, type IPrimitiveState, type ISampler, type ITexture2D, type IUniformBuffer, type IUnlitRenderPipeline, type IVertexBuffer } from "../../../api/index.js";
|
|
2
2
|
import { AWebGlRenderPipeline } from "../AWebGlRenderPipeline.js";
|
|
3
3
|
import { type IIndexBuffer } from "../../../api/index.js";
|
|
4
4
|
/**
|
|
@@ -27,6 +27,8 @@ export declare class WebGlUnlitRenderPipeline extends AWebGlRenderPipeline imple
|
|
|
27
27
|
* @param primitiveState The primitive state.
|
|
28
28
|
*/
|
|
29
29
|
constructor(framework: IFramework, projectionViewBuffer: IUniformBuffer, modelBuffer: IUniformBuffer, materialBuffer: IUniformBuffer, primitiveState?: IPrimitiveState);
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
30
32
|
/** @inheritdoc */
|
|
31
33
|
get projectionViewBuffer(): IUniformBuffer;
|
|
32
34
|
/** @inheritdoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlUnlitRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/material/WebGlUnlitRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WebGlUnlitRenderPipeline.d.ts","sourceRoot":"","s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c,EAEpD;IAED,kBAAkB;IAClB,IAAW,WAAW,IAAI,cAAc,CAEvC;IAED,kBAAkB;IAClB,IAAW,WAAW,CAAC,KAAK,EAAE,cAAc,EAK3C;IAED,kBAAkB;IAClB,IAAW,cAAc,IAAI,cAAc,CAE1C;IAED,kBAAkB;IAClB,IAAW,cAAc,CAAC,KAAK,EAAE,cAAc,EAE9C;IAED,kBAAkB;IAClB,IAAW,cAAc,IAAI,UAAU,CAEtC;IAED,kBAAkB;IAClB,IAAW,cAAc,CAAC,KAAK,EAAE,UAAU,EAE1C;IAED,kBAAkB;IAClB,IAAW,qBAAqB,IAAI,QAAQ,GAAG,SAAS,CAEvD;IAED,IAAW,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAE3D;IAED,kBAAkB;IACF,UAAU,IAAI,IAAI;IASlC,OAAO,CAAC,gBAAgB;IAgBxB,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAS7D,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAE,MAAW,EAAE,aAAa,GAAE,MAAU,GAAG,IAAI;CAmDpI"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GeometryFormat, type IFramework, type ISampler, type ISpriteRenderPipeline, type ITexture2D, type IUniformBuffer, type IVertexBuffer } from "../../../api/index.js";
|
|
2
2
|
import { AWebGlRenderPipeline } from "../AWebGlRenderPipeline.js";
|
|
3
3
|
import { type IIndexBuffer } from "../../../api/index.js";
|
|
4
4
|
/**
|
|
@@ -18,6 +18,8 @@ export declare class WebGlSpriteRenderPipeline extends AWebGlRenderPipeline impl
|
|
|
18
18
|
* @param projectionViewBuffer The projection view buffer.
|
|
19
19
|
*/
|
|
20
20
|
constructor(framework: IFramework, projectionViewBuffer: IUniformBuffer);
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
readonly geometryFormat = GeometryFormat.POS3_COLOR4_TEXTURECOORDS2;
|
|
21
23
|
/** @inheritdoc */
|
|
22
24
|
get projectionViewBuffer(): IUniformBuffer;
|
|
23
25
|
/** @inheritdoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlSpriteRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WebGlSpriteRenderPipeline.d.ts","sourceRoot":"","sources":["../../../../src/webgl/render-pipelines/sprite/WebGlSpriteRenderPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EACrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAC,KAAK,YAAY,EAAkB,MAAM,uBAAuB,CAAC;AAGzE;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,oBAAqB,YAAW,qBAAqB;IAEhG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAa;IAEzD,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,QAAQ,CAAC,CAAe;IAChC,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,iBAAiB,CAAkC;IAE3D;;;;OAIG;gBACS,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,cAAc;IAKvE,kBAAkB;IAClB,SAAgB,cAAc,6CAA6C;IAE3E,kBAAkB;IAClB,IAAW,oBAAoB,IAAI,cAAc,CAEhD;IAED,kBAAkB;IAClB,IAAW,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAEpD;IAED,kBAAkB;IAClB,IAAW,aAAa,IAAI,UAAU,CAErC;IAED,kBAAkB;IAClB,IAAW,aAAa,CAAC,KAAK,EAAE,UAAU,EAEzC;IAED,kBAAkB;IAClB,IAAW,cAAc,IAAI,QAAQ,GAAG,SAAS,CAEhD;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,EAEpD;IAED,kBAAkB;IACF,UAAU,IAAI,IAAI;IASlC,OAAO,CAAC,gBAAgB;IAUxB,kBAAkB;IAClB,SAAS,CAAC,eAAe,IAAI,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAS7D,kBAAkB;IACX,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAE,MAAW,EAAE,aAAa,GAAE,MAAU,GAAG,IAAI;CA4CpI"}
|
|
@@ -10,8 +10,11 @@ export declare class WebGlShaderModule implements IShaderModule {
|
|
|
10
10
|
* The constructor of the WebGL shader module.
|
|
11
11
|
* @param framework The framework.
|
|
12
12
|
* @param shaderFilePath
|
|
13
|
+
* @param @param keyValueDictionary - If present, tries to find key in shader such that it replaced ##DIRECTIONAL_LIGHT_COUNT## by given value for key DIRECTIONAL_LIGHST_COUNT.
|
|
13
14
|
*/
|
|
14
|
-
constructor(framework: IFramework, shaderFilePath: string
|
|
15
|
+
constructor(framework: IFramework, shaderFilePath: string, keyValueDictionary?: {
|
|
16
|
+
[id: string]: number;
|
|
17
|
+
});
|
|
15
18
|
/** @inheritDoc */
|
|
16
19
|
stages: ShaderStage[];
|
|
17
20
|
/** @inheritDoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlShaderModule.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AASpF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAe;IAEhC
|
|
1
|
+
{"version":3,"file":"WebGlShaderModule.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AASpF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAEnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAAe;IAEhC;;;;;OAKG;gBACgB,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE;QAAC,CAAC,EAAE,EAAC,MAAM,GAAG,MAAM,CAAA;KAAC;IAM5G,kBAAkB;IACX,MAAM,EAAE,WAAW,EAAE,CAAM;IAElC,kBAAkB;IACX,YAAY,CAAC,EAAE,GAAG,CAAC;IAE1B;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAelC;;OAEG;IACH,IAAW,OAAO,IAAI,YAAY,GAAG,IAAI,GAAG,SAAS,CAEpD;IAED,OAAO,CAAC,YAAY;IAyCpB,kBAAkB;IACX,OAAO,IAAI,IAAI;CAOzB;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { IFramework, IShaderModule } from "../../api/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Builds the cache key of a shader module: the id plus the sorted replacement values,
|
|
4
|
+
* so the same shader with different `##KEY##` values (e.g. light counts) is compiled separately.
|
|
5
|
+
* @param id The shader module id.
|
|
6
|
+
* @param keyValueDictionary The optional replacement values.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function shaderModuleCacheKey(id: string, keyValueDictionary?: {
|
|
10
|
+
[id: string]: number;
|
|
11
|
+
}): string;
|
|
2
12
|
/**
|
|
3
13
|
* The content WebGL implementation of ShaderContentModule.
|
|
4
14
|
*/
|
|
@@ -10,10 +20,11 @@ export declare class WebGlShaderModuleLoader {
|
|
|
10
20
|
* @param framework The framework.
|
|
11
21
|
*/
|
|
12
22
|
constructor(framework: IFramework);
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
/** @inheritDoc */
|
|
24
|
+
load(assetFilePathOrIdentifier: string, keyValueDictionary?: {
|
|
25
|
+
[id: string]: number;
|
|
26
|
+
}): IShaderModule;
|
|
27
|
+
/** Deletes every cached shader program and clears the cache. */
|
|
28
|
+
dispose(): void;
|
|
18
29
|
}
|
|
19
30
|
//# sourceMappingURL=WebGlShaderModuleLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlShaderModuleLoader.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModuleLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAGlE;;GAEG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwE;IACvG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;OAGG;gBACgB,SAAS,EAAE,UAAU;IAIxC
|
|
1
|
+
{"version":3,"file":"WebGlShaderModuleLoader.d.ts","sourceRoot":"","sources":["../../../src/webgl/shader/WebGlShaderModuleLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAGlE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE;IAAC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GAAG,MAAM,CAMpG;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwE;IACvG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;OAGG;gBACgB,SAAS,EAAE,UAAU;IAIxC,kBAAkB;IACX,IAAI,CAAC,yBAAyB,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE;QAAC,CAAC,EAAE,EAAC,MAAM,GAAG,MAAM,CAAA;KAAC,GAAI,aAAa;IAgB1G,gEAAgE;IACzD,OAAO,IAAI,IAAI;CAMzB"}
|
|
@@ -25,13 +25,20 @@ export declare class WebGlTexture2D extends ATexture2D {
|
|
|
25
25
|
createView(_descriptor?: TextureViewDescriptor): ITextureView;
|
|
26
26
|
/** @inheritdoc */
|
|
27
27
|
dispose(): void;
|
|
28
|
-
|
|
28
|
+
/** One default texture per framework, so a new framework (and GL context) never gets a texture of an old one. */
|
|
29
|
+
private static readonly _defaultFilled;
|
|
29
30
|
/**
|
|
30
31
|
* Creates a default 1x1 white texture if it doesn't already exist and returns it.
|
|
31
32
|
* This can be used as a placeholder texture when a texture is expected but not available.
|
|
32
33
|
* @param framework The framework instance.
|
|
34
|
+
* The texture belongs to that framework's GL context; each framework gets its own.
|
|
33
35
|
* @returns The default 1x1 white texture.
|
|
34
36
|
*/
|
|
35
37
|
static getOrCreateDefault(framework: IFramework): WebGlTexture2D;
|
|
38
|
+
/**
|
|
39
|
+
* Disposes and forgets the default texture of a framework. Called from `Framework.dispose()`.
|
|
40
|
+
* @param framework The framework instance.
|
|
41
|
+
*/
|
|
42
|
+
static disposeDefault(framework: IFramework): void;
|
|
36
43
|
}
|
|
37
44
|
//# sourceMappingURL=WebGlTexture2D.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGlTexture2D.d.ts","sourceRoot":"","sources":["../../../src/webgl/texture/WebGlTexture2D.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAGnE;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAYtC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAV/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;;OAIG;gBAEkB,UAAU,EAAE,UAAU,EACvC,iBAAiB,EAAE,iBAAiB;IAOxC;;;OAGG;IACH,IAAW,SAAS,IAAI,YAAY,CAEnC;IAED,kBAAkB;IACX,UAAU,IAAI,IAAI;IA2CzB,kBAAkB;IACX,UAAU,CAAC,WAAW,CAAC,EAAE,qBAAqB,GAAG,YAAY;IAKpE,kBAAkB;IACX,OAAO,IAAI,IAAI;IAgBtB,OAAO,CAAC,MAAM,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"WebGlTexture2D.d.ts","sourceRoot":"","sources":["../../../src/webgl/texture/WebGlTexture2D.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAGnE;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAYtC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAV/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyB;IAC7C,OAAO,CAAC,UAAU,CAA6B;IAE/C;;;;OAIG;gBAEkB,UAAU,EAAE,UAAU,EACvC,iBAAiB,EAAE,iBAAiB;IAOxC;;;OAGG;IACH,IAAW,SAAS,IAAI,YAAY,CAEnC;IAED,kBAAkB;IACX,UAAU,IAAI,IAAI;IA2CzB,kBAAkB;IACX,UAAU,CAAC,WAAW,CAAC,EAAE,qBAAqB,GAAG,YAAY;IAKpE,kBAAkB;IACX,OAAO,IAAI,IAAI;IAgBtB,iHAAiH;IACjH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAEnF;;;;;;OAMG;WACW,kBAAkB,CAAC,SAAS,EAAE,UAAU,GAAG,cAAc;IAmBvE;;;OAGG;WACW,cAAc,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAM5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-filter-anisotropic-utilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/webgl-filter-anisotropic-utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,+BAA+B;IACxC;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAA4C;IAEtE
|
|
1
|
+
{"version":3,"file":"webgl-filter-anisotropic-utilities.d.ts","sourceRoot":"","sources":["../../../src/webgl/utilities/webgl-filter-anisotropic-utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,+BAA+B;IACxC;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAA4C;IAEtE;;;;OAIG;IACI,gBAAgB,CAAC,EAAE,EAAE,sBAAsB,GAAG,MAAM;IAW3D;;;;;OAKG;IACI,aAAa,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;CAQ7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ris-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-dev.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"build": "tsc --noEmit && npm run build:lib && npm run build:app",
|
|
23
23
|
"build:lib": "rm -rf dist && vite build --config vite.lib.config.ts && tsc -p tsconfig.lib.json && node scripts/rewrite-declaration-extensions.mjs",
|
|
24
24
|
"build:app": "vite build",
|
|
25
|
+
"dev:examples": "vite --config examples/vite.config.ts",
|
|
26
|
+
"build:examples": "vite build --config examples/vite.config.ts",
|
|
25
27
|
"preview": "vite preview",
|
|
26
28
|
"test": "tsc --noEmit && tsc -p tsconfig.test.json --noEmit && vitest run"
|
|
27
29
|
},
|
|
@@ -32,9 +34,7 @@
|
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
36
|
"gl-matrix": "^3.4.4",
|
|
35
|
-
"
|
|
36
|
-
"ris-ktx2": "^0.1.0",
|
|
37
|
-
"tsyringe": "^4.10.0"
|
|
37
|
+
"ris-ktx2": "^0.1.0"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#version 300 es
|
|
2
|
+
precision mediump float;
|
|
3
|
+
|
|
4
|
+
#define DIRECTIONAL_LIGHTS_COUNT ##DIRECTIONAL_LIGHTS_COUNT##
|
|
5
|
+
#define POINT_LIGHTS_COUNT ##POINT_LIGHTS_COUNT##
|
|
6
|
+
|
|
7
|
+
in vec4 v_color;
|
|
8
|
+
in vec2 v_texCoords;
|
|
9
|
+
in vec3 v_normal;
|
|
10
|
+
in vec3 v_worldPosition;
|
|
11
|
+
|
|
12
|
+
layout(location = 0) out vec4 o_outputColor;
|
|
13
|
+
|
|
14
|
+
layout(std140) uniform MaterialBuffer
|
|
15
|
+
{
|
|
16
|
+
vec3 u_ambientColor;
|
|
17
|
+
vec3 u_diffuseColor;
|
|
18
|
+
vec3 u_specularColor;
|
|
19
|
+
float u_shininess;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
layout(std140) uniform CameraPositionBuffer
|
|
23
|
+
{
|
|
24
|
+
vec3 u_cameraPosition;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
struct DirectionalLight
|
|
28
|
+
{
|
|
29
|
+
vec3 light;
|
|
30
|
+
vec3 direction;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
struct PointLight
|
|
34
|
+
{
|
|
35
|
+
vec3 light;
|
|
36
|
+
float constant;
|
|
37
|
+
vec3 position;
|
|
38
|
+
float linear;
|
|
39
|
+
float quadratic;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
layout(std140) uniform LightsBuffer
|
|
43
|
+
{
|
|
44
|
+
vec3 u_ambientLight;
|
|
45
|
+
DirectionalLight u_directionalLight[DIRECTIONAL_LIGHTS_COUNT];
|
|
46
|
+
PointLight u_pointLight[POINT_LIGHTS_COUNT];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
uniform sampler2D u_texture;
|
|
50
|
+
|
|
51
|
+
void main()
|
|
52
|
+
{
|
|
53
|
+
vec3 normal = normalize(v_normal);
|
|
54
|
+
|
|
55
|
+
// Ambient lighting
|
|
56
|
+
vec3 ambient = u_ambientColor * u_ambientLight;
|
|
57
|
+
|
|
58
|
+
vec3 viewDirection = normalize(u_cameraPosition - v_worldPosition);
|
|
59
|
+
|
|
60
|
+
// Directional diffuse and Blinn-Phong specular lighting
|
|
61
|
+
vec3 diffuse = vec3(0.0);
|
|
62
|
+
vec3 specular = vec3(0.0);
|
|
63
|
+
|
|
64
|
+
for (int i = 0; i < DIRECTIONAL_LIGHTS_COUNT; ++i)
|
|
65
|
+
{
|
|
66
|
+
vec3 lightColor = u_directionalLight[i].light;
|
|
67
|
+
vec3 lightDirection = normalize(-u_directionalLight[i].direction);
|
|
68
|
+
|
|
69
|
+
float NdotL = max(dot(normal, lightDirection), 0.0);
|
|
70
|
+
|
|
71
|
+
diffuse += u_diffuseColor * lightColor * NdotL;
|
|
72
|
+
|
|
73
|
+
if (NdotL > 0.0)
|
|
74
|
+
{
|
|
75
|
+
vec3 halfway = normalize(lightDirection + viewDirection);
|
|
76
|
+
float NdotH = max(dot(normal, halfway), 0.0);
|
|
77
|
+
specular += u_specularColor * lightColor * pow(NdotH, u_shininess);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Point lights: same diffuse and specular, scaled by distance attenuation.
|
|
82
|
+
for (int i = 0; i < POINT_LIGHTS_COUNT; ++i)
|
|
83
|
+
{
|
|
84
|
+
vec3 toLight = u_pointLight[i].position - v_worldPosition;
|
|
85
|
+
float lightDistance = length(toLight);
|
|
86
|
+
vec3 lightDirection = toLight / max(lightDistance, 0.0001);
|
|
87
|
+
float attenuation = 1.0 / (u_pointLight[i].constant
|
|
88
|
+
+ u_pointLight[i].linear * lightDistance
|
|
89
|
+
+ u_pointLight[i].quadratic * lightDistance * lightDistance);
|
|
90
|
+
vec3 lightColor = u_pointLight[i].light * attenuation;
|
|
91
|
+
|
|
92
|
+
float NdotL = max(dot(normal, lightDirection), 0.0);
|
|
93
|
+
|
|
94
|
+
diffuse += u_diffuseColor * lightColor * NdotL;
|
|
95
|
+
|
|
96
|
+
if (NdotL > 0.0)
|
|
97
|
+
{
|
|
98
|
+
vec3 halfway = normalize(lightDirection + viewDirection);
|
|
99
|
+
float NdotH = max(dot(normal, halfway), 0.0);
|
|
100
|
+
specular += u_specularColor * lightColor * pow(NdotH, u_shininess);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Apply material lighting, texture, and vertex color
|
|
105
|
+
vec4 texel = texture(u_texture, v_texCoords) * v_color;
|
|
106
|
+
// Specular highlights are not tinted by the texture.
|
|
107
|
+
vec3 finalColor = texel.rgb * (ambient + diffuse) + specular;
|
|
108
|
+
|
|
109
|
+
o_outputColor = vec4(finalColor, texel.a);
|
|
110
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#version 300 es
|
|
2
|
+
|
|
3
|
+
layout(location = 0) in vec3 a_position;
|
|
4
|
+
layout(location = 1) in vec4 a_color;
|
|
5
|
+
layout(location = 2) in vec2 a_texCoord;
|
|
6
|
+
layout(location = 3) in vec3 a_normal;
|
|
7
|
+
|
|
8
|
+
out vec4 v_color;
|
|
9
|
+
out vec2 v_texCoords;
|
|
10
|
+
out vec3 v_normal;
|
|
11
|
+
out vec3 v_worldPosition;
|
|
12
|
+
|
|
13
|
+
layout(std140) uniform CameraBuffer
|
|
14
|
+
{
|
|
15
|
+
mat4 projectionView;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
layout(std140) uniform ModelBuffer
|
|
19
|
+
{
|
|
20
|
+
mat4 model;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
void main()
|
|
24
|
+
{
|
|
25
|
+
vec4 worldPosition = model * vec4(a_position, 1.0);
|
|
26
|
+
gl_Position = projectionView * worldPosition;
|
|
27
|
+
v_color = a_color;
|
|
28
|
+
v_texCoords = a_texCoord;
|
|
29
|
+
// World-space normal through the normal matrix, correct for non-uniform mesh scale.
|
|
30
|
+
v_normal = transpose(inverse(mat3(model))) * a_normal;
|
|
31
|
+
v_worldPosition = worldPosition.xyz;
|
|
32
|
+
}
|