@galacean/engine-core 2.0.0-alpha.54 → 2.0.0-alpha.55

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-core",
3
- "version": "2.0.0-alpha.54",
3
+ "version": "2.0.0-alpha.55",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,8 +18,8 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-design": "2.0.0-alpha.54",
22
- "@galacean/engine-math": "2.0.0-alpha.54"
21
+ "@galacean/engine-design": "2.0.0-alpha.55",
22
+ "@galacean/engine-math": "2.0.0-alpha.55"
23
23
  },
24
24
  "scripts": {
25
25
  "b:types": "tsc"
@@ -33,45 +33,49 @@ export declare class Shader implements IReferable {
33
33
  *
34
34
  * @param shaderSource - Shader code
35
35
  * @param platformTarget - Shader platform target, @defaultValue ShaderLanguage.GLSLES100
36
- * @returns The shader, or `undefined` if its name already exists.
36
+ * @returns A new shader. Shaders with the same name remain independent objects.
37
37
  *
38
38
  * @throws
39
39
  * Throw string exception if the shader compiler has not been enabled properly.
40
40
  */
41
- static create(shaderSource: string, platformTarget?: ShaderLanguage): Shader | undefined;
41
+ static create(shaderSource: string, platformTarget?: ShaderLanguage): Shader;
42
42
  /**
43
43
  * Create a shader.
44
44
  * @param name - Name of the shader
45
45
  * @param shaderPasses - Shader passes
46
- * @returns The shader, or `undefined` if its name already exists.
46
+ * @returns A new shader. Shaders with the same name remain independent objects.
47
47
  */
48
- static create(name: string, shaderPasses: ShaderPass[]): Shader | undefined;
48
+ static create(name: string, shaderPasses: ShaderPass[]): Shader;
49
49
  /**
50
50
  * Create a shader.
51
51
  * @param name - Name of the shader
52
52
  * @param subShaders - Sub shaders
53
- * @returns The shader, or `undefined` if its name already exists.
53
+ * @returns A new shader. Shaders with the same name remain independent objects.
54
54
  */
55
- static create(name: string, subShaders: SubShader[]): Shader | undefined;
55
+ static create(name: string, subShaders: SubShader[]): Shader;
56
56
  /**
57
57
  * Creates a shader while retaining loader-owned source location metadata for relative includes.
58
58
  * @param shaderSource - Complete ShaderLab source.
59
59
  * @param platformTarget - Shader backend target.
60
60
  * @param sourceFile - Canonical source location supplied by an asset loader or authoring tool.
61
- * @returns The compiled shader, or `undefined` if its name already exists.
61
+ * @returns A new shader.
62
62
  * @throws When the shader compiler is unavailable or a pass cannot be compiled.
63
63
  * @internal
64
64
  */
65
- static _createFromSource(shaderSource: string, platformTarget?: ShaderLanguage, sourceFile?: string): Shader | undefined;
65
+ static _createFromSource(shaderSource: string, platformTarget?: ShaderLanguage, sourceFile?: string): Shader;
66
66
  /**
67
67
  * Find a shader by name.
68
68
  * @param name - Name of the shader
69
+ * @returns The most recently registered live shader with this name, or `undefined` if none exists.
70
+ * @remarks Retain the shader object when a material must use a specific shader among namesakes.
69
71
  */
70
- static find(name: string): Shader;
72
+ static find(name: string): Shader | undefined;
71
73
  /**
74
+ * Create a shader from precompiled instructions.
75
+ * @param data - Precompiled shader data
72
76
  * @internal
73
77
  */
74
- static _createFromPrecompiled(data: IPrecompiledShader): Shader | undefined;
78
+ static _createFromPrecompiled(data: IPrecompiledShader): Shader;
75
79
  /**
76
80
  * @internal
77
81
  */
@@ -103,9 +107,9 @@ export declare class Shader implements IReferable {
103
107
  */
104
108
  compileVariant(engine: Engine, macros: string[]): boolean;
105
109
  /**
106
- * Destroy the shader.
107
- * @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
108
- * @returns Whether the release was successful.
110
+ * Destroy this shader and remove it from name lookup.
111
+ * @param force - Whether to destroy the shader even while it is in use
112
+ * @returns Whether the shader was destroyed or had already been destroyed.
109
113
  */
110
114
  destroy(force?: boolean): boolean;
111
115
  /**