@galacean/engine-core 2.0.0-alpha.52 → 2.0.0-alpha.53
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 +373 -352
- package/dist/main.js.map +1 -1
- package/dist/module.js +373 -353
- package/dist/module.js.map +1 -1
- package/package.json +3 -5
- package/types/physics/Collider.d.ts +1 -3
- package/types/physics/DynamicCollider.d.ts +1 -2
- package/types/physics/PhysicsScene.d.ts +43 -1
- package/types/physics/shape/ColliderShape.d.ts +5 -2
- package/types/shader/Shader.d.ts +11 -2
- package/types/shader/ShaderFactory.d.ts +9 -0
- package/types/shader/ShaderMacroProcessor.d.ts +10 -28
- package/types/shader/ShaderPass.d.ts +0 -2
- package/types/shader/enums/ShaderPreprocessorDirective.d.ts +7 -1
- package/types/shader/index.d.ts +1 -0
- package/types/physics/enums/ColliderShapeChangeFlag.d.ts +0 -8
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.53",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -18,10 +18,8 @@
|
|
|
18
18
|
"types/**/*"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@galacean/engine-math": "2.0.0-alpha.
|
|
22
|
-
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@galacean/engine-design": "2.0.0-alpha.52"
|
|
21
|
+
"@galacean/engine-math": "2.0.0-alpha.53",
|
|
22
|
+
"@galacean/engine-design": "2.0.0-alpha.53"
|
|
25
23
|
},
|
|
26
24
|
"scripts": {
|
|
27
25
|
"b:types": "tsc"
|
|
@@ -5,7 +5,6 @@ import { Component } from "../Component";
|
|
|
5
5
|
import { Entity } from "../Entity";
|
|
6
6
|
import { Layer } from "../Layer";
|
|
7
7
|
import { ColliderShape } from "./shape/ColliderShape";
|
|
8
|
-
import { ColliderShapeChangeFlag } from "./enums/ColliderShapeChangeFlag";
|
|
9
8
|
/**
|
|
10
9
|
* Base class for all colliders.
|
|
11
10
|
* @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
|
|
@@ -72,7 +71,7 @@ export declare class Collider extends Component implements ICloneHook<Collider>
|
|
|
72
71
|
/**
|
|
73
72
|
* @internal
|
|
74
73
|
*/
|
|
75
|
-
_handleShapesChanged(
|
|
74
|
+
_handleShapesChanged(): void;
|
|
76
75
|
/**
|
|
77
76
|
* @internal
|
|
78
77
|
*/
|
|
@@ -84,5 +83,4 @@ export declare class Collider extends Component implements ICloneHook<Collider>
|
|
|
84
83
|
protected _onDestroy(): void;
|
|
85
84
|
protected _addNativeShape(shape: ColliderShape): void;
|
|
86
85
|
protected _removeNativeShape(shape: ColliderShape): void;
|
|
87
|
-
private _setCollisionLayer;
|
|
88
86
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Quaternion, Vector3 } from "@galacean/engine-math";
|
|
2
2
|
import { Entity } from "../Entity";
|
|
3
3
|
import { Collider } from "./Collider";
|
|
4
|
-
import { ColliderShapeChangeFlag } from "./enums/ColliderShapeChangeFlag";
|
|
5
4
|
import { ColliderShape } from "./shape/ColliderShape";
|
|
6
5
|
/**
|
|
7
6
|
* A dynamic collider can act with self-defined movement or physical force.
|
|
@@ -188,7 +187,7 @@ export declare class DynamicCollider extends Collider {
|
|
|
188
187
|
/**
|
|
189
188
|
* @internal
|
|
190
189
|
*/
|
|
191
|
-
_handleShapesChanged(
|
|
190
|
+
_handleShapesChanged(): void;
|
|
192
191
|
protected _syncNative(): void;
|
|
193
192
|
private _setMassAndUpdateInertia;
|
|
194
193
|
private _setLinearVelocity;
|
|
@@ -12,6 +12,8 @@ export declare class PhysicsScene {
|
|
|
12
12
|
private static _collision;
|
|
13
13
|
private static _identityQuaternion;
|
|
14
14
|
private static _tempDirection;
|
|
15
|
+
private static _raycastHitPool;
|
|
16
|
+
private static _raycastSeenHits;
|
|
15
17
|
private static _scriptIndexSetter;
|
|
16
18
|
private _scene;
|
|
17
19
|
private _restTime;
|
|
@@ -90,6 +92,46 @@ export declare class PhysicsScene {
|
|
|
90
92
|
* @returns Returns True if the ray intersects with a collider, otherwise false.
|
|
91
93
|
*/
|
|
92
94
|
raycast(ray: Ray, distance: number, layerMask: Layer, outHitResult: HitResult): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Casts a ray and writes all hits in unspecified order.
|
|
97
|
+
* @param ray - World-space ray; its direction is normalized internally
|
|
98
|
+
* @param outHitResults - Receives the hits, reusing existing objects; resized to the hit count
|
|
99
|
+
* @returns Whether any hit was found
|
|
100
|
+
*
|
|
101
|
+
* @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
|
|
102
|
+
* Copy values to retain them. Unused objects are cleared and recycled for other queries.
|
|
103
|
+
* Reuse the array without clearing it; manually removed objects are not pooled.
|
|
104
|
+
* Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
|
|
105
|
+
*/
|
|
106
|
+
raycastAll(ray: Ray, outHitResults: HitResult[]): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Casts a ray and writes all hits in unspecified order.
|
|
109
|
+
* @param ray - World-space ray; its direction is normalized internally
|
|
110
|
+
* @param distance - Maximum query distance; non-positive values return no hits
|
|
111
|
+
* @param outHitResults - Receives the hits, reusing existing objects; resized to the hit count
|
|
112
|
+
* @returns Whether any hit was found
|
|
113
|
+
*
|
|
114
|
+
* @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
|
|
115
|
+
* Copy values to retain them. Unused objects are cleared and recycled for other queries.
|
|
116
|
+
* Reuse the array without clearing it; manually removed objects are not pooled.
|
|
117
|
+
* Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
|
|
118
|
+
*/
|
|
119
|
+
raycastAll(ray: Ray, distance: number, outHitResults: HitResult[]): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Casts a ray and optionally writes all hits in unspecified order.
|
|
122
|
+
* @param ray - World-space ray; its direction is normalized internally
|
|
123
|
+
* @param distance - Maximum query distance; defaults to `Number.MAX_VALUE`
|
|
124
|
+
* @param layerMask - Collision layers to include; defaults to `Layer.Everything`
|
|
125
|
+
* @param outHitResults - Receives the hits; resized to the hit count. Omit to test for a hit only
|
|
126
|
+
* @returns Whether any hit was found
|
|
127
|
+
*
|
|
128
|
+
* @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
|
|
129
|
+
* Copy values to retain them. Unused objects are cleared and recycled for other queries.
|
|
130
|
+
* Reuse the array without clearing it; manually removed objects are not pooled.
|
|
131
|
+
* Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
|
|
132
|
+
* Non-positive distances or directions that cannot be normalized clear the output; hits at distance 0 are ignored.
|
|
133
|
+
*/
|
|
134
|
+
raycastAll(ray: Ray, distance?: number, layerMask?: Layer, outHitResults?: HitResult[]): boolean;
|
|
93
135
|
/**
|
|
94
136
|
* Casts a box through the Scene and returns true if there is any hit.
|
|
95
137
|
* @param center - The center of the box
|
|
@@ -320,7 +362,7 @@ export declare class PhysicsScene {
|
|
|
320
362
|
private _dispatchEvents;
|
|
321
363
|
private static _normalizeDirection;
|
|
322
364
|
private _setGravity;
|
|
323
|
-
private _createPreFilter;
|
|
324
365
|
private _createHitCallback;
|
|
366
|
+
private _setHitResult;
|
|
325
367
|
private _clearHitResult;
|
|
326
368
|
}
|
|
@@ -18,15 +18,18 @@ export declare abstract class ColliderShape extends DataObject implements IClone
|
|
|
18
18
|
protected _id: number;
|
|
19
19
|
protected _material: PhysicsMaterial;
|
|
20
20
|
private _isTrigger;
|
|
21
|
+
private _isSceneQuery;
|
|
21
22
|
private _rotation;
|
|
22
23
|
private _position;
|
|
23
24
|
private _contactOffset;
|
|
24
25
|
/**
|
|
25
26
|
* @internal
|
|
26
27
|
* @beta
|
|
27
|
-
* Whether
|
|
28
|
+
* Whether this shape participates in scene queries, including raycasts, shape casts, and overlap queries.
|
|
29
|
+
* This does not affect collision response.
|
|
28
30
|
*/
|
|
29
|
-
isSceneQuery: boolean;
|
|
31
|
+
get isSceneQuery(): boolean;
|
|
32
|
+
set isSceneQuery(value: boolean);
|
|
30
33
|
/**
|
|
31
34
|
* Collider owner of this shape.
|
|
32
35
|
*/
|
package/types/shader/Shader.d.ts
CHANGED
|
@@ -33,13 +33,12 @@ export declare class Shader implements IReferable {
|
|
|
33
33
|
*
|
|
34
34
|
* @param shaderSource - Shader code
|
|
35
35
|
* @param platformTarget - Shader platform target, @defaultValue ShaderLanguage.GLSLES100
|
|
36
|
-
* @param path - Shader location path, used to resolve relative `#include` paths in ShaderLab source
|
|
37
36
|
* @returns The shader, or `undefined` if its name already exists.
|
|
38
37
|
*
|
|
39
38
|
* @throws
|
|
40
39
|
* Throw string exception if the shader compiler has not been enabled properly.
|
|
41
40
|
*/
|
|
42
|
-
static create(shaderSource: string, platformTarget?: ShaderLanguage
|
|
41
|
+
static create(shaderSource: string, platformTarget?: ShaderLanguage): Shader | undefined;
|
|
43
42
|
/**
|
|
44
43
|
* Create a shader.
|
|
45
44
|
* @param name - Name of the shader
|
|
@@ -54,6 +53,16 @@ export declare class Shader implements IReferable {
|
|
|
54
53
|
* @returns The shader, or `undefined` if its name already exists.
|
|
55
54
|
*/
|
|
56
55
|
static create(name: string, subShaders: SubShader[]): Shader | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a shader while retaining loader-owned source location metadata for relative includes.
|
|
58
|
+
* @param shaderSource - Complete ShaderLab source.
|
|
59
|
+
* @param platformTarget - Shader backend target.
|
|
60
|
+
* @param sourceFile - Canonical source location supplied by an asset loader or authoring tool.
|
|
61
|
+
* @returns The compiled shader, or `undefined` if its name already exists.
|
|
62
|
+
* @throws When the shader compiler is unavailable or a pass cannot be compiled.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
static _createFromSource(shaderSource: string, platformTarget?: ShaderLanguage, sourceFile?: string): Shader | undefined;
|
|
57
66
|
/**
|
|
58
67
|
* Find a shader by name.
|
|
59
68
|
* @param name - Name of the shader
|
|
@@ -22,11 +22,20 @@ export declare class ShaderFactory {
|
|
|
22
22
|
* Register a chunk source so `#include` resolves it.
|
|
23
23
|
* @param includeName - The path key referenced in `#include "..."`.
|
|
24
24
|
* @param includeSource - GLSL chunk source text.
|
|
25
|
+
* @throws Error when the key is empty, malformed, or already registered after normalization.
|
|
25
26
|
*/
|
|
26
27
|
static registerInclude(includeName: string, includeSource: string): void;
|
|
27
28
|
/**
|
|
28
29
|
* Remove a registered shader chunk.
|
|
29
30
|
* @param includeName - The path key passed to `registerInclude`.
|
|
31
|
+
* @throws Error when the key is empty or malformed.
|
|
32
|
+
*/
|
|
33
|
+
static unregisterInclude(includeName: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Remove a registered shader chunk.
|
|
36
|
+
* @param includeName - The path key passed to `registerInclude`.
|
|
37
|
+
* @deprecated Use `unregisterInclude`.
|
|
38
|
+
* @throws Error when the key is empty or malformed.
|
|
30
39
|
*/
|
|
31
40
|
static unRegisterInclude(includeName: string): void;
|
|
32
41
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ShaderInstruction } from "@galacean/engine-design";
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -6,16 +6,21 @@ export declare class ShaderMacroProcessor {
|
|
|
6
6
|
private static _valueMacros;
|
|
7
7
|
private static _funcMacros;
|
|
8
8
|
private static _shaderChunks;
|
|
9
|
+
private static readonly _declarationGroups;
|
|
10
|
+
private static readonly _activeDeclarations;
|
|
11
|
+
private static readonly _ownedChunks;
|
|
12
|
+
private static readonly _references;
|
|
13
|
+
private static readonly _reachableDeclarations;
|
|
14
|
+
private static readonly _pendingDeclarations;
|
|
9
15
|
private static _out;
|
|
10
|
-
private static _expandedNames;
|
|
11
16
|
private static _macroFirstChars;
|
|
12
17
|
private static _macroFirstCharsDirty;
|
|
13
|
-
private static
|
|
14
|
-
private static _parsedFuncArgs;
|
|
18
|
+
private static readonly _expressionContext;
|
|
15
19
|
/**
|
|
16
20
|
* Evaluate a flat instruction array with active macros.
|
|
17
21
|
* Macros are expanded immediately when text chunks are collected,
|
|
18
22
|
* using the current macro state at that point (conforming to GLSL/C99 §6.10 standard).
|
|
23
|
+
* Declaration ownership filters buffered text after execution; it never skips macro directives.
|
|
19
24
|
* @param instructions - Pre-parsed instruction array
|
|
20
25
|
* @param macros - Active runtime macros
|
|
21
26
|
* @returns Pure GLSL string with all conditionals resolved and macros expanded
|
|
@@ -26,35 +31,12 @@ export declare class ShaderMacroProcessor {
|
|
|
26
31
|
* Returns the chunk as-is if no expandable macros exist.
|
|
27
32
|
*/
|
|
28
33
|
private static _expandChunk;
|
|
29
|
-
/**
|
|
30
|
-
* Recursively expand macro substitution results until no more macros remain.
|
|
31
|
-
* @param macroExpansion - Intermediate text from a macro substitution that may contain further macro references
|
|
32
|
-
* @param valueMacros - Current value macro definitions
|
|
33
|
-
* @param funcMacros - Current function macro definitions
|
|
34
|
-
* @param expandedNames - Macro names already on the expansion chain, prevents circular references (C99 §6.10.3.4)
|
|
35
|
-
*/
|
|
36
|
-
private static _recursiveExpandMacro;
|
|
37
|
-
/**
|
|
38
|
-
* Substitute function macro params in body.
|
|
39
|
-
*/
|
|
40
|
-
private static _expandFuncBody;
|
|
41
34
|
/**
|
|
42
35
|
* Evaluate a compound condition tree.
|
|
43
36
|
*/
|
|
44
37
|
private static _evalCondition;
|
|
45
|
-
|
|
46
|
-
* Evaluate a comparison operator.
|
|
47
|
-
*/
|
|
38
|
+
private static _evalDeferredCondition;
|
|
48
39
|
private static _compareValues;
|
|
49
|
-
/**
|
|
50
|
-
* Parse function macro call arguments.
|
|
51
|
-
* Returns reusable static result object to avoid allocation.
|
|
52
|
-
*/
|
|
53
|
-
private static _parseFuncArgs;
|
|
54
|
-
/**
|
|
55
|
-
* Replace all whole-word occurrences of `word` in `text` with `replacement`.
|
|
56
|
-
*/
|
|
57
|
-
private static _replaceWord;
|
|
58
40
|
/**
|
|
59
41
|
* Concatenate shader chunks with consecutive blank lines collapsed to a single newline.
|
|
60
42
|
*/
|
|
@@ -13,8 +13,6 @@ import { RenderState } from "./state/RenderState";
|
|
|
13
13
|
export declare class ShaderPass extends ShaderPart {
|
|
14
14
|
/** @internal */
|
|
15
15
|
static _shaderPassCounter: number;
|
|
16
|
-
/** @internal */
|
|
17
|
-
static _shaderRootPath: string;
|
|
18
16
|
private static _shaderMacroList;
|
|
19
17
|
private static _macroMap;
|
|
20
18
|
/** @internal */
|
|
@@ -12,5 +12,11 @@ export declare enum ShaderPreprocessorDirective {
|
|
|
12
12
|
Define = 7,
|
|
13
13
|
DefineVal = 8,
|
|
14
14
|
DefineFunc = 9,
|
|
15
|
-
Undef = 10
|
|
15
|
+
Undef = 10,
|
|
16
|
+
/** Activates a declaration: [ownerId, groupId, sourceScope]. */
|
|
17
|
+
Declaration = 11,
|
|
18
|
+
/** Text retained when any listed declaration is selected and reachable: [text, ...ownerIds]. */
|
|
19
|
+
OwnedText = 12,
|
|
20
|
+
/** Declaration dependency: [fromOwnerId, toOwnerId]; owner zero denotes a stage root. */
|
|
21
|
+
Reference = 13
|
|
16
22
|
}
|
package/types/shader/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { RenderQueueType } from "./enums/RenderQueueType";
|
|
|
7
7
|
export { RenderStateElementKey } from "./enums/RenderStateElementKey";
|
|
8
8
|
export { ShaderDataGroup } from "./enums/ShaderDataGroup";
|
|
9
9
|
export { ShaderLanguage } from "./enums/ShaderLanguage";
|
|
10
|
+
export { ShaderPreprocessorDirective } from "./enums/ShaderPreprocessorDirective";
|
|
10
11
|
export { ShaderPropertyType } from "./enums/ShaderPropertyType";
|
|
11
12
|
export { StencilOperation } from "./enums/StencilOperation";
|
|
12
13
|
export { Shader } from "./Shader";
|