@galacean/engine-core 1.6.13 → 2.0.0-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "1.6.13",
3
+ "version": "2.0.0-alpha.1",
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": "1.6.13"
21
+ "@galacean/engine-math": "2.0.0-alpha.1"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "1.6.13"
24
+ "@galacean/engine-design": "2.0.0-alpha.1"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -134,6 +134,8 @@ export declare class Animator extends Component {
134
134
  private _preparePlayOwner;
135
135
  private _applyStateTransitions;
136
136
  private _checkNoExitTimeTransition;
137
+ private _checkCrossFadeInterrupt;
138
+ private _checkNoExitTimeTransitions;
137
139
  private _checkSubTransition;
138
140
  private _checkBackwardsSubTransition;
139
141
  private _applyTransitionsByCondition;
@@ -5,10 +5,13 @@ export declare class AudioManager {
5
5
  private static _context;
6
6
  private static _gainNode;
7
7
  private static _resumePromise;
8
+ private static _needsUserGestureResume;
8
9
  /**
9
10
  * Resume the audio context.
10
11
  * @remarks On iOS Safari, calling this within a user gesture (e.g., click/touch event handler) can pre-unlock audio and reduce playback delay.
11
12
  * @returns A promise that resolves when the audio context is resumed
12
13
  */
13
14
  static resume(): Promise<void>;
15
+ private static _onVisibilityChange;
16
+ private static _resumeAfterInterruption;
14
17
  }
@@ -0,0 +1,36 @@
1
+ import { Color } from "@galacean/engine-math";
2
+ import { Engine } from "../Engine";
3
+ import { Shader } from "../shader";
4
+ import { Texture2D } from "../texture";
5
+ import { BaseMaterial } from "./BaseMaterial";
6
+ /**
7
+ * Base material for visual effects like particles and trails.
8
+ */
9
+ export declare class EffectMaterial extends BaseMaterial {
10
+ /**
11
+ * Base color.
12
+ */
13
+ get baseColor(): Color;
14
+ set baseColor(value: Color);
15
+ /**
16
+ * Base texture.
17
+ */
18
+ get baseTexture(): Texture2D;
19
+ set baseTexture(value: Texture2D);
20
+ /**
21
+ * Emissive color.
22
+ */
23
+ get emissiveColor(): Color;
24
+ set emissiveColor(value: Color);
25
+ /**
26
+ * Emissive texture.
27
+ */
28
+ get emissiveTexture(): Texture2D;
29
+ set emissiveTexture(value: Texture2D);
30
+ /**
31
+ * Create an effect material instance.
32
+ * @param engine - Engine to which the material belongs
33
+ * @param shader - Shader used by the material
34
+ */
35
+ constructor(engine: Engine, shader: Shader);
36
+ }
@@ -1,33 +1,11 @@
1
- import { Color } from "@galacean/engine-math";
2
1
  import { Engine } from "../Engine";
3
- import { BaseMaterial } from "../material/BaseMaterial";
4
- import { Texture2D } from "../texture/Texture2D";
2
+ import { EffectMaterial } from "../material/EffectMaterial";
5
3
  /**
6
4
  * Particle Material.
7
5
  */
8
- export declare class ParticleMaterial extends BaseMaterial {
6
+ export declare class ParticleMaterial extends EffectMaterial {
9
7
  /**
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
- * Emissive color.
21
- */
22
- get emissiveColor(): Color;
23
- set emissiveColor(value: Color);
24
- /**
25
- * Emissive texture.
26
- */
27
- get emissiveTexture(): Texture2D;
28
- set emissiveTexture(value: Texture2D);
29
- /**
30
- * Create a unlit material instance.
8
+ * Create a particle material instance.
31
9
  * @param engine - Engine to which the material belongs
32
10
  */
33
11
  constructor(engine: Engine);
@@ -1,5 +1,6 @@
1
1
  import { Quaternion, Vector3 } from "@galacean/engine-math";
2
2
  import { Collider } from "./Collider";
3
+ import { ColliderShape } from "./shape/ColliderShape";
3
4
  /**
4
5
  * A dynamic collider can act with self-defined movement or physical force.
5
6
  */
@@ -151,6 +152,10 @@ export declare class DynamicCollider extends Collider {
151
152
  * Forces a collider to wake up.
152
153
  */
153
154
  wakeUp(): void;
155
+ /**
156
+ * @inheritdoc
157
+ */
158
+ addShape(shape: ColliderShape): void;
154
159
  protected _syncNative(): void;
155
160
  private _setMassAndUpdateInertia;
156
161
  private _setLinearVelocity;
@@ -0,0 +1,59 @@
1
+ import { Mesh } from "../../graphic/Mesh";
2
+ import { ColliderShape } from "./ColliderShape";
3
+ /**
4
+ * Physical collider shape for mesh.
5
+ * @remarks
6
+ * - Triangle mesh (isConvex=false) works with StaticCollider or kinematic DynamicCollider
7
+ * - Convex mesh (isConvex=true) works with both StaticCollider and DynamicCollider
8
+ * @see https://nvidia-omniverse.github.io/PhysX/physx/5.4.1/docs/Geometry.html#triangle-meshes
9
+ */
10
+ export declare class MeshColliderShape extends ColliderShape {
11
+ private _isConvex;
12
+ private _vertices;
13
+ private _indices;
14
+ private _doubleSided;
15
+ private _tightBounds;
16
+ private _indicesU16Cache;
17
+ /**
18
+ * Whether to use convex mesh mode.
19
+ * @remarks
20
+ * - Convex mesh: Works with all collider types, PhysX auto-computes convex hull
21
+ * - Triangle mesh: Works with StaticCollider or kinematic DynamicCollider, requires indices
22
+ * - After changing this property, you must call {@link setMesh} or {@link setMeshData} again to apply the change
23
+ */
24
+ get isConvex(): boolean;
25
+ set isConvex(value: boolean);
26
+ /**
27
+ * Whether the triangle mesh should be double-sided for collision detection.
28
+ * @remarks Only applies to triangle mesh (non-convex).
29
+ */
30
+ get doubleSided(): boolean;
31
+ set doubleSided(value: boolean);
32
+ /**
33
+ * Whether to use tight bounds for convex mesh.
34
+ * @remarks Only applies to convex mesh.
35
+ */
36
+ get tightBounds(): boolean;
37
+ set tightBounds(value: boolean);
38
+ /**
39
+ * Create a MeshColliderShape.
40
+ * @param isConvex - Whether to use convex mesh mode (default: false)
41
+ */
42
+ constructor(isConvex?: boolean);
43
+ /**
44
+ * Set mesh data directly from arrays.
45
+ * @param vertices - Vertex positions as Float32Array (x, y, z per vertex)
46
+ * @param indices - Triangle indices (required for triangle mesh, optional for convex)
47
+ */
48
+ setMeshData(vertices: Float32Array, indices?: Uint16Array | Uint32Array): void;
49
+ /**
50
+ * Set mesh data from a Mesh object.
51
+ * @param mesh - The mesh to extract vertex and index data from
52
+ * @remarks The mesh must have accessible data (not released after upload)
53
+ */
54
+ setMesh(mesh: Mesh): void;
55
+ protected _syncNative(): void;
56
+ private _extractMeshData;
57
+ private _extractIndices;
58
+ private _updateNativeMesh;
59
+ }
@@ -3,3 +3,4 @@ export { BoxColliderShape } from "./BoxColliderShape";
3
3
  export { SphereColliderShape } from "./SphereColliderShape";
4
4
  export { PlaneColliderShape } from "./PlaneColliderShape";
5
5
  export { CapsuleColliderShape } from "./CapsuleColliderShape";
6
+ export { MeshColliderShape } from "./MeshColliderShape";
@@ -1,5 +1,16 @@
1
1
  import { Engine } from "../Engine";
2
- import { Material } from "../material/Material";
3
- export declare class TrailMaterial extends Material {
2
+ import { EffectMaterial } from "../material/EffectMaterial";
3
+ /**
4
+ * Trail material.
5
+ */
6
+ export declare class TrailMaterial extends EffectMaterial {
7
+ /**
8
+ * Create a trail material instance.
9
+ * @param engine - Engine to which the material belongs
10
+ */
4
11
  constructor(engine: Engine);
12
+ /**
13
+ * @inheritdoc
14
+ */
15
+ clone(): TrailMaterial;
5
16
  }
@@ -1,35 +1,92 @@
1
- import { Entity } from "../Entity";
2
- import { MeshRenderer } from "../mesh/MeshRenderer";
3
- import { Texture2D } from "../texture";
1
+ import { BoundingBox } from "@galacean/engine-math";
2
+ import { RenderContext } from "../RenderPipeline/RenderContext";
3
+ import { Renderer } from "../Renderer";
4
+ import { ParticleCurve } from "../particle/modules/ParticleCurve";
5
+ import { ParticleGradient } from "../particle/modules/ParticleGradient";
6
+ import { TrailTextureMode } from "./enums/TrailTextureMode";
4
7
  /**
5
- * @deprecated
8
+ * Trail Renderer Component.
9
+ * Renders a trail behind a moving object.
6
10
  */
7
- export declare class TrailRenderer extends MeshRenderer {
8
- private _vertexStride;
9
- private _vertices;
11
+ export declare class TrailRenderer extends Renderer {
12
+ private static readonly VERTEX_STRIDE;
13
+ private static readonly VERTEX_FLOAT_STRIDE;
14
+ private static readonly DISTANCE_OFFSET;
15
+ private static readonly POINT_FLOAT_STRIDE;
16
+ private static readonly POINT_BYTE_STRIDE;
17
+ private static readonly POINT_INCREASE_COUNT;
18
+ private static _trailParamsProp;
19
+ private static _distanceParamsProp;
20
+ private static _widthCurveProp;
21
+ private static _colorKeysProp;
22
+ private static _alphaKeysProp;
23
+ private static _curveMaxTimeProp;
24
+ private static _tempVector3;
25
+ /** Whether the trail is being created as the object moves. */
26
+ emitting: boolean;
27
+ /** The minimum distance the object must move before a new trail segment is added, in world units. */
28
+ minVertexDistance: number;
29
+ /** The curve describing the trail width from start to end. */
30
+ widthCurve: ParticleCurve;
31
+ /** The gradient describing the trail color from start to end. */
32
+ colorGradient: ParticleGradient;
33
+ private _trailParams;
34
+ private _distanceParams;
35
+ private _curveMaxTime;
36
+ private _time;
37
+ private _primitive;
38
+ private _mainSubPrimitive;
39
+ private _wrapSubPrimitive;
10
40
  private _vertexBuffer;
11
- private _stroke;
12
- private _minSeg;
13
- private _lifetime;
14
- private _maxPointNum;
15
- private _points;
16
- private _pointStates;
17
- private _strapPoints;
18
- private _curPointNum;
19
- private _prePointsNum;
41
+ private _vertices;
42
+ private _firstActiveElement;
43
+ private _firstNewElement;
44
+ private _firstFreeElement;
45
+ private _firstRetiredElement;
46
+ private _currentPointCapacity;
47
+ private _bufferResized;
48
+ private _lastPosition;
49
+ private _hasLastPosition;
50
+ private _cumulativeDistance;
51
+ private _playTime;
52
+ private _lastPlayTimeUpdateFrameCount;
53
+ /**
54
+ * How long the trail takes to fade out, in seconds.
55
+ */
56
+ get time(): number;
57
+ set time(value: number);
58
+ /**
59
+ * The width of the trail.
60
+ */
61
+ get width(): number;
62
+ set width(value: number);
63
+ /**
64
+ * The texture mapping mode for the trail.
65
+ */
66
+ get textureMode(): TrailTextureMode;
67
+ set textureMode(value: TrailTextureMode);
20
68
  /**
21
- * @deprecated
69
+ * The texture scale when using Tile texture mode.
22
70
  */
23
- constructor(entity: Entity, props: any);
71
+ get textureScale(): number;
72
+ set textureScale(value: number);
24
73
  /**
25
- * @deprecated
26
- * Set trail texture.
27
- * @param texture
74
+ * Clear all trail points.
28
75
  */
29
- setTexture(texture: Texture2D): void;
76
+ clear(): void;
77
+ protected _update(context: RenderContext): void;
78
+ protected _render(context: RenderContext): void;
79
+ protected _updateBounds(worldBounds: BoundingBox): void;
80
+ private _mergePointPosition;
81
+ protected _onDestroy(): void;
82
+ private _updateAndGetPlayTime;
30
83
  private _initGeometry;
31
- private _updateStrapVertices;
32
- private _updateStrapCoords;
33
- private _projectOnVector;
34
- private _projectOnPlane;
84
+ private _resizeBuffer;
85
+ private _retireActivePoints;
86
+ private _freeRetiredPoints;
87
+ private _emitNewPoint;
88
+ private _addPoint;
89
+ private _getActivePointCount;
90
+ private _addActivePointsToVertexBuffer;
91
+ private _addSubRenderElement;
35
92
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Texture mapping mode for trails.
3
+ */
4
+ export declare enum TrailTextureMode {
5
+ /** Map the texture once along the entire length of the trail. */
6
+ Stretch = 0,
7
+ /** Repeat the texture along the trail based on its length in world units. */
8
+ Tile = 1
9
+ }
@@ -1,2 +1,3 @@
1
1
  export { TrailRenderer } from "./TrailRenderer";
2
2
  export { TrailMaterial } from "./TrailMaterial";
3
+ export { TrailTextureMode } from "./enums/TrailTextureMode";