excalibur 0.25.1 → 0.25.2
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/.nvmrc +1 -1
- package/CHANGELOG.md +119 -27
- package/README.md +0 -1
- package/build/dist/Actions/ActionsComponent.d.ts +1 -1
- package/build/dist/Actor.d.ts +46 -45
- package/build/dist/Camera.d.ts +10 -2
- package/build/dist/Class.d.ts +4 -5
- package/build/dist/Collision/BodyComponent.d.ts +6 -2
- package/build/dist/Collision/BoundingBox.d.ts +6 -0
- package/build/dist/Collision/ColliderComponent.d.ts +1 -4
- package/build/dist/Collision/Colliders/CircleCollider.d.ts +18 -2
- package/build/dist/Collision/Colliders/EdgeCollider.d.ts +1 -1
- package/build/dist/Collision/Colliders/SeparatingAxis.d.ts +2 -2
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +4 -4
- package/build/dist/Collision/Detection/Pair.d.ts +5 -1
- package/build/dist/Collision/Group/CollisionGroup.d.ts +0 -1
- package/build/dist/Collision/MotionSystem.d.ts +4 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.d.ts +1 -1
- package/build/dist/Collision/Solver/Solver.d.ts +1 -1
- package/build/dist/Debug/Debug.d.ts +18 -1
- package/build/dist/Debug/DebugFlags.d.ts +16 -3
- package/build/dist/Engine.d.ts +66 -8
- package/build/dist/EntityComponentSystem/Component.d.ts +3 -3
- package/build/dist/EntityComponentSystem/Components/MotionComponent.d.ts +2 -2
- package/build/dist/EntityComponentSystem/Entity.d.ts +4 -4
- package/build/dist/EntityComponentSystem/System.d.ts +1 -1
- package/build/dist/EntityComponentSystem/SystemManager.d.ts +6 -1
- package/build/dist/EventDispatcher.d.ts +0 -5
- package/build/dist/Events/ExEvent.d.ts +6 -0
- package/build/dist/Events/PointerEvents.d.ts +37 -0
- package/build/dist/Graphics/Animation.d.ts +3 -2
- package/build/dist/Graphics/Circle.d.ts +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.d.ts +37 -5
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +12 -2
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +29 -13
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.d.ts +22 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.frag.glsl +53 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.vert.glsl +37 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.d.ts +27 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.frag.glsl +28 -0
- package/build/dist/Graphics/Context/{shaders/image-vertex.glsl → image-renderer/image-renderer.vert.glsl} +2 -7
- package/build/dist/Graphics/Context/{shaders → line-renderer}/line-fragment.glsl +0 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.d.ts +21 -0
- package/build/dist/Graphics/Context/{shaders → line-renderer}/line-vertex.glsl +2 -2
- package/build/dist/Graphics/Context/{shaders → point-renderer}/point-fragment.glsl +6 -2
- package/build/dist/Graphics/Context/point-renderer/point-renderer.d.ts +21 -0
- package/build/dist/Graphics/Context/{shaders → point-renderer}/point-vertex.glsl +2 -2
- package/build/dist/Graphics/Context/quad-index-buffer.d.ts +36 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.d.ts +23 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.frag.glsl +85 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.vert.glsl +42 -0
- package/build/dist/Graphics/Context/render-source.d.ts +7 -0
- package/build/dist/Graphics/Context/render-target.d.ts +26 -0
- package/build/dist/Graphics/Context/renderer.d.ts +20 -51
- package/build/dist/Graphics/Context/screen-pass-painter/screen-fragment.glsl +11 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.d.ts +13 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-vertex.glsl +11 -0
- package/build/dist/Graphics/Context/shader.d.ts +116 -42
- package/build/dist/Graphics/Context/shaders/crt-effect.glsl +64 -0
- package/build/dist/Graphics/Context/shaders/grayscale-fragment.glsl +13 -0
- package/build/dist/Graphics/Context/shaders/invert-fragment.glsl +12 -0
- package/build/dist/Graphics/Context/texture-loader.d.ts +8 -2
- package/build/dist/Graphics/Context/vertex-buffer.d.ts +49 -0
- package/build/dist/Graphics/Context/vertex-layout.d.ts +52 -0
- package/build/dist/Graphics/Context/webgl-adapter.d.ts +9 -0
- package/build/dist/Graphics/Context/webgl-util.d.ts +22 -0
- package/build/dist/Graphics/DebugGraphicsComponent.d.ts +13 -0
- package/build/dist/Graphics/Filtering.d.ts +15 -0
- package/build/dist/Graphics/Font.d.ts +61 -23
- package/build/dist/Graphics/FontCommon.d.ts +43 -2
- package/build/dist/Graphics/Graphic.d.ts +23 -9
- package/build/dist/Graphics/GraphicsSystem.d.ts +0 -1
- package/build/dist/Graphics/ImageSource.d.ts +8 -3
- package/build/dist/Graphics/Polygon.d.ts +2 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.d.ts +5 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.d.ts +17 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.d.ts +7 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.d.ts +16 -0
- package/build/dist/Graphics/PostProcessor/color-blind-fragment.glsl +62 -0
- package/build/dist/Graphics/Raster.d.ts +32 -5
- package/build/dist/Graphics/Sprite.d.ts +5 -0
- package/build/dist/Graphics/SpriteFont.d.ts +6 -7
- package/build/dist/Graphics/SpriteSheet.d.ts +1 -2
- package/build/dist/Graphics/Text.d.ts +18 -2
- package/build/dist/Graphics/index.d.ts +14 -0
- package/build/dist/Id.d.ts +1 -1
- package/build/dist/Input/EngineInput.d.ts +2 -2
- package/build/dist/Input/Index.d.ts +10 -3
- package/build/dist/Input/NativePointerButton.d.ts +10 -0
- package/build/dist/Input/PointerAbstraction.d.ts +33 -0
- package/build/dist/Input/PointerButton.d.ts +10 -0
- package/build/dist/Input/PointerComponent.d.ts +24 -0
- package/build/dist/Input/PointerEvent.d.ts +18 -0
- package/build/dist/Input/PointerEventReceiver.d.ts +114 -0
- package/build/dist/Input/PointerScope.d.ts +14 -0
- package/build/dist/Input/PointerSystem.d.ts +43 -0
- package/build/dist/Input/PointerType.d.ts +9 -0
- package/build/dist/Input/WheelDeltaMode.d.ts +5 -0
- package/build/dist/Input/WheelEvent.d.ts +18 -0
- package/build/dist/Interfaces/PointerEventHandlers.d.ts +17 -16
- package/build/dist/Label.d.ts +9 -2
- package/build/dist/Loader.d.ts +5 -2
- package/build/dist/Math/Index.d.ts +1 -0
- package/build/dist/Math/matrix.d.ts +19 -1
- package/build/dist/Math/util.d.ts +45 -0
- package/build/dist/Particles.d.ts +12 -0
- package/build/dist/Resources/Gif.d.ts +1 -1
- package/build/dist/Scene.d.ts +10 -1
- package/build/dist/Screen.d.ts +4 -3
- package/build/dist/TileMap.d.ts +3 -2
- package/build/dist/Traits/Index.d.ts +0 -1
- package/build/dist/Trigger.d.ts +4 -0
- package/build/dist/Util/Clock.d.ts +118 -0
- package/build/dist/Util/Fps.d.ts +40 -0
- package/build/dist/Util/Observable.d.ts +1 -1
- package/build/dist/Util/Pool.d.ts +2 -10
- package/build/dist/Util/Util.d.ts +23 -66
- package/build/dist/excalibur.js +9124 -7580
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +2 -2
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.d.ts +5 -2
- package/build/esm/Actions/ActionsComponent.d.ts +1 -1
- package/build/esm/Actor.d.ts +46 -45
- package/build/esm/Camera.d.ts +10 -2
- package/build/esm/Class.d.ts +4 -5
- package/build/esm/Collision/BodyComponent.d.ts +6 -2
- package/build/esm/Collision/BoundingBox.d.ts +6 -0
- package/build/esm/Collision/ColliderComponent.d.ts +1 -4
- package/build/esm/Collision/Colliders/CircleCollider.d.ts +18 -2
- package/build/esm/Collision/Colliders/EdgeCollider.d.ts +1 -1
- package/build/esm/Collision/Colliders/SeparatingAxis.d.ts +2 -2
- package/build/esm/Collision/Detection/DynamicTreeCollisionProcessor.d.ts +4 -4
- package/build/esm/Collision/Detection/Pair.d.ts +5 -1
- package/build/esm/Collision/Group/CollisionGroup.d.ts +0 -1
- package/build/esm/Collision/MotionSystem.d.ts +4 -0
- package/build/esm/Collision/Solver/ContactConstraintPoint.d.ts +1 -1
- package/build/esm/Collision/Solver/Solver.d.ts +1 -1
- package/build/esm/Debug/Debug.d.ts +18 -1
- package/build/esm/Debug/DebugFlags.d.ts +16 -3
- package/build/esm/Engine.d.ts +66 -8
- package/build/esm/EntityComponentSystem/Component.d.ts +3 -3
- package/build/esm/EntityComponentSystem/Components/MotionComponent.d.ts +2 -2
- package/build/esm/EntityComponentSystem/Entity.d.ts +4 -4
- package/build/esm/EntityComponentSystem/System.d.ts +1 -1
- package/build/esm/EntityComponentSystem/SystemManager.d.ts +6 -1
- package/build/esm/EventDispatcher.d.ts +0 -5
- package/build/esm/Events/ExEvent.d.ts +6 -0
- package/build/esm/Events/PointerEvents.d.ts +37 -0
- package/build/esm/Graphics/Animation.d.ts +3 -2
- package/build/esm/Graphics/Circle.d.ts +2 -0
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext.d.ts +37 -5
- package/build/esm/Graphics/Context/ExcaliburGraphicsContext2DCanvas.d.ts +12 -2
- package/build/esm/Graphics/Context/ExcaliburGraphicsContextWebGL.d.ts +29 -13
- package/build/esm/Graphics/Context/circle-renderer/circle-renderer.d.ts +22 -0
- package/build/esm/Graphics/Context/image-renderer/image-renderer.d.ts +27 -0
- package/build/esm/Graphics/Context/line-renderer/line-renderer.d.ts +21 -0
- package/build/esm/Graphics/Context/point-renderer/point-renderer.d.ts +21 -0
- package/build/esm/Graphics/Context/quad-index-buffer.d.ts +36 -0
- package/build/esm/Graphics/Context/rectangle-renderer/rectangle-renderer.d.ts +23 -0
- package/build/esm/Graphics/Context/render-source.d.ts +7 -0
- package/build/esm/Graphics/Context/render-target.d.ts +26 -0
- package/build/esm/Graphics/Context/renderer.d.ts +20 -51
- package/build/esm/Graphics/Context/screen-pass-painter/screen-pass-painter.d.ts +13 -0
- package/build/esm/Graphics/Context/shader.d.ts +116 -42
- package/build/esm/Graphics/Context/texture-loader.d.ts +8 -2
- package/build/esm/Graphics/Context/vertex-buffer.d.ts +49 -0
- package/build/esm/Graphics/Context/vertex-layout.d.ts +52 -0
- package/build/esm/Graphics/Context/webgl-adapter.d.ts +9 -0
- package/build/esm/Graphics/Context/webgl-util.d.ts +22 -0
- package/build/esm/Graphics/DebugGraphicsComponent.d.ts +13 -0
- package/build/esm/Graphics/Filtering.d.ts +15 -0
- package/build/esm/Graphics/Font.d.ts +61 -23
- package/build/esm/Graphics/FontCommon.d.ts +43 -2
- package/build/esm/Graphics/Graphic.d.ts +23 -9
- package/build/esm/Graphics/GraphicsSystem.d.ts +0 -1
- package/build/esm/Graphics/ImageSource.d.ts +8 -3
- package/build/esm/Graphics/Polygon.d.ts +2 -0
- package/build/esm/Graphics/PostProcessor/ColorBlindnessMode.d.ts +5 -0
- package/build/esm/Graphics/PostProcessor/ColorBlindnessPostProcessor.d.ts +17 -0
- package/build/esm/Graphics/PostProcessor/PostProcessor.d.ts +7 -0
- package/build/esm/Graphics/PostProcessor/ScreenShader.d.ts +16 -0
- package/build/esm/Graphics/Raster.d.ts +32 -5
- package/build/esm/Graphics/Sprite.d.ts +5 -0
- package/build/esm/Graphics/SpriteFont.d.ts +6 -7
- package/build/esm/Graphics/SpriteSheet.d.ts +1 -2
- package/build/esm/Graphics/Text.d.ts +18 -2
- package/build/esm/Graphics/index.d.ts +14 -0
- package/build/esm/Id.d.ts +1 -1
- package/build/esm/Input/EngineInput.d.ts +2 -2
- package/build/esm/Input/Index.d.ts +10 -3
- package/build/esm/Input/NativePointerButton.d.ts +10 -0
- package/build/esm/Input/PointerAbstraction.d.ts +33 -0
- package/build/esm/Input/PointerButton.d.ts +10 -0
- package/build/esm/Input/PointerComponent.d.ts +24 -0
- package/build/esm/Input/PointerEvent.d.ts +18 -0
- package/build/esm/Input/PointerEventReceiver.d.ts +114 -0
- package/build/esm/Input/PointerScope.d.ts +14 -0
- package/build/esm/Input/PointerSystem.d.ts +43 -0
- package/build/esm/Input/PointerType.d.ts +9 -0
- package/build/esm/Input/WheelDeltaMode.d.ts +5 -0
- package/build/esm/Input/WheelEvent.d.ts +18 -0
- package/build/esm/Interfaces/PointerEventHandlers.d.ts +17 -16
- package/build/esm/Label.d.ts +9 -2
- package/build/esm/Loader.d.ts +5 -2
- package/build/esm/Math/Index.d.ts +1 -0
- package/build/esm/Math/matrix.d.ts +19 -1
- package/build/esm/Math/util.d.ts +45 -0
- package/build/esm/Particles.d.ts +12 -0
- package/build/esm/Resources/Gif.d.ts +1 -1
- package/build/esm/Scene.d.ts +10 -1
- package/build/esm/Screen.d.ts +4 -3
- package/build/esm/TileMap.d.ts +3 -2
- package/build/esm/Traits/Index.d.ts +0 -1
- package/build/esm/Trigger.d.ts +4 -0
- package/build/esm/Util/Clock.d.ts +118 -0
- package/build/esm/Util/Fps.d.ts +40 -0
- package/build/esm/Util/Observable.d.ts +1 -1
- package/build/esm/Util/Pool.d.ts +2 -10
- package/build/esm/Util/Util.d.ts +23 -66
- package/build/esm/excalibur.js +9001 -7438
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +2 -2
- package/build/esm/excalibur.min.js.map +1 -1
- package/build/esm/index.d.ts +5 -2
- package/package.json +31 -27
- package/build/dist/Graphics/Context/batch.d.ts +0 -11
- package/build/dist/Graphics/Context/draw-image-command.d.ts +0 -47
- package/build/dist/Graphics/Context/image-renderer.d.ts +0 -39
- package/build/dist/Graphics/Context/line-renderer.d.ts +0 -22
- package/build/dist/Graphics/Context/point-renderer.d.ts +0 -22
- package/build/dist/Graphics/Context/shaders/image-fragment.glsl +0 -48
- package/build/dist/Input/Pointer.d.ts +0 -134
- package/build/dist/Input/PointerEvents.d.ts +0 -170
- package/build/dist/Input/Pointers.d.ts +0 -78
- package/build/dist/PostProcessing/ColorBlindCorrector.d.ts +0 -28
- package/build/dist/PostProcessing/Index.d.ts +0 -2
- package/build/dist/PostProcessing/PostProcessor.d.ts +0 -6
- package/build/dist/Traits/CapturePointer.d.ts +0 -10
- package/build/esm/Graphics/Context/batch.d.ts +0 -11
- package/build/esm/Graphics/Context/draw-image-command.d.ts +0 -47
- package/build/esm/Graphics/Context/image-renderer.d.ts +0 -39
- package/build/esm/Graphics/Context/line-renderer.d.ts +0 -22
- package/build/esm/Graphics/Context/point-renderer.d.ts +0 -22
- package/build/esm/Input/Pointer.d.ts +0 -134
- package/build/esm/Input/PointerEvents.d.ts +0 -170
- package/build/esm/Input/Pointers.d.ts +0 -78
- package/build/esm/PostProcessing/ColorBlindCorrector.d.ts +0 -28
- package/build/esm/PostProcessing/Index.d.ts +0 -2
- package/build/esm/PostProcessing/PostProcessor.d.ts +0 -6
- package/build/esm/Traits/CapturePointer.d.ts +0 -10
- package/wallaby.js +0 -77
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
attribute vec2 a_position;
|
|
2
|
+
|
|
3
|
+
// UV coordinate
|
|
4
|
+
attribute vec2 a_uv;
|
|
5
|
+
varying vec2 v_uv;
|
|
6
|
+
|
|
7
|
+
attribute vec2 a_size;
|
|
8
|
+
varying vec2 v_size;
|
|
9
|
+
|
|
10
|
+
// Opacity
|
|
11
|
+
attribute float a_opacity;
|
|
12
|
+
varying float v_opacity;
|
|
13
|
+
|
|
14
|
+
attribute vec4 a_color;
|
|
15
|
+
varying vec4 v_color;
|
|
16
|
+
|
|
17
|
+
attribute vec4 a_strokeColor;
|
|
18
|
+
varying vec4 v_strokeColor;
|
|
19
|
+
|
|
20
|
+
attribute float a_strokeThickness;
|
|
21
|
+
varying float v_strokeThickness;
|
|
22
|
+
|
|
23
|
+
uniform mat4 u_matrix;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
void main() {
|
|
27
|
+
// Set the vertex position using the ortho transform matrix
|
|
28
|
+
gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
|
|
29
|
+
|
|
30
|
+
// Pass through UV coords
|
|
31
|
+
v_uv = a_uv;
|
|
32
|
+
// Pass through size
|
|
33
|
+
v_size = a_size;
|
|
34
|
+
// Pass through the Opacity to the fragment shader
|
|
35
|
+
v_opacity = a_opacity;
|
|
36
|
+
// Pass through the color to the fragment shader
|
|
37
|
+
v_color = a_color;
|
|
38
|
+
// Pass through the stroke color to the fragment shader
|
|
39
|
+
v_strokeColor = a_strokeColor;
|
|
40
|
+
// Pass through the stroke thickenss to the fragment shader
|
|
41
|
+
v_strokeThickness = a_strokeThickness;
|
|
42
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RenderSource } from './render-source';
|
|
2
|
+
export declare class RenderTarget {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
private _gl;
|
|
6
|
+
constructor(options: {
|
|
7
|
+
gl: WebGLRenderingContext;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
});
|
|
11
|
+
setResolution(width: number, height: number): void;
|
|
12
|
+
private _frameBuffer;
|
|
13
|
+
get frameBuffer(): WebGLFramebuffer;
|
|
14
|
+
private _frameTexture;
|
|
15
|
+
get frameTexture(): WebGLTexture;
|
|
16
|
+
private _setupFramebuffer;
|
|
17
|
+
toRenderSource(): RenderSource;
|
|
18
|
+
/**
|
|
19
|
+
* When called, all drawing gets redirected to this render target
|
|
20
|
+
*/
|
|
21
|
+
use(): void;
|
|
22
|
+
/**
|
|
23
|
+
* When called, all drawing is sent back to the canvas
|
|
24
|
+
*/
|
|
25
|
+
disable(): void;
|
|
26
|
+
}
|
|
@@ -1,66 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export interface Ctor<T> {
|
|
8
|
-
new (): T;
|
|
9
|
-
}
|
|
10
|
-
export interface BatchRendererOptions<T extends Poolable> {
|
|
11
|
-
gl: WebGLRenderingContext;
|
|
1
|
+
import { ExcaliburGraphicsContextWebGL } from './ExcaliburGraphicsContextWebGL';
|
|
2
|
+
/**
|
|
3
|
+
* Interface that defines an Excalibur Renderer that can be called with .draw() in the [[ExcaliburGraphicsContext]]
|
|
4
|
+
*/
|
|
5
|
+
export interface RendererPlugin {
|
|
12
6
|
/**
|
|
13
|
-
*
|
|
7
|
+
* Unique type name for this renderer plugin
|
|
14
8
|
*/
|
|
15
|
-
|
|
9
|
+
readonly type: string;
|
|
16
10
|
/**
|
|
17
|
-
*
|
|
11
|
+
* Render priority tie breaker when drawings are at the same z index
|
|
12
|
+
* @warning Not yet used by excalibur
|
|
18
13
|
*/
|
|
19
|
-
verticesPerCommand?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Maximum commands to batch before drawing
|
|
22
|
-
*/
|
|
23
|
-
maxCommandsPerBatch?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Override the built in command batching mechanism
|
|
26
|
-
*/
|
|
27
|
-
batchFactory?: () => BatchCommand<T>;
|
|
28
|
-
}
|
|
29
|
-
export declare abstract class BatchRenderer<T extends Poolable> implements Renderer {
|
|
30
14
|
priority: number;
|
|
31
|
-
private _gl;
|
|
32
|
-
private _vertices;
|
|
33
|
-
private _verticesPerCommand;
|
|
34
|
-
private _buffer;
|
|
35
|
-
private _maxCommandsPerBatch;
|
|
36
|
-
shader: Shader;
|
|
37
|
-
commands: Pool<T>;
|
|
38
|
-
private _batchPool;
|
|
39
|
-
private _batches;
|
|
40
|
-
constructor(options: BatchRendererOptions<T>);
|
|
41
|
-
/**
|
|
42
|
-
* Initialize render, builds shader and initialized webgl buffers
|
|
43
|
-
*/
|
|
44
|
-
init(): void;
|
|
45
|
-
get vertexSize(): number;
|
|
46
|
-
addCommand(cmd: T): void;
|
|
47
15
|
/**
|
|
48
|
-
*
|
|
16
|
+
* Initialize your renderer
|
|
17
|
+
*
|
|
49
18
|
* @param gl
|
|
19
|
+
* @param context
|
|
50
20
|
*/
|
|
51
|
-
|
|
21
|
+
initialize(gl: WebGLRenderingContext, context: ExcaliburGraphicsContextWebGL): void;
|
|
52
22
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param
|
|
55
|
-
* @param batch
|
|
23
|
+
* Issue a draw command to draw something to the screen
|
|
24
|
+
* @param args
|
|
56
25
|
*/
|
|
57
|
-
|
|
26
|
+
draw(...args: any[]): void;
|
|
58
27
|
/**
|
|
59
|
-
*
|
|
28
|
+
* @returns if there are any pending draws in the renderer
|
|
60
29
|
*/
|
|
61
|
-
|
|
30
|
+
hasPendingDraws(): boolean;
|
|
62
31
|
/**
|
|
63
|
-
*
|
|
32
|
+
* Flush any pending graphics draws to the screen
|
|
64
33
|
*/
|
|
65
|
-
|
|
34
|
+
flush(): void;
|
|
66
35
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PostProcessor } from '../../PostProcessor/PostProcessor';
|
|
2
|
+
/**
|
|
3
|
+
* This is responsible for painting the entire screen during the render passes
|
|
4
|
+
*/
|
|
5
|
+
export declare class ScreenPassPainter {
|
|
6
|
+
private _gl;
|
|
7
|
+
private _shader;
|
|
8
|
+
private _buffer;
|
|
9
|
+
private _layout;
|
|
10
|
+
constructor(gl: WebGLRenderingContext);
|
|
11
|
+
renderWithPostProcessor(postprocessor: PostProcessor): void;
|
|
12
|
+
renderToScreen(): void;
|
|
13
|
+
}
|
|
@@ -1,81 +1,155 @@
|
|
|
1
|
+
import { Vector } from '../..';
|
|
2
|
+
import { Matrix } from '../../Math/matrix';
|
|
3
|
+
export declare type UniformTypeNames = 'uniform1f' | 'uniform1i' | 'uniform2f' | 'uniform2i' | 'uniform3f' | 'uniform3i' | 'uniform4f' | 'uniform4i' | 'uniform1fv' | 'uniform1iv' | 'uniform2fv' | 'uniform2iv' | 'uniform3fv' | 'uniform3iv' | 'uniform4fv' | 'uniform4iv' | 'uniformMatrix2fv' | 'uniformMatrix3fv' | 'uniformMatrix4fv';
|
|
4
|
+
declare type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? undefined : (((...b: T) => void) extends (a: any, ...b: infer I) => void ? I : []);
|
|
5
|
+
declare type UniformParameters<TUniformType extends UniformTypeNames> = RemoveFirstFromTuple<Parameters<WebGLRenderingContext[TUniformType]>>;
|
|
6
|
+
export interface UniformDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
glType: number;
|
|
9
|
+
location: WebGLUniformLocation;
|
|
10
|
+
}
|
|
1
11
|
export interface VertexAttributeDefinition {
|
|
12
|
+
/**
|
|
13
|
+
* string name of the attribute in the shader program, commonly `a_nameofmyvariable`
|
|
14
|
+
*/
|
|
2
15
|
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Number of components for a given attribute
|
|
18
|
+
* Must be 1, 2, 3, or 4
|
|
19
|
+
*
|
|
20
|
+
* For example a vec4 attribute would be `4` floats, so 4
|
|
21
|
+
*/
|
|
3
22
|
size: number;
|
|
23
|
+
/**
|
|
24
|
+
* Supported types in webgl 1
|
|
25
|
+
* * gl.BYTE
|
|
26
|
+
* * gl.SHORT
|
|
27
|
+
* * gl.UNSIGNED_BYTE
|
|
28
|
+
* * gl.UNSIGNED_SHORT
|
|
29
|
+
* * gl.FLOAT
|
|
30
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
|
|
31
|
+
*/
|
|
4
32
|
glType: number;
|
|
33
|
+
/**
|
|
34
|
+
* Is the attribute normalized between (0-1)
|
|
35
|
+
*/
|
|
5
36
|
normalized: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Location index in the shader program
|
|
39
|
+
*/
|
|
6
40
|
location: number;
|
|
7
41
|
}
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type: string;
|
|
12
|
-
data: any;
|
|
42
|
+
export interface ShaderOptions {
|
|
43
|
+
vertexSource: string;
|
|
44
|
+
fragmentSource: string;
|
|
13
45
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Create a shader program for the Excalibur WebGL Graphics Context
|
|
16
|
-
*/
|
|
17
46
|
export declare class Shader {
|
|
47
|
+
private static _ACTIVE_SHADER_INSTANCE;
|
|
18
48
|
private _gl;
|
|
19
|
-
|
|
20
|
-
private _fragmentSource;
|
|
21
|
-
program: WebGLProgram | null;
|
|
49
|
+
program: WebGLProgram;
|
|
22
50
|
uniforms: {
|
|
23
51
|
[variableName: string]: UniformDefinition;
|
|
24
52
|
};
|
|
25
53
|
attributes: {
|
|
26
54
|
[variableName: string]: VertexAttributeDefinition;
|
|
27
55
|
};
|
|
28
|
-
|
|
56
|
+
private _compiled;
|
|
57
|
+
readonly vertexSource: string;
|
|
58
|
+
readonly fragmentSource: string;
|
|
59
|
+
get compiled(): boolean;
|
|
29
60
|
/**
|
|
30
61
|
* Create a shader program in excalibur
|
|
31
|
-
* @param
|
|
32
|
-
* @param _vertexSource Vertex shader source as a string
|
|
33
|
-
* @param _fragmentSource Fragment shader source as a string
|
|
62
|
+
* @param options specify shader vertex and fragment source
|
|
34
63
|
*/
|
|
35
|
-
constructor(
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
constructor(options?: ShaderOptions);
|
|
65
|
+
/**
|
|
66
|
+
* Binds the shader program
|
|
67
|
+
*/
|
|
68
|
+
use(): void;
|
|
69
|
+
isCurrentlyBound(): boolean;
|
|
38
70
|
/**
|
|
39
71
|
* Compile the current shader against a webgl context
|
|
40
|
-
* @param gl WebGL context
|
|
41
72
|
*/
|
|
42
|
-
compile(
|
|
73
|
+
compile(): WebGLProgram;
|
|
74
|
+
getUniforms(): UniformDefinition[];
|
|
75
|
+
getAttributes(): VertexAttributeDefinition[];
|
|
43
76
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
77
|
+
* Set a texture in a gpu texture slot
|
|
78
|
+
* @param slotNumber
|
|
79
|
+
* @param texture
|
|
47
80
|
*/
|
|
48
|
-
|
|
81
|
+
setTexture(slotNumber: number, texture: WebGLTexture): void;
|
|
49
82
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
83
|
+
* Set an integer uniform for the current shader
|
|
84
|
+
*
|
|
85
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
86
|
+
*
|
|
87
|
+
* @param name
|
|
88
|
+
* @param value
|
|
53
89
|
*/
|
|
54
|
-
|
|
90
|
+
setUniformInt(name: string, value: number): void;
|
|
55
91
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
92
|
+
* Set an integer array uniform for the current shader
|
|
93
|
+
*
|
|
94
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
95
|
+
*
|
|
96
|
+
* @param name
|
|
97
|
+
* @param value
|
|
60
98
|
*/
|
|
61
|
-
|
|
99
|
+
setUniformIntArray(name: string, value: number[]): void;
|
|
62
100
|
/**
|
|
63
|
-
*
|
|
101
|
+
* Set a boolean uniform for the current shader
|
|
102
|
+
*
|
|
103
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
104
|
+
*
|
|
105
|
+
* @param name
|
|
106
|
+
* @param value
|
|
64
107
|
*/
|
|
65
|
-
|
|
108
|
+
setUniformBoolean(name: string, value: boolean): void;
|
|
66
109
|
/**
|
|
67
|
-
*
|
|
110
|
+
* Set a float uniform for the current shader
|
|
111
|
+
*
|
|
112
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
113
|
+
*
|
|
114
|
+
* @param name
|
|
115
|
+
* @param value
|
|
68
116
|
*/
|
|
69
|
-
|
|
117
|
+
setUniformFloat(name: string, value: number): void;
|
|
70
118
|
/**
|
|
71
|
-
*
|
|
119
|
+
* Set a float array uniform for the current shader
|
|
120
|
+
*
|
|
121
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
122
|
+
*
|
|
72
123
|
* @param name
|
|
124
|
+
* @param value
|
|
73
125
|
*/
|
|
74
|
-
|
|
126
|
+
setUniformFloatArray(name: string, value: number[]): void;
|
|
75
127
|
/**
|
|
76
|
-
*
|
|
128
|
+
* Set a [[Vector]] uniform for the current shader
|
|
129
|
+
*
|
|
130
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
77
131
|
*
|
|
78
|
-
*
|
|
132
|
+
* @param name
|
|
133
|
+
* @param value
|
|
79
134
|
*/
|
|
80
|
-
|
|
135
|
+
setUniformFloatVector(name: string, value: Vector): void;
|
|
136
|
+
/**
|
|
137
|
+
* Set an [[Matrix]] uniform for the current shader
|
|
138
|
+
*
|
|
139
|
+
* **Important** Must call ex.Shader.use() before setting a uniform!
|
|
140
|
+
*
|
|
141
|
+
* @param name
|
|
142
|
+
* @param value
|
|
143
|
+
*/
|
|
144
|
+
setUniformMatrix(name: string, value: Matrix): void;
|
|
145
|
+
/**
|
|
146
|
+
* Set any available uniform type in webgl
|
|
147
|
+
*
|
|
148
|
+
* For example setUniform('uniformMatrix2fv', 'u_my2x2_mat`, ...);
|
|
149
|
+
*/
|
|
150
|
+
setUniform<TUniformType extends UniformTypeNames>(uniformType: TUniformType, name: string, ...value: UniformParameters<TUniformType>): void;
|
|
151
|
+
private _createProgram;
|
|
152
|
+
private _compileShader;
|
|
153
|
+
private _processSourceForError;
|
|
81
154
|
}
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// https://www.shadertoy.com/view/Ms23DR
|
|
2
|
+
precision mediump float;
|
|
3
|
+
|
|
4
|
+
// Passed in from the vertex shader.
|
|
5
|
+
varying vec2 v_texcoord;
|
|
6
|
+
|
|
7
|
+
// The texture.
|
|
8
|
+
uniform sampler2D u_texture;
|
|
9
|
+
|
|
10
|
+
vec2 curve(vec2 uv)
|
|
11
|
+
{
|
|
12
|
+
uv = (uv - 0.5) * 2.0;
|
|
13
|
+
uv *= 1.1;
|
|
14
|
+
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);
|
|
15
|
+
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);
|
|
16
|
+
uv = (uv / 2.0) + 0.5;
|
|
17
|
+
uv = uv *0.92 + 0.04;
|
|
18
|
+
return uv;
|
|
19
|
+
}
|
|
20
|
+
void main()
|
|
21
|
+
{
|
|
22
|
+
vec2 uv = vec2(v_texcoord.x, v_texcoord.y);
|
|
23
|
+
uv = curve( uv );
|
|
24
|
+
vec3 oricol = texture2D(u_texture, uv).xyz;
|
|
25
|
+
float iTime = 10.0;
|
|
26
|
+
vec2 iResolution = vec2(1200, 900);
|
|
27
|
+
vec3 col;
|
|
28
|
+
float x = sin(0.3*iTime+uv.y*21.0)*sin(0.7*iTime+uv.y*29.0)*sin(0.3+0.33*iTime+uv.y*31.0)*0.0017;
|
|
29
|
+
|
|
30
|
+
col.r = texture2D(u_texture,vec2(x+uv.x+0.001,uv.y+0.001)).x+0.05;
|
|
31
|
+
col.g = texture2D(u_texture,vec2(x+uv.x+0.000,uv.y-0.002)).y+0.05;
|
|
32
|
+
col.b = texture2D(u_texture,vec2(x+uv.x-0.002,uv.y+0.000)).z+0.05;
|
|
33
|
+
col.r += 0.08*texture2D(u_texture,0.75*vec2(x+0.025, -0.027)+vec2(uv.x+0.001,uv.y+0.001)).x;
|
|
34
|
+
col.g += 0.05*texture2D(u_texture,0.75*vec2(x+-0.022, -0.02)+vec2(uv.x+0.000,uv.y-0.002)).y;
|
|
35
|
+
col.b += 0.08*texture2D(u_texture,0.75*vec2(x+-0.02, -0.018)+vec2(uv.x-0.002,uv.y+0.000)).z;
|
|
36
|
+
|
|
37
|
+
col = clamp(col*0.6+0.4*col*col*1.0,0.0,1.0);
|
|
38
|
+
|
|
39
|
+
float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));
|
|
40
|
+
col *= vec3(pow(vig,0.3));
|
|
41
|
+
|
|
42
|
+
col *= vec3(0.95,1.05,0.95);
|
|
43
|
+
col *= 2.8;
|
|
44
|
+
|
|
45
|
+
float scans = clamp( 0.35+0.35*sin(3.5*iTime+uv.y*iResolution.y*1.5), 0.0, 1.0);
|
|
46
|
+
|
|
47
|
+
float s = pow(scans,1.7);
|
|
48
|
+
col = col*vec3( 0.4+0.7*s) ;
|
|
49
|
+
|
|
50
|
+
col *= 1.0+0.01*sin(110.0*iTime);
|
|
51
|
+
if (uv.x < 0.0 || uv.x > 1.0)
|
|
52
|
+
col *= 0.0;
|
|
53
|
+
if (uv.y < 0.0 || uv.y > 1.0)
|
|
54
|
+
col *= 0.0;
|
|
55
|
+
|
|
56
|
+
col*=1.0-0.65*vec3(clamp((mod(gl_FragCoord.x, 2.0)-1.0)*2.0,0.0,1.0));
|
|
57
|
+
|
|
58
|
+
float comp = smoothstep( 0.1, 0.9, sin(iTime) );
|
|
59
|
+
|
|
60
|
+
// Remove the next line to stop cross-fade between original and postprocess
|
|
61
|
+
// col = mix( col, oricol, comp );
|
|
62
|
+
|
|
63
|
+
gl_FragColor = vec4(col,1.0);
|
|
64
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
precision mediump float;
|
|
2
|
+
|
|
3
|
+
// Passed in from the vertex shader.
|
|
4
|
+
varying vec2 v_texcoord;
|
|
5
|
+
|
|
6
|
+
// The texture.
|
|
7
|
+
uniform sampler2D u_texture;
|
|
8
|
+
|
|
9
|
+
void main() {
|
|
10
|
+
vec4 tex = texture2D(u_texture, vec2(v_texcoord.x, 1.0 - v_texcoord.y));
|
|
11
|
+
float avg = 0.2126 * tex.r + 0.7152 * tex.g + 0.0722 * tex.b;
|
|
12
|
+
gl_FragColor = vec4(avg, avg, avg, 1.0);
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
precision mediump float;
|
|
2
|
+
|
|
3
|
+
// Passed in from the vertex shader.
|
|
4
|
+
varying vec2 v_texcoord;
|
|
5
|
+
|
|
6
|
+
// The texture.
|
|
7
|
+
uniform sampler2D u_texture;
|
|
8
|
+
|
|
9
|
+
void main() {
|
|
10
|
+
vec4 tex = texture2D(u_texture, vec2(v_texcoord.x, 1.0 - v_texcoord.y));
|
|
11
|
+
gl_FragColor = vec4(vec3(1.0, 1.0, 1.0) - tex.rgb, tex.a);
|
|
12
|
+
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { ImageFiltering } from '../Filtering';
|
|
1
2
|
import { HTMLImageSource } from './ExcaliburGraphicsContext';
|
|
2
3
|
/**
|
|
3
4
|
* Manages loading image sources into webgl textures, a unique id is associated with all sources
|
|
4
5
|
*/
|
|
5
6
|
export declare class TextureLoader {
|
|
7
|
+
/**
|
|
8
|
+
* Sets the default filtering for the Excalibur texture loader, default [[ImageFiltering.Blended]]
|
|
9
|
+
*/
|
|
10
|
+
static filtering: ImageFiltering;
|
|
6
11
|
private static _POT_CANVAS;
|
|
7
12
|
private static _POT_CTX;
|
|
8
13
|
private static _GL;
|
|
9
14
|
private static _TEXTURE_MAP;
|
|
10
|
-
static
|
|
15
|
+
static register(context: WebGLRenderingContext): void;
|
|
11
16
|
/**
|
|
12
17
|
* Get the WebGL Texture from a source image
|
|
13
18
|
* @param image
|
|
@@ -21,9 +26,10 @@ export declare class TextureLoader {
|
|
|
21
26
|
/**
|
|
22
27
|
* Loads a graphic into webgl and returns it's texture info, a webgl context must be previously registered
|
|
23
28
|
* @param image Source graphic
|
|
29
|
+
* @param filtering {ImageFiltering} The ImageFiltering mode to apply to the loaded texture
|
|
24
30
|
* @param forceUpdate Optionally force a texture to be reloaded, useful if the source graphic has changed
|
|
25
31
|
*/
|
|
26
|
-
static load(image: HTMLImageSource, forceUpdate?: boolean): WebGLTexture;
|
|
32
|
+
static load(image: HTMLImageSource, filtering?: ImageFiltering, forceUpdate?: boolean): WebGLTexture;
|
|
27
33
|
/**
|
|
28
34
|
* Converts source images into power of two images, WebGL only supports POT images
|
|
29
35
|
* https://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface VertexBufferOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Size in number of floats, so [4.2, 4.0, 2.1] is size = 3
|
|
4
|
+
*
|
|
5
|
+
* Ignored if data is passed directly
|
|
6
|
+
*/
|
|
7
|
+
size?: number;
|
|
8
|
+
/**
|
|
9
|
+
* If the vertices never change switching 'static' can be more efficient on the gpu
|
|
10
|
+
*
|
|
11
|
+
* Default is 'dynamic'
|
|
12
|
+
*/
|
|
13
|
+
type?: 'static' | 'dynamic';
|
|
14
|
+
/**
|
|
15
|
+
* Optionally pass pre-seeded data, size parameter is ignored
|
|
16
|
+
*/
|
|
17
|
+
data?: Float32Array;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Helper around vertex buffer to simplify creating and uploading geometry
|
|
21
|
+
*
|
|
22
|
+
* Under the hood uses Float32Array
|
|
23
|
+
*/
|
|
24
|
+
export declare class VertexBuffer {
|
|
25
|
+
private _gl;
|
|
26
|
+
/**
|
|
27
|
+
* Access to the webgl buffer handle
|
|
28
|
+
*/
|
|
29
|
+
readonly buffer: WebGLBuffer;
|
|
30
|
+
/**
|
|
31
|
+
* Access to the raw data of the vertex buffer
|
|
32
|
+
*/
|
|
33
|
+
readonly bufferData: Float32Array;
|
|
34
|
+
/**
|
|
35
|
+
* If the vertices never change switching 'static' can be more efficient on the gpu
|
|
36
|
+
*
|
|
37
|
+
* Default is 'dynamic'
|
|
38
|
+
*/
|
|
39
|
+
type: 'static' | 'dynamic';
|
|
40
|
+
constructor(options: VertexBufferOptions);
|
|
41
|
+
/**
|
|
42
|
+
* Bind this vertex buffer
|
|
43
|
+
*/
|
|
44
|
+
bind(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Upload vertex buffer geometry to the GPU
|
|
47
|
+
*/
|
|
48
|
+
upload(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Shader } from './shader';
|
|
2
|
+
import { VertexBuffer } from './vertex-buffer';
|
|
3
|
+
export interface VertexLayoutOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Shader that this layout will be for
|
|
6
|
+
*/
|
|
7
|
+
shader: Shader;
|
|
8
|
+
/**
|
|
9
|
+
* Vertex buffer to use for vertex data
|
|
10
|
+
*/
|
|
11
|
+
vertexBuffer: VertexBuffer;
|
|
12
|
+
/**
|
|
13
|
+
* Specify the attributes that will exist in the vertex buffer
|
|
14
|
+
*
|
|
15
|
+
* **Important** must specify them in the order that they will be in the vertex buffer!!
|
|
16
|
+
*/
|
|
17
|
+
attributes: [name: string, numberOfComponents: number][];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Helper around creating vertex attributes in a given [[VertexBuffer]], this is useful for describing
|
|
21
|
+
* the memory layout for your vertices inside a particular buffer
|
|
22
|
+
*
|
|
23
|
+
* Note: This helper assumes interleaved attributes in one [[VertexBuffer]], not many.
|
|
24
|
+
*
|
|
25
|
+
* Working with `gl.vertexAttribPointer` can be tricky, and this attempts to double check you
|
|
26
|
+
*/
|
|
27
|
+
export declare class VertexLayout {
|
|
28
|
+
private _gl;
|
|
29
|
+
private _logger;
|
|
30
|
+
private _shader;
|
|
31
|
+
private _layout;
|
|
32
|
+
private _attributes;
|
|
33
|
+
private _vertexBuffer;
|
|
34
|
+
get vertexBuffer(): VertexBuffer;
|
|
35
|
+
get attributes(): readonly [name: string, numberOfComponents: number][];
|
|
36
|
+
constructor(options: VertexLayoutOptions);
|
|
37
|
+
private _vertexTotalSizeBytes;
|
|
38
|
+
/**
|
|
39
|
+
* Total number of bytes that the vertex will take up
|
|
40
|
+
*/
|
|
41
|
+
get totalVertexSizeBytes(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Layouts need shader locations and must be bound to a shader
|
|
44
|
+
*/
|
|
45
|
+
initialize(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Bind this layout with it's associated vertex buffer
|
|
48
|
+
*
|
|
49
|
+
* @param uploadBuffer Optionally indicate you wish to upload the buffer to the GPU associated with this layout
|
|
50
|
+
*/
|
|
51
|
+
use(uploadBuffer?: boolean): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Must be accessed after Engine construction time to ensure the context has been created
|
|
3
|
+
*/
|
|
4
|
+
export declare class ExcaliburWebGLContextAccessor {
|
|
5
|
+
private static _GL;
|
|
6
|
+
static clear(): void;
|
|
7
|
+
static register(gl: WebGLRenderingContext): void;
|
|
8
|
+
static get gl(): WebGLRenderingContext;
|
|
9
|
+
}
|
|
@@ -10,3 +10,25 @@ export declare function nextHighestPowerOfTwo(x: number): number;
|
|
|
10
10
|
* Returns the input number if a power of two, otherwise the next highest power of two
|
|
11
11
|
*/
|
|
12
12
|
export declare function ensurePowerOfTwo(x: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Return the size of the GlType in bytes
|
|
15
|
+
* @param gl
|
|
16
|
+
* @param type
|
|
17
|
+
*/
|
|
18
|
+
export declare function getGlTypeSizeBytes(gl: WebGLRenderingContext, type: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Based on the type return the number of attribute components
|
|
21
|
+
*
|
|
22
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
|
|
23
|
+
* @param gl
|
|
24
|
+
* @param type
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAttributeComponentSize(gl: WebGLRenderingContext, type: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Based on the attribute return the corresponding supported attrib pointer type
|
|
29
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
|
|
30
|
+
*
|
|
31
|
+
* @param gl
|
|
32
|
+
* @param type
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAttributePointerType(gl: WebGLRenderingContext, type: number): number;
|