@galacean/engine-core 1.2.0-alpha.13 → 1.2.0-alpha.15

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": "1.2.0-alpha.13",
3
+ "version": "1.2.0-alpha.15",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -15,10 +15,10 @@
15
15
  "types/**/*"
16
16
  ],
17
17
  "dependencies": {
18
- "@galacean/engine-math": "1.2.0-alpha.13"
18
+ "@galacean/engine-math": "1.2.0-alpha.15"
19
19
  },
20
20
  "devDependencies": {
21
- "@galacean/engine-design": "1.2.0-alpha.13"
21
+ "@galacean/engine-design": "1.2.0-alpha.15"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
package/types/Camera.d.ts CHANGED
@@ -3,6 +3,8 @@ import { Component } from "./Component";
3
3
  import { Layer } from "./Layer";
4
4
  import { CameraClearFlags } from "./enums/CameraClearFlags";
5
5
  import { DepthTextureMode } from "./enums/DepthTextureMode";
6
+ import { Downsampling } from "./enums/Downsampling";
7
+ import { MSAASamples } from "./enums/MSAASamples";
6
8
  import { Shader } from "./shader/Shader";
7
9
  import { ShaderData } from "./shader/ShaderData";
8
10
  import { ShaderTagKey } from "./shader/ShaderTagKey";
@@ -22,6 +24,7 @@ export declare class Camera extends Component {
22
24
  enableFrustumCulling: boolean;
23
25
  /**
24
26
  * Determining what to clear when rendering by a Camera.
27
+ *
25
28
  * @defaultValue `CameraClearFlags.All`
26
29
  */
27
30
  clearFlags: CameraClearFlags;
@@ -32,9 +35,23 @@ export declare class Camera extends Component {
32
35
  cullingMask: Layer;
33
36
  /**
34
37
  * Depth texture mode.
38
+ * If `DepthTextureMode.PrePass` is used, the depth texture can be accessed in the shader using `camera_DepthTexture`.
39
+ *
35
40
  * @defaultValue `DepthTextureMode.None`
36
41
  */
37
42
  depthTextureMode: DepthTextureMode;
43
+ /**
44
+ * Opacity texture down sampling.
45
+ *
46
+ * @defaultValue `Downsampling.TwoX`
47
+ */
48
+ opaqueTextureDownsampling: Downsampling;
49
+ /**
50
+ * Multi-sample anti-aliasing samples when use independent canvas mode.
51
+ *
52
+ * @remarks The `independentCanvasEnabled` property should be `true` to take effect, otherwise it will be invalid.
53
+ */
54
+ msaaSamples: MSAASamples;
38
55
  private _priority;
39
56
  private _shaderData;
40
57
  private _isCustomViewMatrix;
@@ -46,6 +63,8 @@ export declare class Camera extends Component {
46
63
  private _customAspectRatio;
47
64
  private _renderTarget;
48
65
  private _depthBufferParams;
66
+ private _preferIndependentCanvas;
67
+ private _opaqueTextureEnabled;
49
68
  private _frustumChangeFlag;
50
69
  private _transform;
51
70
  private _isViewMatrixDirty;
@@ -54,6 +73,29 @@ export declare class Camera extends Component {
54
73
  private _pixelViewport;
55
74
  private _inverseProjectionMatrix;
56
75
  private _invViewProjMat;
76
+ /**
77
+ * Whether to enable opaque texture.
78
+ * If enabled, the opaque texture can be accessed in the shader using `camera_OpaqueTexture`.
79
+ *
80
+ * @defaultValue `false`
81
+ *
82
+ * @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
83
+ */
84
+ get opaqueTextureEnabled(): boolean;
85
+ set opaqueTextureEnabled(value: boolean);
86
+ /**
87
+ * Whether prefer to use an independent canvas in viewport area when camera rendering to main canvas.
88
+ *
89
+ * @remarks If success, the `independentCanvasEnabled` property will be true and the msaa in viewport can turn or off independently by `msaaSamples` property.
90
+ */
91
+ get preferIndependentCanvas(): boolean;
92
+ set preferIndependentCanvas(value: boolean);
93
+ /**
94
+ * Whether independent canvas is enabled.
95
+ *
96
+ * @remarks If true, the msaa in viewport can turn or off independently by `msaaSamples` property.
97
+ */
98
+ get independentCanvasEnabled(): boolean;
57
99
  /**
58
100
  * Shader data.
59
101
  */
@@ -252,5 +294,7 @@ export declare class Camera extends Component {
252
294
  * The inverse of the projection matrix.
253
295
  */
254
296
  private _getInverseProjectionMatrix;
297
+ private _forceUseInternalCanvas;
255
298
  private _onPixelViewportChanged;
299
+ private _checkMainCanvasAntialiasWaste;
256
300
  }
@@ -1,49 +1,23 @@
1
1
  import { Camera } from "../Camera";
2
- import { Layer } from "../Layer";
3
2
  import { CameraClearFlags } from "../enums/CameraClearFlags";
4
- import { Material } from "../material";
5
- import { RenderTarget, TextureCubeFace } from "../texture";
3
+ import { TextureCubeFace } from "../texture";
6
4
  import { RenderContext } from "./RenderContext";
7
5
  import { RenderData } from "./RenderData";
8
- import { RenderPass } from "./RenderPass";
9
6
  /**
10
7
  * Basic render pipeline.
11
8
  */
12
9
  export declare class BasicRenderPipeline {
13
10
  private _camera;
14
- private _defaultPass;
15
- private _renderPassArray;
16
11
  private _lastCanvasSize;
17
- private _cascadedShadowCaster;
12
+ private _internalColorTarget;
13
+ private _cascadedShadowCasterPass;
18
14
  private _depthOnlyPass;
15
+ private _opaqueTexturePass;
19
16
  /**
20
17
  * Create a basic render pipeline.
21
18
  * @param camera - Camera
22
19
  */
23
20
  constructor(camera: Camera);
24
- /**
25
- * Default render pass.
26
- */
27
- get defaultRenderPass(): RenderPass;
28
- /**
29
- * Add render pass.
30
- * @param nameOrPass - The name of this Pass or RenderPass object. When it is a name, the following parameters need to be provided
31
- * @param priority - Priority, less than 0 before the default pass, greater than 0 after the default pass
32
- * @param renderTarget - The specified Render Target
33
- * @param replaceMaterial - Replaced material
34
- * @param mask - Perform bit and operations with Entity.Layer to filter the objects that this Pass needs to render
35
- */
36
- addRenderPass(nameOrPass: string | RenderPass, priority?: number, renderTarget?: RenderTarget, replaceMaterial?: Material, mask?: Layer): void;
37
- /**
38
- * Remove render pass by name or render pass object.
39
- * @param nameOrPass - Render pass name or render pass object
40
- */
41
- removeRenderPass(nameOrPass: string | RenderPass): void;
42
- /**
43
- * Get render pass by name.
44
- * @param name - Render pass name
45
- */
46
- getRenderPass(name: string): RenderPass;
47
21
  /**
48
22
  * Destroy internal resources.
49
23
  */
@@ -1,6 +1,5 @@
1
1
  import { Camera } from "../Camera";
2
2
  import { Engine } from "../Engine";
3
- import { Layer } from "../Layer";
4
3
  import { RenderQueueType } from "../shader";
5
4
  import { RenderElement } from "./RenderElement";
6
5
  /**
@@ -15,7 +14,7 @@ export declare class RenderQueue {
15
14
  * Push a render element.
16
15
  */
17
16
  pushRenderElement(element: RenderElement): void;
18
- render(camera: Camera, mask: Layer, pipelineStageTagValue: string): void;
17
+ render(camera: Camera, pipelineStageTagValue: string): void;
19
18
  /**
20
19
  * Clear collection.
21
20
  */
@@ -1,4 +1,3 @@
1
1
  export { BasicRenderPipeline } from "./BasicRenderPipeline";
2
2
  export { PipelineStage } from "./enums/PipelineStage";
3
- export { RenderPass } from "./RenderPass";
4
3
  export { RenderQueue } from "./RenderQueue";
@@ -1,5 +1,6 @@
1
- import { BoundingBox, Vector4 } from "@galacean/engine-math";
1
+ import { BoundingBox, Matrix, Vector4 } from "@galacean/engine-math";
2
2
  import { Component } from "./Component";
3
+ import { RenderContext } from "./RenderPipeline/RenderContext";
3
4
  import { IComponentCustomClone } from "./clone/ComponentCloner";
4
5
  import { Material } from "./material";
5
6
  import { ShaderData } from "./shader/ShaderData";
@@ -110,5 +111,7 @@ export declare class Renderer extends Component implements IComponentCustomClone
110
111
  */
111
112
  setMaterials(materials: Material[]): void;
112
113
  update(deltaTime: number): void;
114
+ protected _updateTransformShaderData(context: RenderContext, worldMatrix: Matrix): void;
115
+ protected _updateMVPShaderData(context: RenderContext, worldMatrix: Matrix): void;
113
116
  private _setMaterial;
114
117
  }
@@ -27,7 +27,7 @@ export declare class AnimatorLayerMask {
27
27
  * Removes a path mask from the AnimatorLayerMask.
28
28
  * @param path - The path of the mask to remove
29
29
  */
30
- removePathMask(path: any): void;
30
+ removePathMask(path: string): void;
31
31
  /**
32
32
  * Get a path mask based on the given path.
33
33
  * @param path - The path of the mask to get
package/types/index.d.ts CHANGED
@@ -30,6 +30,8 @@ export { DepthTextureMode } from "./enums/DepthTextureMode";
30
30
  export { FogMode } from "./enums/FogMode";
31
31
  export { CameraClearFlags } from "./enums/CameraClearFlags";
32
32
  export { CameraType } from "./enums/CameraType";
33
+ export { MSAASamples } from "./enums/MSAASamples";
34
+ export { Downsampling } from "./enums/Downsampling";
33
35
  export { ColorSpace } from "./enums/ColorSpace";
34
36
  export { BackgroundTextureFillMode } from "./enums/BackgroundTextureFillMode";
35
37
  export { XRManager } from "./xr/XRManager";
@@ -1,5 +1,6 @@
1
1
  import { BoundingBox } from "@galacean/engine-math";
2
2
  import { Entity } from "../Entity";
3
+ import { RenderContext } from "../RenderPipeline/RenderContext";
3
4
  import { MeshRenderer } from "./MeshRenderer";
4
5
  import { Skin } from "./Skin";
5
6
  /**
@@ -38,6 +39,7 @@ export declare class SkinnedMeshRenderer extends MeshRenderer {
38
39
  */
39
40
  get bones(): ReadonlyArray<Entity>;
40
41
  set bones(value: ReadonlyArray<Entity>);
42
+ _updateShaderData(context: RenderContext, onlyMVP: boolean): void;
41
43
  private _checkBlendShapeWeightLength;
42
44
  private _onLocalBoundsChanged;
43
45
  private _getEntityHierarchyPath;
@@ -5,10 +5,10 @@ import { TextureCubeFace } from "../texture";
5
5
  export interface IPlatformRenderTarget {
6
6
  /**
7
7
  * Set which face and mipLevel of the cube texture to render to.
8
- * @param faceIndex - Cube texture face
9
8
  * @param mipLevel - Set mip level the data want to write
9
+ * @param faceIndex - Cube texture face
10
10
  */
11
- setRenderTargetInfo(faceIndex: TextureCubeFace, mipLevel: number): void;
11
+ activeRenderTarget(mipLevel: number, faceIndex?: TextureCubeFace): void;
12
12
  /**
13
13
  * Blit FBO.
14
14
  */
@@ -6,9 +6,9 @@ export declare class DepthState {
6
6
  private static _getGLCompareFunction;
7
7
  /** Whether to enable the depth test. */
8
8
  enabled: boolean;
9
- /** Whether the depth value can be written.*/
10
- writeEnabled: boolean;
11
9
  /** Depth comparison function. */
12
10
  compareFunction: CompareFunction;
11
+ /** Whether the depth value can be written.*/
12
+ writeEnabled: boolean;
13
13
  private _platformApply;
14
14
  }
@@ -1,6 +1,7 @@
1
1
  import { GraphicsResource } from "../asset/GraphicsResource";
2
2
  import { Engine } from "../Engine";
3
3
  import { RenderBufferDepthFormat } from "./enums/RenderBufferDepthFormat";
4
+ import { TextureFormat } from "./enums/TextureFormat";
4
5
  import { Texture } from "./Texture";
5
6
  /**
6
7
  * The render target used for off-screen rendering.
@@ -43,10 +44,10 @@ export declare class RenderTarget extends GraphicsResource {
43
44
  * @param width - Render target width
44
45
  * @param height - Render target height
45
46
  * @param colorTexture - Render color texture
46
- * @param depthFormat - Depth format. default RenderBufferDepthFormat.Depth, engine will automatically select the supported precision
47
+ * @param depthFormat - Depth format. default TextureFormat.Depth, engine will automatically select the supported precision
47
48
  * @param antiAliasing - Anti-aliasing level, default is 1
48
49
  */
49
- constructor(engine: Engine, width: number, height: number, colorTexture: Texture, depthFormat?: RenderBufferDepthFormat | null, antiAliasing?: number);
50
+ constructor(engine: Engine, width: number, height: number, colorTexture: Texture, depthFormat?: TextureFormat | null | RenderBufferDepthFormat, antiAliasing?: number);
50
51
  /**
51
52
  * Create a render target through color texture and depth format.
52
53
  * @remarks If the color texture is not transmitted, only the depth texture is generated.
@@ -64,10 +65,10 @@ export declare class RenderTarget extends GraphicsResource {
64
65
  * @param width - Render target width
65
66
  * @param height - Render target height
66
67
  * @param colorTextures - Render color texture array
67
- * @param depthFormat - Depth format. default RenderBufferDepthFormat.Depth,engine will automatically select the supported precision
68
+ * @param depthFormat - Depth format. default TextureFormat.Depth,engine will automatically select the supported precision
68
69
  * @param antiAliasing - Anti-aliasing level, default is 1
69
70
  */
70
- constructor(engine: Engine, width: number, height: number, colorTextures: Texture[], depthFormat?: RenderBufferDepthFormat | null, antiAliasing?: number);
71
+ constructor(engine: Engine, width: number, height: number, colorTextures: Texture[], depthFormat?: TextureFormat | null | RenderBufferDepthFormat, antiAliasing?: number);
71
72
  /**
72
73
  * Create a render target with color texture array and depth texture.
73
74
  * @param engine - Define the engine to use for this off-screen rendering
@@ -1,21 +1,23 @@
1
1
  /**
2
+ * @deprecated Please use `TextureFormat` instead.
3
+ *
2
4
  * Render buffer depth format enumeration.
3
5
  */
4
6
  export declare enum RenderBufferDepthFormat {
5
7
  /** Render to depth buffer,engine will automatically select the supported precision. */
6
- Depth = 0,
7
- /** Render to depth stencil buffer, engine will automatically select the supported precision. */
8
- DepthStencil = 1,
8
+ Depth = 27,
9
9
  /** Render to stencil buffer. */
10
- Stencil = 2,
10
+ Stencil = 28,
11
+ /** Render to depth stencil buffer, engine will automatically select the supported precision. */
12
+ DepthStencil = 29,
11
13
  /** Force 16-bit depth buffer. */
12
- Depth16 = 3,
14
+ Depth16 = 30,
13
15
  /** Force 24-bit depth buffer. */
14
- Depth24 = 4,
16
+ Depth24 = 31,
15
17
  /** Force 32-bit depth buffer. */
16
- Depth32 = 5,
18
+ Depth32 = 32,
17
19
  /** Force 16-bit depth + 8-bit stencil buffer. */
18
- Depth24Stencil8 = 6,
20
+ Depth24Stencil8 = 33,
19
21
  /** Force 32-bit depth + 8-bit stencil buffer. */
20
- Depth32Stencil8 = 7
22
+ Depth32Stencil8 = 34
21
23
  }
@@ -58,20 +58,22 @@ export declare enum TextureFormat {
58
58
  ASTC_12x12 = 26,
59
59
  /** Automatic depth format, engine will automatically select the supported precision. */
60
60
  Depth = 27,
61
+ /** Render to stencil buffer. */
62
+ Stencil = 28,
61
63
  /** Automatic depth stencil format, engine will automatically select the supported precision. */
62
- DepthStencil = 28,
64
+ DepthStencil = 29,
63
65
  /** 16-bit depth format. */
64
- Depth16 = 29,
66
+ Depth16 = 30,
65
67
  /** 24-bit depth format. */
66
- Depth24 = 30,
68
+ Depth24 = 31,
67
69
  /** 32-bit depth format. */
68
- Depth32 = 31,
70
+ Depth32 = 32,
69
71
  /** 16-bit depth + 8-bit stencil format. */
70
- Depth24Stencil8 = 32,
72
+ Depth24Stencil8 = 33,
71
73
  /** 32-bit depth + 8-bit stencil format. */
72
- Depth32Stencil8 = 33,
74
+ Depth32Stencil8 = 34,
73
75
  /** @deprecated Use `TextureFormat.BC1` instead. */
74
- DXT1 = 34,
76
+ DXT1 = 10,
75
77
  /** @deprecated Use `TextureFormat.BC3` instead. */
76
- DXT5 = 35
78
+ DXT5 = 11
77
79
  }