@galacean/engine-core 1.0.0 → 1.1.0-alpha.0

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.
Files changed (118) hide show
  1. package/dist/main.js +14441 -12563
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +14441 -12563
  4. package/dist/module.js +14426 -12558
  5. package/dist/module.js.map +1 -1
  6. package/package.json +3 -3
  7. package/types/2d/assembler/TiledSpriteAssembler.d.ts +1 -0
  8. package/types/2d/atlas/SpriteAtlas.d.ts +2 -6
  9. package/types/2d/data/VertexData2D.d.ts +1 -0
  10. package/types/2d/enums/SpriteDrawMode.d.ts +4 -2
  11. package/types/2d/enums/SpriteTileMode.d.ts +11 -0
  12. package/types/2d/index.d.ts +1 -0
  13. package/types/2d/sprite/Sprite.d.ts +14 -8
  14. package/types/2d/sprite/SpriteMask.d.ts +16 -22
  15. package/types/2d/sprite/SpriteRenderer.d.ts +31 -17
  16. package/types/2d/text/Font.d.ts +2 -7
  17. package/types/2d/text/TextRenderer.d.ts +1 -13
  18. package/types/2d/text/index.d.ts +1 -0
  19. package/types/Camera.d.ts +35 -12
  20. package/types/Component.d.ts +1 -8
  21. package/types/ComponentsDependencies.d.ts +17 -9
  22. package/types/Engine.d.ts +39 -46
  23. package/types/Entity.d.ts +1 -1
  24. package/types/RenderPipeline/Basic2DBatcher.d.ts +6 -7
  25. package/types/RenderPipeline/BasicRenderPipeline.d.ts +8 -6
  26. package/types/RenderPipeline/MeshRenderData.d.ts +15 -0
  27. package/types/RenderPipeline/RenderData.d.ts +7 -0
  28. package/types/RenderPipeline/RenderElement.d.ts +5 -7
  29. package/types/RenderPipeline/RenderPass.d.ts +1 -1
  30. package/types/RenderPipeline/RenderQueue.d.ts +3 -5
  31. package/types/RenderPipeline/SpriteMaskBatcher.d.ts +4 -3
  32. package/types/RenderPipeline/SpriteMaskRenderData.d.ts +10 -0
  33. package/types/RenderPipeline/SpriteRenderData.d.ts +12 -0
  34. package/types/RenderPipeline/TextRenderData.d.ts +6 -0
  35. package/types/RenderPipeline/enums/PipelineStage.d.ts +9 -0
  36. package/types/RenderPipeline/index.d.ts +4 -0
  37. package/types/Renderer.d.ts +5 -13
  38. package/types/SafeLoopArray.d.ts +37 -0
  39. package/types/Scene.d.ts +6 -5
  40. package/types/SceneManager.d.ts +28 -5
  41. package/types/Script.d.ts +18 -15
  42. package/types/Transform.d.ts +9 -12
  43. package/types/Utils.d.ts +28 -0
  44. package/types/animation/AnimationClip.d.ts +2 -1
  45. package/types/animation/Animator.d.ts +2 -3
  46. package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +0 -1
  47. package/types/animation/internal/AnimationCurveLayerOwner.d.ts +1 -0
  48. package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +1 -0
  49. package/types/asset/AssetType.d.ts +16 -16
  50. package/types/asset/ContentRestorer.d.ts +17 -0
  51. package/types/asset/GraphicsResource.d.ts +5 -0
  52. package/types/asset/IReferable.d.ts +2 -0
  53. package/types/asset/ReferResource.d.ts +22 -0
  54. package/types/asset/ResourceManager.d.ts +17 -9
  55. package/types/base/Constant.d.ts +2 -1
  56. package/types/base/EngineObject.d.ts +1 -0
  57. package/types/base/EventDispatcher.d.ts +1 -14
  58. package/types/base/Time.d.ts +27 -24
  59. package/types/base/index.d.ts +0 -2
  60. package/types/enums/ActiveChangeFlag.d.ts +6 -0
  61. package/types/env-probe/CubeProbe.d.ts +0 -7
  62. package/types/env-probe/Probe.d.ts +0 -6
  63. package/types/graphic/Buffer.d.ts +5 -12
  64. package/types/graphic/Mesh.d.ts +5 -16
  65. package/types/index.d.ts +8 -7
  66. package/types/input/InputManager.d.ts +3 -3
  67. package/types/input/interface/IInput.d.ts +1 -1
  68. package/types/lighting/DirectLight.d.ts +0 -1
  69. package/types/lighting/Light.d.ts +0 -1
  70. package/types/lighting/SpotLight.d.ts +0 -1
  71. package/types/material/BaseMaterial.d.ts +8 -10
  72. package/types/material/BlinnPhongMaterial.d.ts +0 -3
  73. package/types/material/Material.d.ts +3 -10
  74. package/types/material/PBRMaterial.d.ts +12 -3
  75. package/types/material/PBRSpecularMaterial.d.ts +1 -1
  76. package/types/material/UnlitMaterial.d.ts +1 -1
  77. package/types/mesh/BlendShape.d.ts +1 -1
  78. package/types/mesh/BlendShapeFrame.d.ts +28 -6
  79. package/types/mesh/MeshRenderer.d.ts +7 -12
  80. package/types/mesh/ModelMesh.d.ts +5 -5
  81. package/types/mesh/PrimitiveMesh.d.ts +4 -2
  82. package/types/mesh/PrimitiveMeshRestorer.d.ts +1 -0
  83. package/types/mesh/SkinnedMeshRenderer.d.ts +0 -14
  84. package/types/particle/ParticleRenderer.d.ts +2 -2
  85. package/types/physics/CharacterController.d.ts +0 -2
  86. package/types/physics/Collider.d.ts +1 -1
  87. package/types/physics/Collision.d.ts +4 -0
  88. package/types/physics/PhysicsManager.d.ts +1 -20
  89. package/types/physics/PhysicsScene.d.ts +75 -0
  90. package/types/physics/index.d.ts +7 -7
  91. package/types/physics/joint/HingeJoint.d.ts +2 -2
  92. package/types/physics/joint/Joint.d.ts +2 -2
  93. package/types/physics/joint/SpringJoint.d.ts +1 -1
  94. package/types/renderingHardwareInterface/IPlatformBuffer.d.ts +8 -0
  95. package/types/renderingHardwareInterface/index.d.ts +1 -0
  96. package/types/shader/Shader.d.ts +32 -23
  97. package/types/shader/ShaderData.d.ts +24 -24
  98. package/types/shader/ShaderMacro.d.ts +16 -0
  99. package/types/shader/ShaderPart.d.ts +41 -0
  100. package/types/shader/ShaderPass.d.ts +9 -2
  101. package/types/shader/ShaderProperty.d.ts +7 -0
  102. package/types/shader/ShaderTagKey.d.ts +16 -0
  103. package/types/shader/SubShader.d.ts +19 -0
  104. package/types/shader/index.d.ts +5 -1
  105. package/types/shader/state/index.d.ts +6 -0
  106. package/types/shadow/CascadedShadowCasterPass.d.ts +1 -1
  107. package/types/sky/SkyBoxMaterial.d.ts +27 -9
  108. package/types/sky/SkyProceduralMaterial.d.ts +72 -0
  109. package/types/sky/index.d.ts +1 -0
  110. package/types/texture/RenderTarget.d.ts +2 -6
  111. package/types/texture/Texture.d.ts +2 -6
  112. package/types/trail/TrailRenderer.d.ts +0 -5
  113. package/types/utils/BoolUpdateFlag.d.ts +12 -0
  114. package/types/utils/DisorderedArray.d.ts +18 -0
  115. package/types/utils/SafeLoopArray.d.ts +41 -0
  116. package/types/utils/UpdateFlag.d.ts +20 -0
  117. package/types/utils/UpdateFlagManager.d.ts +1 -0
  118. package/types/utils/Utils.d.ts +31 -0
