@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.
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/FontAtlas.d.ts +23 -1
- package/types/2d/atlas/SpriteAtlas.d.ts +8 -0
- package/types/2d/sprite/Sprite.d.ts +27 -1
- package/types/2d/sprite/SpriteMask.d.ts +43 -0
- package/types/2d/sprite/SpriteRenderer.d.ts +29 -0
- package/types/2d/text/CharInfo.d.ts +20 -1
- package/types/2d/text/CharRenderInfo.d.ts +15 -1
- package/types/2d/text/Font.d.ts +10 -0
- package/types/2d/text/SubFont.d.ts +35 -1
- package/types/2d/text/TextRenderer.d.ts +53 -0
- package/types/2d/text/TextUtils.d.ts +89 -1
- package/types/Background.d.ts +17 -0
- package/types/BasicResources.d.ts +52 -0
- package/types/Camera.d.ts +71 -1
- package/types/Canvas.d.ts +13 -0
- package/types/Component.d.ts +33 -0
- package/types/ComponentsDependencies.d.ts +34 -1
- package/types/ComponentsManager.d.ts +17 -0
- package/types/Engine.d.ts +106 -2
- package/types/Entity.d.ts +88 -0
- package/types/Polyfill.d.ts +12 -1
- package/types/RenderPipeline/BasicRenderPipeline.d.ts +3 -0
- package/types/RenderPipeline/BatcherManager.d.ts +23 -1
- package/types/RenderPipeline/CullingResults.d.ts +17 -1
- package/types/RenderPipeline/DepthOnlyPass.d.ts +18 -1
- package/types/RenderPipeline/InstanceBuffer.d.ts +28 -1
- package/types/RenderPipeline/MaskManager.d.ts +36 -1
- package/types/RenderPipeline/OpaqueTexturePass.d.ts +16 -1
- package/types/RenderPipeline/PipelineUtils.d.ts +11 -1
- package/types/RenderPipeline/PrimitiveChunk.d.ts +27 -1
- package/types/RenderPipeline/PrimitiveChunkManager.d.ts +16 -1
- package/types/RenderPipeline/RenderContext.d.ts +46 -1
- package/types/RenderPipeline/RenderElement.d.ts +9 -0
- package/types/RenderPipeline/RenderQueue.d.ts +23 -1
- package/types/RenderPipeline/RenderTargetPool.d.ts +17 -1
- package/types/RenderPipeline/SubPrimitiveChunk.d.ts +14 -1
- package/types/RenderPipeline/VertexArea.d.ts +10 -1
- package/types/RenderPipeline/VertexMergeBatcher.d.ts +11 -1
- package/types/RenderPipeline/enums/RenderQueueMaskType.d.ts +9 -1
- package/types/RenderPipeline/index.d.ts +2 -0
- package/types/Renderer.d.ts +58 -0
- package/types/Scene.d.ts +28 -0
- package/types/SceneManager.d.ts +13 -0
- package/types/Script.d.ts +40 -0
- package/types/SystemInfo.d.ts +10 -0
- package/types/Transform.d.ts +13 -0
- package/types/UpdateFlag.d.ts +3 -0
- package/types/UpdateFlagManager.d.ts +41 -1
- package/types/Utils.d.ts +20 -0
- package/types/VirtualCamera.d.ts +16 -1
- package/types/animation/AnimationClip.d.ts +5 -0
- package/types/animation/AnimationClipCurveBinding.d.ts +16 -1
- package/types/animation/Animator.d.ts +25 -0
- package/types/animation/AnimatorController.d.ts +17 -0
- package/types/animation/AnimatorControllerLayer.d.ts +9 -0
- package/types/animation/AnimatorControllerParameter.d.ts +4 -0
- package/types/animation/AnimatorState.d.ts +44 -0
- package/types/animation/AnimatorStateInstance.d.ts +8 -0
- package/types/animation/AnimatorStateMachine.d.ts +14 -0
- package/types/animation/AnimatorStateTransition.d.ts +9 -0
- package/types/animation/AnimatorStateTransitionCollection.d.ts +23 -1
- package/types/animation/StateMachineScript.d.ts +2 -0
- package/types/animation/animationCurve/AnimationArrayCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationBoolCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationColorCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationCurve.d.ts +8 -0
- package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +38 -0
- package/types/animation/animationCurve/AnimationFloatCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationQuaternionCurve.d.ts +41 -0
- package/types/animation/animationCurve/AnimationRectCurve.d.ts +18 -0
- package/types/animation/animationCurve/AnimationRefCurve.d.ts +18 -0
- package/types/animation/animationCurve/AnimationStringCurve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationVector2Curve.d.ts +39 -0
- package/types/animation/animationCurve/AnimationVector3Curve.d.ts +43 -0
- package/types/animation/animationCurve/AnimationVector4Curve.d.ts +39 -0
- package/types/animation/animationCurve/interfaces/IAnimationCurveCalculator.d.ts +18 -1
- package/types/animation/enums/AnimatorStatePlayState.d.ts +8 -1
- package/types/animation/internal/AnimationCurveLayerOwner.d.ts +15 -1
- package/types/animation/internal/AnimationEventHandler.d.ts +8 -1
- package/types/animation/internal/AnimatorLayerData.d.ts +28 -1
- package/types/animation/internal/AnimatorStateData.d.ts +14 -1
- package/types/animation/internal/AnimatorStatePlayData.d.ts +27 -1
- package/types/animation/internal/AnimatorTempValue.d.ts +12 -1
- package/types/animation/internal/animationCurveOwner/AnimationCurveOwner.d.ts +39 -0
- package/types/animation/internal/animationCurveOwner/assembler/BlendShapeWeightsAnimationCurveOwnerAssembler.d.ts +12 -1
- package/types/animation/internal/animationCurveOwner/assembler/IAnimationCurveOwnerAssembler.d.ts +10 -1
- package/types/animation/internal/animationCurveOwner/assembler/PositionAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/RotationAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/ScaleAnimationCurveOwnerAssembler.d.ts +13 -1
- package/types/animation/internal/animationCurveOwner/assembler/UniversalAnimationCurveOwnerAssembler.d.ts +23 -1
- package/types/asset/GraphicsResource.d.ts +10 -0
- package/types/asset/IReferable.d.ts +8 -0
- package/types/asset/ReferResource.d.ts +28 -0
- package/types/asset/RenderingStatistics.d.ts +8 -0
- package/types/asset/ResourceManager.d.ts +94 -4
- package/types/audio/AudioClip.d.ts +8 -0
- package/types/audio/AudioManager.d.ts +14 -0
- package/types/audio/AudioSource.d.ts +17 -0
- package/types/base/EngineObject.d.ts +4 -0
- package/types/base/Time.d.ts +13 -0
- package/types/clone/CloneDecorators.d.ts +20 -0
- package/types/clone/CloneUtil.d.ts +30 -1
- package/types/clone/ComponentCloner.d.ts +11 -1
- package/types/enums/CameraType.d.ts +9 -1
- package/types/env-probe/CubeProbe.d.ts +2 -0
- package/types/graphic/Buffer.d.ts +10 -0
- package/types/graphic/BufferUtil.d.ts +5 -0
- package/types/graphic/IndexBufferBinding.d.ts +4 -0
- package/types/graphic/Mesh.d.ts +54 -0
- package/types/graphic/Primitive.d.ts +50 -1
- package/types/graphic/TransformFeedback.d.ts +46 -1
- package/types/graphic/TransformFeedbackPrimitive.d.ts +67 -1
- package/types/graphic/TransformFeedbackSimulator.d.ts +55 -1
- package/types/graphic/VertexBufferBinding.d.ts +4 -0
- package/types/input/InputManager.d.ts +19 -0
- package/types/input/enums/PointerButton.d.ts +8 -0
- package/types/input/keyboard/KeyboardManager.d.ts +41 -1
- package/types/input/pointer/Pointer.d.ts +36 -0
- package/types/input/pointer/PointerEventData.d.ts +4 -0
- package/types/input/pointer/PointerManager.d.ts +58 -0
- package/types/input/pointer/emitter/IHitResult.d.ts +11 -1
- package/types/input/pointer/emitter/PhysicsPointerEventEmitter.d.ts +20 -1
- package/types/input/wheel/WheelManager.d.ts +34 -1
- package/types/lighting/AmbientLight.d.ts +9 -0
- package/types/lighting/DirectLight.d.ts +17 -0
- package/types/lighting/Light.d.ts +2 -0
- package/types/lighting/LightManager.d.ts +57 -0
- package/types/lighting/PointLight.d.ts +17 -0
- package/types/lighting/SpotLight.d.ts +17 -0
- package/types/lighting/ambientOcclusion/AmbientOcclusion.d.ts +4 -0
- package/types/lighting/ambientOcclusion/ScalableAmbientObscurancePass.d.ts +38 -1
- package/types/material/BaseMaterial.d.ts +4 -0
- package/types/material/Material.d.ts +2 -0
- package/types/mesh/BlendShape.d.ts +13 -0
- package/types/mesh/BlendShapeFrame.d.ts +7 -0
- package/types/mesh/BlendShapeManager.d.ts +101 -1
- package/types/mesh/MeshRenderer.d.ts +37 -0
- package/types/mesh/ModelMesh.d.ts +18 -0
- package/types/mesh/PrimitiveMesh.d.ts +28 -0
- package/types/mesh/PrimitiveMeshRestorer.d.ts +107 -0
- package/types/mesh/Skin.d.ts +10 -0
- package/types/mesh/SkinnedMeshRenderer.d.ts +21 -0
- package/types/particle/ParticleBufferUtils.d.ts +26 -1
- package/types/particle/ParticleGenerator.d.ts +102 -0
- package/types/particle/ParticleRenderer.d.ts +55 -0
- package/types/particle/ParticleTransformFeedbackSimulator.d.ts +52 -1
- package/types/particle/enums/ParticleRandomSubSeeds.d.ts +25 -1
- package/types/particle/enums/attributes/BillboardParticleVertexAttribute.d.ts +6 -1
- package/types/particle/enums/attributes/ParticleFeedbackVertexAttribute.d.ts +8 -1
- package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +17 -1
- package/types/particle/modules/ColorOverLifetimeModule.d.ts +12 -0
- package/types/particle/modules/CustomDataModule.d.ts +5 -0
- package/types/particle/modules/EmissionModule.d.ts +28 -0
- package/types/particle/modules/ForceOverLifetimeModule.d.ts +16 -1
- package/types/particle/modules/LimitVelocityOverLifetimeModule.d.ts +20 -1
- package/types/particle/modules/MainModule.d.ts +33 -1
- package/types/particle/modules/NoiseModule.d.ts +12 -1
- package/types/particle/modules/ParticleCompositeCurve.d.ts +37 -0
- package/types/particle/modules/ParticleCurve.d.ts +28 -0
- package/types/particle/modules/ParticleGeneratorModule.d.ts +7 -0
- package/types/particle/modules/ParticleGradient.d.ts +16 -0
- package/types/particle/modules/RotationOverLifetimeModule.d.ts +12 -0
- package/types/particle/modules/SizeOverLifetimeModule.d.ts +16 -0
- package/types/particle/modules/SubEmitter.d.ts +3 -0
- package/types/particle/modules/SubEmittersModule.d.ts +17 -0
- package/types/particle/modules/TextureSheetAnimationModule.d.ts +14 -1
- package/types/particle/modules/VelocityOverLifetimeModule.d.ts +28 -1
- package/types/particle/modules/shape/BaseShape.d.ts +33 -1
- package/types/particle/modules/shape/BoxShape.d.ts +13 -1
- package/types/particle/modules/shape/CircleShape.d.ts +13 -0
- package/types/particle/modules/shape/ConeShape.d.ts +13 -0
- package/types/particle/modules/shape/HemisphereShape.d.ts +13 -0
- package/types/particle/modules/shape/MeshShape.d.ts +17 -0
- package/types/particle/modules/shape/ShapeUtils.d.ts +13 -1
- package/types/particle/modules/shape/SphereShape.d.ts +13 -0
- package/types/physics/CharacterController.d.ts +21 -0
- package/types/physics/Collider.d.ts +39 -0
- package/types/physics/Collision.d.ts +3 -0
- package/types/physics/DynamicCollider.d.ts +14 -0
- package/types/physics/PhysicsMaterial.d.ts +3 -0
- package/types/physics/PhysicsScene.d.ts +51 -0
- package/types/physics/StaticCollider.d.ts +5 -0
- package/types/physics/enums/ColliderShapeChangeFlag.d.ts +8 -1
- package/types/physics/enums/HingeJointFlag.d.ts +14 -1
- package/types/physics/joint/HingeJoint.d.ts +4 -0
- package/types/physics/joint/Joint.d.ts +20 -0
- package/types/physics/joint/JointLimits.d.ts +3 -0
- package/types/physics/joint/JointMotor.d.ts +3 -0
- package/types/physics/shape/ColliderShape.d.ts +17 -0
- package/types/physics/shape/MeshColliderShape.d.ts +4 -0
- package/types/postProcess/FinalPass.d.ts +19 -1
- package/types/postProcess/PostProcess.d.ts +2 -0
- package/types/postProcess/PostProcessEffect.d.ts +4 -0
- package/types/postProcess/PostProcessEffectParameter.d.ts +4 -0
- package/types/postProcess/PostProcessManager.d.ts +43 -0
- package/types/postProcess/effects/BloomEffect.d.ts +25 -0
- package/types/postProcess/effects/TonemappingEffect.d.ts +3 -0
- package/types/renderingHardwareInterface/IPlatformTransformFeedback.d.ts +36 -1
- package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +40 -1
- package/types/shader/Shader.d.ts +22 -0
- package/types/shader/ShaderBlockProperty.d.ts +19 -1
- package/types/shader/ShaderData.d.ts +29 -0
- package/types/shader/ShaderFactory.d.ts +23 -0
- package/types/shader/ShaderMacro.d.ts +15 -0
- package/types/shader/ShaderMacroCollection.d.ts +57 -1
- package/types/shader/ShaderMacroProcessor.d.ts +72 -1
- package/types/shader/ShaderPass.d.ts +38 -0
- package/types/shader/ShaderProgram.d.ts +91 -1
- package/types/shader/ShaderProgramMap.d.ts +20 -1
- package/types/shader/ShaderProperty.d.ts +17 -0
- package/types/shader/ShaderTagKey.d.ts +2 -0
- package/types/shader/ShaderUniform.d.ts +49 -1
- package/types/shader/ShaderUniformBlock.d.ts +9 -1
- package/types/shader/enums/ConstantBufferBindingPoint.d.ts +7 -1
- package/types/shader/state/BlendState.d.ts +14 -0
- package/types/shader/state/DepthState.d.ts +14 -0
- package/types/shader/state/RasterState.d.ts +17 -0
- package/types/shader/state/RenderState.d.ts +11 -0
- package/types/shader/state/StencilState.d.ts +13 -0
- package/types/shadow/CascadedShadowCasterPass.d.ts +5 -0
- package/types/shadow/ShadowSliceData.d.ts +13 -1
- package/types/shadow/ShadowUtils.d.ts +43 -1
- package/types/sky/Sky.d.ts +9 -0
- package/types/texture/RenderTarget.d.ts +21 -0
- package/types/texture/Texture.d.ts +21 -0
- package/types/texture/Texture2D.d.ts +4 -0
- package/types/texture/Texture2DArray.d.ts +4 -0
- package/types/texture/TextureCube.d.ts +4 -0
- package/types/texture/TextureUtils.d.ts +16 -1
- package/types/trail/TrailRenderer.d.ts +5 -0
- package/types/ui/IUICanvas.d.ts +16 -1
- package/types/utils/DisorderedArray.d.ts +2 -0
- 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.
|
|
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.
|
|
21
|
+
"@galacean/engine-math": "2.0.0-alpha.45"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@galacean/engine-design": "2.0.0-alpha.
|
|
24
|
+
"@galacean/engine-design": "2.0.0-alpha.45"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
}
|
package/types/2d/text/Font.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
+
}
|
package/types/Background.d.ts
CHANGED
|
@@ -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>;
|