@galacean/engine-core 2.0.0-alpha.44 → 2.0.0-alpha.45

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 (236) hide show
  1. package/dist/main.js.map +1 -1
  2. package/dist/module.js.map +1 -1
  3. package/package.json +3 -3
  4. package/types/2d/atlas/FontAtlas.d.ts +23 -1
  5. package/types/2d/atlas/SpriteAtlas.d.ts +8 -0
  6. package/types/2d/sprite/Sprite.d.ts +27 -1
  7. package/types/2d/sprite/SpriteMask.d.ts +43 -0
  8. package/types/2d/sprite/SpriteRenderer.d.ts +29 -0
  9. package/types/2d/text/CharInfo.d.ts +20 -1
  10. package/types/2d/text/CharRenderInfo.d.ts +15 -1
  11. package/types/2d/text/Font.d.ts +10 -0
  12. package/types/2d/text/SubFont.d.ts +35 -1
  13. package/types/2d/text/TextRenderer.d.ts +53 -0
  14. package/types/2d/text/TextUtils.d.ts +89 -1
  15. package/types/Background.d.ts +17 -0
  16. package/types/BasicResources.d.ts +52 -0
  17. package/types/Camera.d.ts +71 -1
  18. package/types/Canvas.d.ts +13 -0
  19. package/types/Component.d.ts +33 -0
  20. package/types/ComponentsDependencies.d.ts +34 -1
  21. package/types/ComponentsManager.d.ts +17 -0
  22. package/types/Engine.d.ts +106 -2
  23. package/types/Entity.d.ts +88 -0
  24. package/types/Polyfill.d.ts +12 -1
  25. package/types/RenderPipeline/BasicRenderPipeline.d.ts +3 -0
  26. package/types/RenderPipeline/BatcherManager.d.ts +23 -1
  27. package/types/RenderPipeline/CullingResults.d.ts +17 -1
  28. package/types/RenderPipeline/DepthOnlyPass.d.ts +18 -1
  29. package/types/RenderPipeline/InstanceBuffer.d.ts +28 -1
  30. package/types/RenderPipeline/MaskManager.d.ts +36 -1
  31. package/types/RenderPipeline/OpaqueTexturePass.d.ts +16 -1
  32. package/types/RenderPipeline/PipelineUtils.d.ts +11 -1
  33. package/types/RenderPipeline/PrimitiveChunk.d.ts +27 -1
  34. package/types/RenderPipeline/PrimitiveChunkManager.d.ts +16 -1
  35. package/types/RenderPipeline/RenderContext.d.ts +46 -1
  36. package/types/RenderPipeline/RenderElement.d.ts +9 -0
  37. package/types/RenderPipeline/RenderQueue.d.ts +23 -1
  38. package/types/RenderPipeline/RenderTargetPool.d.ts +17 -1
  39. package/types/RenderPipeline/SubPrimitiveChunk.d.ts +14 -1
  40. package/types/RenderPipeline/VertexArea.d.ts +10 -1
  41. package/types/RenderPipeline/VertexMergeBatcher.d.ts +11 -1
  42. package/types/RenderPipeline/enums/RenderQueueMaskType.d.ts +9 -1
  43. package/types/RenderPipeline/index.d.ts +2 -0
  44. package/types/Renderer.d.ts +58 -0
  45. package/types/Scene.d.ts +28 -0
  46. package/types/SceneManager.d.ts +13 -0
  47. package/types/Script.d.ts +40 -0
  48. package/types/SystemInfo.d.ts +10 -0
  49. package/types/Transform.d.ts +13 -0
  50. package/types/UpdateFlag.d.ts +3 -0
  51. package/types/UpdateFlagManager.d.ts +41 -1
  52. package/types/Utils.d.ts +20 -0
  53. package/types/VirtualCamera.d.ts +16 -1
  54. package/types/animation/AnimationClip.d.ts +5 -0
  55. package/types/animation/AnimationClipCurveBinding.d.ts +16 -1
  56. package/types/animation/Animator.d.ts +25 -0
  57. package/types/animation/AnimatorController.d.ts +17 -0
  58. package/types/animation/AnimatorControllerLayer.d.ts +9 -0
  59. package/types/animation/AnimatorControllerParameter.d.ts +4 -0
  60. package/types/animation/AnimatorState.d.ts +44 -0
  61. package/types/animation/AnimatorStateInstance.d.ts +8 -0
  62. package/types/animation/AnimatorStateMachine.d.ts +14 -0
  63. package/types/animation/AnimatorStateTransition.d.ts +9 -0
  64. package/types/animation/AnimatorStateTransitionCollection.d.ts +23 -1
  65. package/types/animation/StateMachineScript.d.ts +2 -0
  66. package/types/animation/animationCurve/AnimationArrayCurve.d.ts +39 -0
  67. package/types/animation/animationCurve/AnimationBoolCurve.d.ts +39 -0
  68. package/types/animation/animationCurve/AnimationColorCurve.d.ts +39 -0
  69. package/types/animation/animationCurve/AnimationCurve.d.ts +8 -0
  70. package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +38 -0
  71. package/types/animation/animationCurve/AnimationFloatCurve.d.ts +39 -0
  72. package/types/animation/animationCurve/AnimationQuaternionCurve.d.ts +41 -0
  73. package/types/animation/animationCurve/AnimationRectCurve.d.ts +18 -0
  74. package/types/animation/animationCurve/AnimationRefCurve.d.ts +18 -0
  75. package/types/animation/animationCurve/AnimationStringCurve.d.ts +39 -0
  76. package/types/animation/animationCurve/AnimationVector2Curve.d.ts +39 -0
  77. package/types/animation/animationCurve/AnimationVector3Curve.d.ts +43 -0
  78. package/types/animation/animationCurve/AnimationVector4Curve.d.ts +39 -0
  79. package/types/animation/animationCurve/interfaces/IAnimationCurveCalculator.d.ts +18 -1
  80. package/types/animation/enums/AnimatorStatePlayState.d.ts +8 -1
  81. package/types/animation/internal/AnimationCurveLayerOwner.d.ts +15 -1
  82. package/types/animation/internal/AnimationEventHandler.d.ts +8 -1
  83. package/types/animation/internal/AnimatorLayerData.d.ts +28 -1
  84. package/types/animation/internal/AnimatorStateData.d.ts +14 -1
  85. package/types/animation/internal/AnimatorStatePlayData.d.ts +27 -1
  86. package/types/animation/internal/AnimatorTempValue.d.ts +12 -1
  87. package/types/animation/internal/animationCurveOwner/AnimationCurveOwner.d.ts +39 -0
  88. package/types/animation/internal/animationCurveOwner/assembler/BlendShapeWeightsAnimationCurveOwnerAssembler.d.ts +12 -1
  89. package/types/animation/internal/animationCurveOwner/assembler/IAnimationCurveOwnerAssembler.d.ts +10 -1
  90. package/types/animation/internal/animationCurveOwner/assembler/PositionAnimationCurveOwnerAssembler.d.ts +13 -1
  91. package/types/animation/internal/animationCurveOwner/assembler/RotationAnimationCurveOwnerAssembler.d.ts +13 -1
  92. package/types/animation/internal/animationCurveOwner/assembler/ScaleAnimationCurveOwnerAssembler.d.ts +13 -1
  93. package/types/animation/internal/animationCurveOwner/assembler/UniversalAnimationCurveOwnerAssembler.d.ts +23 -1
  94. package/types/asset/GraphicsResource.d.ts +10 -0
  95. package/types/asset/IReferable.d.ts +8 -0
  96. package/types/asset/ReferResource.d.ts +28 -0
  97. package/types/asset/RenderingStatistics.d.ts +8 -0
  98. package/types/asset/ResourceManager.d.ts +94 -4
  99. package/types/audio/AudioClip.d.ts +8 -0
  100. package/types/audio/AudioManager.d.ts +14 -0
  101. package/types/audio/AudioSource.d.ts +17 -0
  102. package/types/base/EngineObject.d.ts +4 -0
  103. package/types/base/Time.d.ts +13 -0
  104. package/types/clone/CloneDecorators.d.ts +20 -0
  105. package/types/clone/CloneUtil.d.ts +30 -1
  106. package/types/clone/ComponentCloner.d.ts +11 -1
  107. package/types/enums/CameraType.d.ts +9 -1
  108. package/types/env-probe/CubeProbe.d.ts +2 -0
  109. package/types/graphic/Buffer.d.ts +10 -0
  110. package/types/graphic/BufferUtil.d.ts +5 -0
  111. package/types/graphic/IndexBufferBinding.d.ts +4 -0
  112. package/types/graphic/Mesh.d.ts +54 -0
  113. package/types/graphic/Primitive.d.ts +50 -1
  114. package/types/graphic/TransformFeedback.d.ts +46 -1
  115. package/types/graphic/TransformFeedbackPrimitive.d.ts +67 -1
  116. package/types/graphic/TransformFeedbackSimulator.d.ts +55 -1
  117. package/types/graphic/VertexBufferBinding.d.ts +4 -0
  118. package/types/input/InputManager.d.ts +19 -0
  119. package/types/input/enums/PointerButton.d.ts +8 -0
  120. package/types/input/keyboard/KeyboardManager.d.ts +41 -1
  121. package/types/input/pointer/Pointer.d.ts +36 -0
  122. package/types/input/pointer/PointerEventData.d.ts +4 -0
  123. package/types/input/pointer/PointerManager.d.ts +58 -0
  124. package/types/input/pointer/emitter/IHitResult.d.ts +11 -1
  125. package/types/input/pointer/emitter/PhysicsPointerEventEmitter.d.ts +20 -1
  126. package/types/input/wheel/WheelManager.d.ts +34 -1
  127. package/types/lighting/AmbientLight.d.ts +9 -0
  128. package/types/lighting/DirectLight.d.ts +17 -0
  129. package/types/lighting/Light.d.ts +2 -0
  130. package/types/lighting/LightManager.d.ts +57 -0
  131. package/types/lighting/PointLight.d.ts +17 -0
  132. package/types/lighting/SpotLight.d.ts +17 -0
  133. package/types/lighting/ambientOcclusion/AmbientOcclusion.d.ts +4 -0
  134. package/types/lighting/ambientOcclusion/ScalableAmbientObscurancePass.d.ts +38 -1
  135. package/types/material/BaseMaterial.d.ts +4 -0
  136. package/types/material/Material.d.ts +2 -0
  137. package/types/mesh/BlendShape.d.ts +13 -0
  138. package/types/mesh/BlendShapeFrame.d.ts +7 -0
  139. package/types/mesh/BlendShapeManager.d.ts +101 -1
  140. package/types/mesh/MeshRenderer.d.ts +37 -0
  141. package/types/mesh/ModelMesh.d.ts +18 -0
  142. package/types/mesh/PrimitiveMesh.d.ts +28 -0
  143. package/types/mesh/PrimitiveMeshRestorer.d.ts +107 -0
  144. package/types/mesh/Skin.d.ts +10 -0
  145. package/types/mesh/SkinnedMeshRenderer.d.ts +21 -0
  146. package/types/particle/ParticleBufferUtils.d.ts +26 -1
  147. package/types/particle/ParticleGenerator.d.ts +102 -0
  148. package/types/particle/ParticleRenderer.d.ts +55 -0
  149. package/types/particle/ParticleTransformFeedbackSimulator.d.ts +52 -1
  150. package/types/particle/enums/ParticleRandomSubSeeds.d.ts +25 -1
  151. package/types/particle/enums/attributes/BillboardParticleVertexAttribute.d.ts +6 -1
  152. package/types/particle/enums/attributes/ParticleFeedbackVertexAttribute.d.ts +8 -1
  153. package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +17 -1
  154. package/types/particle/modules/ColorOverLifetimeModule.d.ts +12 -0
  155. package/types/particle/modules/CustomDataModule.d.ts +5 -0
  156. package/types/particle/modules/EmissionModule.d.ts +28 -0
  157. package/types/particle/modules/ForceOverLifetimeModule.d.ts +16 -1
  158. package/types/particle/modules/LimitVelocityOverLifetimeModule.d.ts +20 -1
  159. package/types/particle/modules/MainModule.d.ts +33 -1
  160. package/types/particle/modules/NoiseModule.d.ts +12 -1
  161. package/types/particle/modules/ParticleCompositeCurve.d.ts +37 -0
  162. package/types/particle/modules/ParticleCurve.d.ts +28 -0
  163. package/types/particle/modules/ParticleGeneratorModule.d.ts +7 -0
  164. package/types/particle/modules/ParticleGradient.d.ts +16 -0
  165. package/types/particle/modules/RotationOverLifetimeModule.d.ts +12 -0
  166. package/types/particle/modules/SizeOverLifetimeModule.d.ts +16 -0
  167. package/types/particle/modules/SubEmitter.d.ts +3 -0
  168. package/types/particle/modules/SubEmittersModule.d.ts +17 -0
  169. package/types/particle/modules/TextureSheetAnimationModule.d.ts +14 -1
  170. package/types/particle/modules/VelocityOverLifetimeModule.d.ts +28 -1
  171. package/types/particle/modules/shape/BaseShape.d.ts +33 -1
  172. package/types/particle/modules/shape/BoxShape.d.ts +13 -1
  173. package/types/particle/modules/shape/CircleShape.d.ts +13 -0
  174. package/types/particle/modules/shape/ConeShape.d.ts +13 -0
  175. package/types/particle/modules/shape/HemisphereShape.d.ts +13 -0
  176. package/types/particle/modules/shape/MeshShape.d.ts +17 -0
  177. package/types/particle/modules/shape/ShapeUtils.d.ts +13 -1
  178. package/types/particle/modules/shape/SphereShape.d.ts +13 -0
  179. package/types/physics/CharacterController.d.ts +21 -0
  180. package/types/physics/Collider.d.ts +39 -0
  181. package/types/physics/Collision.d.ts +3 -0
  182. package/types/physics/DynamicCollider.d.ts +14 -0
  183. package/types/physics/PhysicsMaterial.d.ts +3 -0
  184. package/types/physics/PhysicsScene.d.ts +51 -0
  185. package/types/physics/StaticCollider.d.ts +5 -0
  186. package/types/physics/enums/ColliderShapeChangeFlag.d.ts +8 -1
  187. package/types/physics/enums/HingeJointFlag.d.ts +14 -1
  188. package/types/physics/joint/HingeJoint.d.ts +4 -0
  189. package/types/physics/joint/Joint.d.ts +20 -0
  190. package/types/physics/joint/JointLimits.d.ts +3 -0
  191. package/types/physics/joint/JointMotor.d.ts +3 -0
  192. package/types/physics/shape/ColliderShape.d.ts +17 -0
  193. package/types/physics/shape/MeshColliderShape.d.ts +4 -0
  194. package/types/postProcess/FinalPass.d.ts +19 -1
  195. package/types/postProcess/PostProcess.d.ts +2 -0
  196. package/types/postProcess/PostProcessEffect.d.ts +4 -0
  197. package/types/postProcess/PostProcessEffectParameter.d.ts +4 -0
  198. package/types/postProcess/PostProcessManager.d.ts +43 -0
  199. package/types/postProcess/effects/BloomEffect.d.ts +25 -0
  200. package/types/postProcess/effects/TonemappingEffect.d.ts +3 -0
  201. package/types/renderingHardwareInterface/IPlatformTransformFeedback.d.ts +36 -1
  202. package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +40 -1
  203. package/types/shader/Shader.d.ts +22 -0
  204. package/types/shader/ShaderBlockProperty.d.ts +19 -1
  205. package/types/shader/ShaderData.d.ts +29 -0
  206. package/types/shader/ShaderFactory.d.ts +23 -0
  207. package/types/shader/ShaderMacro.d.ts +15 -0
  208. package/types/shader/ShaderMacroCollection.d.ts +57 -1
  209. package/types/shader/ShaderMacroProcessor.d.ts +72 -1
  210. package/types/shader/ShaderPass.d.ts +38 -0
  211. package/types/shader/ShaderProgram.d.ts +91 -1
  212. package/types/shader/ShaderProgramMap.d.ts +20 -1
  213. package/types/shader/ShaderProperty.d.ts +17 -0
  214. package/types/shader/ShaderTagKey.d.ts +2 -0
  215. package/types/shader/ShaderUniform.d.ts +49 -1
  216. package/types/shader/ShaderUniformBlock.d.ts +9 -1
  217. package/types/shader/enums/ConstantBufferBindingPoint.d.ts +7 -1
  218. package/types/shader/state/BlendState.d.ts +14 -0
  219. package/types/shader/state/DepthState.d.ts +14 -0
  220. package/types/shader/state/RasterState.d.ts +17 -0
  221. package/types/shader/state/RenderState.d.ts +11 -0
  222. package/types/shader/state/StencilState.d.ts +13 -0
  223. package/types/shadow/CascadedShadowCasterPass.d.ts +5 -0
  224. package/types/shadow/ShadowSliceData.d.ts +13 -1
  225. package/types/shadow/ShadowUtils.d.ts +43 -1
  226. package/types/sky/Sky.d.ts +9 -0
  227. package/types/texture/RenderTarget.d.ts +21 -0
  228. package/types/texture/Texture.d.ts +21 -0
  229. package/types/texture/Texture2D.d.ts +4 -0
  230. package/types/texture/Texture2DArray.d.ts +4 -0
  231. package/types/texture/TextureCube.d.ts +4 -0
  232. package/types/texture/TextureUtils.d.ts +16 -1
  233. package/types/trail/TrailRenderer.d.ts +5 -0
  234. package/types/ui/IUICanvas.d.ts +16 -1
  235. package/types/utils/DisorderedArray.d.ts +2 -0
  236. package/types/xr/XRManager.d.ts +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "2.0.0-alpha.44",
