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

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 (194) hide show
  1. package/dist/main.js +4539 -3189
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +4539 -3189
  4. package/dist/module.js +4917 -3567
  5. package/dist/module.js.map +1 -1
  6. package/package.json +3 -3
  7. package/types/2d/sprite/Sprite.d.ts +3 -0
  8. package/types/Camera.d.ts +25 -4
  9. package/types/DisorderedArray.d.ts +4 -3
  10. package/types/Engine.d.ts +5 -1
  11. package/types/Entity.d.ts +3 -1
  12. package/types/RenderPipeline/BasicRenderPipeline.d.ts +1 -2
  13. package/types/RenderPipeline/ClassPool.d.ts +3 -1
  14. package/types/RenderPipeline/CullingResults.d.ts +1 -0
  15. package/types/RenderPipeline/DepthOnlyPass.d.ts +1 -0
  16. package/types/RenderPipeline/IPoolElement.d.ts +3 -0
  17. package/types/RenderPipeline/MeshRenderData.d.ts +3 -1
  18. package/types/RenderPipeline/PipelinePass.d.ts +16 -0
  19. package/types/RenderPipeline/PipelineUtils.d.ts +1 -0
  20. package/types/RenderPipeline/RenderElement.d.ts +5 -5
  21. package/types/RenderPipeline/RenderElementX.d.ts +12 -0
  22. package/types/RenderPipeline/RenderQueue.d.ts +1 -1
  23. package/types/RenderPipeline/SpriteMaskRenderData.d.ts +3 -1
  24. package/types/RenderPipeline/SpriteRenderData.d.ts +3 -1
  25. package/types/RenderPipeline/TextRenderData.d.ts +3 -1
  26. package/types/RenderPipeline/enums/PipelineStage.d.ts +2 -0
  27. package/types/Renderer.d.ts +5 -2
  28. package/types/Scene.d.ts +10 -4
  29. package/types/Ticker.d.ts +30 -0
  30. package/types/Transform.d.ts +1 -0
  31. package/types/animation/Animator.d.ts +3 -1
  32. package/types/animation/enums/LayerState.d.ts +3 -1
  33. package/types/asset/AssetType.d.ts +2 -0
  34. package/types/asset/LoadItem.d.ts +16 -9
  35. package/types/asset/Loader.d.ts +3 -1
  36. package/types/asset/ResourceManager.d.ts +8 -2
  37. package/types/asset/request.d.ts +7 -3
  38. package/types/base/Constant.d.ts +1 -0
  39. package/types/base/EventDispatcher.d.ts +1 -1
  40. package/types/clone/ComponentCloner.d.ts +2 -1
  41. package/types/enums/DepthTextureMode.d.ts +7 -0
  42. package/types/graphic/Buffer.d.ts +22 -6
  43. package/types/graphic/BufferUtil.d.ts +1 -0
  44. package/types/graphic/Primitive.d.ts +1 -0
  45. package/types/graphic/PrimitiveVertexBinding.d.ts +1 -0
  46. package/types/graphic/SubMesh.d.ts +3 -1
  47. package/types/graphic/SubPrimitive.d.ts +9 -0
  48. package/types/graphic/VertexElement.d.ts +10 -6
  49. package/types/index.d.ts +2 -1
  50. package/types/lighting/AmbientLight.d.ts +4 -1
  51. package/types/lighting/LightManager.d.ts +1 -0
  52. package/types/material/Material.d.ts +9 -2
  53. package/types/mesh/BufferMesh.d.ts +2 -2
  54. package/types/mesh/ModelMesh.d.ts +62 -41
  55. package/types/mesh/PrimitiveMesh.d.ts +4 -2
  56. package/types/mesh/Skin.d.ts +3 -0
  57. package/types/mesh/SkinnedMeshRenderer.d.ts +20 -11
  58. package/types/mesh/index.d.ts +6 -5
  59. package/types/particle/ParticleBufferUtils.d.ts +1 -0
  60. package/types/particle/ParticleData.d.ts +1 -0
  61. package/types/particle/ParticleGenerator.d.ts +72 -0
  62. package/types/particle/ParticleMaterial.d.ts +28 -0
  63. package/types/particle/ParticleMesh.d.ts +289 -0
  64. package/types/particle/ParticleShaderDeclaration.d.ts +1 -0
  65. package/types/particle/ParticleShaderMacro.d.ts +1 -0
  66. package/types/particle/ParticleShaderProperty.d.ts +1 -0
  67. package/types/particle/ParticleSystem.d.ts +41 -0
  68. package/types/particle/ParticleVertexElements.d.ts +1 -0
  69. package/types/particle/ParticleVertexUtils.d.ts +1 -0
  70. package/types/particle/enum/ParticleAnimationRowMode.d.ts +9 -0
  71. package/types/particle/enum/ParticleAnimationType.d.ts +9 -0
  72. package/types/particle/enum/ParticleCurveMode.d.ts +13 -0
  73. package/types/particle/enum/ParticleGradientMode.d.ts +13 -0
  74. package/types/particle/enum/ParticleRenderMode.d.ts +17 -0
  75. package/types/particle/enum/ParticleScaleMode.d.ts +11 -0
  76. package/types/particle/enum/ParticleShapeMultiModeValue.d.ts +9 -0
  77. package/types/particle/enum/ParticleShapeType.d.ts +15 -0
  78. package/types/particle/enum/ParticleSimulationSpace.d.ts +9 -0
  79. package/types/particle/enum/index.d.ts +9 -0
  80. package/types/particle/enums/ParticleCurveMode.d.ts +9 -0
  81. package/types/particle/enums/ParticleGradientMode.d.ts +9 -0
  82. package/types/particle/enums/ParticleRandomSubSeeds.d.ts +1 -0
  83. package/types/particle/enums/ParticleRenderMode.d.ts +17 -0
  84. package/types/particle/enums/ParticleScaleMode.d.ts +11 -0
  85. package/types/particle/enums/ParticleSimulationSpace.d.ts +9 -0
  86. package/types/particle/enums/ParticleStopMode.d.ts +6 -0
  87. package/types/particle/enums/attributes/BillboardParticleVertexAttribute.d.ts +1 -0
  88. package/types/particle/enums/attributes/MeshParticleVertexAttribute.d.ts +5 -0
  89. package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +1 -0
  90. package/types/particle/module/Burst.d.ts +38 -0
  91. package/types/particle/module/ColorGradient.d.ts +75 -0
  92. package/types/particle/module/ColorOverLifetimeModule.d.ts +20 -0
  93. package/types/particle/module/EmissionModule.d.ts +63 -0
  94. package/types/particle/module/FrameOverTime.d.ts +73 -0
  95. package/types/particle/module/ParticleCurve.d.ts +37 -0
  96. package/types/particle/module/RotationOverLifetimeModule.d.ts +21 -0
  97. package/types/particle/module/RotationVelocityGradient.d.ts +184 -0
  98. package/types/particle/module/SizeGradient.d.ts +151 -0
  99. package/types/particle/module/SizeOverLifetimeModule.d.ts +21 -0
  100. package/types/particle/module/StartFrame.d.ts +46 -0
  101. package/types/particle/module/TextureSheetAnimationModule.d.ts +37 -0
  102. package/types/particle/module/VelocityGradient.d.ts +110 -0
  103. package/types/particle/module/VelocityOverLifetimeModule.d.ts +22 -0
  104. package/types/particle/module/index.d.ts +15 -0
  105. package/types/particle/module/shape/BaseShape.d.ts +26 -0
  106. package/types/particle/module/shape/BoxShape.d.ts +20 -0
  107. package/types/particle/module/shape/CircleShape.d.ts +27 -0
  108. package/types/particle/module/shape/ConeShape.d.ts +35 -0
  109. package/types/particle/module/shape/HemisphereShape.d.ts +23 -0
  110. package/types/particle/module/shape/ShapeUtils.d.ts +1 -0
  111. package/types/particle/module/shape/SphereShape.d.ts +23 -0
  112. package/types/particle/module/shape/index.d.ts +5 -0
  113. package/types/particle/modules/Burst.d.ts +14 -0
  114. package/types/particle/modules/ColorOverLifetimeModule.d.ts +20 -0
  115. package/types/particle/modules/EmissionModule.d.ts +45 -0
  116. package/types/particle/modules/MainModule.d.ts +68 -0
  117. package/types/particle/modules/ParticleCompositeCurve.d.ts +56 -0
  118. package/types/particle/modules/ParticleCompositeGradient.d.ts +55 -0
  119. package/types/particle/modules/ParticleCurve.d.ts +56 -0
  120. package/types/particle/modules/ParticleGeneratorModule.d.ts +12 -0
  121. package/types/particle/modules/ParticleGradient.d.ts +94 -0
  122. package/types/particle/modules/RotationOverLifetimeModule.d.ts +34 -0
  123. package/types/particle/modules/ShapeModule.d.ts +9 -0
  124. package/types/particle/modules/SizeOverLifetimeModule.d.ts +34 -0
  125. package/types/particle/modules/TextureSheetAnimationModule.d.ts +42 -0
  126. package/types/particle/modules/VelocityOverLifetimeModule.d.ts +34 -0
  127. package/types/particle/modules/shape/BaseShape.d.ts +12 -0
  128. package/types/particle/modules/shape/BoxShape.d.ts +11 -0
  129. package/types/particle/modules/shape/CircleShape.d.ts +17 -0
  130. package/types/particle/modules/shape/ConeShape.d.ts +28 -0
  131. package/types/particle/modules/shape/HemisphereShape.d.ts +9 -0
  132. package/types/particle/modules/shape/ShapeUtils.d.ts +1 -0
  133. package/types/particle/modules/shape/SphereShape.d.ts +9 -0
  134. package/types/particle/modules/shape/enums/ParticleShapeArcMode.d.ts +9 -0
  135. package/types/particle/modules/shape/enums/ParticleShapeMultiModeValue.d.ts +9 -0
  136. package/types/particle/modules/shape/enums/ParticleShapeType.d.ts +15 -0
  137. package/types/particle/modules/shape/index.d.ts +6 -0
  138. package/types/particle/moudules/Burst.d.ts +25 -0
  139. package/types/particle/moudules/Emission.d.ts +47 -0
  140. package/types/particle/moudules/EmissionModule.d.ts +49 -0
  141. package/types/particle/moudules/MainModule.d.ts +59 -0
  142. package/types/particle/moudules/ParticleCurve.d.ts +27 -0
  143. package/types/particle/moudules/ParticleGradient.d.ts +28 -0
  144. package/types/particle/moudules/ShapeModule.d.ts +7 -0
  145. package/types/particle/moudules/shape/BaseShape.d.ts +28 -0
  146. package/types/particle/moudules/shape/BoxShape.d.ts +20 -0
  147. package/types/particle/moudules/shape/CircleShape.d.ts +27 -0
  148. package/types/particle/moudules/shape/ConeShape.d.ts +35 -0
  149. package/types/particle/moudules/shape/HemisphereShape.d.ts +23 -0
  150. package/types/particle/moudules/shape/ShapeUtils.d.ts +1 -0
  151. package/types/particle/moudules/shape/SphereShape.d.ts +23 -0
  152. package/types/particle/moudules/shape/enums/ParticleShapeMultiModeValue.d.ts +9 -0
  153. package/types/particle/moudules/shape/enums/ParticleShapeType.d.ts +15 -0
  154. package/types/particle/moudules/shape/index.d.ts +5 -0
  155. package/types/physics/PhysicsScene.d.ts +6 -2
  156. package/types/renderingHardwareInterface/IPlatformBuffer.d.ts +0 -1
  157. package/types/renderingHardwareInterface/IPlatformTexture2D.d.ts +1 -1
  158. package/types/renderingHardwareInterface/IPlatformTexture2DArray.d.ts +1 -1
  159. package/types/renderingHardwareInterface/IPlatformTextureCube.d.ts +1 -1
  160. package/types/shader/Shader.d.ts +22 -0
  161. package/types/shader/enums/RenderStateElementKey.d.ts +58 -0
  162. package/types/shader/index.d.ts +1 -0
  163. package/types/shaderlib/particle/index.d.ts +14 -0
  164. package/types/shadow/CascadedShadowCasterPass.d.ts +5 -6
  165. package/types/shadow/PipelinePass.d.ts +16 -0
  166. package/types/sky/Sky.d.ts +12 -4
  167. package/types/texture/RenderTarget.d.ts +1 -2
  168. package/types/texture/Texture.d.ts +6 -0
  169. package/types/texture/Texture2D.d.ts +4 -2
  170. package/types/texture/Texture2DArray.d.ts +1 -1
  171. package/types/texture/TextureCube.d.ts +1 -1
  172. package/types/texture/enums/TextureFormat.d.ts +55 -49
  173. package/types/texture/enums/TextureUsage.d.ts +9 -0
  174. package/types/texture/index.d.ts +1 -0
  175. package/types/xr/XRManager.d.ts +31 -0
  176. package/types/xr/component/XRPoseDriver.d.ts +10 -0
  177. package/types/xr/data/XRCamera.d.ts +6 -0
  178. package/types/xr/data/XRDevice.d.ts +9 -0
  179. package/types/xr/data/XRHandle.d.ts +10 -0
  180. package/types/xr/enum/EnumXRButton.d.ts +5 -0
  181. package/types/xr/enum/EnumXRDevicePhase.d.ts +4 -0
  182. package/types/xr/enum/EnumXRFeature.d.ts +9 -0
  183. package/types/xr/enum/EnumXRInputSource.d.ts +8 -0
  184. package/types/xr/enum/EnumXRMode.d.ts +7 -0
  185. package/types/xr/enum/EnumXRSubsystem.d.ts +4 -0
  186. package/types/xr/enum/EnumXRTrackingMode.d.ts +7 -0
  187. package/types/xr/feature/XRCameraManager.d.ts +21 -0
  188. package/types/xr/feature/XRFeature.d.ts +29 -0
  189. package/types/xr/feature/XRImageTrackManager.d.ts +10 -0
  190. package/types/xr/feature/XRInputManager.d.ts +16 -0
  191. package/types/xr/index.d.ts +18 -0
  192. package/types/xr/provider/XRProvider.d.ts +19 -0
  193. package/types/xr/subsystem/XRInputSubsystem.d.ts +5 -0
  194. package/types/xr/subsystem/XRSubsystem.d.ts +30 -0
