@galacean/effects-webgl 2.0.0-alpha.2 → 2.0.0-alpha.4

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,8 +1,7 @@
1
- import type { MaterialDestroyOptions, MaterialProps, MaterialStates, UndefinedAble, Texture, GlobalUniforms, Renderer, MaterialData } from '@galacean/effects-core';
2
- import { Material, math } from '@galacean/effects-core';
3
- import { GLMaterialState } from './gl-material-state';
1
+ import type { Engine, GlobalUniforms, MaterialData, MaterialDestroyOptions, MaterialProps, MaterialStates, Renderer, Texture, UndefinedAble } from '@galacean/effects-core';
2
+ import { Material, Shader, math } from '@galacean/effects-core';
4
3
  import type { GLPipelineContext } from './gl-pipeline-context';
5
- import type { GLShader } from './gl-shader';
4
+ import type { GLShaderVariant } from './gl-shader';
6
5
  type Color = math.Color;
7
6
  type Vector2 = math.Vector2;
8
7
  type Vector3 = math.Vector3;
@@ -12,7 +11,8 @@ type Matrix4 = math.Matrix4;
12
11
  type Quaternion = math.Quaternion;
13
12
  declare const Vector4: typeof math.Vector4, Matrix4: typeof math.Matrix4;
14
13
  export declare class GLMaterial extends Material {
15
- shader: GLShader;
14
+ shader: Shader;
15
+ shaderVariant: GLShaderVariant;
16
16
  private floats;
17
17
  private ints;
18
18
  private vector2s;
@@ -26,10 +26,13 @@ export declare class GLMaterial extends Material {
26
26
  private floatArrays;
27
27
  private vector4Arrays;
28
28
  private matrixArrays;
29
- samplers: string[];
30
- uniforms: string[];
31
- uniformDirtyFlag: boolean;
32
- glMaterialState: GLMaterialState;
29
+ private samplers;
30
+ private uniforms;
31
+ private uniformDirtyFlag;
32
+ private macrosDirtyFlag;
33
+ private readonly macros;
34
+ private glMaterialState;
35
+ constructor(engine: Engine, props?: MaterialProps);
33
36
  get blending(): UndefinedAble<boolean>;
34
37
  set blending(blending: UndefinedAble<boolean>);
35
38
  get blendColor(): UndefinedAble<[r: number, g: number, b: number, a: number]>;
@@ -74,9 +77,9 @@ export declare class GLMaterial extends Material {
74
77
  set frontFace(value: UndefinedAble<number>);
75
78
  get cullFace(): UndefinedAble<number>;
76
79
  set cullFace(value: UndefinedAble<number>);
77
- enableKeyword(keyword: string): void;
78
- disableKeyword(keyword: string): void;
79
- isKeywordEnabled(keyword: string): boolean;
80
+ enableMacro(keyword: string): void;
81
+ disableMacro(keyword: string): void;
82
+ isMacroEnabled(keyword: string): boolean;
80
83
  createMaterialStates(states: MaterialStates): void;
81
84
  get isDestroyed(): boolean;
82
85
  /**shader和texture的GPU资源初始化。 */
@@ -1,5 +1,5 @@
1
- import type { Disposable, RestoreHandler, ShaderCompileResult, ShaderLibrary, ShaderWithSource } from '@galacean/effects-core';
2
- import { GLShader } from './gl-shader';
1
+ import type { Disposable, RestoreHandler, ShaderCompileResult, ShaderLibrary, ShaderMarcos, ShaderWithSource } from '@galacean/effects-core';
2
+ import { GLShaderVariant } from './gl-shader';
3
3
  import type { GLPipelineContext } from './gl-pipeline-context';
4
4
  import type { GLEngine } from './gl-engine';
5
5
  export declare class GLShaderLibrary implements ShaderLibrary, Disposable, RestoreHandler {
@@ -14,9 +14,9 @@ export declare class GLShaderLibrary implements ShaderLibrary, Disposable, Resto
14
14
  private cachedShaders;
15
15
  constructor(engine: GLEngine, pipelineContext: GLPipelineContext);
16
16
  compileAllShaders(asyncCallback?: (results: ShaderCompileResult[]) => void): void;
17
- addShader(shaderSource: ShaderWithSource): string;
18
- createShader(shaderSource: ShaderWithSource): GLShader;
19
- compileShader(shader: GLShader, asyncCallback?: (result: ShaderCompileResult) => void): void;
17
+ addShader(shaderSource: ShaderWithSource, macros?: ShaderMarcos): string;
18
+ createShader(shaderSource: ShaderWithSource, macros?: ShaderMarcos): GLShaderVariant;
19
+ compileShader(shader: GLShaderVariant, asyncCallback?: (result: ShaderCompileResult) => void): void;
20
20
  private computeShaderCacheId;
21
21
  private createProgram;
22
22
  private createGLShader;
@@ -1,5 +1,5 @@
1
1
  import type { ShaderCompileResult, ShaderWithSource, Texture, Engine, math } from '@galacean/effects-core';
2
- import { Shader } from '@galacean/effects-core';
2
+ import { ShaderVariant } from '@galacean/effects-core';
3
3
  import type { GLProgram } from './gl-program';
4
4
  import type { GLPipelineContext } from './gl-pipeline-context';
5
5
  type Color = math.Color;
@@ -9,7 +9,7 @@ type Vector4 = math.Vector4;
9
9
  type Matrix3 = math.Matrix3;
10
10
  type Matrix4 = math.Matrix4;
11
11
  type Quaternion = math.Quaternion;
12
- export declare class GLShader extends Shader {
12
+ export declare class GLShaderVariant extends ShaderVariant {
13
13
  pipelineContext: GLPipelineContext;
14
14
  program: GLProgram;
15
15
  compileResult: ShaderCompileResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-webgl",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Galacean Effects runtime webgl for the web",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -38,7 +38,7 @@
38
38
  "registry": "https://registry.npmjs.org"
39
39
  },
40
40
  "dependencies": {
41
- "@galacean/effects-core": "2.0.0-alpha.2"
41
+ "@galacean/effects-core": "2.0.0-alpha.4"
42
42
  },
43
43
  "scripts": {
44
44
  "prebuild": "pnpm clean",