3
+ "version": "2.0.0-alpha.45",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "2.0.0-alpha.44"
21
+ "@galacean/engine-math": "2.0.0-alpha.45"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "2.0.0-alpha.44"
24
+ "@galacean/engine-design": "2.0.0-alpha.45"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -1 +1,23 @@
1
- export {};
1
+ import { Engine } from "../../Engine";
2
+ import { ReferResource } from "../../asset/ReferResource";
3
+ import { Texture2D } from "../../texture/Texture2D";
4
+ import { CharInfo } from "../text/CharInfo";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class FontAtlas extends ReferResource {
9
+ texture: Texture2D;
10
+ _charInfoMap: Record<number, CharInfo>;
11
+ private _space;
12
+ private _curX;
13
+ private _curY;
14
+ private _nextY;
15
+ constructor(engine: Engine);
16
+ uploadCharTexture(charInfo: CharInfo): boolean;
17
+ addCharInfo(char: string, charInfo: CharInfo): void;
18
+ getCharInfo(char: string): CharInfo;
19
+ /**
20
+ * @internal
21
+ */
22
+ protected _onDestroy(): void;
23
+ }
@@ -29,4 +29,12 @@ export declare class SpriteAtlas extends ReferResource {
29
29
  * @param engine - Engine to which the SpriteAtlas belongs
30
30
  */
31
31
  constructor(engine: Engine);
32
+ /**
33
+ * @internal
34
+ */
35
+ _addSprite(sprite: Sprite): void;
36
+ /**
37
+ * @internal
38
+ */
39
+ protected _onDestroy(): void;
32
40
  }
