rapid-render 0.1.1 → 0.1.3

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.
@@ -1,17 +1,20 @@
1
- import { IAttribute, UniformType } from "../interface";
1
+ import { IAttribute, ShaderType } from "../interface";
2
2
  import Rapid from "../render";
3
+ import { Uniform } from "./uniform";
3
4
  declare class GLShader {
4
5
  attributeLoc: Record<string, number>;
5
6
  uniformLoc: Record<string, WebGLUniformLocation>;
6
7
  program: WebGLProgram;
8
+ private attributes;
7
9
  private gl;
8
- constructor(rapid: Rapid, vs: string, fs: string);
10
+ usedTexture: number;
11
+ constructor(rapid: Rapid, vs: string, fs: string, attributes?: IAttribute[], usedTexture?: number);
9
12
  /**
10
13
  * Set the uniform of this shader
11
14
  * @param uniforms
12
15
  * @param usedTextureUnit How many texture units have been used
13
16
  */
14
- setUniforms(uniforms: UniformType, usedTextureUnit: number): void;
17
+ setUniforms(uniform: Uniform, usedTextureUnit: number): number;
15
18
  private getUniform;
16
19
  /**
17
20
  * use this shader
@@ -19,9 +22,16 @@ declare class GLShader {
19
22
  use(): void;
20
23
  private parseShader;
21
24
  /**
22
- * Set vertex attributes in glsl shader
25
+ * Set vertex attribute in glsl shader
23
26
  * @param element
24
27
  */
25
28
  setAttribute(element: IAttribute): void;
29
+ /**
30
+ * Set vertex attributes in glsl shader
31
+ * @param elements
32
+ */
33
+ setAttributes(elements: IAttribute[]): void;
34
+ updateAttributes(): void;
35
+ static createCostumShader(rapid: Rapid, vs: string, fs: string, type: ShaderType, usedTexture?: number): GLShader;
26
36
  }
27
37
  export default GLShader;
@@ -0,0 +1,13 @@
1
+ import { UniformType, WebGLContext } from '../interface';
2
+ export declare class Uniform {
3
+ private data;
4
+ isDirty: boolean;
5
+ constructor(data: UniformType);
6
+ setUniform(key: string, data: UniformType[string]): void;
7
+ /**
8
+ * @ignore
9
+ */
10
+ clearDirty(): void;
11
+ getUnifromNames(): string[];
12
+ bind(gl: WebGLContext, uniformName: string, loc: WebGLUniformLocation, usedTextureUnit: number): number;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapid-render",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"