@galacean/engine-design 2.0.0-alpha.24 → 2.0.0-alpha.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-design",
3
- "version": "2.0.0-alpha.24",
3
+ "version": "2.0.0-alpha.26",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "types": "types/index.d.ts",
19
19
  "dependencies": {
20
- "@galacean/engine-math": "2.0.0-alpha.24"
20
+ "@galacean/engine-math": "2.0.0-alpha.26"
21
21
  },
22
22
  "scripts": {
23
23
  "b:types": "tsc"
@@ -0,0 +1,50 @@
1
+ /**
2
+ * #ifdef MACRO
3
+ */
4
+ export interface DefinedCondition {
5
+ t: "def";
6
+ m: string;
7
+ }
8
+ /**
9
+ * #ifndef MACRO
10
+ */
11
+ export interface NotDefinedCondition {
12
+ t: "ndef";
13
+ m: string;
14
+ }
15
+ /**
16
+ * #if MACRO op value (e.g., SCENE_FOG_MODE > 0)
17
+ */
18
+ export interface CompareCondition {
19
+ t: "cmp";
20
+ m: string;
21
+ op: string;
22
+ v: number;
23
+ }
24
+ export interface AndCondition {
25
+ t: "and";
26
+ l: Condition;
27
+ r: Condition;
28
+ }
29
+ export interface OrCondition {
30
+ t: "or";
31
+ l: Condition;
32
+ r: Condition;
33
+ }
34
+ export interface NotCondition {
35
+ t: "not";
36
+ c: Condition;
37
+ }
38
+ /**
39
+ * Constant boolean produced when numeric literals resolve statically
40
+ * (e.g. #define FOO 3 → #if 3 == 3 → always true)
41
+ */
42
+ export interface BoolCondition {
43
+ t: "bool";
44
+ v: boolean;
45
+ }
46
+ export type Condition = DefinedCondition | NotDefinedCondition | CompareCondition | AndCondition | OrCondition | NotCondition | BoolCondition;
47
+ /**
48
+ * Preprocessor instruction tuple: `[directive, ...operands]`
49
+ */
50
+ export type ShaderInstruction = readonly [number, ...(string | number | string[] | Condition)[]];
@@ -0,0 +1,22 @@
1
+ import type { ShaderInstruction } from "./ICondition";
2
+ export interface IPrecompiledShader {
3
+ name: string;
4
+ platformTarget: number;
5
+ subShaders: IPrecompiledSubShader[];
6
+ }
7
+ export interface IPrecompiledSubShader {
8
+ name: string;
9
+ tags?: Record<string, number | string | boolean>;
10
+ passes: IPrecompiledPass[];
11
+ }
12
+ export interface IPrecompiledPass {
13
+ name: string;
14
+ isUsePass: boolean;
15
+ tags?: Record<string, number | string | boolean>;
16
+ renderStates: {
17
+ constantMap: Record<string, number | string | boolean | number[]>;
18
+ variableMap: Record<string, string>;
19
+ };
20
+ vertexShaderInstructions?: ShaderInstruction[];
21
+ fragmentShaderInstructions?: ShaderInstruction[];
22
+ }
@@ -1,3 +1,4 @@
1
+ import { IPrecompiledShader } from "./IPrecompiledShader";
1
2
  import { IShaderProgramSource } from "./IShaderProgramSource";
2
3
  import { IShaderSource } from "./shaderSource/IShaderSource";
3
4
  /**
@@ -15,8 +16,8 @@ export interface IShaderLab {
15
16
  * @param basePathForIncludeKey the base path to resolve the relative path of `#include` directive. Must follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
16
17
  */
17
18
  _parseShaderPass(shaderPassSource: string, vertexEntry: string, fragmentEntry: string, backend: any, basePathForIncludeKey: string): IShaderProgramSource;
18
- _parseMacros(context: string, macros: Array<{
19
- name: string;
20
- value: string;
21
- }>): string;
19
+ /**
20
+ * @internal
21
+ */
22
+ _precompile(sourceCode: string, platformTarget: any, basePath: string): IPrecompiledShader;
22
23
  }
@@ -1,4 +1,7 @@
1
+ import type { ShaderInstruction } from "./ICondition";
1
2
  export interface IShaderProgramSource {
2
3
  vertex: string;
3
4
  fragment: string;
5
+ vertexShaderInstructions?: ShaderInstruction[];
6
+ fragmentShaderInstructions?: ShaderInstruction[];
4
7
  }
@@ -1,4 +1,6 @@
1
1
  export type { IShaderLab } from "./IShaderLab";
2
+ export type { Condition, DefinedCondition, NotDefinedCondition, CompareCondition, BoolCondition, ShaderInstruction } from "./ICondition";
3
+ export type { IPrecompiledShader, IPrecompiledSubShader, IPrecompiledPass } from "./IPrecompiledShader";
2
4
  export type { IShaderProgramSource as IShaderInfo } from "./IShaderProgramSource";
3
5
  export { IRenderStates } from "./shaderSource/IRenderStates";
4
6
  export { IShaderPassSource } from "./shaderSource/IShaderPassSource";