@@ -1,7 +1,9 @@
1
- import { Rect, Vector2, Vector4 } from "@galacean/engine-math";
1
+ import { BoundingBox, Rect, Vector2, Vector4 } from "@galacean/engine-math";
2
2
  import { Engine } from "../../Engine";
3
+ import { UpdateFlagManager } from "../../UpdateFlagManager";
3
4
  import { ReferResource } from "../../asset/ReferResource";
4
5
  import { Texture2D } from "../../texture/Texture2D";
6
+ import { SpriteAtlas } from "../atlas/SpriteAtlas";
5
7
  /**
6
8
  * 2D sprite.
7
9
  */
@@ -23,6 +25,10 @@ export declare class Sprite extends ReferResource {
23
25
  private _pivot;
24
26
  private _border;
25
27
  private _dirtyUpdateFlag;
28
+ /** @internal */
29
+ _atlas: SpriteAtlas;
30
+ /** @internal */
31
+ _updateFlagManager: UpdateFlagManager;
26
32
  /**
27
33
  * The reference to the used texture.
28
34
  */
@@ -96,6 +102,26 @@ export declare class Sprite extends ReferResource {
96
102
  * @returns Cloned sprite
97
103
  */
98
104
  clone(): Sprite;
105
+ /**
106
+ * @internal
107
+ */
108
+ _getPositions(): Vector2[];
109
+ /**
110
+ * @internal
111
+ */
112
+ _getUVs(): Vector2[];
113
+ /**
114
+ * @internal
115
+ */
116
+ _getBounds(): BoundingBox;
117
+ /**
118
+ * @internal
119
+ */
120
+ _addReferCount(value: number): void;
121
+ /**
122
+ * @internal
123
+ */
124
+ protected _onDestroy(): void;
99
125
  private _calDefaultSize;
100
126
  private _updatePositions;
101
127
  private _updateUVs;
@@ -1,15 +1,30 @@
1
1
  import { BoundingBox } from "@galacean/engine-math";
2
+ import { Entity } from "../../Entity";
3
+ import { PrimitiveChunkManager } from "../../RenderPipeline/PrimitiveChunkManager";
2
4
  import { RenderContext } from "../../RenderPipeline/RenderContext";
5
+ import { SubPrimitiveChunk } from "../../RenderPipeline/SubPrimitiveChunk";
6
+ import { RenderElement } from "../../RenderPipeline/RenderElement";
3
7
  import { Renderer } from "../../Renderer";
4
8
  import { SpriteMaskLayer } from "../../enums/SpriteMaskLayer";
9
+ import { ShaderProperty } from "../../shader/ShaderProperty";
5
10
  import { ISpriteRenderer } from "../assembler/ISpriteRenderer";
6
11
  import { Sprite } from "./Sprite";
7
12
  /**
8
13
  * A component for masking Sprites.
9
14
  */
10
15
  export declare class SpriteMask extends Renderer implements ISpriteRenderer {
16
+ /** @internal */
17
+ static _textureProperty: ShaderProperty;
18
+ /** @internal */
19
+ static _alphaCutoffProperty: ShaderProperty;
11
20
  /** The mask layers the sprite mask influence to. */
12
21
  influenceLayers: SpriteMaskLayer;
22
+ /** @internal */
23
+ _renderElement: RenderElement;
24
+ /** @internal */
25
+ _subChunk: SubPrimitiveChunk;
26
+ /** @internal */
27
+ _maskIndex: number;
13
28
  private _sprite;
14
29
  private _automaticWidth;
15
30
  private _automaticHeight;
@@ -56,10 +71,38 @@ export declare class SpriteMask extends Renderer implements ISpriteRenderer {
56
71
  */
57
72
  get alphaCutoff(): number;
58
73
  set alphaCutoff(value: number);
74
+ /**
75
+ * @internal
76
+ */
77
+ constructor(entity: Entity);
78
+ /**
79
+ * @internal
80
+ */
81
+ _updateTransformShaderData(context: RenderContext, onlyMVP: boolean): void;
59
82
  /**
60
83
  * @inheritdoc
61
84
  */
62
85
  _onClone(target: SpriteMask): void;
86
+ /**
87
+ * @internal
88
+ */
89
+ _canBatch(preElement: RenderElement, curElement: RenderElement): boolean;
90
+ /**
91
+ * @internal
92
+ */
93
+ _batch(preElement: RenderElement | null, curElement: RenderElement): void;
94
+ /**
95
+ * @internal
96
+ */
97
+ _onEnableInScene(): void;
98
+ /**
99
+ * @internal
100
+ */
101
+ _onDisableInScene(): void;
102
+ /**
103
+ * @internal
104
+ */
105
+ _getChunkManager(): PrimitiveChunkManager;
63
106
  protected _updateBounds(worldBounds: BoundingBox): void;
64
107
  /**
65
108
  * @inheritdoc
@@ -1,6 +1,11 @@
1
1
  import { BoundingBox, Color } from "@galacean/engine-math";
2
+ import { Entity } from "../../Entity";
3
+ import { PrimitiveChunkManager } from "../../RenderPipeline/PrimitiveChunkManager";
2
4
  import { RenderContext } from "../../RenderPipeline/RenderContext";
5
+ import { SubPrimitiveChunk } from "../../RenderPipeline/SubPrimitiveChunk";
6
+ import { RenderElement } from "../../RenderPipeline/RenderElement";
3
7
  import { Renderer } from "../../Renderer";
8
+ import { ShaderProperty } from "../../shader/ShaderProperty";
4
9
  import { ISpriteRenderer } from "../assembler/ISpriteRenderer";
5
10
  import { SpriteDrawMode } from "../enums/SpriteDrawMode";
6
11
  import { SpriteMaskInteraction } from "../enums/SpriteMaskInteraction";
@@ -11,6 +16,10 @@ import { SpriteMaskLayer } from "../../enums/SpriteMaskLayer";
11
16
  * Renders a Sprite for 2D graphics.
12
17
  */
13
18
  export declare class SpriteRenderer extends Renderer implements ISpriteRenderer {
19
+ /** @internal */
20
+ static _textureProperty: ShaderProperty;
21
+ /** @internal */
22
+ _subChunk: SubPrimitiveChunk;
14
23
  private _drawMode;
15
24
  private _assembler;
16
25
  private _tileMode;
@@ -86,10 +95,30 @@ export declare class SpriteRenderer extends Renderer implements ISpriteRenderer
86
95
  */
87
96
  get maskInteraction(): SpriteMaskInteraction;
88
97
  set maskInteraction(value: SpriteMaskInteraction);
98
+ /**
99
+ * @internal
100
+ */
101
+ constructor(entity: Entity);
102
+ /**
103
+ * @internal
104
+ */
105
+ _updateTransformShaderData(context: RenderContext, onlyMVP: boolean): void;
89
106
  /**
90
107
  * @inheritdoc
91
108
  */
92
109
  _onClone(target: SpriteRenderer): void;
110
+ /**
111
+ * @internal
112
+ */
113
+ _canBatch(preElement: RenderElement, curElement: RenderElement): boolean;
114
+ /**
115
+ * @internal
116
+ */
117
+ _batch(preElement: RenderElement | null, curElement: RenderElement): void;
118
+ /**
119
+ * @internal
120
+ */
121
+ _getChunkManager(): PrimitiveChunkManager;
93
122
  protected _updateBounds(worldBounds: BoundingBox): void;
94
123
  protected _render(context: RenderContext): void;
95
124
  protected _onDestroy(): void;
@@ -1 +1,20 @@
1
- export {};
1
+ import { Vector2 } from "@galacean/engine-math";
2
+ /**
3
+ * @internal
4
+ */
5
+ export interface CharInfo {
6
+ char: string;
7
+ x: number;
8
+ y: number;
9
+ w: number;
10
+ h: number;
11
+ offsetX: number;
12
+ offsetY: number;
13
+ xAdvance: number;
14
+ ascent: number;
15
+ descent: number;
16
+ index: number;
17
+ data?: Uint8Array;
18
+ uvs: Vector2[];
19
+ bufferOffset?: Vector2;
20
+ }
@@ -1 +1,15 @@
1
- export {};
1
+ import { Vector2, Vector4 } from "@galacean/engine-math";
2
+ import { Texture2D } from "../../texture";
3
+ import { IPoolElement } from "../../utils/ObjectPool";
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare class CharRenderInfo implements IPoolElement {
8
+ static triangles: number[];
9
+ texture: Texture2D;
10
+ /** x:Top y:Left z:Bottom w:Right */
11
+ localPositions: Vector4;
12
+ uvs: Vector2[];
13
+ indexInChunk: number;
14
+ dispose(): void;
15
+ }
@@ -1,5 +1,7 @@
1
1
  import { ReferResource } from "../../asset/ReferResource";
2
2
  import { Engine } from "../../Engine";
3
+ import { FontStyle } from "../enums/FontStyle";
4
+ import { SubFont } from "./SubFont";
3
5
  /**
4
6
  * Font.
5
7
  */
@@ -18,4 +20,12 @@ export declare class Font extends ReferResource {
18
20
  */
19
21
  get name(): string;
20
22
  constructor(engine: Engine, name?: string);
23
+ /**
24
+ * @internal
25
+ */
26
+ _getSubFont(fontSize: number, fontStyle: FontStyle): SubFont;
27
+ /**
28
+ * @internal
29
+ */
30
+ protected _onDestroy(): void;
21
31
  }
@@ -1 +1,35 @@
1
- export {};
1
+ import { Engine } from "../../Engine";
2
+ import { Texture2D } from "../../texture";
3
+ import { CharInfo } from "./CharInfo";
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare class SubFont {
8
+ nativeFontString: string;
9
+ private _engine;
10
+ private _fontAtlases;
11
+ private _lastIndex;
12
+ constructor(engine: Engine);
13
+ destroy(): void;
14
+ /**
15
+ * @internal
16
+ */
17
+ _uploadCharTexture(charInfo: CharInfo): void;
18
+ /**
19
+ * @internal
20
+ */
21
+ _addCharInfo(char: string, charInfo: CharInfo): void;
22
+ /**
23
+ * @internal
24
+ */
25
+ _getCharInfo(char: string): CharInfo;
26
+ /**
27
+ * @internal
28
+ */
29
+ _getTextureByIndex(index: number): Texture2D;
30
+ /**
31
+ * @internal
32
+ */
33
+ _getLastIndex(): number;
34
+ private _createFontAtlas;
35
+ }
@@ -1,6 +1,8 @@
1
1
  import { BoundingBox, Color } from "@galacean/engine-math";
2
2
  import { Entity } from "../../Entity";
3
+ import { PrimitiveChunkManager } from "../../RenderPipeline/PrimitiveChunkManager";
3
4
  import { RenderContext } from "../../RenderPipeline/RenderContext";
5
+ import { RenderElement } from "../../RenderPipeline/RenderElement";
4
6
  import { Renderer } from "../../Renderer";
5
7
  import { TransformModifyFlags } from "../../Transform";
6
8
  import { FontStyle } from "../enums/FontStyle";
@@ -9,6 +11,7 @@ import { TextHorizontalAlignment, TextVerticalAlignment } from "../enums/TextAli
9
11
  import { OverflowMode } from "../enums/TextOverflow";
10
12
  import { Font } from "./Font";
11
13
  import { ITextRenderer } from "./ITextRenderer";
14
+ import { SubFont } from "./SubFont";
12
15
  import { SpriteMaskLayer } from "../../enums/SpriteMaskLayer";
13
16
  /**
14
17
  * Renders a text for 2D graphics.
@@ -20,6 +23,10 @@ export declare class TextRenderer extends Renderer implements ITextRenderer {
20
23
  private static _worldPositions;
21
24
  private static _charRenderInfos;
22
25
  private _textChunks;
26
+ /** @internal */
27
+ _subFont: SubFont;
28
+ /** @internal */
29
+ _dirtyFlag: DirtyFlag;
23
30
  private _color;
24
31
  private _text;
25
32
  private _width;
@@ -114,6 +121,42 @@ export declare class TextRenderer extends Renderer implements ITextRenderer {
114
121
  */
115
122
  get bounds(): BoundingBox;
116
123
  constructor(entity: Entity);
124
+ /**
125
+ * @internal
126
+ */
127
+ protected _onDestroy(): void;
128
+ /**
129
+ * @internal
130
+ */
131
+ _isContainDirtyFlag(type: number): boolean;
132
+ /**
133
+ * @internal
134
+ */
135
+ _setDirtyFlagTrue(type: number): void;
136
+ /**
137
+ * @internal
138
+ */
139
+ _setDirtyFlagFalse(type: number): void;
140
+ /**
141
+ * @internal
142
+ */
143
+ _getSubFont(): SubFont;
144
+ /**
145
+ * @internal
146
+ */
147
+ _updateTransformShaderData(context: RenderContext, onlyMVP: boolean): void;
148
+ /**
149
+ * @internal
150
+ */
151
+ _canBatch(preElement: RenderElement, curElement: RenderElement): boolean;
152
+ /**
153
+ * @internal
154
+ */
155
+ _batch(preElement: RenderElement | null, curElement: RenderElement): void;
156
+ /**
157
+ * @internal
158
+ */
159
+ _getChunkManager(): PrimitiveChunkManager;
117
160
  protected _updateBounds(worldBounds: BoundingBox): void;
118
161
  protected _render(context: RenderContext): void;
119
162
  private _resetSubFont;
@@ -126,3 +169,13 @@ export declare class TextRenderer extends Renderer implements ITextRenderer {
126
169
  private _freeTextChunks;
127
170
  private _onColorChanged;
128
171
  }
172
+ declare enum DirtyFlag {
173
+ SubFont = 1,
174
+ LocalPositionBounds = 2,
175
+ WorldPosition = 4,
176
+ WorldBounds = 8,
177
+ Color = 16,
178
+ Position = 14,
179
+ Font = 15
180
+ }
181
+ export {};
@@ -1 +1,89 @@
1
- export {};
1
+ import { FontStyle } from "../enums/FontStyle";
2
+ import { CharInfo } from "./CharInfo";
3
+ import { ITextRenderer } from "./ITextRenderer";
4
+ import { SubFont } from "./SubFont";
5
+ /**
6
+ * @internal
7
+ * TextUtils includes some helper function for text.
8
+ */
9
+ export declare class TextUtils {
10
+ /** @internal */
11
+ static _genericFontFamilies: string[];
12
+ /** @internal */
13
+ static _extendHeight: number;
14
+ /** These characters are all tall to help calculate the height required for text. */
15
+ private static _measureString;
16
+ private static _measureBaseline;
17
+ private static _heightMultiplier;
18
+ private static _baselineMultiplier;
19
+ private static _fontSizeInfoCache;
20
+ private static _textContext;
21
+ /**
22
+ * The instance function to get an object includes 2d context and canvas.
23
+ * @returns the TextContext object
24
+ */
25
+ static textContext(): TextContext;
26
+ /**
27
+ * Measure the font.
28
+ * @param fontString - the string of the font
29
+ * @returns the font size info
30
+ */
31
+ static measureFont(fontString: string): FontSizeInfo;
32
+ /**
33
+ * Get native font string.
34
+ * @param fontName - The font name
35
+ * @param fontSize - The font size
36
+ * @param style - The font style
37
+ * @returns The native font string
38
+ */
39
+ static getNativeFontString(fontName: string, fontSize: number, style: FontStyle): string;
40
+ static measureChar(char: string, fontString: string): CharInfo;
41
+ static measureTextWithWrap(renderer: ITextRenderer, rendererWidth: number, rendererHeight: number, lineSpacing: number, characterSpacing: number): TextMetrics;
42
+ static measureTextWithoutWrap(renderer: ITextRenderer, rendererHeight: number, lineSpacing: number, characterSpacing: number): TextMetrics;
43
+ /**
44
+ * Get native font hash.
45
+ * @param fontName - The font name
46
+ * @param fontSize - The font size
47
+ * @param style - The font style
48
+ * @returns The native font hash
49
+ */
50
+ static getNativeFontHash(fontName: string, fontSize: number, style: FontStyle): string;
51
+ /**
52
+ * @internal
53
+ */
54
+ static _measureFontOrChar(fontString: string, measureString: string, isChar: boolean): FontSizeInfo | CharInfo;
55
+ /**
56
+ * @internal
57
+ */
58
+ static _getCharInfo(char: string, fontString: string, font: SubFont): CharInfo;
59
+ private static _pushLine;
60
+ }
61
+ /**
62
+ * @internal
63
+ * TextContext.
64
+ */
65
+ export interface TextContext {
66
+ canvas: HTMLCanvasElement | OffscreenCanvas;
67
+ context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
68
+ }
69
+ /**
70
+ * @internal
71
+ * FontSizeInfo.
72
+ */
73
+ export interface FontSizeInfo {
74
+ ascent: number;
75
+ descent: number;
76
+ size: number;
77
+ }
78
+ /**
79
+ * @internal
80
+ * TextMetrics.
81
+ */
82
+ export interface TextMetrics {
83
+ width: number;
84
+ height: number;
85
+ lines: Array<string>;
86
+ lineWidths: Array<number>;
87
+ lineHeight: number;
88
+ lineMaxSizes?: Array<FontSizeInfo>;
89
+ }
@@ -1,4 +1,5 @@
1
1
  import { Color } from "@galacean/engine-math";
2
+ import { Material, ModelMesh } from ".";
2
3
  import { Engine } from "./Engine";
3
4
  import { BackgroundMode } from "./enums/BackgroundMode";
4
5
  import { BackgroundTextureFillMode } from "./enums/BackgroundTextureFillMode";
@@ -9,6 +10,8 @@ import { Texture2D } from "./texture";
9
10
  */
10
11
  export declare class Background {
11
12
  private _engine;
13
+ /** @internal */
14
+ static _premultiplySolidColor: Color;
12
15
  /**
13
16
  * Background mode.
14
17
  * @defaultValue `BackgroundMode.SolidColor`
@@ -20,6 +23,12 @@ export declare class Background {
20
23
  * @remarks When `mode` is `BackgroundMode.Sky`, the property will take effects.
21
24
  */
22
25
  readonly sky: Sky;
26
+ /** @internal */
27
+ _textureFillMode: BackgroundTextureFillMode;
28
+ /** @internal */
29
+ _mesh: ModelMesh;
30
+ /** @internal */
31
+ _material: Material;
23
32
  private _solidColor;
24
33
  private _texture;
25
34
  /**
@@ -42,11 +51,19 @@ export declare class Background {
42
51
  */
43
52
  get textureFillMode(): BackgroundTextureFillMode;
44
53
  set textureFillMode(value: BackgroundTextureFillMode);
54
+ /**
55
+ * @internal
56
+ */
57
+ destroy(): void;
45
58
  /**
46
59
  * Constructor of Background.
47
60
  * @param _engine Engine Which the background belongs to.
48
61
  */
49
62
  constructor(_engine: Engine);
63
+ /**
64
+ * @internal
65
+ */
66
+ _resizeBackgroundTexture(): void;
50
67
  private _initMesh;
51
68
  private _initMaterial;
52
69
  private _createPlane;
@@ -1,2 +1,54 @@
1
+ import { SpriteMaskInteraction } from "./2d";
2
+ import { Engine } from "./Engine";
3
+ import { RenderQueueMaskType } from "./RenderPipeline/enums/RenderQueueMaskType";
4
+ import { BlinnPhongMaterial, Material } from "./material";
5
+ import { ModelMesh } from "./mesh";
1
6
  import { RenderStateElementKey } from "./shader/enums/RenderStateElementKey";
7
+ import { Texture2D, TextureCube } from "./texture";
8
+ import { Texture2DArray } from "./texture/Texture2DArray";
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare class BasicResources {
13
+ engine: Engine;
14
+ private static _maskReadInsideRenderStates;
15
+ private static _maskReadOutsideRenderStates;
16
+ private static _maskWriteIncrementRenderStates;
17
+ private static _maskWriteDecrementRenderStates;
18
+ static getMaskInteractionRenderStates(maskInteraction: SpriteMaskInteraction): RenderStateElementMap;
19
+ static getMaskTypeRenderStates(maskType: RenderQueueMaskType): RenderStateElementMap;
20
+ /**
21
+ * Use triangle to blit texture, ref: https://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/ .
22
+ */
23
+ readonly blitMesh: ModelMesh;
24
+ readonly flipYBlitMesh: ModelMesh;
25
+ readonly blitMaterial: Material;
26
+ readonly blitScreenMaterial: Material;
27
+ readonly whiteTexture2D: Texture2D;
28
+ readonly whiteTextureCube: TextureCube;
29
+ readonly whiteTexture2DArray: Texture2DArray;
30
+ readonly uintWhiteTexture2D: Texture2D;
31
+ readonly spriteDefaultMaterial: Material;
32
+ readonly textDefaultMaterial: Material;
33
+ readonly spriteMaskDefaultMaterial: Material;
34
+ readonly meshMagentaMaterial: Material;
35
+ readonly particleMagentaMaterial: Material;
36
+ private _blinnPhongMaterial;
37
+ private _prefilteredDFGTexture;
38
+ get prefilteredDFGTexture(): Texture2D;
39
+ constructor(engine: Engine);
40
+ /**
41
+ * @internal
42
+ */
43
+ _getBlinnPhongMaterial(): BlinnPhongMaterial;
44
+ /**
45
+ * @internal
46
+ */
47
+ _initialize(): Promise<BasicResources>;
48
+ private _createBlitMesh;
49
+ private _create1x1Texture;
50
+ private _create2DMaterial;
51
+ private _createMagentaMaterial;
52
+ private _createSpriteMaskMaterial;
53
+ }
2
54
  export type RenderStateElementMap = Record<RenderStateElementKey, number | boolean>;