@galacean/engine-core 2.0.0-alpha.56 → 2.0.0-alpha.58
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 +13833 -11865
- package/dist/main.js.map +1 -1
- package/dist/module.js +13833 -11866
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/BasicResources.d.ts +8 -2
- package/types/Camera.d.ts +6 -0
- package/types/Engine.d.ts +10 -5
- package/types/SystemInfo.d.ts +3 -4
- package/types/graphic/Primitive.d.ts +2 -2
- package/types/lighting/ambientOcclusion/ScalableAmbientObscurancePass.d.ts +2 -2
- package/types/material/Material.d.ts +1 -0
- package/types/mesh/MeshTangentUtils.d.ts +9 -0
- package/types/mesh/ModelMesh.d.ts +5 -8
- package/types/mesh/PrimitiveMesh.d.ts +229 -101
- package/types/mesh/PrimitiveMeshOptions.d.ts +415 -0
- package/types/mesh/enums/PrimitiveMeshCapMode.d.ts +21 -0
- package/types/mesh/index.d.ts +2 -0
- package/types/mesh/primitive/MeshPathUtils.d.ts +13 -0
- package/types/mesh/primitive/PolygonUtils.d.ts +44 -0
- package/types/mesh/primitive/PrimitiveMeshBuilder.d.ts +25 -0
- package/types/mesh/primitive/PrimitiveMeshRestorer.d.ts +15 -0
- package/types/mesh/primitive/SubdivisionUtils.d.ts +9 -0
- package/types/particle/ParticleSubEmitterSpawnState.d.ts +2 -1
- package/types/particle/ParticleTransformFeedbackSimulator.d.ts +2 -6
- 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/postProcess/FinalPass.d.ts +2 -1
- 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/BuiltinShaders.d.ts +27 -0
- package/types/shader/Shader.d.ts +0 -2
- package/types/shader/ShaderProgram.d.ts +2 -1
- package/types/shader/index.d.ts +1 -0
- 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/types/mesh/PrimitiveMeshRestorer.d.ts +0 -108
|
@@ -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
|
}
|
|
@@ -2,6 +2,7 @@ import { Camera } from "../Camera";
|
|
|
2
2
|
import { Engine } from "../Engine";
|
|
3
3
|
import { PipelinePass } from "../RenderPipeline/PipelinePass";
|
|
4
4
|
import { RenderContext } from "../RenderPipeline/RenderContext";
|
|
5
|
+
import { Shader } from "../shader";
|
|
5
6
|
import { RenderTarget } from "../texture";
|
|
6
7
|
/**
|
|
7
8
|
* @internal
|
|
@@ -12,7 +13,7 @@ export declare class FinalPass extends PipelinePass {
|
|
|
12
13
|
private _srgbRenderTarget;
|
|
13
14
|
private _antiAliasingMaterial;
|
|
14
15
|
private _sRGBmaterial;
|
|
15
|
-
constructor(engine: Engine);
|
|
16
|
+
constructor(engine: Engine, sRGBShader: Shader, antiAliasingShader: Shader);
|
|
16
17
|
onConfig(camera: Camera, inputRenderTarget: RenderTarget): void;
|
|
17
18
|
onRender(context: RenderContext): void;
|
|
18
19
|
release(): void;
|
|
@@ -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";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Shader } from "./Shader";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface BuiltinShaders {
|
|
6
|
+
readonly blit: Shader;
|
|
7
|
+
readonly blitScreen: Shader;
|
|
8
|
+
readonly pbr: Shader;
|
|
9
|
+
readonly blinnPhong: Shader;
|
|
10
|
+
readonly unlit: Shader;
|
|
11
|
+
readonly skybox: Shader;
|
|
12
|
+
readonly skyProcedural: Shader;
|
|
13
|
+
readonly backgroundTexture: Shader;
|
|
14
|
+
readonly sprite: Shader;
|
|
15
|
+
readonly spriteMask: Shader;
|
|
16
|
+
readonly text: Shader;
|
|
17
|
+
readonly trail: Shader;
|
|
18
|
+
readonly ui: Shader;
|
|
19
|
+
readonly spine: Shader;
|
|
20
|
+
readonly particle: Shader;
|
|
21
|
+
readonly particleFeedback: Shader;
|
|
22
|
+
readonly uber: Shader;
|
|
23
|
+
readonly finalSRGB: Shader;
|
|
24
|
+
readonly finalAntiAliasing: Shader;
|
|
25
|
+
readonly bloom: Shader;
|
|
26
|
+
readonly scalableAmbientOcclusion: Shader;
|
|
27
|
+
}
|
package/types/shader/Shader.d.ts
CHANGED
|
@@ -71,8 +71,6 @@ export declare class Shader implements IReferable {
|
|
|
71
71
|
*/
|
|
72
72
|
static find(name: string): Shader | undefined;
|
|
73
73
|
/**
|
|
74
|
-
* Create a shader from precompiled instructions.
|
|
75
|
-
* @param data - Precompiled shader data
|
|
76
74
|
* @internal
|
|
77
75
|
*/
|
|
78
76
|
static _createFromPrecompiled(data: IPrecompiledShader): Shader;
|
|
@@ -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;
|
package/types/shader/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { BlendFactor } from "./enums/BlendFactor";
|
|
2
|
+
export type { BuiltinShaders } from "./BuiltinShaders";
|
|
2
3
|
export { BlendOperation } from "./enums/BlendOperation";
|
|
3
4
|
export { ColorWriteMask } from "./enums/ColorWriteMask";
|
|
4
5
|
export { CompareFunction } from "./enums/CompareFunction";
|
|
@@ -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;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { ContentRestorer } from "../asset/ContentRestorer";
|
|
2
|
-
import { Buffer } from "../graphic/Buffer";
|
|
3
|
-
import { ModelMesh } from "./ModelMesh";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare class PrimitiveMeshRestorer extends ContentRestorer<ModelMesh> {
|
|
8
|
-
primitiveInfo: PrimitiveRestoreInfo;
|
|
9
|
-
constructor(resource: ModelMesh, primitiveInfo: PrimitiveRestoreInfo);
|
|
10
|
-
restoreContent(): void;
|
|
11
|
-
}
|
|
12
|
-
declare enum PrimitiveType {
|
|
13
|
-
Sphere = 0,
|
|
14
|
-
Cuboid = 1,
|
|
15
|
-
Plane = 2,
|
|
16
|
-
Cylinder = 3,
|
|
17
|
-
Torus = 4,
|
|
18
|
-
Cone = 5,
|
|
19
|
-
Capsule = 6,
|
|
20
|
-
CCSphere = 7
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
export declare class PrimitiveRestoreInfo {
|
|
26
|
-
type: PrimitiveType;
|
|
27
|
-
vertexBuffer: Buffer;
|
|
28
|
-
noLongerAccessible: boolean;
|
|
29
|
-
constructor(type: PrimitiveType, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
export declare class SphereRestoreInfo extends PrimitiveRestoreInfo {
|
|
35
|
-
radius: number;
|
|
36
|
-
segments: number;
|
|
37
|
-
constructor(radius: number, segments: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
export declare class SubdivisionSurfaceSphereRestoreInfo extends PrimitiveRestoreInfo {
|
|
43
|
-
radius: number;
|
|
44
|
-
step: number;
|
|
45
|
-
constructor(radius: number, step: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
export declare class CuboidRestoreInfo extends PrimitiveRestoreInfo {
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
depth: number;
|
|
54
|
-
constructor(width: number, height: number, depth: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
export declare class PlaneRestoreInfo extends PrimitiveRestoreInfo {
|
|
60
|
-
width: number;
|
|
61
|
-
height: number;
|
|
62
|
-
horizontalSegments: number;
|
|
63
|
-
verticalSegments: number;
|
|
64
|
-
constructor(width: number, height: number, horizontalSegments: number, verticalSegments: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export declare class CylinderRestoreInfo extends PrimitiveRestoreInfo {
|
|
70
|
-
radiusTop: number;
|
|
71
|
-
radiusBottom: number;
|
|
72
|
-
height: number;
|
|
73
|
-
radialSegments: number;
|
|
74
|
-
heightSegments: number;
|
|
75
|
-
constructor(radiusTop: number, radiusBottom: number, height: number, radialSegments: number, heightSegments: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
export declare class TorusRestoreInfo extends PrimitiveRestoreInfo {
|
|
81
|
-
radius: number;
|
|
82
|
-
tubeRadius: number;
|
|
83
|
-
radialSegments: number;
|
|
84
|
-
tubularSegments: number;
|
|
85
|
-
arc: number;
|
|
86
|
-
constructor(radius: number, tubeRadius: number, radialSegments: number, tubularSegments: number, arc: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @internal
|
|
90
|
-
*/
|
|
91
|
-
export declare class ConeRestoreInfo extends PrimitiveRestoreInfo {
|
|
92
|
-
radius: number;
|
|
93
|
-
height: number;
|
|
94
|
-
radialSegments: number;
|
|
95
|
-
heightSegments: number;
|
|
96
|
-
constructor(radius: number, height: number, radialSegments: number, heightSegments: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* @internal
|
|
100
|
-
*/
|
|
101
|
-
export declare class CapsuleRestoreInfo extends PrimitiveRestoreInfo {
|
|
102
|
-
radius: number;
|
|
103
|
-
height: number;
|
|
104
|
-
radialSegments: number;
|
|
105
|
-
heightSegments: number;
|
|
106
|
-
constructor(radius: number, height: number, radialSegments: number, heightSegments: number, vertexBuffer: Buffer, noLongerAccessible: boolean);
|
|
107
|
-
}
|
|
108
|
-
export {};
|