@@ -11,6 +11,8 @@ export declare class Buffer extends GraphicsResource {
11
11
  private _byteLength;
12
12
  private _bufferUsage;
13
13
  private _platformBuffer;
14
+ private _readable;
15
+ private _data;
14
16
  /**
15
17
  * Buffer binding flag.
16
18
  */
@@ -23,22 +25,36 @@ export declare class Buffer extends GraphicsResource {
23
25
  * Buffer usage.
24
26
  */
25
27
  get bufferUsage(): BufferUsage;
28
+ /**
29
+ * If buffer is readable.
30
+ */
31
+ get readable(): boolean;
32
+ /**
33
+ * Buffer data cache.
34
+ *
35
+ * @remarks
36
+ * Buffer must be readable.
37
+ * If the data you get is modified, must call `setData()` to update buffer to GPU.
38
+ */
39
+ get data(): Uint8Array;
26
40
  /**
27
41
  * Create Buffer.
28
42
  * @param engine - Engine
29
43
  * @param type - Buffer binding flag
30
44
  * @param byteLength - Byte length
31
45
  * @param bufferUsage - Buffer usage
46
+ * @param readable - If buffer is readable
32
47
  */
33
- constructor(engine: Engine, type: BufferBindFlag, byteLength: number, bufferUsage?: BufferUsage);
48
+ constructor(engine: Engine, type: BufferBindFlag, byteLength: number, bufferUsage?: BufferUsage, readable?: boolean);
34
49
  /**
35
50
  * Create Buffer.
36
51
  * @param engine - Engine
37
52
  * @param type - Buffer binding flag
38
- * @param data - Byte
53
+ * @param data - Buffer data, if `readable` is true, the`data` property will store a copy of this
39
54
  * @param bufferUsage - Buffer usage
55
+ * @param readable - If buffer is readable
40
56
  */
41
- constructor(engine: Engine, type: BufferBindFlag, data: ArrayBuffer | ArrayBufferView, bufferUsage?: BufferUsage);
57
+ constructor(engine: Engine, type: BufferBindFlag, data: ArrayBuffer | ArrayBufferView, bufferUsage?: BufferUsage, readable?: boolean);
42
58
  /**
43
59
  * Bind buffer.
44
60
  */
@@ -90,9 +106,9 @@ export declare class Buffer extends GraphicsResource {
90
106
  * @param dataLength - Output data length
91
107
  */
92
108
  getData(data: ArrayBufferView, bufferByteOffset: number, dataOffset: number, dataLength: number): void;
93
- _rebuild(): void;
94
109
  /**
95
- * @deprecated
110
+ * Mark buffer as readable, the `data` property will be not accessible anymore.
96
111
  */
97
- resize(byteLength: number): void;
112
+ markAsUnreadable(): void;
113
+ _rebuild(): void;
98
114
  }
@@ -4,6 +4,7 @@ export interface ElementInfo {
4
4
  size: number;
5
5
  type: DataType;
6
6
  normalized: boolean;
7
+ normalizedScaleFactor: number;
7
8
  }
8
9
  export declare class BufferUtil {
9
10
  static _getGLIndexType(indexFormat: IndexFormat): DataType;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,9 @@
1
+ import { IPoolElement } from "../RenderPipeline/IPoolElement";
1
2
  import { MeshTopology } from "./enums/MeshTopology";
2
3
  /**
3
4
  * Sub-mesh, mainly contains drawing information.
4
5
  */
5
- export declare class SubMesh {
6
+ export declare class SubMesh implements IPoolElement {
6
7
  /** Start drawing offset. */
7
8
  start: number;
8
9
  /** Drawing count. */
@@ -16,4 +17,5 @@ export declare class SubMesh {
16
17
  * @param topology - Drawing topology
17
18
  */
18
19
  constructor(start?: number, count?: number, topology?: MeshTopology);
20
+ dispose?(): void;
19
21
  }
@@ -0,0 +1,9 @@
1
+ import { MeshTopology } from "./enums/MeshTopology";
2
+ export declare class SubPrimitive {
3
+ /** Start drawing offset. */
4
+ start: number;
5
+ /** Drawing count. */
6
+ count: number;
7
+ /** Drawing topology. */
8
+ topology: MeshTopology;
9
+ }
@@ -4,16 +4,16 @@ import { VertexElementFormat } from "./enums/VertexElementFormat";
4
4
  * Vertex element.
5
5
  */
6
6
  export declare class VertexElement {
7
- _glElementInfo: ElementInfo;
8
- private _semantic;
7
+ _formatMetaInfo: ElementInfo;
8
+ private _attributeName;
9
9
  private _offset;
10
10
  private _format;
11
11
  private _bindingIndex;
12
12
  private _instanceStepRate;
13
13
  /**
14
- * Vertex semantic.
14
+ * Vertex attribute.
15
15
  */
16
- get semantic(): string;
16
+ get attribute(): string;
17
17
  /**
18
18
  * Vertex data byte offset.
19
19
  */
@@ -34,11 +34,15 @@ export declare class VertexElement {
34
34
  get instanceStepRate(): number;
35
35
  /**
36
36
  * Create vertex element.
37
- * @param semantic - Input vertex semantic
37
+ * @param attribute - Input attribute
38
38
  * @param offset - Vertex data byte offset
39
39
  * @param format - Vertex data format
40
40
  * @param bindingIndex - Vertex buffer binding index
41
41
  * @param instanceStepRate - Instance cadence, the number of instances drawn for each vertex in the buffer, non-instance elements must be 0.
42
42
  */
43
- constructor(semantic: string, offset: number, format: VertexElementFormat, bindingIndex: number, instanceStepRate?: number);
43
+ constructor(attribute: string, offset: number, format: VertexElementFormat, bindingIndex: number, instanceStepRate?: number);
44
+ /**
45
+ * @deprecated use `attributeName` instead
46
+ */
47
+ get semantic(): string;
44
48
  }
package/types/index.d.ts CHANGED
@@ -22,10 +22,11 @@ export { AssetPromise } from "./asset/AssetPromise";
22
22
  export type { LoadItem } from "./asset/LoadItem";
23
23
  export { AssetType } from "./asset/AssetType";
24
24
  export { ReferResource } from "./asset/ReferResource";
25
- export * from "./RenderPipeline/Index";
25
+ export * from "./RenderPipeline/index";
26
26
  export * from "./base";
27
27
  export { Background } from "./Background";
28
28
  export { BackgroundMode } from "./enums/BackgroundMode";
29
+ export { DepthTextureMode } from "./enums/DepthTextureMode";
29
30
  export { FogMode } from "./enums/FogMode";
30
31
  export { CameraClearFlags } from "./enums/CameraClearFlags";
31
32
  export { ColorSpace } from "./enums/ColorSpace";
@@ -1,10 +1,12 @@
1
1
  import { Color, SphericalHarmonics3 } from "@galacean/engine-math";
2
2
  import { TextureCube } from "../texture";
3
3
  import { DiffuseMode } from "./enums/DiffuseMode";
4
+ import { ReferResource } from "../asset/ReferResource";
5
+ import { Engine } from "../Engine";
4
6
  /**
5
7
  * Ambient light.
6
8
  */
7
- export declare class AmbientLight {
9
+ export declare class AmbientLight extends ReferResource {
8
10
  private static _shMacro;
9
11
  private static _specularMacro;
10
12
  private static _decodeRGBMMacro;
@@ -60,6 +62,7 @@ export declare class AmbientLight {
60
62
  */
61
63
  get specularIntensity(): number;
62
64
  set specularIntensity(value: number);
65
+ constructor(engine: Engine);
63
66
  private _setDiffuseMode;
64
67
  private _setSpecularTexture;
65
68
  private _setSpecularTextureDecodeRGBM;
@@ -2,4 +2,5 @@
2
2
  * Light manager.
3
3
  */
4
4
  export declare class LightManager {
5
+ private _getSunLightIndex;
5
6
  }
@@ -10,8 +10,11 @@ import { RenderState } from "../shader/state/RenderState";
10
10
  export declare class Material extends ReferResource implements IClone {
11
11
  /** Name. */
12
12
  name: string;
13
- /** Shader data. */
14
- readonly shaderData: ShaderData;
13
+ private _shaderData;
14
+ /**
15
+ * Shader data.
16
+ */
17
+ get shaderData(): ShaderData;
15
18
  /**
16
19
  * Shader used by the material.
17
20
  */
@@ -41,4 +44,8 @@ export declare class Material extends ReferResource implements IClone {
41
44
  */
42
45
  cloneTo(target: Material): void;
43
46
  _addReferCount(value: number): void;
47
+ /**
48
+ * @override
49
+ */
50
+ protected _onDestroy(): void;
44
51
  }
@@ -27,10 +27,10 @@ export declare class BufferMesh extends Mesh {
27
27
  setVertexElements(elements: VertexElement[]): void;
28
28
  /**
29
29
  * Set vertex buffer binding.
30
- * @param vertexBufferBindings - Vertex buffer binding
30
+ * @param vertexBufferBinding - Vertex buffer binding
31
31
  * @param index - Vertex buffer index, the default value is 0
32
32
  */
33
- setVertexBufferBinding(vertexBufferBindings: VertexBufferBinding, index?: number): void;
33
+ setVertexBufferBinding(vertexBufferBinding: VertexBufferBinding, index?: number): void;
34
34
  /**
35
35
  * Set vertex buffer binding.
36
36
  * @param vertexBuffer - Vertex buffer
@@ -15,12 +15,8 @@ export declare class ModelMesh extends Mesh {
15
15
  private static _tempVec3;
16
16
  private static _tempVec4;
17
17
  private _vertexCount;
18
- private _readable;
19
- private _verticesFloat32;
20
- private _verticesUint8;
21
- private _indices;
22
- private _indicesFormat;
23
- private _indicesChangeFlag;
18
+ private _vertexCountDirty;
19
+ private _dataVersionCounter;
24
20
  private _positions;
25
21
  private _normals;
26
22
  private _colors;
@@ -35,18 +31,20 @@ export declare class ModelMesh extends Mesh {
35
31
  private _uv7;
36
32
  private _boneWeights;
37
33
  private _boneIndices;
38
- private _bufferStrides;
39
- private _vertexBufferUpdateFlag;
40
- private _vertexDataUpdateFlag;
41
- private _vertexElementsUpdate;
42
- private _customVertexElements;
43
- private _vertexCountChanged;
44
- /**
45
- * Whether to read data of the mesh.
46
- */
47
- get readable(): boolean;
34
+ private _advancedElementUpdateFlag;
35
+ private _advancedDataUpdateFlag;
36
+ private _advancedVertexDataVersions;
37
+ private _advancedDataSyncToBuffer;
38
+ private _internalVertexBufferStride;
39
+ private _internalVertexBufferCreatedInfo;
40
+ private _internalVertexElementsOffset;
41
+ private _internalVertexElementsFlags;
42
+ private _vertexBufferInfos;
43
+ private _indices;
44
+ private _indicesFormat;
45
+ private _indicesChangeFlag;
48
46
  /**
49
- * Vertex count of current mesh.
47
+ * Vertex count of mesh.
50
48
  */
51
49
  get vertexCount(): number;
52
50
  /**
@@ -73,7 +71,7 @@ export declare class ModelMesh extends Mesh {
73
71
  constructor(engine: Engine, name?: string);
74
72
  /**
75
73
  * Set positions for the mesh.
76
- * @param positions - The positions for the mesh.
74
+ * @param positions - The positions for the mesh
77
75
  */
78
76
  setPositions(positions: Vector3[] | null): void;
79
77
  /**
@@ -83,7 +81,7 @@ export declare class ModelMesh extends Mesh {
83
81
  getPositions(): Vector3[] | null;
84
82
  /**
85
83
  * Set per-vertex normals for the mesh.
86
- * @param normals - The normals for the mesh.
84
+ * @param normals - The normals for the mesh
87
85
  */
88
86
  setNormals(normals: Vector3[] | null): void;
89
87
  /**
@@ -93,7 +91,7 @@ export declare class ModelMesh extends Mesh {
93
91
  getNormals(): Vector3[] | null;
94
92
  /**
95
93
  * Set per-vertex colors for the mesh.
96
- * @param colors - The colors for the mesh.
94
+ * @param colors - The colors for the mesh
97
95
  */
98
96
  setColors(colors: Color[] | null): void;
99
97
  /**
@@ -103,27 +101,27 @@ export declare class ModelMesh extends Mesh {
103
101
  getColors(): Color[] | null;
104
102
  /**
105
103
  * Set per-vertex bone weights for the mesh.
106
- * @param boneWeights - The bone weights for the mesh.
104
+ * @param boneWeights - The bone weights for the mesh
107
105
  */
108
106
  setBoneWeights(boneWeights: Vector4[] | null): void;
109
107
  /**
110
- * Get weights for the mesh.
108
+ * Get bone weights for the mesh.
111
109
  * @remarks Please call the setWeights() method after modification to ensure that the modification takes effect.
112
110
  */
113
111
  getBoneWeights(): Vector4[] | null;
114
112
  /**
115
113
  * Set per-vertex bone indices for the mesh.
116
- * @param boneIndices - The bone indices for the mesh.
114
+ * @param boneIndices - The bone indices for the mesh
117
115
  */
118
116
  setBoneIndices(boneIndices: Vector4[] | null): void;
119
117
  /**
120
- * Get joints for the mesh.
118
+ * Get bone indices for the mesh.
121
119
  * @remarks Please call the setBoneIndices() method after modification to ensure that the modification takes effect.
122
120
  */
123
121
  getBoneIndices(): Vector4[] | null;
124
122
  /**
125
123
  * Set per-vertex tangents for the mesh.
126
- * @param tangents - The tangents for the mesh.
124
+ * @param tangents - The tangents for the mesh
127
125
  */
128
126
  setTangents(tangents: Vector4[] | null): void;
129
127
  /**
@@ -133,13 +131,13 @@ export declare class ModelMesh extends Mesh {
133
131
  getTangents(): Vector4[] | null;
134
132
  /**
135
133
  * Set per-vertex uv for the mesh.
136
- * @param uv - The uv for the mesh.
134
+ * @param uv - The uv for the mesh
137
135
  */
138
136
  setUVs(uv: Vector2[] | null): void;
139
137
  /**
140
138
  * Set per-vertex uv for the mesh by channelIndex.
141
- * @param uv - The uv for the mesh.
142
- * @param channelIndex - The index of uv channels, in [0 ~ 7] range.
139
+ * @param uv - The uv for the mesh
140
+ * @param channelIndex - The index of uv channels, in [0 ~ 7] range
143
141
  */
144
142
  setUVs(uv: Vector2[] | null, channelIndex: number): void;
145
143
  /**
@@ -155,7 +153,7 @@ export declare class ModelMesh extends Mesh {
155
153
  getUVs(channelIndex: number): Vector2[] | null;
156
154
  /**
157
155
  * Set indices for the mesh.
158
- * @param indices - The indices for the mesh.
156
+ * @param indices - The indices for the mesh
159
157
  */
160
158
  setIndices(indices: Uint8Array | Uint16Array | Uint32Array): void;
161
159
  /**
@@ -163,21 +161,20 @@ export declare class ModelMesh extends Mesh {
163
161
  */
164
162
  getIndices(): Uint8Array | Uint16Array | Uint32Array;
165
163
  /**
166
- * @beta
167
- * @todo Update buffer should support custom vertex elements.
168
164
  * Set vertex elements.
169
165
  * @param elements - Vertex element collection
166
+ *
167
+ * @remarks
168
+ * Call this method will clear the vertex data set by the setPositions(), setNormals(), setColors(), setBoneWeights(), setBoneIndices(), setTangents(), setUVs() methods.
170
169
  */
171
170
  setVertexElements(elements: VertexElement[]): void;
172
171
  /**
173
- * @beta
174
172
  * Set vertex buffer binding.
175
- * @param vertexBufferBindings - Vertex buffer binding
173
+ * @param vertexBufferBinding - Vertex buffer binding
176
174
  * @param index - Vertex buffer index, the default value is 0
177
175
  */
178
- setVertexBufferBinding(vertexBufferBindings: VertexBufferBinding, index?: number): void;
176
+ setVertexBufferBinding(vertexBufferBinding: VertexBufferBinding, index?: number): void;
179
177
  /**
180
- * @beta
181
178
  * Set vertex buffer binding.
182
179
  * @param vertexBuffer - Vertex buffer
183
180
  * @param stride - Vertex buffer data stride
@@ -206,21 +203,45 @@ export declare class ModelMesh extends Mesh {
206
203
  */
207
204
  getBlendShapeName(index: number): string;
208
205
  /**
209
- * Upload Mesh Data to GPU.
210
- * @param noLongerReadable - Whether to read data later. If true, you'll never read data anymore (free memory cache)
206
+ * Upload data to GPU set by `setPositions()`, `setNormals()`, `setColors()`, `setBoneWeights()`, `setBoneIndices()`, `setTangents()`, `setUVs()`, `setIndices()` methods.
207
+ * This method will be auto generate vertex element and vertex buffer binding if needed.
208
+ *
209
+ * @param releaseData - Whether to release the data cache, release data can reduce memory usage.
211
210
  */
212
- uploadData(noLongerReadable: boolean): void;
211
+ uploadData(releaseData: boolean): void;
213
212
  /**
214
213
  * Calculate mesh tangent.
215
214
  * @remark need to set positions(with or not with indices), normals, uv before calculation.
216
215
  * @remark based on http://foundationsofgameenginedev.com/FGED2-sample.pdf
217
216
  */
218
217
  calculateTangents(): void;
219
- private _supplementaryVertexElements;
218
+ private _getVertexElementData;
219
+ private _beforeSetAdvancedVertexData;
220
+ private _updateAdvancedVertexDataMarks;
221
+ private _updateInternalVertexBuffer;
222
+ private _readVector2VertexData;
223
+ private _readVector3VertexData;
224
+ private _readVector4VertexData;
225
+ private _readColorVertexData;
226
+ private _readVertexData;
227
+ private _updateAdvancedVertexElement;
228
+ private _updateAdvancedVertexElements;
220
229
  private _updateVertexElements;
221
- private _updateVertices;
222
- private _insertVertexAttribute;
230
+ private _writeVector2AdvancedVertexData;
231
+ private _writeVector3AdvancedVertexData;
232
+ private _writeVector4AdvancedVertexData;
233
+ private _writeColorAdvancedVertexData;
234
+ private _writeAdvancedVertexData;
235
+ private _updateAdvancedVertices;
236
+ private _getInternalVertexBufferIndex;
223
237
  private _getAttributeFormat;
224
238
  private _getAttributeByteLength;
225
239
  private _releaseCache;
240
+ /** @deprecated */
241
+ private _accessible;
242
+ /**
243
+ * @deprecated
244
+ * Whether to access data of the mesh.
245
+ */
246
+ get accessible(): boolean;
226
247
  }
@@ -1,9 +1,11 @@
1
1
  import { Engine } from "../Engine";
2
+ import { Buffer } from "../graphic/Buffer";
2
3
  import { ModelMesh } from "./ModelMesh";
3
4
  /**
4
5
  * Used to generate common primitive meshes.
5
6
  */
6
7
  export declare class PrimitiveMesh {
8
+ private static _tempVec30;
7
9
  /**
8
10
  * Create a sphere mesh.
9
11
  * @param engine - Engine
@@ -80,8 +82,8 @@ export declare class PrimitiveMesh {
80
82
  * @returns Capsule model mesh
81
83
  */
82
84
  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;
85
+ static _setCylinderData(cylinderMesh: ModelMesh, radiusTop: number, radiusBottom: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean, restoreVertexBuffer?: Buffer): void;
86
+ static _setCapsuleData(capsuleMesh: ModelMesh, radius: number, height: number, radialSegments: number, heightSegments: number, noLongerAccessible: boolean, isRestoreMode: boolean, restoreVertexBuffer?: Buffer): void;
85
87
  private static _initialize;
86
88
  private static _generateIndices;
87
89
  private static _createCapsuleCap;
@@ -1,5 +1,6 @@
1
1
  import { Matrix } from "@galacean/engine-math";
2
2
  import { EngineObject } from "../base/EngineObject";
3
+ import { Entity } from "../Entity";
3
4
  /**
4
5
  * Mesh skin data, equal glTF skins define
5
6
  */
@@ -8,6 +9,8 @@ export declare class Skin extends EngineObject {
8
9
  inverseBindMatrices: Matrix[];
9
10
  joints: string[];
10
11
  skeleton: string;
12
+ _rootBone: Entity;
13
+ _bones: Entity[];
11
14
  /**
12
15
  * Constructor of skin
13
16
  * @param name - name
@@ -9,27 +9,20 @@ export declare class SkinnedMeshRenderer extends MeshRenderer {
9
9
  private static _jointCountProperty;
10
10
  private static _jointSamplerProperty;
11
11
  private static _jointMatrixProperty;
12
- private _hasInitSkin;
13
12
  private _jointDataCreateCache;
14
- private _skin;
15
13
  private _blendShapeWeights;
16
14
  private _maxVertexUniformVectors;
17
15
  private _rootBone;
18
16
  private _localBounds;
19
17
  private _jointMatrices;
20
18
  private _jointTexture;
21
- private _jointEntities;
19
+ private _bones;
22
20
  /**
23
21
  * The weights of the BlendShapes.
24
22
  * @remarks Array index is BlendShape index.
25
23
  */
26
24
  get blendShapeWeights(): Float32Array;
27
25
  set blendShapeWeights(value: Float32Array);
28
- /**
29
- * Skin Object.
30
- */
31
- get skin(): Skin;
32
- set skin(value: Skin);
33
26
  /**
34
27
  * Local bounds.
35
28
  */
@@ -40,9 +33,25 @@ export declare class SkinnedMeshRenderer extends MeshRenderer {
40
33
  */
41
34
  get rootBone(): Entity;
42
35
  set rootBone(value: Entity);
43
- private _initSkin;
44
- private _computeApproximateBindMatrix;
45
- private _findByEntityName;
36
+ /**
37
+ * Bones of the SkinnedMeshRenderer.
38
+ */
39
+ get bones(): ReadonlyArray<Entity>;
40
+ set bones(value: ReadonlyArray<Entity>);
46
41
  private _checkBlendShapeWeightLength;
47
42
  private _onLocalBoundsChanged;
43
+ private _getEntityHierarchyPath;
44
+ private _skin;
45
+ /**
46
+ * @deprecated
47
+ * Skin Object.
48
+ *
49
+ * If you want get `skeleton`, use {@link SkinnedMeshRenderer.rootBone} instead.
50
+ * If you want get `bones`, use {@link SkinnedMeshRenderer.bones} instead.
51
+ * `inverseBindMatrices` will migrate to mesh in the future.
52
+ *
53
+ * @remarks `rootBone` and `bones` will not update when `skin` changed.
54
+ */
55
+ get skin(): Skin;
56
+ set skin(value: Skin);
48
57
  }
@@ -1,8 +1,9 @@
1
+ export { BlendShape } from "./BlendShape";
2
+ export { BlendShapeFrame } from "./BlendShapeFrame";
3
+ export { BufferMesh } from "./BufferMesh";
4
+ export { MeshRenderer } from "./MeshRenderer";
1
5
  export { ModelMesh } from "./ModelMesh";
6
+ export { PrimitiveMesh } from "./PrimitiveMesh";
2
7
  export { Skin } from "./Skin";
3
- export { MeshRenderer } from "./MeshRenderer";
4
8
  export { SkinnedMeshRenderer } from "./SkinnedMeshRenderer";
5
- export { PrimitiveMesh } from "./PrimitiveMesh";
6
- export { BufferMesh } from "./BufferMesh";
7
- export { BlendShape } from "./BlendShape";
8
- export { BlendShapeFrame } from "./BlendShapeFrame";
9
+ export { VertexAttribute } from "./enums/VertexAttribute";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,72 @@
1
+ import { ParticleRenderer } from "./ParticleRenderer";
2
+ import { ParticleStopMode } from "./enums/ParticleStopMode";
3
+ import { ColorOverLifetimeModule } from "./modules/ColorOverLifetimeModule";
4
+ import { EmissionModule } from "./modules/EmissionModule";
5
+ import { MainModule } from "./modules/MainModule";
6
+ import { RotationOverLifetimeModule } from "./modules/RotationOverLifetimeModule";
7
+ import { SizeOverLifetimeModule } from "./modules/SizeOverLifetimeModule";
8
+ import { TextureSheetAnimationModule } from "./modules/TextureSheetAnimationModule";
9
+ import { VelocityOverLifetimeModule } from "./modules/VelocityOverLifetimeModule";
10
+ /**
11
+ * Particle System.
12
+ */
13
+ export declare class ParticleGenerator {
14
+ private static readonly _particleIncreaseCount;
15
+ /** Use auto random seed. */
16
+ useAutoRandomSeed: boolean;
17
+ /** Main module. */
18
+ readonly main: MainModule;
19
+ /** Emission module. */
20
+ readonly emission: EmissionModule;
21
+ /** Velocity over lifetime module. */
22
+ readonly velocityOverLifetime: VelocityOverLifetimeModule;
23
+ /** Size over lifetime module. */
24
+ readonly sizeOverLifetime: SizeOverLifetimeModule;
25
+ /** Rotation over lifetime module. */
26
+ readonly rotationOverLifetime: RotationOverLifetimeModule;
27
+ /** Color over lifetime module. */
28
+ readonly colorOverLifetime: ColorOverLifetimeModule;
29
+ /** Texture sheet animation module. */
30
+ readonly textureSheetAnimation: TextureSheetAnimationModule;
31
+ private _isPlaying;
32
+ private _instanceBufferResized;
33
+ private _waitProcessRetiredElementCount;
34
+ private _instanceVertexBufferBinding;
35
+ private _instanceVertices;
36
+ private _randomSeed;
37
+ /**
38
+ * Whether the particle system is contain alive or is still creating particles.
39
+ */
40
+ get isAlive(): boolean;
41
+ /**
42
+ * Random seed.
43
+ *
44
+ * @remarks
45
+ * If `useAutoRandomSeed` is true, this value will be random changed when play.
46
+ * If you set this value custom, `useAutoRandomSeed` will be false.
47
+ */
48
+ get randomSeed(): number;
49
+ set randomSeed(value: number);
50
+ constructor(renderer: ParticleRenderer);
51
+ /**
52
+ * Start emitting particles.
53
+ * @param withChildren - Whether to start the particle system of the child entity
54
+ */
55
+ play(withChildren?: boolean): void;
56
+ /**
57
+ * Stop emitting particles.
58
+ * @param withChildren - Whether to stop the particle system of the child entity
59
+ * @param stopMode - Stop mode
60
+ */
61
+ stop(withChildren?: boolean, stopMode?: ParticleStopMode): void;
62
+ /**
63
+ * Manually emit certain number of particles immediately.
64
+ * @param count - Number of particles to emit
65
+ */
66
+ emit(count: number): void;
67
+ private _addNewParticle;
68
+ private _retireActiveParticles;
69
+ private _freeRetiredParticles;
70
+ private _addNewParticlesToVertexBuffer;
71
+ private _addVertexBufferBindingsFilterDuplicate;
72
+ }
@@ -0,0 +1,28 @@
1
+ import { Color } from "@galacean/engine-math";
2
+ import { Engine } from "../Engine";
3
+ import { BaseMaterial } from "../material/BaseMaterial";
4
+ import { Texture2D } from "../texture/Texture2D";
5
+ /**
6
+ * Particle Material.
7
+ */
8
+ export declare class ParticleMaterial extends BaseMaterial {
9
+ /**
10
+ * Base color.
11
+ */
12
+ get baseColor(): Color;
13
+ set baseColor(value: Color);
14
+ /**
15
+ * Base texture.
16
+ */
17
+ get baseTexture(): Texture2D;
18
+ set baseTexture(value: Texture2D);
19
+ /**
20
+ * Create a unlit material instance.
21
+ * @param engine - Engine to which the material belongs
22
+ */
23
+ constructor(engine: Engine);
24
+ /**
25
+ * @inheritdoc
26
+ */
27
+ clone(): ParticleMaterial;
28
+ }