@galacean/engine-core 2.0.0-alpha.57 → 2.0.0-alpha.59
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/dist/main.js +9595 -9349
- package/dist/main.js.map +1 -1
- package/dist/module.js +9595 -9349
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/BasicResources.d.ts +6 -0
- package/types/Camera.d.ts +6 -0
- package/types/Engine.d.ts +7 -5
- package/types/SystemInfo.d.ts +3 -4
- package/types/graphic/Primitive.d.ts +2 -2
- package/types/physics/CharacterController.d.ts +3 -3
- package/types/physics/Collider.d.ts +3 -2
- package/types/physics/PhysicsMaterial.d.ts +9 -3
- package/types/physics/shape/ColliderShape.d.ts +18 -7
- package/types/physics/shape/MeshColliderShape.d.ts +7 -12
- package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +78 -0
- package/types/renderingHardwareInterface/IPlatformPrimitive.d.ts +6 -0
- package/types/renderingHardwareInterface/IPlatformShaderProgram.d.ts +4 -0
- package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +1 -1
- package/types/renderingHardwareInterface/index.d.ts +3 -0
- package/types/shader/ShaderProgram.d.ts +2 -1
- package/types/shader/state/BlendState.d.ts +1 -1
- package/types/shader/state/DepthState.d.ts +1 -1
- package/types/shader/state/RasterState.d.ts +1 -1
- package/types/shader/state/StencilState.d.ts +1 -1
- package/types/texture/Texture.d.ts +25 -12
- package/types/texture/TextureUtils.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.59",
|
|
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.
|
|
22
|
-
"@galacean/engine-math": "2.0.0-alpha.
|
|
21
|
+
"@galacean/engine-design": "2.0.0-alpha.59",
|
|
22
|
+
"@galacean/engine-math": "2.0.0-alpha.59"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"b:types": "tsc"
|
|
@@ -3,6 +3,7 @@ import { Engine } from "./Engine";
|
|
|
3
3
|
import { RenderQueueMaskType } from "./RenderPipeline/enums/RenderQueueMaskType";
|
|
4
4
|
import { BlinnPhongMaterial, Material } from "./material";
|
|
5
5
|
import { ModelMesh } from "./mesh";
|
|
6
|
+
import { PhysicsMaterial } from "./physics/PhysicsMaterial";
|
|
6
7
|
import type { BuiltinShaders } from "./shader/BuiltinShaders";
|
|
7
8
|
import { RenderStateElementKey } from "./shader/enums/RenderStateElementKey";
|
|
8
9
|
import { Texture2D, TextureCube } from "./texture";
|
|
@@ -12,10 +13,15 @@ import { Texture2DArray } from "./texture/Texture2DArray";
|
|
|
12
13
|
*/
|
|
13
14
|
export declare class BasicResources {
|
|
14
15
|
engine: Engine;
|
|
16
|
+
static physicsDefaultMaterial: PhysicsMaterial;
|
|
15
17
|
private static _maskReadInsideRenderStates;
|
|
16
18
|
private static _maskReadOutsideRenderStates;
|
|
17
19
|
private static _maskWriteIncrementRenderStates;
|
|
18
20
|
private static _maskWriteDecrementRenderStates;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
static _initializePhysics(): void;
|
|
19
25
|
static getMaskInteractionRenderStates(maskInteraction: SpriteMaskInteraction): RenderStateElementMap;
|
|
20
26
|
static getMaskTypeRenderStates(maskType: RenderQueueMaskType): RenderStateElementMap;
|
|
21
27
|
/**
|
package/types/Camera.d.ts
CHANGED
|
@@ -199,6 +199,7 @@ export declare class Camera extends Component {
|
|
|
199
199
|
/**
|
|
200
200
|
* Whether to enable HDR.
|
|
201
201
|
* @defaultValue `false`
|
|
202
|
+
* @remarks Kept on this property across backends; rendering falls back to LDR when the device lacks HDR color targets.
|
|
202
203
|
*/
|
|
203
204
|
get enableHDR(): boolean;
|
|
204
205
|
set enableHDR(value: boolean);
|
|
@@ -218,6 +219,7 @@ export declare class Camera extends Component {
|
|
|
218
219
|
* Higher sample counts (e.g., 2x, 4x, 8x) produce smoother edges.
|
|
219
220
|
*
|
|
220
221
|
* @defaultValue `MSAASamples.FourX`
|
|
222
|
+
* @remarks The requested count is kept; rendering uses at most the count supported by the device.
|
|
221
223
|
*/
|
|
222
224
|
get msaaSamples(): MSAASamples;
|
|
223
225
|
set msaaSamples(value: MSAASamples);
|
|
@@ -349,6 +351,10 @@ export declare class Camera extends Component {
|
|
|
349
351
|
* @internal
|
|
350
352
|
*/
|
|
351
353
|
_getInternalColorTextureFormat(): TextureFormat;
|
|
354
|
+
/**
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
357
|
+
_isInternalFormatHDR(): boolean;
|
|
352
358
|
/**
|
|
353
359
|
* @internal
|
|
354
360
|
*/
|
package/types/Engine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IInputOptions, IPhysics, IPhysicsManager, IShaderCompiler, IXRDevice } from "@galacean/engine-design";
|
|
2
2
|
import { CharRenderInfo } from "./2d/text/CharRenderInfo";
|
|
3
3
|
import { Font } from "./2d/text/Font";
|
|
4
4
|
import { BasicResources } from "./BasicResources";
|
|
@@ -24,6 +24,7 @@ import { ShaderMacroCollection } from "./shader/ShaderMacroCollection";
|
|
|
24
24
|
import { ShaderProgramMap } from "./shader/ShaderProgramMap";
|
|
25
25
|
import { RenderState } from "./shader/state/RenderState";
|
|
26
26
|
import { Texture2D } from "./texture";
|
|
27
|
+
import type { IHardwareRenderer } from "./renderingHardwareInterface";
|
|
27
28
|
import { ClearableObjectPool } from "./utils/ClearableObjectPool";
|
|
28
29
|
import { ReturnableObjectPool } from "./utils/ReturnableObjectPool";
|
|
29
30
|
import { XRManager } from "./xr/XRManager";
|
|
@@ -147,15 +148,15 @@ export declare class Engine extends EventDispatcher {
|
|
|
147
148
|
get isPaused(): boolean;
|
|
148
149
|
/**
|
|
149
150
|
* The number of vertical synchronization means the number of vertical blanking for one frame.
|
|
150
|
-
* @remarks 0 means that the vertical synchronization is turned off.
|
|
151
|
+
* @remarks 0 means that the vertical synchronization is turned off. Hosts without animation-frame scheduling use `targetFrameRate`.
|
|
151
152
|
*/
|
|
152
153
|
get vSyncCount(): number;
|
|
153
154
|
set vSyncCount(value: number);
|
|
154
155
|
/**
|
|
155
156
|
* Set the target frame rate you want to achieve.
|
|
156
157
|
* @remarks
|
|
157
|
-
* It
|
|
158
|
-
* The larger the value, the higher the target frame rate, Number.POSITIVE_INFINITY represents the infinite target frame rate.
|
|
158
|
+
* It takes effect when `vSyncCount = 0` or the host does not provide animation-frame scheduling.
|
|
159
|
+
* The larger the value, the higher the target frame rate, `Number.POSITIVE_INFINITY` represents the infinite target frame rate.
|
|
159
160
|
*/
|
|
160
161
|
get targetFrameRate(): number;
|
|
161
162
|
set targetFrameRate(value: number);
|
|
@@ -239,7 +240,8 @@ export declare class Engine extends EventDispatcher {
|
|
|
239
240
|
/**
|
|
240
241
|
* @internal
|
|
241
242
|
*/
|
|
242
|
-
protected _initialize(configuration: EngineConfiguration): Promise<
|
|
243
|
+
protected _initialize(configuration: EngineConfiguration): Promise<this>;
|
|
244
|
+
private _getRequestAnimationFrame;
|
|
243
245
|
private _onDeviceLost;
|
|
244
246
|
private _onDeviceRestored;
|
|
245
247
|
private _gc;
|
package/types/SystemInfo.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssetPromise } from "./asset/AssetPromise";
|
|
2
|
-
import { Engine } from "./Engine";
|
|
2
|
+
import type { Engine } from "./Engine";
|
|
3
3
|
import { Platform } from "./Platform";
|
|
4
|
-
import { TextureFormat } from "./texture";
|
|
4
|
+
import type { TextureFormat } from "./texture";
|
|
5
5
|
/**
|
|
6
6
|
* Access operating system, platform and hardware information.
|
|
7
7
|
*/
|
|
@@ -10,8 +10,6 @@ export declare class SystemInfo {
|
|
|
10
10
|
static platform: Platform;
|
|
11
11
|
/** The operating system is running on. */
|
|
12
12
|
static operatingSystem: string;
|
|
13
|
-
/** @internal */
|
|
14
|
-
static _isBrowser: boolean;
|
|
15
13
|
/** Whether the system support SIMD. */
|
|
16
14
|
private static _simdSupported;
|
|
17
15
|
private static _webpSupported;
|
|
@@ -34,6 +32,7 @@ export declare class SystemInfo {
|
|
|
34
32
|
static _checkWebpSupported(): AssetPromise<boolean>;
|
|
35
33
|
/**
|
|
36
34
|
* Checks whether the system supports the given texture format.
|
|
35
|
+
* @param engine - Engine instance
|
|
37
36
|
* @param format - The texture format
|
|
38
37
|
* @returns Whether support the texture format
|
|
39
38
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Engine } from "../Engine";
|
|
2
2
|
import { GraphicsResource } from "../asset/GraphicsResource";
|
|
3
|
-
import {
|
|
3
|
+
import type { IPlatformShaderProgram } from "../renderingHardwareInterface";
|
|
4
4
|
import { IndexBufferBinding } from "./IndexBufferBinding";
|
|
5
5
|
import { SubPrimitive } from "./SubPrimitive";
|
|
6
6
|
import { VertexBufferBinding } from "./VertexBufferBinding";
|
|
@@ -43,7 +43,7 @@ export declare class Primitive extends GraphicsResource {
|
|
|
43
43
|
*/
|
|
44
44
|
setVertexBufferBindings(vertexBufferBindings: (VertexBufferBinding | null)[], firstIndex?: number): void;
|
|
45
45
|
setIndexBufferBinding(binding: IndexBufferBinding | null): void;
|
|
46
|
-
draw(shaderProgram:
|
|
46
|
+
draw(shaderProgram: IPlatformShaderProgram, subMesh: SubPrimitive): void;
|
|
47
47
|
_addReferCount(value: number): void;
|
|
48
48
|
_rebuild(): void;
|
|
49
49
|
protected _onDestroy(): void;
|
|
@@ -2,7 +2,7 @@ import { Vector3 } from "@galacean/engine-math";
|
|
|
2
2
|
import { Entity } from "../Entity";
|
|
3
3
|
import { Collider } from "./Collider";
|
|
4
4
|
import { ControllerNonWalkableMode } from "./enums/ControllerNonWalkableMode";
|
|
5
|
-
import {
|
|
5
|
+
import { BoxColliderShape, CapsuleColliderShape } from "./shape";
|
|
6
6
|
/**
|
|
7
7
|
* The character controllers.
|
|
8
8
|
*/
|
|
@@ -13,7 +13,7 @@ export declare class CharacterController extends Collider {
|
|
|
13
13
|
private _slopeLimit;
|
|
14
14
|
/**
|
|
15
15
|
* The step offset for the controller, the value must be greater than or equal to 0.
|
|
16
|
-
* @remarks Character can overcome obstacle less than the height(stepOffset +
|
|
16
|
+
* @remarks Character can overcome obstacle less than the height(stepOffset + contactOffset of the shape).
|
|
17
17
|
*/
|
|
18
18
|
get stepOffset(): number;
|
|
19
19
|
set stepOffset(value: number);
|
|
@@ -49,7 +49,7 @@ export declare class CharacterController extends Collider {
|
|
|
49
49
|
* Add collider shape on this controller.
|
|
50
50
|
* @param shape - Collider shape
|
|
51
51
|
*/
|
|
52
|
-
addShape(shape:
|
|
52
|
+
addShape(shape: BoxColliderShape | CapsuleColliderShape): void;
|
|
53
53
|
/**
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ICollider } from "@galacean/engine-design";
|
|
1
|
+
import { ICollider, IColliderShape } from "@galacean/engine-design";
|
|
2
2
|
import { BoolUpdateFlag } from "../BoolUpdateFlag";
|
|
3
3
|
import type { ICloneHook } from "../clone/ICloneHook";
|
|
4
4
|
import { Component } from "../Component";
|
|
5
5
|
import { Entity } from "../Entity";
|
|
6
6
|
import { Layer } from "../Layer";
|
|
7
7
|
import { ColliderShape } from "./shape/ColliderShape";
|
|
8
|
+
import type { MeshColliderShape } from "./shape/MeshColliderShape";
|
|
8
9
|
/**
|
|
9
10
|
* Base class for all colliders.
|
|
10
11
|
* @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
|
|
@@ -75,7 +76,7 @@ export declare class Collider extends Component implements ICloneHook<Collider>
|
|
|
75
76
|
/**
|
|
76
77
|
* @internal
|
|
77
78
|
*/
|
|
78
|
-
|
|
79
|
+
_replaceNativeShape(shape: MeshColliderShape, nativeShape: IColliderShape | null): void;
|
|
79
80
|
protected _syncNative(): void;
|
|
80
81
|
/**
|
|
81
82
|
* @internal
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { IPhysicsMaterial } from "@galacean/engine-design";
|
|
1
|
+
import { IPhysicsMaterial, IPhysicsMaterialProperties } from "@galacean/engine-design";
|
|
2
2
|
import { PhysicsMaterialCombineMode } from "./enums/PhysicsMaterialCombineMode";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Surface friction, bounciness, and combine modes for collider shapes.
|
|
5
5
|
*/
|
|
6
6
|
export declare class PhysicsMaterial {
|
|
7
|
+
/** @internal */
|
|
8
|
+
static readonly _defaultProperties: IPhysicsMaterialProperties;
|
|
7
9
|
private _bounciness;
|
|
8
10
|
private _dynamicFriction;
|
|
9
11
|
private _staticFriction;
|
|
@@ -39,7 +41,11 @@ export declare class PhysicsMaterial {
|
|
|
39
41
|
get frictionCombine(): PhysicsMaterialCombineMode;
|
|
40
42
|
set frictionCombine(value: PhysicsMaterialCombineMode);
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
44
|
+
* Create an independent material with the same properties.
|
|
45
|
+
*/
|
|
46
|
+
clone(): PhysicsMaterial;
|
|
47
|
+
/**
|
|
48
|
+
* Release this material after all shapes have stopped using it.
|
|
43
49
|
*/
|
|
44
50
|
destroy(): void;
|
|
45
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataObject } from "../../base/DataObject";
|
|
2
|
-
import { IColliderShape } from "@galacean/engine-design";
|
|
2
|
+
import { IColliderShape, IPhysicsMaterial } from "@galacean/engine-design";
|
|
3
3
|
import { PhysicsMaterial } from "../PhysicsMaterial";
|
|
4
4
|
import { Vector3 } from "@galacean/engine-math";
|
|
5
5
|
import { Collider } from "../Collider";
|
|
@@ -13,10 +13,9 @@ export declare abstract class ColliderShape extends DataObject implements IClone
|
|
|
13
13
|
_collider: Collider | null;
|
|
14
14
|
/** @internal */
|
|
15
15
|
_nativeShape: IColliderShape | null;
|
|
16
|
-
/** @internal */
|
|
17
|
-
_isShapeAttached: boolean;
|
|
18
16
|
protected _id: number;
|
|
19
|
-
protected _material: PhysicsMaterial;
|
|
17
|
+
protected _material: PhysicsMaterial | null;
|
|
18
|
+
private _materialInstanced;
|
|
20
19
|
private _isTrigger;
|
|
21
20
|
private _isSceneQuery;
|
|
22
21
|
private _rotation;
|
|
@@ -45,10 +44,12 @@ export declare abstract class ColliderShape extends DataObject implements IClone
|
|
|
45
44
|
get contactOffset(): number;
|
|
46
45
|
set contactOffset(value: number);
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
47
|
+
* The assigned material, or null to use the shared default material.
|
|
48
|
+
* @defaultValue null
|
|
49
|
+
* @remarks This property returns null for the shared default. Use {@link getInstanceMaterial} to obtain an instance.
|
|
49
50
|
*/
|
|
50
|
-
get material(): PhysicsMaterial;
|
|
51
|
-
set material(value: PhysicsMaterial);
|
|
51
|
+
get material(): PhysicsMaterial | null;
|
|
52
|
+
set material(value: PhysicsMaterial | null);
|
|
52
53
|
/**
|
|
53
54
|
* The local rotation of this ColliderShape, in degrees.
|
|
54
55
|
*/
|
|
@@ -65,6 +66,13 @@ export declare abstract class ColliderShape extends DataObject implements IClone
|
|
|
65
66
|
get isTrigger(): boolean;
|
|
66
67
|
set isTrigger(value: boolean);
|
|
67
68
|
protected constructor();
|
|
69
|
+
/**
|
|
70
|
+
* Get the instance material for this shape.
|
|
71
|
+
* @remarks On first use, assigns a clone of {@link material}, or a new material with default properties if null.
|
|
72
|
+
* Reuses the instance until a different material or null is assigned.
|
|
73
|
+
* @returns The instance material
|
|
74
|
+
*/
|
|
75
|
+
getInstanceMaterial(): PhysicsMaterial;
|
|
68
76
|
/**
|
|
69
77
|
* Get the distance and the closest point on the shape from a point.
|
|
70
78
|
* @param point - Location in world space you want to find the closest point to
|
|
@@ -81,7 +89,10 @@ export declare abstract class ColliderShape extends DataObject implements IClone
|
|
|
81
89
|
* @internal
|
|
82
90
|
*/
|
|
83
91
|
_destroy(): void;
|
|
92
|
+
protected _cloneNativeShape(target: ColliderShape): void;
|
|
93
|
+
protected _getNativeMaterial(): IPhysicsMaterial;
|
|
84
94
|
protected _syncNative(): void;
|
|
95
|
+
protected _syncNativeShape(nativeShape: IColliderShape): void;
|
|
85
96
|
private _setPosition;
|
|
86
97
|
private _setRotation;
|
|
87
98
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ModelMesh } from "../../mesh/ModelMesh";
|
|
2
1
|
import { Vector3 } from "@galacean/engine-math";
|
|
2
|
+
import { ModelMesh } from "../../mesh/ModelMesh";
|
|
3
3
|
import { MeshColliderShapeCookingFlag } from "../enums/MeshColliderShapeCookingFlag";
|
|
4
4
|
import { ColliderShape } from "./ColliderShape";
|
|
5
5
|
/**
|
|
6
6
|
* Collider shape based on mesh geometry, supporting both convex hull and triangle mesh modes.
|
|
7
7
|
*/
|
|
8
8
|
export declare class MeshColliderShape extends ColliderShape {
|
|
9
|
+
private static readonly _unitScale;
|
|
9
10
|
private _mesh;
|
|
10
11
|
private _isConvex;
|
|
11
|
-
private
|
|
12
|
-
private _indices;
|
|
12
|
+
private _meshData;
|
|
13
13
|
private _cookingFlags;
|
|
14
14
|
/**
|
|
15
15
|
* Cooking flags for this mesh collider shape.
|
|
@@ -19,7 +19,7 @@ export declare class MeshColliderShape extends ColliderShape {
|
|
|
19
19
|
/**
|
|
20
20
|
* Whether to use convex mesh mode.
|
|
21
21
|
* @remarks
|
|
22
|
-
* - When true, generates a convex hull from the mesh vertices. Works with
|
|
22
|
+
* - When true, generates a convex hull from the mesh vertices. Works with StaticCollider or DynamicCollider.
|
|
23
23
|
* - When false, uses the original triangle mesh. Only works with StaticCollider or kinematic DynamicCollider, and the mesh must have indices.
|
|
24
24
|
*/
|
|
25
25
|
get isConvex(): boolean;
|
|
@@ -34,18 +34,13 @@ export declare class MeshColliderShape extends ColliderShape {
|
|
|
34
34
|
* {@inheritDoc ColliderShape.getClosestPoint}
|
|
35
35
|
*/
|
|
36
36
|
getClosestPoint(point: Vector3, outClosestPoint: Vector3): number;
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
* @inheritdoc
|
|
40
|
-
*/
|
|
41
|
-
_onClone(target: MeshColliderShape): void;
|
|
42
37
|
/**
|
|
43
38
|
* @internal
|
|
44
39
|
*/
|
|
45
40
|
_destroy(): void;
|
|
46
|
-
|
|
47
|
-
private
|
|
48
|
-
private _extractMeshData;
|
|
41
|
+
protected _cloneNativeShape(target: MeshColliderShape): void;
|
|
42
|
+
private _getMeshData;
|
|
49
43
|
private _updateNativeShapeData;
|
|
50
44
|
private _createNativeShape;
|
|
45
|
+
private _replaceNativeShape;
|
|
51
46
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Color, Vector4 } from "@galacean/engine-math";
|
|
2
|
+
import type { Canvas } from "../Canvas";
|
|
3
|
+
import type { Engine } from "../Engine";
|
|
4
|
+
import type { GLCapabilityType } from "../base/Constant";
|
|
5
|
+
import type { BufferBindFlag, BufferUsage, Primitive, SubPrimitive } from "../graphic";
|
|
6
|
+
import type { CameraClearFlags } from "../enums/CameraClearFlags";
|
|
7
|
+
import type { RenderTarget, Texture2D, Texture2DArray, TextureCube, TextureCubeFace, TextureFormat } from "../texture";
|
|
8
|
+
import type { IPlatformBuffer } from "./IPlatformBuffer";
|
|
9
|
+
import type { IPlatformPrimitive } from "./IPlatformPrimitive";
|
|
10
|
+
import type { IPlatformRenderTarget } from "./IPlatformRenderTarget";
|
|
11
|
+
import type { IPlatformShaderProgram } from "./IPlatformShaderProgram";
|
|
12
|
+
import type { IPlatformTexture } from "./IPlatformTexture";
|
|
13
|
+
import type { IPlatformTexture2D } from "./IPlatformTexture2D";
|
|
14
|
+
import type { IPlatformTexture2DArray } from "./IPlatformTexture2DArray";
|
|
15
|
+
import type { IPlatformTextureCube } from "./IPlatformTextureCube";
|
|
16
|
+
import type { IPlatformTransformFeedback } from "./IPlatformTransformFeedback";
|
|
17
|
+
import type { IPlatformTransformFeedbackPrimitive } from "./IPlatformTransformFeedbackPrimitive";
|
|
18
|
+
/** Graphics resource and command boundary used by the engine. */
|
|
19
|
+
export interface IHardwareRenderer {
|
|
20
|
+
/** WebGL access requires a graphics-capable backend. */
|
|
21
|
+
readonly gl: WebGLRenderingContext | WebGL2RenderingContext;
|
|
22
|
+
readonly isWebGL2: boolean;
|
|
23
|
+
readonly maxUniformBlockSize: number;
|
|
24
|
+
/** Whether this device can execute rendering commands. */
|
|
25
|
+
readonly supportsRendering: boolean;
|
|
26
|
+
readonly capability: {
|
|
27
|
+
readonly maxTextureSize: number;
|
|
28
|
+
readonly maxAntiAliasing: number;
|
|
29
|
+
readonly maxVertexUniformVectors: number;
|
|
30
|
+
readonly canUseFloatTextureBlendShape: boolean;
|
|
31
|
+
readonly isFragmentHighPrecision: boolean;
|
|
32
|
+
};
|
|
33
|
+
readonly canIUseMoreJoints: boolean;
|
|
34
|
+
/** @internal */
|
|
35
|
+
readonly _options: {
|
|
36
|
+
readonly depth?: boolean;
|
|
37
|
+
readonly stencil?: boolean;
|
|
38
|
+
readonly _forceFlush?: boolean;
|
|
39
|
+
readonly _maxAllowSkinUniformVectorCount?: number;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
_currentBindShaderProgram: IPlatformShaderProgram | null;
|
|
43
|
+
/** @internal */
|
|
44
|
+
_enableGlobalDepthBias: boolean;
|
|
45
|
+
init(canvas: Canvas, onDeviceLost: () => void, onDeviceRestored: () => void): void;
|
|
46
|
+
canIUse(capability: GLCapabilityType): boolean;
|
|
47
|
+
canIUseCompressedTextureInternalFormat(format: number): boolean;
|
|
48
|
+
supportsTextureFormat(format: TextureFormat): boolean;
|
|
49
|
+
supportsRenderTargetColorFormat(format: TextureFormat): boolean;
|
|
50
|
+
createPlatformPrimitive(primitive: Primitive): IPlatformPrimitive;
|
|
51
|
+
createPlatformBuffer(type: BufferBindFlag, byteLength: number, usage?: BufferUsage, data?: ArrayBuffer | ArrayBufferView): IPlatformBuffer;
|
|
52
|
+
createPlatformTexture2D(texture: Texture2D): IPlatformTexture2D;
|
|
53
|
+
createPlatformTexture2DArray(texture: Texture2DArray): IPlatformTexture2DArray;
|
|
54
|
+
createPlatformTextureCube(texture: TextureCube): IPlatformTextureCube;
|
|
55
|
+
createPlatformRenderTarget(target: RenderTarget): IPlatformRenderTarget;
|
|
56
|
+
createPlatformTransformFeedback(): IPlatformTransformFeedback;
|
|
57
|
+
createPlatformTransformFeedbackPrimitive(): IPlatformTransformFeedbackPrimitive;
|
|
58
|
+
activeRenderTarget(target: RenderTarget | null, viewport: Vector4, isFlipProjection: boolean | null, mipLevel?: number, faceIndex?: TextureCubeFace): void;
|
|
59
|
+
clearRenderTarget(engine: Engine, flags: CameraClearFlags, color?: Color | null): void;
|
|
60
|
+
drawPrimitive(primitive: Primitive, subPrimitive: SubPrimitive | null, program: IPlatformShaderProgram): void;
|
|
61
|
+
blitInternalRTByBlitFrameBuffer(source: RenderTarget | null, destination: RenderTarget, flags: CameraClearFlags, viewport: Vector4): void;
|
|
62
|
+
copyRenderTargetToSubTexture(source: RenderTarget | null, texture: Texture2D, viewport: Vector4): void;
|
|
63
|
+
viewport(x: number, y: number, width: number, height: number): void;
|
|
64
|
+
scissor(x: number, y: number, width: number, height: number): void;
|
|
65
|
+
activeTexture(textureID: number): void;
|
|
66
|
+
bindTexture(texture: IPlatformTexture): void;
|
|
67
|
+
bindUniformBufferBase(bindingPoint: number, buffer: IPlatformBuffer): void;
|
|
68
|
+
setGlobalDepthBias(bias: number, slopeBias: number): void;
|
|
69
|
+
enableRasterizerDiscard(): void;
|
|
70
|
+
disableRasterizerDiscard(): void;
|
|
71
|
+
invalidateShaderProgramState(): void;
|
|
72
|
+
flush(): void;
|
|
73
|
+
forceLoseDevice(): void;
|
|
74
|
+
forceRestoreDevice(): void;
|
|
75
|
+
isContextLost(): boolean;
|
|
76
|
+
resetState(): void;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SubPrimitive } from "../graphic/SubPrimitive";
|
|
2
|
+
import type { IPlatformShaderProgram } from "./IPlatformShaderProgram";
|
|
3
|
+
export interface IPlatformPrimitive {
|
|
4
|
+
draw(shaderProgram: IPlatformShaderProgram, subPrimitive: SubPrimitive): void;
|
|
5
|
+
destroy(): void;
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IPlatformShaderProgram } from "@galacean/engine-design";
|
|
2
1
|
import type { VertexBufferBinding } from "../graphic/VertexBufferBinding";
|
|
3
2
|
import type { VertexElement } from "../graphic/VertexElement";
|
|
3
|
+
import type { IPlatformShaderProgram } from "./IPlatformShaderProgram";
|
|
4
4
|
/**
|
|
5
5
|
* Platform interface for Transform Feedback primitive operations.
|
|
6
6
|
* @internal
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export type { IHardwareRenderer } from "./IHardwareRenderer";
|
|
1
2
|
export type { IPlatformBuffer } from "./IPlatformBuffer";
|
|
3
|
+
export type { IPlatformPrimitive } from "./IPlatformPrimitive";
|
|
2
4
|
export type { IPlatformRenderTarget } from "./IPlatformRenderTarget";
|
|
5
|
+
export type { IPlatformShaderProgram } from "./IPlatformShaderProgram";
|
|
3
6
|
export type { IPlatformTexture } from "./IPlatformTexture";
|
|
4
7
|
export type { IPlatformTexture2D } from "./IPlatformTexture2D";
|
|
5
8
|
export type { IPlatformTexture2DArray } from "./IPlatformTexture2DArray";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IPlatformShaderProgram } from "../renderingHardwareInterface";
|
|
1
2
|
import { Engine } from "../Engine";
|
|
2
3
|
import { ShaderData } from "./ShaderData";
|
|
3
4
|
import { ShaderUniformBlock } from "./ShaderUniformBlock";
|
|
@@ -6,7 +7,7 @@ import { InstanceBufferLayout } from "./ShaderFactory";
|
|
|
6
7
|
* Shader program, corresponding to the GPU shader program.
|
|
7
8
|
* @internal
|
|
8
9
|
*/
|
|
9
|
-
export declare class ShaderProgram {
|
|
10
|
+
export declare class ShaderProgram implements IPlatformShaderProgram {
|
|
10
11
|
private static _counter;
|
|
11
12
|
private static _addLineNum;
|
|
12
13
|
id: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataObject } from "../../base/DataObject";
|
|
2
|
-
import { IHardwareRenderer } from "
|
|
2
|
+
import type { IHardwareRenderer } from "../../renderingHardwareInterface";
|
|
3
3
|
import { Color } from "@galacean/engine-math";
|
|
4
4
|
import { RenderStateElementMap } from "../../BasicResources";
|
|
5
5
|
import { ShaderData } from "../ShaderData";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataObject } from "../../base/DataObject";
|
|
2
|
-
import { IHardwareRenderer } from "
|
|
2
|
+
import type { IHardwareRenderer } from "../../renderingHardwareInterface";
|
|
3
3
|
import { RenderStateElementMap } from "../../BasicResources";
|
|
4
4
|
import { ShaderData } from "../ShaderData";
|
|
5
5
|
import { ShaderProperty } from "../ShaderProperty";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataObject } from "../../base/DataObject";
|
|
2
|
-
import { IHardwareRenderer } from "
|
|
2
|
+
import type { IHardwareRenderer } from "../../renderingHardwareInterface";
|
|
3
3
|
import { RenderStateElementMap } from "../../BasicResources";
|
|
4
4
|
import { ShaderData } from "../ShaderData";
|
|
5
5
|
import { ShaderProperty } from "../ShaderProperty";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataObject } from "../../base/DataObject";
|
|
2
|
-
import { IHardwareRenderer } from "
|
|
2
|
+
import type { IHardwareRenderer } from "../../renderingHardwareInterface";
|
|
3
3
|
import { RenderStateElementMap } from "../../BasicResources";
|
|
4
4
|
import { ShaderData } from "../ShaderData";
|
|
5
5
|
import { ShaderProperty } from "../ShaderProperty";
|
|
@@ -7,7 +7,7 @@ import { TextureFormat } from "./enums/TextureFormat";
|
|
|
7
7
|
import { TextureUsage } from "./enums/TextureUsage";
|
|
8
8
|
import { TextureWrapMode } from "./enums/TextureWrapMode";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Base class for textures, holding format, base dimensions, mipmap count, and sampler state.
|
|
11
11
|
*/
|
|
12
12
|
export declare abstract class Texture extends GraphicsResource {
|
|
13
13
|
name: string;
|
|
@@ -32,23 +32,23 @@ export declare abstract class Texture extends GraphicsResource {
|
|
|
32
32
|
private _depthCompareFunction;
|
|
33
33
|
private _useDepthCompareMode;
|
|
34
34
|
/**
|
|
35
|
-
* Whether
|
|
35
|
+
* Whether texels are stored in sRGB rather than linear color space.
|
|
36
36
|
*/
|
|
37
37
|
get isSRGBColorSpace(): boolean;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Pixel storage format of the texture.
|
|
40
40
|
*/
|
|
41
41
|
get format(): TextureFormat;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Width of mip level `0`, in pixels.
|
|
44
44
|
*/
|
|
45
45
|
get width(): number;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Height of mip level `0`, in pixels.
|
|
48
48
|
*/
|
|
49
49
|
get height(): number;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Upload frequency hint for the texture.
|
|
52
52
|
*/
|
|
53
53
|
get usage(): TextureUsage;
|
|
54
54
|
/**
|
|
@@ -62,28 +62,41 @@ export declare abstract class Texture extends GraphicsResource {
|
|
|
62
62
|
get wrapModeV(): TextureWrapMode;
|
|
63
63
|
set wrapModeV(value: TextureWrapMode);
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Number of mip levels; `1` when mipmapping is disabled.
|
|
66
66
|
*/
|
|
67
67
|
get mipmapCount(): number;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Sampling filter mode.
|
|
70
|
+
* @remarks Integer formats (`TextureFormat.R32G32B32A32_UInt`) only accept `TextureFilterMode.Point`; other modes log a warning and are ignored.
|
|
70
71
|
*/
|
|
71
72
|
get filterMode(): TextureFilterMode;
|
|
72
73
|
set filterMode(value: TextureFilterMode);
|
|
73
74
|
/**
|
|
74
75
|
* Anisotropic level for texture.
|
|
76
|
+
* @defaultValue `1`
|
|
77
|
+
* @remarks Values below `1` are clamped to `1`; values above the device limit are kept on this property and clamped when sampling.
|
|
75
78
|
*/
|
|
76
79
|
get anisoLevel(): number;
|
|
77
80
|
set anisoLevel(value: number);
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @remarks
|
|
82
|
+
* Comparison function used when sampling this texture as a shadow depth map.
|
|
83
|
+
* @remarks Kept on this property across backends, and takes effect only for depth formats sampled with comparison in WebGL2.
|
|
81
84
|
*/
|
|
82
85
|
get depthCompareFunction(): TextureDepthCompareFunction;
|
|
83
86
|
set depthCompareFunction(value: TextureDepthCompareFunction);
|
|
87
|
+
/**
|
|
88
|
+
* Initialize base texture metadata and validate format support.
|
|
89
|
+
* @param engine - Owning engine instance
|
|
90
|
+
* @param width - Width of mip level `0` in pixels
|
|
91
|
+
* @param height - Height of mip level `0` in pixels
|
|
92
|
+
* @param format - Pixel storage format
|
|
93
|
+
* @param mipmap - Whether to allocate a full mip chain down to `1x1`
|
|
94
|
+
* @param isSRGBColorSpace - Whether texels use sRGB rather than linear encoding
|
|
95
|
+
* @throws If `format` is not supported by `engine`.
|
|
96
|
+
*/
|
|
84
97
|
constructor(engine: Engine, width: number, height: number, format: TextureFormat, mipmap: boolean, isSRGBColorSpace: boolean);
|
|
85
98
|
/**
|
|
86
|
-
*
|
|
99
|
+
* Regenerate mip levels `1..mipmapCount - 1` from mip level `0`. No-op if mipmapping is disabled.
|
|
87
100
|
*/
|
|
88
101
|
generateMipmaps(): void;
|
|
89
102
|
/**
|
|
@@ -99,7 +112,7 @@ export declare abstract class Texture extends GraphicsResource {
|
|
|
99
112
|
*/
|
|
100
113
|
protected _onDestroy(): void;
|
|
101
114
|
/**
|
|
102
|
-
*
|
|
115
|
+
* Maximum 0-based mip level for a dimension of `size` pixels, rounding down.
|
|
103
116
|
* @remarks http://download.nvidia.com/developer/Papers/2005/NP2_Mipmapping/NP2_Mipmap_Creation.pdf
|
|
104
117
|
*/
|
|
105
118
|
protected _getMaxMiplevel(size: number): number;
|
|
@@ -8,6 +8,7 @@ export declare class TextureUtils {
|
|
|
8
8
|
* Check if the texture config supports auto mipmap generation with real correction for mipmap and isSRGBColorSpace.
|
|
9
9
|
*/
|
|
10
10
|
static supportGenerateMipmapsWithCorrection(engine: Engine, width: number, height: number, format: TextureFormat, mipmap: boolean, isSRGBColorSpace: boolean): boolean;
|
|
11
|
+
static isHDRFormat(format: TextureFormat): boolean;
|
|
11
12
|
static supportSRGB(format: TextureFormat): boolean;
|
|
12
13
|
static supportMipmaps(width: number, height: any, isWebGL2: boolean): boolean;
|
|
13
14
|
static supportGenerateMipmaps(format: TextureFormat, mipmap: boolean, isSRGBColorSpace: boolean, isWebGL2: boolean): boolean;
|