@@ -15,7 +15,7 @@ export declare class ModelMesh extends Mesh {
15
15
  private static _tempVec3;
16
16
  private static _tempVec4;
17
17
  private _vertexCount;
18
- private _accessible;
18
+ private _readable;
19
19
  private _verticesFloat32;
20
20
  private _verticesUint8;
21
21
  private _indices;
@@ -42,9 +42,9 @@ export declare class ModelMesh extends Mesh {
42
42
  private _customVertexElements;
43
43
  private _vertexCountChanged;
44
44
  /**
45
- * Whether to access data of the mesh.
45
+ * Whether to read data of the mesh.
46
46
  */
47
- get accessible(): boolean;
47
+ get readable(): boolean;
48
48
  /**
49
49
  * Vertex count of current mesh.
50
50
  */
@@ -207,9 +207,9 @@ export declare class ModelMesh extends Mesh {
207
207
  getBlendShapeName(index: number): string;
208
208
  /**
209
209
  * Upload Mesh Data to GPU.
210
- * @param noLongerAccessible - Whether to access data later. If true, you'll never access data anymore (free memory cache)
210
+ * @param noLongerReadable - Whether to read data later. If true, you'll never read data anymore (free memory cache)
211
211
  */
212
- uploadData(noLongerAccessible: boolean): void;
212
+ uploadData(noLongerReadable: boolean): void;
213
213
  /**
214
214
  * Calculate mesh tangent.
215
215
  * @remark need to set positions(with or not with indices), normals, uv before calculation.
@@ -63,8 +63,8 @@ export declare class PrimitiveMesh {
63
63
  * @param engine - Engine
64
64
  * @param radius - The radius of cap
65
65
  * @param height - The height of torso
66
- * @param radialSegments - Cylinder radial segments
67
- * @param heightSegments - Cylinder height segments
66
+ * @param radialSegments - Cone radial segments
67
+ * @param heightSegments - Cone height segments
68
68
  * @param noLongerAccessible - No longer access the vertices of the mesh after creation
69
69
  * @returns Cone model mesh
70
70
  */
@@ -80,6 +80,8 @@ export declare class PrimitiveMesh {
80
80
  * @returns Capsule model mesh
81
81
  */
82
82
  static createCapsule(engine: Engine, radius?: number, height?: number, radialSegments?: number, heightSegments?: number, noLongerAccessible?: boolean): ModelMesh;
83
+ static _setCylinderData(cylinderMesh: ModelMesh, radiusTop: number, radiusBottom: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean): void;
84
+ static _setCapsuleData(capsuleMesh: ModelMesh, radius: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean): void;
83
85
  private static _initialize;
84
86
  private static _generateIndices;
85
87
  private static _createCapsuleCap;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,11 @@
1
1
  import { BoundingBox } from "@galacean/engine-math";
2
2
  import { Entity } from "../Entity";
3
- import { RenderContext } from "../RenderPipeline/RenderContext";
4
3
  import { MeshRenderer } from "./MeshRenderer";
5
4
  import { Skin } from "./Skin";
6
5
  /**
7
6
  * SkinnedMeshRenderer.
8
7
  */
9
8
  export declare class SkinnedMeshRenderer extends MeshRenderer {
10
- private static _tempMatrix;
11
9
  private static _jointCountProperty;
12
10
  private static _jointSamplerProperty;
13
11
  private static _jointMatrixProperty;
@@ -42,18 +40,6 @@ export declare class SkinnedMeshRenderer extends MeshRenderer {
42
40
  */
43
41
  get rootBone(): Entity;
44
42
  set rootBone(value: Entity);
45
- /**
46
- * @override
47
- */
48
- protected _updateShaderData(context: RenderContext): void;
49
- /**
50
- * @override
51
- */
52
- protected _registerEntityTransformListener(): void;
53
- /**
54
- * @override
55
- */
56
- protected _updateBounds(worldBounds: BoundingBox): void;
57
43
  private _initSkin;
58
44
  private _computeApproximateBindMatrix;
59
45
  private _findByEntityName;
@@ -1,6 +1,6 @@
1
- import { Vector3, Color } from "@galacean/engine-math";
2
- import { Texture } from "../texture";
1
+ import { Color, Vector3 } from "@galacean/engine-math";
3
2
  import { MeshRenderer } from "../mesh/MeshRenderer";
3
+ import { Texture } from "../texture";
4
4
  /**
5
5
  * Blend mode enums of the particle renderer's material.
6
6
  */
@@ -41,12 +41,10 @@ export declare class CharacterController extends Collider {
41
41
  /**
42
42
  * Add collider shape on this controller.
43
43
  * @param shape - Collider shape
44
- * @override
45
44
  */
46
45
  addShape(shape: ColliderShape): void;
47
46
  /**
48
47
  * Remove all shape attached.
49
- * @override
50
48
  */
51
49
  clearShapes(): void;
52
50
  private _setUpDirection;
@@ -3,7 +3,7 @@ import { Component } from "../Component";
3
3
  import { ColliderShape } from "./shape/ColliderShape";
4
4
  /**
5
5
  * Base class for all colliders.
6
- * @decorator `@dependentComponents(Transform)`
6
+ * @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
7
7
  */
8
8
  export declare class Collider extends Component {
9
9
  protected _updateFlag: BoolUpdateFlag;
@@ -0,0 +1,4 @@
1
+ import { ColliderShape } from "./shape";
2
+ export declare class Collision {
3
+ shape: ColliderShape;
4
+ }
@@ -1,4 +1,3 @@
1
- import { IPhysics } from "@galacean/engine-design";
2
1
  import { Ray, Vector3 } from "@galacean/engine-math";
3
2
  import { Engine } from "../Engine";
4
3
  import { Layer } from "../Layer";
@@ -7,6 +6,7 @@ import { HitResult } from "./HitResult";
7
6
  * A physics manager is a collection of colliders and constraints which can interact.
8
7
  */
9
8
  export declare class PhysicsManager {
9
+ private static _collision;
10
10
  private _engine;
11
11
  private _restTime;
12
12
  private _colliders;
@@ -21,31 +21,12 @@ export declare class PhysicsManager {
21
21
  private _onTriggerStay;
22
22
  /** The fixed time step in seconds at which physics are performed. */
23
23
  fixedTimeStep: number;
24
- /**
25
- * The max allowed time step in seconds one frame.
26
- *
27
- * @remarks
28
- * When the frame rate is low or stutter occurs, the maximum execution time of physics will not exceed this value.
29
- * So physics will slow down a bit when performance hitch occurs.
30
- */
31
- maxAllowedTimeStep: number;
32
24
  /**
33
25
  * The gravity of physics scene.
34
26
  */
35
27
  get gravity(): Vector3;
36
28
  set gravity(value: Vector3);
37
- /**
38
- * @deprecated
39
- * Please use `maxAllowedTimeStep` instead.
40
- */
41
- get maxSumTimeStep(): number;
42
- set maxSumTimeStep(value: number);
43
29
  constructor(engine: Engine);
44
- /**
45
- * initialize PhysicsManager.
46
- * @param physics - Physics Engine
47
- */
48
- initialize(physics: IPhysics): void;
49
30
  /**
50
31
  * Casts a ray through the Scene and returns the first hit.
51
32
  * @param ray - The ray
@@ -0,0 +1,75 @@
1
+ import { Ray, Vector3 } from "@galacean/engine-math";
2
+ import { Layer } from "../Layer";
3
+ import { Scene } from "../Scene";
4
+ import { HitResult } from "./HitResult";
5
+ /**
6
+ * A physics scene is a collection of colliders and constraints which can interact.
7
+ */
8
+ export declare class PhysicsScene {
9
+ private static _collision;
10
+ private _scene;
11
+ private _restTime;
12
+ private _colliders;
13
+ private _gravity;
14
+ private _nativePhysicsScene;
15
+ private _onContactEnter;
16
+ private _onContactExit;
17
+ private _onContactStay;
18
+ private _onTriggerEnter;
19
+ private _onTriggerExit;
20
+ private _onTriggerStay;
21
+ /** The fixed time step in seconds at which physics are performed. */
22
+ fixedTimeStep: number;
23
+ /**
24
+ * The gravity of physics scene.
25
+ */
26
+ get gravity(): Vector3;
27
+ set gravity(value: Vector3);
28
+ constructor(scene: Scene);
29
+ /**
30
+ * Casts a ray through the Scene and returns the first hit.
31
+ * @param ray - The ray
32
+ * @returns Returns True if the ray intersects with a collider, otherwise false
33
+ */
34
+ raycast(ray: Ray): boolean;
35
+ /**
36
+ * Casts a ray through the Scene and returns the first hit.
37
+ * @param ray - The ray
38
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
39
+ * @returns Returns True if the ray intersects with a collider, otherwise false
40
+ */
41
+ raycast(ray: Ray, outHitResult: HitResult): boolean;
42
+ /**
43
+ * Casts a ray through the Scene and returns the first hit.
44
+ * @param ray - The ray
45
+ * @param distance - The max distance the ray should check
46
+ * @returns Returns True if the ray intersects with a collider, otherwise false
47
+ */
48
+ raycast(ray: Ray, distance: number): boolean;
49
+ /**
50
+ * Casts a ray through the Scene and returns the first hit.
51
+ * @param ray - The ray
52
+ * @param distance - The max distance the ray should check
53
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
54
+ * @returns Returns True if the ray intersects with a collider, otherwise false
55
+ */
56
+ raycast(ray: Ray, distance: number, outHitResult: HitResult): boolean;
57
+ /**
58
+ * Casts a ray through the Scene and returns the first hit.
59
+ * @param ray - The ray
60
+ * @param distance - The max distance the ray should check
61
+ * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
62
+ * @returns Returns True if the ray intersects with a collider, otherwise false
63
+ */
64
+ raycast(ray: Ray, distance: number, layerMask: Layer): boolean;
65
+ /**
66
+ * Casts a ray through the Scene and returns the first hit.
67
+ * @param ray - The ray
68
+ * @param distance - The max distance the ray should check
69
+ * @param layerMask - Layer mask that is used to selectively ignore Colliders when casting
70
+ * @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
71
+ * @returns Returns True if the ray intersects with a collider, otherwise false.
72
+ */
73
+ raycast(ray: Ray, distance: number, layerMask: Layer, outHitResult: HitResult): boolean;
74
+ private _setGravity;
75
+ }
@@ -1,10 +1,10 @@
1
- export { HitResult } from "./HitResult";
2
- export { PhysicsManager } from "./PhysicsManager";
3
- export { PhysicsMaterial } from "./PhysicsMaterial";
4
1
  export { CharacterController } from "./CharacterController";
5
- export * from "./shape";
6
- export * from "./joint";
7
- export * from "./enums";
8
2
  export { Collider } from "./Collider";
3
+ export { CollisionDetectionMode, DynamicCollider, DynamicColliderConstraints } from "./DynamicCollider";
4
+ export { HitResult } from "./HitResult";
5
+ export { PhysicsMaterial } from "./PhysicsMaterial";
6
+ export { PhysicsScene } from "./PhysicsScene";
9
7
  export { StaticCollider } from "./StaticCollider";
10
- export { DynamicCollider, CollisionDetectionMode, DynamicColliderConstraints } from "./DynamicCollider";
8
+ export * from "./enums";
9
+ export * from "./joint";
10
+ export * from "./shape";
@@ -1,7 +1,7 @@
1
- import { Joint } from "./Joint";
2
1
  import { Vector3 } from "@galacean/engine-math";
3
- import { JointMotor } from "./JointMotor";
2
+ import { Joint } from "./Joint";
4
3
  import { JointLimits } from "./JointLimits";
4
+ import { JointMotor } from "./JointMotor";
5
5
  /**
6
6
  * A joint which behaves in a similar way to a hinge or axle.
7
7
  */
@@ -1,11 +1,11 @@
1
1
  import { IJoint } from "@galacean/engine-design";
2
2
  import { Vector3 } from "@galacean/engine-math";
3
3
  import { Component } from "../../Component";
4
- import { Collider } from "../Collider";
5
4
  import { Entity } from "../../Entity";
5
+ import { Collider } from "../Collider";
6
6
  /**
7
7
  * A base class providing common functionality for joints.
8
- * @decorator `@dependentComponents(Collider)`
8
+ * @decorator `@dependentComponents(Collider, DependentMode.CheckOnly)`
9
9
  */
10
10
  export declare class Joint extends Component {
11
11
  protected _connectedCollider: JointCollider;
@@ -1,5 +1,5 @@
1
- import { Joint } from "./Joint";
2
1
  import { Vector3 } from "@galacean/engine-math";
2
+ import { Joint } from "./Joint";
3
3
  /**
4
4
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
5
5
  */
@@ -0,0 +1,8 @@
1
+ import { SetDataOptions } from "../graphic";
2
+ export interface IPlatformBuffer {
3
+ bind(): void;
4
+ setData(byteLength: number, data: ArrayBuffer | ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number, options?: SetDataOptions): void;
5
+ getData(data: ArrayBufferView, bufferByteOffset?: number, dataOffset?: number, dataLength?: number): void;
6
+ resize(byteLength: number): void;
7
+ destroy(): void;
8
+ }
@@ -1,4 +1,5 @@
1
1
  export type { IHardwareRenderer } from "./IHardwareRenderer";
2
+ export type { IPlatformBuffer } from "./IPlatformBuffer";
2
3
  export type { IPlatformRenderTarget } from "./IPlatformRenderTarget";
3
4
  export type { IPlatformTexture } from "./IPlatformTexture";
4
5
  export type { IPlatformTexture2D } from "./IPlatformTexture2D";
@@ -2,15 +2,13 @@ import { Engine } from "../Engine";
2
2
  import { ShaderMacro } from "./ShaderMacro";
3
3
  import { ShaderPass } from "./ShaderPass";
4
4
  import { ShaderProperty } from "./ShaderProperty";
5
+ import { SubShader } from "./SubShader";
5
6
  /**
6
7
  * Shader for rendering.
7
8
  */
8
9
  export declare class Shader {
10
+ readonly name: string;
9
11
  private static _shaderMap;
10
- private static _propertyNameMap;
11
- private static _macroMaskMap;
12
- private static _macroCounter;
13
- private static _macroMap;
14
12
  /**
15
13
  * Create a shader.
16
14
  * @param name - Name of the shader
@@ -26,18 +24,46 @@ export declare class Shader {
26
24
  * @returns Shader
27
25
  */
28
26
  static create(name: string, shaderPasses: ShaderPass[]): Shader;
27
+ /**
28
+ * Create a shader.
29
+ * @param name - Name of the shader
30
+ * @param subShaders - Sub shaders
31
+ * @returns Shader
32
+ */
33
+ static create(name: string, subShaders: SubShader[]): Shader;
29
34
  /**
30
35
  * Find a shader by name.
31
36
  * @param name - Name of the shader
32
37
  */
33
38
  static find(name: string): Shader;
39
+ private _subShaders;
40
+ /**
41
+ * Sub shaders of the shader.
42
+ */
43
+ get subShaders(): ReadonlyArray<SubShader>;
44
+ private constructor();
45
+ /**
46
+ * Compile shader variant by macro name list.
47
+ *
48
+ * @remarks
49
+ * Usually a shader contains some macros,any combination of macros is called shader variant.
50
+ *
51
+ * @param engine - Engine to which the shader variant belongs
52
+ * @param macros - Macro name list
53
+ * @returns Is the compiled shader variant valid
54
+ */
55
+ compileVariant(engine: Engine, macros: string[]): boolean;
34
56
  /**
57
+ * @deprecated Please use `ShaderMacro.getByName` instead
58
+ *
35
59
  * Get shader macro by name.
36
60
  * @param name - Name of the shader macro
37
61
  * @returns Shader macro
38
62
  */
39
63
  static getMacroByName(name: string): ShaderMacro;
40
64
  /**
65
+ * @deprecated Please use `ShaderMacro.getByName` instead
66
+ *
41
67
  * Get shader macro by name.
42
68
  * @param name - Name of the shader macro
43
69
  * @param value - Value of the shader macro
@@ -45,28 +71,11 @@ export declare class Shader {
45
71
  */
46
72
  static getMacroByName(name: string, value: string): ShaderMacro;
47
73
  /**
74
+ * @deprecated Please use `ShaderProperty.getByName` instead
75
+ *
48
76
  * Get shader property by name.
49
77
  * @param name - Name of the shader property
50
78
  * @returns Shader property
51
79
  */
52
80
  static getPropertyByName(name: string): ShaderProperty;
53
- /** The name of shader. */
54
- readonly name: string;
55
- /**
56
- * Shader passes.
57
- */
58
- get passes(): ReadonlyArray<ShaderPass>;
59
- private _passes;
60
- private constructor();
61
- /**
62
- * Compile shader variant by macro name list.
63
- *
64
- * @remarks
65
- * Usually a shader contains some macros,any combination of macros is called shader variant.
66
- *
67
- * @param engine - Engine to which the shader variant belongs
68
- * @param macros - Macro name list
69
- * @returns Is the compiled shader variant valid
70
- */
71
- compileVariant(engine: Engine, macros: string[]): boolean;
72
81
  }
@@ -1,13 +1,13 @@
1
1
  import { IClone } from "@galacean/engine-design";
2
2
  import { Color, Matrix, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
- import { IRefObject } from "../asset/IRefObject";
3
+ import { IReferable } from "../asset/IReferable";
4
4
  import { Texture } from "../texture/Texture";
5
5
  import { ShaderMacro } from "./ShaderMacro";
6
6
  import { ShaderProperty } from "./ShaderProperty";
7
7
  /**
8
8
  * Shader data collection,Correspondence includes shader properties data and macros data.
9
9
  */
10
- export declare class ShaderData implements IRefObject, IClone {
10
+ export declare class ShaderData implements IReferable, IClone {
11
11
  private _macroMap;
12
12
  private _refCount;
13
13
  /**
@@ -18,7 +18,7 @@ export declare class ShaderData implements IRefObject, IClone {
18
18
  getFloat(propertyName: string): number;
19
19
  /**
20
20
  * Get float by shader property.
21
- * @param property - Shader property, use `Shader.getPropertyByName` to get
21
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
22
22
  * @returns Float
23
23
  */
24
24
  getFloat(property: ShaderProperty): number;
@@ -32,7 +32,7 @@ export declare class ShaderData implements IRefObject, IClone {
32
32
  /**
33
33
  * Set float by shader property.
34
34
  * @remarks Corresponding float shader property type.
35
- * @param property - Shader property, use `Shader.getPropertyByName` to get
35
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
36
36
  * @param value - Float
37
37
  */
38
38
  setFloat(property: ShaderProperty, value: number): void;
@@ -44,7 +44,7 @@ export declare class ShaderData implements IRefObject, IClone {
44
44
  getInt(propertyName: string): number;
45
45
  /**
46
46
  * Get int by shader property.
47
- * @param property - Shader property, use `Shader.getPropertyByName` to get
47
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
48
48
  * @returns Int
49
49
  */
50
50
  getInt(property: ShaderProperty): number;
@@ -58,7 +58,7 @@ export declare class ShaderData implements IRefObject, IClone {
58
58
  /**
59
59
  * Set int by shader property.
60
60
  * @remarks Correspondence includes int and bool shader property type.
61
- * @param property - Shader property, use `Shader.getPropertyByName` to get
61
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
62
62
  * @param value - Int
63
63
  */
64
64
  setInt(property: ShaderProperty, value: number): void;
@@ -70,7 +70,7 @@ export declare class ShaderData implements IRefObject, IClone {
70
70
  getFloatArray(propertyName: string): Float32Array;
71
71
  /**
72
72
  * Get float array by shader property.
73
- * @param property - Shader property, use `Shader.getPropertyByName` to get
73
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
74
74
  * @returns Float array
75
75
  */
76
76
  getFloatArray(property: ShaderProperty): Float32Array;
@@ -84,7 +84,7 @@ export declare class ShaderData implements IRefObject, IClone {
84
84
  /**
85
85
  * Set float array by shader property.
86
86
  * @remarks Correspondence includes float array、vec2 array、vec3 array、vec4 array and matrix array shader property type.
87
- * @param property - Shader property, use `Shader.getPropertyByName` to get
87
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
88
88
  * @param value - Float array
89
89
  */
90
90
  setFloatArray(property: ShaderProperty, value: Float32Array): void;
@@ -96,7 +96,7 @@ export declare class ShaderData implements IRefObject, IClone {
96
96
  getIntArray(propertyName: string): Int32Array;
97
97
  /**
98
98
  * Get int array by shader property.
99
- * @param property - Shader property, use `Shader.getPropertyByName` to get
99
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
100
100
  * @returns Int Array
101
101
  */
102
102
  getIntArray(property: ShaderProperty): Int32Array;
@@ -110,7 +110,7 @@ export declare class ShaderData implements IRefObject, IClone {
110
110
  /**
111
111
  * Set int array by shader property.
112
112
  * @remarks Correspondence includes bool array、int array、bvec2 array、bvec3 array、bvec4 array、ivec2 array、ivec3 array and ivec4 array shader property type.
113
- * @param property - Shader property, use `Shader.getPropertyByName` to get
113
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
114
114
  * @param value - Int Array
115
115
  */
116
116
  setIntArray(property: ShaderProperty, value: Int32Array): void;
@@ -122,7 +122,7 @@ export declare class ShaderData implements IRefObject, IClone {
122
122
  getVector2(propertyName: string): Vector2;
123
123
  /**
124
124
  * Get two-dimensional from shader property.
125
- * @param property - Shader property, use `Shader.getPropertyByName` to get
125
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
126
126
  * @returns Two-dimensional vector
127
127
  */
128
128
  getVector2(property: ShaderProperty): Vector2;
@@ -136,7 +136,7 @@ export declare class ShaderData implements IRefObject, IClone {
136
136
  /**
137
137
  * Set two-dimensional vector from shader property.
138
138
  * @remarks Correspondence includes vec2、ivec2 and bvec2 shader property type.
139
- * @param property - Shader property, use `Shader.getPropertyByName` to get
139
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
140
140
  * @param value - Two-dimensional vector
141
141
  */
142
142
  setVector2(property: ShaderProperty, value: Vector2): void;
@@ -148,7 +148,7 @@ export declare class ShaderData implements IRefObject, IClone {
148
148
  getVector3(propertyName: string): Vector3;
149
149
  /**
150
150
  * Get vector3 by shader property.
151
- * @param property - Shader property, use `Shader.getPropertyByName` to get
151
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
152
152
  * @returns Three-dimensional vector
153
153
  */
154
154
  getVector3(property: ShaderProperty): Vector3;
@@ -162,7 +162,7 @@ export declare class ShaderData implements IRefObject, IClone {
162
162
  /**
163
163
  * Set three dimensional vector by shader property.
164
164
  * @remarks Correspondence includes vec3、ivec3 and bvec3 shader property type.
165
- * @param property - Shader property, use `Shader.getPropertyByName` to get
165
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
166
166
  * @param value - Three-dimensional vector
167
167
  */
168
168
  setVector3(property: ShaderProperty, value: Vector3): void;
@@ -174,7 +174,7 @@ export declare class ShaderData implements IRefObject, IClone {
174
174
  getVector4(propertyName: string): Vector4;
175
175
  /**
176
176
  * Get vector4 by shader property.
177
- * @param property - Shader property, use `Shader.getPropertyByName` to get
177
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
178
178
  * @returns Four-dimensional vector
179
179
  */
180
180
  getVector4(property: ShaderProperty): Vector4;
@@ -188,7 +188,7 @@ export declare class ShaderData implements IRefObject, IClone {
188
188
  /**
189
189
  * Set four-dimensional vector by shader property.
190
190
  * @remarks Correspondence includes vec4、ivec4 and bvec4 shader property type.
191
- * @param property - Shader property, use `Shader.getPropertyByName` to get
191
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
192
192
  * @param value - Four-dimensional vector
193
193
  */
194
194
  setVector4(property: ShaderProperty, value: Vector4): void;
@@ -200,7 +200,7 @@ export declare class ShaderData implements IRefObject, IClone {
200
200
  getMatrix(propertyName: string): Matrix;
201
201
  /**
202
202
  * Get matrix by shader property.
203
- * @param property - Shader property, use `Shader.getPropertyByName` to get
203
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
204
204
  * @returns Matrix
205
205
  */
206
206
  getMatrix(property: ShaderProperty): Matrix;
@@ -214,7 +214,7 @@ export declare class ShaderData implements IRefObject, IClone {
214
214
  /**
215
215
  * Set matrix by shader property.
216
216
  * @remarks Correspondence includes matrix shader property type.
217
- * @param property - Shader property, use `Shader.getPropertyByName` to get
217
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
218
218
  * @param value - Matrix
219
219
  */
220
220
  setMatrix(property: ShaderProperty, value: Matrix): any;
@@ -226,7 +226,7 @@ export declare class ShaderData implements IRefObject, IClone {
226
226
  getColor(propertyName: string): Color;
227
227
  /**
228
228
  * Get color by shader property.
229
- * @param property - Shader property, use `Shader.getPropertyByName` to get
229
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
230
230
  * @returns Color
231
231
  */
232
232
  getColor(property: ShaderProperty): Color;
@@ -240,7 +240,7 @@ export declare class ShaderData implements IRefObject, IClone {
240
240
  /**
241
241
  * Set color by shader property.
242
242
  * @remarks Correspondence includes vec4 shader property type.
243
- * @param property - Shader property, use `Shader.getPropertyByName` to get
243
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
244
244
  * @param value - Color
245
245
  */
246
246
  setColor(property: ShaderProperty, value: Color): void;
@@ -252,7 +252,7 @@ export declare class ShaderData implements IRefObject, IClone {
252
252
  getTexture(propertyName: string): Texture;
253
253
  /**
254
254
  * Get texture by shader property.
255
- * @param property - Shader property, use `Shader.getPropertyByName` to get
255
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
256
256
  * @returns Texture
257
257
  */
258
258
  getTexture(property: ShaderProperty): Texture;
@@ -264,7 +264,7 @@ export declare class ShaderData implements IRefObject, IClone {
264
264
  setTexture(propertyName: string, value: Texture): void;
265
265
  /**
266
266
  * Set texture by shader property.
267
- * @param property - Shader property, use `Shader.getPropertyByName` to get
267
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
268
268
  * @param value - Texture
269
269
  */
270
270
  setTexture(property: ShaderProperty, value: Texture): void;
@@ -276,7 +276,7 @@ export declare class ShaderData implements IRefObject, IClone {
276
276
  getTextureArray(propertyName: string): Texture[];
277
277
  /**
278
278
  * Get texture array by shader property.
279
- * @param property - Shader property, use `Shader.getPropertyByName` to get
279
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
280
280
  * @returns Texture array
281
281
  */
282
282
  getTextureArray(property: ShaderProperty): Texture[];
@@ -288,7 +288,7 @@ export declare class ShaderData implements IRefObject, IClone {
288
288
  setTextureArray(propertyName: string, value: Texture[]): void;
289
289
  /**
290
290
  * Set texture array by shader property.
291
- * @param property - Shader property, use `Shader.getPropertyByName` to get
291
+ * @param property - Shader property, use `ShaderProperty.getByName` to get
292
292
  * @param value - Texture array
293
293
  */
294
294
  setTextureArray(property: ShaderProperty, value: Texture[]): void;
@@ -3,8 +3,24 @@
3
3
  */
4
4
  export declare class ShaderMacro {
5
5
  private static _macroNameCounter;
6
+ private static _macroCounter;
7
+ private static _macroMap;
8
+ /**
9
+ * Get shader macro by name.
10
+ * @param name - Name of the shader macro
11
+ * @returns Shader macro
12
+ */
13
+ static getByName(name: string): ShaderMacro;
14
+ /**
15
+ * Get shader macro by name.
16
+ * @param name - Name of the shader macro
17
+ * @param value - Value of the shader macro
18
+ * @returns Shader macro
19
+ */
20
+ static getByName(name: string, value: string): ShaderMacro;
6
21
  /** Name. */
7
22
  readonly name: string;
8
23
  /** Value. */
9
24
  readonly value: string;
25
+ private constructor();
10
26
  }