@galacean/engine-design 0.0.0-experimental-2.0-game.19 → 0.0.0-experimental-2.0-migrate.1

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": "0.0.0-experimental-2.0-game.19",
3
+ "version": "0.0.0-experimental-2.0-migrate.1",
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": "0.0.0-experimental-2.0-game.19"
20
+ "@galacean/engine-math": "0.0.0-experimental-2.0-migrate.1"
21
21
  },
22
22
  "scripts": {
23
23
  "b:types": "tsc"
package/types/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export type { IClone } from "./IClone";
2
2
  export * from "./input/index";
3
3
  export * from "./physics/index";
4
4
  export * from "./renderingHardwareInterface/index";
5
- export * from "./shader-lab/index";
5
+ export * from "./shader-compiler/index";
6
6
  export * from "./xr/index";
@@ -122,6 +122,12 @@ export interface IDynamicCollider extends ICollider {
122
122
  * @param force - The force make the collider move
123
123
  */
124
124
  addForce(force: Vector3): void;
125
+ /**
126
+ * Apply a force to the dynamic collider at a world-space position.
127
+ * @param force - The force make the collider move
128
+ * @param position - The world-space position where the force is applied
129
+ */
130
+ addForceAtPosition(force: Vector3, position: Vector3): void;
125
131
  /**
126
132
  * Apply a torque to the dynamic collider.
127
133
  * @param torque - The force make the collider rotate
@@ -40,7 +40,7 @@ export interface IPhysicsScene {
40
40
  * Enable contact event buffering.
41
41
  * @param enabled - Whether collision contact events should be buffered for dispatch.
42
42
  */
43
- setContactEventEnabled(enabled: boolean): void;
43
+ setContactEventEnabled?(enabled: boolean): void;
44
44
  /**
45
45
  * Collect buffered collision and trigger events.
46
46
  * Must be called after update() and after syncing transforms back from physics.
@@ -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
+ }
@@ -0,0 +1,25 @@
1
+ import { IPrecompiledShader } from "./IPrecompiledShader";
2
+ import { IShaderProgramSource } from "./IShaderProgramSource";
3
+ import { IShaderSource } from "./shaderSource/IShaderSource";
4
+ /**
5
+ * Shader compiler interface.
6
+ */
7
+ export interface IShaderCompiler {
8
+ /**
9
+ * @internal
10
+ * Parse shader source code to get the source structure of shader.
11
+ */
12
+ _parseShaderSource(sourceCode: string): IShaderSource;
13
+ /**
14
+ * @internal
15
+ * Parse shader pass source code.
16
+ * @param basePathForIncludeKey - The base path to resolve the relative path of `#include` directives.
17
+ * Must follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin),
18
+ * like: `shaders://root/`.
19
+ */
20
+ _parseShaderPass(shaderPassSource: string, vertexEntry: string, fragmentEntry: string, backend: any, basePathForIncludeKey: string): IShaderProgramSource | undefined;
21
+ /**
22
+ * @internal
23
+ */
24
+ _precompile(sourceCode: string, platformTarget: any, basePathForIncludeKey: string): IPrecompiledShader;
25
+ }
@@ -0,0 +1,7 @@
1
+ import type { ShaderInstruction } from "./ICondition";
2
+ export interface IShaderProgramSource {
3
+ vertex: string;
4
+ fragment: string;
5
+ vertexShaderInstructions?: ShaderInstruction[];
6
+ fragmentShaderInstructions?: ShaderInstruction[];
7
+ }
@@ -1,4 +1,6 @@
1
- export type { IShaderLab } from "./IShaderLab";
1
+ export type { IShaderCompiler } from "./IShaderCompiler";
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";
@@ -6,7 +6,7 @@ export interface IShaderPassSource {
6
6
  isUsePass: boolean;
7
7
  tags?: Record<string, number | string | boolean>;
8
8
  renderStates: IRenderStates;
9
- /** ShaderLab code source. */
9
+ /** Shader source code. */
10
10
  contents: string;
11
11
  vertexEntry: string;
12
12
  fragmentEntry: string;
@@ -1,22 +0,0 @@
1
- import { IShaderProgramSource } from "./IShaderProgramSource";
2
- import { IShaderSource } from "./shaderSource/IShaderSource";
3
- /**
4
- * Shader lab interface.
5
- */
6
- export interface IShaderLab {
7
- /**
8
- * @internal
9
- * Parse shader source code to get the source structure of shader.
10
- */
11
- _parseShaderSource(sourceCode: string): IShaderSource;
12
- /**
13
- * @internal
14
- * Parse shader pass source code.
15
- * @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
- _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;
22
- }
@@ -1,4 +0,0 @@
1
- export interface IShaderProgramSource {
2
- vertex: string;
3
- fragment: string;
4
- }