rapid-render 1.0.16 → 1.0.18
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/README.md +17 -9
- package/dist/extensions/light.d.ts +34 -0
- package/dist/{particle.d.ts → extensions/particle.d.ts} +6 -6
- package/dist/index.d.ts +4 -9
- package/dist/matrix-engine.d.ts +3 -1
- package/dist/rapid-render.js +1064 -956
- package/dist/rapid-render.umd.cjs +84 -51
- package/dist/region/atlasSpriteRegion.d.ts +0 -2
- package/dist/region/graphicRegion.d.ts +1 -0
- package/dist/region/particleRegion.d.ts +1 -1
- package/dist/region/region.d.ts +2 -0
- package/dist/region/spriteRegion.d.ts +0 -2
- package/dist/render.d.ts +3 -5
- package/dist/texture-filter-mode.d.ts +5 -0
- package/dist/texture.d.ts +2 -2
- package/dist/utils.d.ts +1 -0
- package/dist/webgl/glshader.d.ts +6 -3
- package/dist/webgl/utils.d.ts +4 -3
- package/package.json +4 -3
package/dist/render.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { ICircleOptions, IDrawParticleBatchOptions, IGraphicOptions, ILineOption
|
|
|
10
10
|
import { Vec2 } from './math';
|
|
11
11
|
import { AtlasSpriteRegion } from './region/atlasSpriteRegion';
|
|
12
12
|
import { ParticleRegion } from './region/particleRegion';
|
|
13
|
+
import { TextureFilterMode } from './texture-filter-mode';
|
|
14
|
+
export { TextureFilterMode } from './texture-filter-mode';
|
|
13
15
|
/**
|
|
14
16
|
* Options for initializing the Rapid application.
|
|
15
17
|
*/
|
|
@@ -66,10 +68,6 @@ export declare enum BlendMode {
|
|
|
66
68
|
/** Erase blending (removes alpha based on source). */
|
|
67
69
|
ERASE = 4
|
|
68
70
|
}
|
|
69
|
-
export declare enum TextureFilterMode {
|
|
70
|
-
LINEAR = 0,
|
|
71
|
-
NEAREST = 1
|
|
72
|
-
}
|
|
73
71
|
export declare enum CanvasScaleMode {
|
|
74
72
|
/**
|
|
75
73
|
* Scales the canvas by increasing the WebGL backbuffer size.
|
|
@@ -202,7 +200,7 @@ export declare class Rapid {
|
|
|
202
200
|
* @param v The V texture coordinate (0 to 1).
|
|
203
201
|
* @param color The vertex color as a 32-bit unsigned integer.
|
|
204
202
|
*/
|
|
205
|
-
addGraphicVertex(x: number, y: number, u
|
|
203
|
+
addGraphicVertex(x: number, y: number, u?: number, v?: number, color?: Color | number): void;
|
|
206
204
|
/**
|
|
207
205
|
* Ends the current graphics geometry definition, readying it for rendering.
|
|
208
206
|
*/
|
package/dist/texture.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Rapid
|
|
1
|
+
import { Rapid } from './render';
|
|
2
|
+
import { TextureFilterMode } from './texture-filter-mode';
|
|
2
3
|
import { Color } from './color';
|
|
3
4
|
export type Images = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | OffscreenCanvas;
|
|
4
5
|
export declare enum TextureWrapMode {
|
|
@@ -190,7 +191,6 @@ declare class RenderTexture extends Texture {
|
|
|
190
191
|
private framebuffer;
|
|
191
192
|
private renderbuffer;
|
|
192
193
|
private gl;
|
|
193
|
-
flipY: boolean;
|
|
194
194
|
clearColor?: Color;
|
|
195
195
|
/** Actual GPU-allocated dimensions — grow-only, never shrink */
|
|
196
196
|
private _allocW;
|
package/dist/utils.d.ts
CHANGED
package/dist/webgl/glshader.d.ts
CHANGED
|
@@ -85,17 +85,19 @@ export declare class CustomGlShader {
|
|
|
85
85
|
uniformDirty: Set<string>;
|
|
86
86
|
/** Map of textures to be bound to this shader */
|
|
87
87
|
uniformTextures: Record<string, WebGLTexture>;
|
|
88
|
+
uniformArrayTexture: Record<string, WebGLTexture[]>;
|
|
88
89
|
/** Number of texture units reserved by this custom shader */
|
|
89
90
|
usedTextureUnitNum: number;
|
|
90
91
|
/** Padding in pixels this shader needs beyond the sprite bounds (for outline/glow effects) */
|
|
91
92
|
padding: number;
|
|
92
93
|
rapid: Rapid;
|
|
93
|
-
|
|
94
|
+
prefix: string[];
|
|
95
|
+
constructor(rapid: Rapid, vs?: string, fs?: string, usedTextureUnitNum?: number, uniforms?: Record<string, UniformValue>);
|
|
94
96
|
/**
|
|
95
97
|
* Updates uniform values or textures for the custom shader.
|
|
96
98
|
* @param uniforms Map of uniform values or WebGL textures to apply.
|
|
97
99
|
*/
|
|
98
|
-
setUniforms(uniforms: Record<string, UniformValue | WebGLTexture>): void;
|
|
100
|
+
setUniforms(uniforms: Record<string, UniformValue | WebGLTexture | WebGLTexture[]>): void;
|
|
99
101
|
/**
|
|
100
102
|
* Sets the padding (in pixels) for this shader and propagates to all compiled GLShaders.
|
|
101
103
|
* Must be called before the first draw call if set after construction.
|
|
@@ -107,7 +109,8 @@ export declare class CustomGlShader {
|
|
|
107
109
|
* @param key The region key.
|
|
108
110
|
* @param textureUniforms Map of texture uniform names to assigned texture unit indices.
|
|
109
111
|
*/
|
|
110
|
-
applyUniform(key: string, textureUniforms: Record<string, number>): void;
|
|
112
|
+
applyUniform(key: string, textureUniforms: Record<string, number | number[]>): void;
|
|
113
|
+
replaceCustomCode(shader: string, code: string): string;
|
|
111
114
|
/**
|
|
112
115
|
* Retrieves or compiles a customized GLShader for a specific region.
|
|
113
116
|
* @param region The Region requesting the shader.
|
package/dist/webgl/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TextureFilterMode } from '../texture-filter-mode';
|
|
2
|
+
import { TextureWrapMode, ITextOptions } from '../texture';
|
|
3
|
+
import { Rapid } from '../render';
|
|
3
4
|
export type WebGLContext = WebGL2RenderingContext;
|
|
4
5
|
export declare const supportsWebGL: (canvas: HTMLCanvasElement) => boolean;
|
|
5
6
|
/**
|
|
@@ -40,7 +41,7 @@ export declare function createTexture(render: Rapid, source: TexImageSource | {
|
|
|
40
41
|
width: number;
|
|
41
42
|
height: number;
|
|
42
43
|
}, options: ICreateTextureOptions): WebGLTexture;
|
|
43
|
-
export declare function generateShader(fs: string, max: number): string;
|
|
44
|
+
export declare function generateShader(fs: string, max: number, id?: string, uv?: string, set?: string): string;
|
|
44
45
|
export declare const FLOAT = 5126;
|
|
45
46
|
export declare const UNSIGNED_BYTE = 5121;
|
|
46
47
|
export declare function vertexAttribDivisor(gl: WebGLContext, index: number, divisor: number): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapid-render",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.18",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A high-performance lightweight WebGL 2D renderer for browser games.",
|
|
7
7
|
"repository": "https://github.com/Nightre/Rapid.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dev": "vite",
|
|
38
38
|
"build": "tsc && vite build",
|
|
39
39
|
"build:test-internal": "vite build --config vite.test.config.ts",
|
|
40
|
-
"test": "
|
|
40
|
+
"test": "vitest run",
|
|
41
41
|
"build:docs": "vite build --config vite.docs.config.ts",
|
|
42
42
|
"docs": "typedoc",
|
|
43
43
|
"example:dev": "vite --config example/vite.config.ts",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"@types/stats.js": "^0.17.4",
|
|
51
51
|
"highlight.js": "^11.11.1",
|
|
52
52
|
"stats.js": "^0.17.0",
|
|
53
|
-
"vite-plugin-dts": "^4.5.4"
|
|
53
|
+
"vite-plugin-dts": "^4.5.4",
|
|
54
|
+
"vitest": "^4.0.18"
|
|
54
55
|
},
|
|
55
56
|
"dependencies": {}
|
|
56
57
|
}
|