@galacean/effects-plugin-model 2.0.0-alpha.6 → 2.0.0-alpha.8

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.
@@ -73,6 +73,8 @@ export declare enum PShadowType {
73
73
  variance = 2,
74
74
  expVariance = 3
75
75
  }
76
+ export declare const PBRShaderGUID = "pbr00000000000000000000000000000";
77
+ export declare const UnlitShaderGUID = "unlit000000000000000000000000000";
76
78
  /**
77
79
  * 插件变换类
78
80
  */
@@ -1,7 +1,6 @@
1
1
  import type { Texture } from '@galacean/effects';
2
- import { Material } from '@galacean/effects';
3
- import { spec } from '@galacean/effects';
4
- import type { ModelMaterialOptions, ModelMaterialUnlitOptions, ModelMaterialPBROptions } from '../index';
2
+ import { spec, Material } from '@galacean/effects';
3
+ import type { ModelMaterialOptions, ModelMaterialUnlitOptions, ModelMaterialPBROptions, MacroInfo } from '../index';
5
4
  import { Vector3, Vector4, Matrix3 } from './math';
6
5
  import { PMaterialType, PBlendMode, PFaceSideMode } from './common';
7
6
  import { PObject } from './object';
@@ -48,6 +47,7 @@ export declare abstract class PMaterialBase extends PObject {
48
47
  * @returns 特性列表
49
48
  */
50
49
  getShaderFeatures(): string[];
50
+ getShaderMacros(): MacroInfo[];
51
51
  /**
52
52
  * 根据材质状态,更新 GE 材质状态
53
53
  * @param material - GE 材质
@@ -60,6 +60,7 @@ export declare abstract class PMaterialBase extends PObject {
60
60
  */
61
61
  build(inFeatureList?: string[]): void;
62
62
  getFeatureList(inFeatureList?: string[]): string[];
63
+ getMacroList(inMacroList?: MacroInfo[]): MacroInfo[];
63
64
  /**
64
65
  * 获取混合模式,根据 GE 混合模式
65
66
  * @param mode - GE 混合模式
@@ -132,13 +133,13 @@ export declare abstract class PMaterialBase extends PObject {
132
133
  * 无光照材质类,负责无关照或者不接受光照情况下的物体材质效果
133
134
  */
134
135
  export declare class PMaterialUnlit extends PMaterialBase {
135
- private baseColorFactor;
136
136
  private baseColorTexture?;
137
137
  /**
138
138
  * 创建无光照材质,支持基础颜色纹理
139
139
  * @param options - 无光照材质参数
140
140
  */
141
141
  create(options: ModelMaterialUnlitOptions): void;
142
+ createFromMaterial(mat: Material): void;
142
143
  /**
143
144
  * 销毁材质
144
145
  */
@@ -148,6 +149,7 @@ export declare class PMaterialUnlit extends PMaterialBase {
148
149
  * @returns 着色器特性列表
149
150
  */
150
151
  getShaderFeatures(): string[];
152
+ getShaderMacros(): MacroInfo[];
151
153
  /**
152
154
  * 更新对应的 GE 材质中着色器的 Uniform 数据
153
155
  * @param material - GE 材质
@@ -168,16 +170,6 @@ export declare class PMaterialUnlit extends PMaterialBase {
168
170
  * @param val - 纹理对象
169
171
  */
170
172
  setBaseColorTexture(val: Texture): void;
171
- /**
172
- * 获取基础颜色值
173
- * @returns
174
- */
175
- getBaseColorFactor(): Vector4;
176
- /**
177
- * 设置基础颜色值
178
- * @param val - 颜色值
179
- */
180
- setBaseColorFactor(val: Vector4 | spec.vec4): void;
181
173
  }
182
174
  /**
183
175
  * PBR 材质类,负责基于物理的材质效果,也是渲染中最常用的材质。
@@ -272,6 +264,7 @@ export declare class PMaterialPBR extends PMaterialBase {
272
264
  * @returns 材质特性列表
273
265
  */
274
266
  getShaderFeatures(): string[];
267
+ getShaderMacros(): MacroInfo[];
275
268
  /**
276
269
  * 更新关联的 GE 材质中着色器的 Uniform 数据
277
270
  * @param material - GE 材质
@@ -1,5 +1,5 @@
1
- import type { Engine, math, VFXItemContent, VFXItem, Renderer } from '@galacean/effects';
2
- import { Geometry, spec, Mesh, Material } from '@galacean/effects';
1
+ import type { Engine, math, VFXItemContent, VFXItem, Renderer, Geometry } from '@galacean/effects';
2
+ import { spec, Mesh, Material } from '@galacean/effects';
3
3
  import type { ModelMeshComponentData, ModelMeshPrimitiveData } from '../index';
4
4
  import { PEntity } from './object';
5
5
  import type { PMaterial } from './material';
@@ -207,6 +207,7 @@ export declare class PPrimitive {
207
207
  [k: string]: any;
208
208
  }, skybox?: PSkybox): void;
209
209
  private getFeatureList;
210
+ private getMacroList;
210
211
  /**
211
212
  * 销毁,需要释放创建的 GE 对象
212
213
  */
@@ -354,4 +355,8 @@ export declare class PGeometry {
354
355
  */
355
356
  hasWeights(): boolean;
356
357
  }
358
+ export interface MacroInfo {
359
+ name: string;
360
+ value?: boolean | number;
361
+ }
357
362
  export {};
@@ -10,4 +10,5 @@ export declare namespace StandardShaderSource {
10
10
  * @returns 最终代码
11
11
  */
12
12
  function build(source: string, features: string[], isWebGL2: boolean): string;
13
+ function getSourceCode(source: string, isWebGL2?: boolean): string;
13
14
  }
@@ -1,3 +1,4 @@
1
+ import { PMaterialType } from '../common';
1
2
  import type { PShaderContext } from '../shader';
2
3
  /**
3
4
  * 着色器代码生成类
@@ -19,4 +20,11 @@ export declare class StandardShader {
19
20
  * @returns
20
21
  */
21
22
  static getFragmentShaderCode(context: PShaderContext): string;
23
+ static genVertexShaderCode(materialType: PMaterialType, isWebGL2?: boolean): string;
24
+ /**
25
+ * 获取片段着色器代码
26
+ * @param materialType - 材质类型
27
+ * @returns
28
+ */
29
+ static genFragmentShaderCode(materialType: PMaterialType, isWebGL2?: boolean): string;
22
30
  }
@@ -1,4 +1,6 @@
1
1
  import type { PShaderContext, PShaderResults } from '../runtime/shader';
2
+ export declare function fetchPBRShaderCode(isWebGL2?: boolean): PShaderResults;
3
+ export declare function fetchUnlitShaderCode(isWebGL2?: boolean): PShaderResults;
2
4
  /**
3
5
  * 获取 PBR 材质着色器代码
4
6
  * @param context - 着色器上下文
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-plugin-model",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.8",
4
4
  "description": "Galacean Effects player model plugin",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -33,15 +33,15 @@
33
33
  "registry": "https://registry.npmjs.org"
34
34
  },
35
35
  "dependencies": {
36
- "@galacean/effects-helper": "2.0.0-alpha.6"
36
+ "@galacean/effects-helper": "2.0.0-alpha.8"
37
37
  },
38
38
  "devDependencies": {
39
- "@vvfx/resource-detection": "0.4.2-alpha.22",
39
+ "@vvfx/resource-detection": "0.6.0-alpha.2",
40
40
  "@types/hammerjs": "^2.0.45",
41
41
  "fpsmeter": "^0.3.1",
42
42
  "hammerjs": "^2.0.8",
43
- "@galacean/effects": "2.0.0-alpha.6",
44
- "@galacean/effects-plugin-editor-gizmo": "2.0.0-alpha.6"
43
+ "@galacean/effects": "2.0.0-alpha.8",
44
+ "@galacean/effects-plugin-editor-gizmo": "2.0.0-alpha.8"
45
45
  },
46
46
  "scripts": {
47
47
  "dev": "vite",