retiam 1.0.1 → 1.0.3
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/bin/render-config.js +0 -1
- package/dist/{UTIF-CuM_xgsi.js → UTIF-Ds1s3mlY.js} +1 -1
- package/dist/{index-C7UzgTiw.js → index-B0d0AebJ.js} +15763 -15093
- package/dist/{main-CCBHkqdA.js → main-D6re07P2.js} +1 -1
- package/dist/retiam.es.js +810 -798
- package/dist/src/engine/_core/Material.d.ts +13 -18
- package/dist/src/engine/_core/Scene.d.ts +3 -0
- package/dist/src/engine/_core/SnapshotManager.d.ts +3 -0
- package/dist/src/engine/_core/VectorEntity.d.ts +14 -0
- package/dist/src/engine/animation/transform/TransformMatchingShapes.d.ts +14 -0
- package/dist/src/engine/animation/transform/TransformMatchingTex.d.ts +15 -0
- package/dist/src/engine/animation/transform/TransformMatchingText.d.ts +14 -0
- package/dist/src/engine/components/fragment/ModelFragment.d.ts +1 -6
- package/dist/src/engine/entities/composites/coordinates/Axes.d.ts +20 -0
- package/dist/src/engine/entities/composites/geometry/Arrow.d.ts +35 -0
- package/dist/src/engine/entities/composites/geometry/Arrow3D.d.ts +31 -0
- package/dist/src/engine/material/shading/CelShading.d.ts +16 -0
- package/dist/src/engine/material/shading/ClayShading.d.ts +6 -0
- package/dist/src/engine/material/shading/GoochShading.d.ts +14 -0
- package/dist/src/engine/material/shading/PBRShading.d.ts +6 -0
- package/dist/src/engine/material/shading/Shading.d.ts +17 -0
- package/dist/src/engine/material/shading/index.d.ts +5 -0
- package/dist/src/engine/render/RenderConfig.d.ts +1 -23
- package/dist/src/engine/utils/IndexInspector.d.ts +44 -0
- package/dist/src/engine/utils/PathEqualizer.d.ts +15 -0
- package/dist/src/index.d.ts +2 -0
- package/package.json +3 -2
- package/readme.md +298 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Color } from '../math/Color';
|
|
2
2
|
import { SubTexture } from '../loader/SubTexture';
|
|
3
|
-
import { ShadingStyle } from '../
|
|
3
|
+
import { Shading, ShadingStyle } from '../material/shading';
|
|
4
4
|
export type TextureSource = string | ImageBitmap | HTMLCanvasElement | OffscreenCanvas | HTMLImageElement | HTMLVideoElement | HTMLElement | SubTexture;
|
|
5
5
|
/**
|
|
6
6
|
* Bitmask flags to track which material properties were explicitly set by the user.
|
|
@@ -21,8 +21,7 @@ export declare enum MaterialFlags {
|
|
|
21
21
|
ALBEDO_IDX = 2048,
|
|
22
22
|
NORMAL_IDX = 4096,
|
|
23
23
|
NORMAL_SCALE = 8192,
|
|
24
|
-
SHADING_STYLE = 16384
|
|
25
|
-
STYLE_PARAMS = 32768
|
|
24
|
+
SHADING_STYLE = 16384
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
27
|
* Manages rendering material parameters (reflectance, roughness, metallic, normal scaling) for an [[Entity]],
|
|
@@ -52,6 +51,7 @@ export declare class Material {
|
|
|
52
51
|
readonly _emColor: Float32Array;
|
|
53
52
|
private _albedoMap?;
|
|
54
53
|
private _normalMap?;
|
|
54
|
+
private _shading;
|
|
55
55
|
/**
|
|
56
56
|
* Creates a new Material instance.
|
|
57
57
|
*
|
|
@@ -151,22 +151,17 @@ export declare class Material {
|
|
|
151
151
|
setSpecular(v: number): Material;
|
|
152
152
|
/** Sets the normal map scale strength. */
|
|
153
153
|
setNormalScale(v: number): Material;
|
|
154
|
-
/**
|
|
154
|
+
/** Surface lighting override. Null inherits the parent material or scene default. */
|
|
155
|
+
get shading(): Shading | null;
|
|
156
|
+
set shading(value: Shading | null);
|
|
157
|
+
/** Selects a shading model using its name, or -1 to inherit. */
|
|
155
158
|
get shadingStyle(): ShadingStyle | number;
|
|
156
|
-
set shadingStyle(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
set celBands(v: number);
|
|
163
|
-
get rimStrength(): number;
|
|
164
|
-
set rimStrength(v: number);
|
|
165
|
-
get rimPower(): number;
|
|
166
|
-
set rimPower(v: number);
|
|
167
|
-
setShadingStyle(v: ShadingStyle | number): Material;
|
|
168
|
-
setGooch(warm?: number, cool?: number): Material;
|
|
169
|
-
setCel(bands?: number, rimStrength?: number): Material;
|
|
159
|
+
set shadingStyle(value: ShadingStyle | number);
|
|
160
|
+
setShadingStyle(value: ShadingStyle | number): this;
|
|
161
|
+
setGooch(warm?: number, cool?: number): this;
|
|
162
|
+
setCel(bands?: number, rimStrength?: number, rimPower?: number): this;
|
|
163
|
+
/** Numeric settings interpolate within a model; model changes happen at the endpoint. */
|
|
164
|
+
interpolateShading(start: Material, target: Material, t: number): void;
|
|
170
165
|
/** Clones this material instance. */
|
|
171
166
|
copy(): Material;
|
|
172
167
|
clone(): Material;
|
|
@@ -11,6 +11,7 @@ import { Entity } from './Entity';
|
|
|
11
11
|
import { Compute, ComputeCommand } from '../compute/Compute';
|
|
12
12
|
import { RenderCommand } from './SceneInterface';
|
|
13
13
|
import { RenderConfig } from '../render/RenderConfig';
|
|
14
|
+
import { Shading } from '../material/shading';
|
|
14
15
|
import { Pass } from '../render/frame_graph/Pass';
|
|
15
16
|
import { GroupAnimator } from '../animation/GroupAnimator';
|
|
16
17
|
import { SnapshotManager } from './SnapshotManager';
|
|
@@ -386,6 +387,8 @@ export declare class Scene {
|
|
|
386
387
|
*/
|
|
387
388
|
onAfterReset(): void;
|
|
388
389
|
enableFrameFeedback(): FrameFeedbackFeature;
|
|
390
|
+
/** Default surface lighting for this scene; individual materials can override it. */
|
|
391
|
+
shading: Shading;
|
|
389
392
|
_renderConfig: RenderConfig;
|
|
390
393
|
get renderConfig(): RenderConfig;
|
|
391
394
|
addCompute(...compute_commands: ComputeCommand[]): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Scene } from './Scene';
|
|
2
|
+
import { Shading } from '../material/shading';
|
|
2
3
|
export interface EntitySnapshot {
|
|
3
4
|
id: number;
|
|
4
5
|
visibility: boolean;
|
|
5
6
|
stateData: Float32Array;
|
|
7
|
+
shading?: Shading | null;
|
|
6
8
|
}
|
|
7
9
|
export interface AnimationSnapshot {
|
|
8
10
|
type: string;
|
|
@@ -30,6 +32,7 @@ export interface SceneSnapshot {
|
|
|
30
32
|
entities: EntitySnapshot[];
|
|
31
33
|
animations: AnimationSnapshot[];
|
|
32
34
|
isPaused: boolean;
|
|
35
|
+
shading?: Shading;
|
|
33
36
|
}
|
|
34
37
|
/**
|
|
35
38
|
* Manages deterministic scene state checkpoints and snapshots.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IndexInfo, ShowIndicesOptions } from '../utils/IndexInspector';
|
|
1
2
|
import { Entity, EntityOptions } from './Entity';
|
|
2
3
|
import { Path } from '../entities/primitives/2d/Path';
|
|
3
4
|
import { Camera } from '../camera/Camera';
|
|
@@ -5,6 +6,10 @@ import { Vec2 } from '../math/vector/Vec2';
|
|
|
5
6
|
import { Vec3 } from '../math/vector/Vec3';
|
|
6
7
|
import { ISpatialField, SpatialMappingFunction, HomotopyFunction, ComplexMappingFunction } from '../math/fields/SpatialField';
|
|
7
8
|
import { SubdivisionOptions } from '../utils/SubdivisionEngine';
|
|
9
|
+
export declare function registerIndexInspector(inspector: {
|
|
10
|
+
inspect: (e: any) => any;
|
|
11
|
+
show: (e: any, opt?: any) => any;
|
|
12
|
+
}): void;
|
|
8
13
|
/**
|
|
9
14
|
* Abstract base class for all 2D vector-based entities.
|
|
10
15
|
* Guarantees support for mathematical path extraction, morphing, and sub-path animations.
|
|
@@ -148,4 +153,13 @@ export declare abstract class VectorEntity extends Entity {
|
|
|
148
153
|
* @param fn Callback invoked for each leaf Path instance along with its sequential index.
|
|
149
154
|
*/
|
|
150
155
|
forEachPath(fn: (path: Path, index: number) => void): this;
|
|
156
|
+
/**
|
|
157
|
+
* Inspects all sub-paths and prints a formatted table to console.table.
|
|
158
|
+
*/
|
|
159
|
+
inspectIndices(): IndexInfo[];
|
|
160
|
+
/**
|
|
161
|
+
* Generates an overlaid VGroup of numbered badges corresponding to each sub-path index.
|
|
162
|
+
* Add directly to the scene to visually identify path indices.
|
|
163
|
+
*/
|
|
164
|
+
showIndices(options?: ShowIndicesOptions): any;
|
|
151
165
|
}
|
|
@@ -3,8 +3,22 @@ import { Entity } from '../../_core/Entity';
|
|
|
3
3
|
import { AnimOptions } from '../AnimOptions';
|
|
4
4
|
import { State } from '../../_core/State';
|
|
5
5
|
import { VectorEntity } from '../../_core/VectorEntity';
|
|
6
|
+
import { IndexMap, KeyMap } from './TransformMatchingTex';
|
|
6
7
|
export interface TransformMatchingShapesOptions extends AnimOptions {
|
|
7
8
|
morphUnmatched?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Explicit path/contour index pair mappings [sourceIndex, targetIndex][].
|
|
11
|
+
* Direct surgical control: forces source shape path at sourceIndex to map to targetIndex.
|
|
12
|
+
* Takes highest precedence before geometric/label matching.
|
|
13
|
+
* @example [[0, 2]] or { 0: 2 }
|
|
14
|
+
*/
|
|
15
|
+
indexMap?: IndexMap;
|
|
16
|
+
/**
|
|
17
|
+
* Explicit shape label or constructor name mapping.
|
|
18
|
+
* Maps source shape LABEL/name to target shape LABEL/name.
|
|
19
|
+
* @example { "circle": "square", "leftArm": "rightArm" }
|
|
20
|
+
*/
|
|
21
|
+
keyMap?: KeyMap;
|
|
8
22
|
}
|
|
9
23
|
export declare class TransformMatchingShapes extends Concurrent {
|
|
10
24
|
private sourceEntity;
|
|
@@ -2,8 +2,23 @@ import { Concurrent } from '../Concurrent';
|
|
|
2
2
|
import { Tex } from '../../entities/composites/text/Tex';
|
|
3
3
|
import { Text } from '../../entities/composites/text/Text';
|
|
4
4
|
import { AnimOptions } from '../AnimOptions';
|
|
5
|
+
export type IndexMap = [number, number][] | Record<number, number> | Map<number, number>;
|
|
6
|
+
export type KeyMap = Record<string, string> | Map<string, string>;
|
|
5
7
|
export interface TransformMatchingTexOptions extends AnimOptions {
|
|
6
8
|
morphUnmatched?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Explicit index pair mappings [sourceIndex, targetIndex][].
|
|
11
|
+
* Direct surgical control: forces path at sourceIndex to map to targetIndex.
|
|
12
|
+
* Takes highest precedence before key/anchor matching.
|
|
13
|
+
* @example [[2, 5]] or { 2: 5 }
|
|
14
|
+
*/
|
|
15
|
+
indexMap?: IndexMap;
|
|
16
|
+
/**
|
|
17
|
+
* Explicit symbol/substring translation map.
|
|
18
|
+
* Maps source symbol/substring to target symbol/substring.
|
|
19
|
+
* @example { "+": "-", "b^2": "b^2", "\\alpha": "\\beta" }
|
|
20
|
+
*/
|
|
21
|
+
keyMap?: KeyMap;
|
|
7
22
|
}
|
|
8
23
|
export declare class TransformMatchingTex extends Concurrent {
|
|
9
24
|
/** Resolves the absolute world state matrix mapping. */
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { Concurrent } from '../Concurrent';
|
|
2
2
|
import { Text } from '../../entities/composites/text/Text';
|
|
3
3
|
import { AnimOptions } from '../AnimOptions';
|
|
4
|
+
import { IndexMap, KeyMap } from './TransformMatchingTex';
|
|
4
5
|
export interface TransformMatchingOptions extends AnimOptions {
|
|
5
6
|
morphUnmatched?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Explicit index pair mappings [sourceCharIndex, targetCharIndex][].
|
|
9
|
+
* Direct surgical control: forces char at sourceCharIndex to map to targetCharIndex.
|
|
10
|
+
* Takes highest precedence before key/anchor matching.
|
|
11
|
+
* @example [[0, 3]] or { 0: 3 }
|
|
12
|
+
*/
|
|
13
|
+
indexMap?: IndexMap;
|
|
14
|
+
/**
|
|
15
|
+
* Explicit substring or character translation map.
|
|
16
|
+
* Maps source substring/character to target substring/character.
|
|
17
|
+
* @example { "apple": "orange", "A": "B" }
|
|
18
|
+
*/
|
|
19
|
+
keyMap?: KeyMap;
|
|
6
20
|
}
|
|
7
21
|
export declare class TransformMatchingText extends Concurrent {
|
|
8
22
|
/**
|
|
@@ -6,13 +6,8 @@ export declare class ModelFragment extends FragmentComponent {
|
|
|
6
6
|
private _lastShadowState;
|
|
7
7
|
private _lastShadowMethod;
|
|
8
8
|
private _lastLightSize;
|
|
9
|
-
private
|
|
9
|
+
private _shading;
|
|
10
10
|
private _lastIsTransparent;
|
|
11
|
-
private _lastGoochWarm;
|
|
12
|
-
private _lastGoochCool;
|
|
13
|
-
private _lastCelBands;
|
|
14
|
-
private _lastCelRimStrength;
|
|
15
|
-
private _lastCelRimPower;
|
|
16
11
|
prepare(scene: Scene, state?: State): void;
|
|
17
12
|
setup(builder: ShaderBuilder, passName: string): void;
|
|
18
13
|
isPassActive(passName: string, state: State): boolean;
|
|
@@ -5,6 +5,7 @@ import { Vec3 } from '../../../math/vector/Vec3';
|
|
|
5
5
|
import { VGroup } from '../../layout/VGroup';
|
|
6
6
|
import { Path } from '../../primitives/2d/Path';
|
|
7
7
|
import { PathEffect } from '../../../material/PathEffect';
|
|
8
|
+
import { Arrow, ArrowTipType } from '../geometry/Arrow';
|
|
8
9
|
/**
|
|
9
10
|
* Configuration options for the [[Axes]] 2D coordinate system.
|
|
10
11
|
*/
|
|
@@ -39,6 +40,16 @@ export interface AxesOptions extends CoordinateSystemOptions {
|
|
|
39
40
|
yLabelFormatter?: AxisLabelFormatter;
|
|
40
41
|
/** Custom formatter callback for 2D coordinate pairs. */
|
|
41
42
|
labelFormatter?: CoordinateLabelFormatter;
|
|
43
|
+
/** Tip style for the main axis arrows ('stealth' | 'triangle' | 'line' | etc.). Default: 'stealth' */
|
|
44
|
+
tipType?: ArrowTipType;
|
|
45
|
+
/** Physical length of arrowhead along the axis. */
|
|
46
|
+
arrowHeadLength?: number;
|
|
47
|
+
/** Physical total width of arrowhead transverse to the axis. */
|
|
48
|
+
arrowHeadWidth?: number;
|
|
49
|
+
/** Whether to render arrowheads on main axes. Default: true */
|
|
50
|
+
showArrows?: boolean;
|
|
51
|
+
/** Alias for showArrows. Default: true */
|
|
52
|
+
includeArrows?: boolean;
|
|
42
53
|
}
|
|
43
54
|
export declare class Axes extends CoordinateSystem {
|
|
44
55
|
axesGroup: VGroup;
|
|
@@ -53,6 +64,14 @@ export declare class Axes extends CoordinateSystem {
|
|
|
53
64
|
xLabelFormatter?: AxisLabelFormatter;
|
|
54
65
|
yLabelFormatter?: AxisLabelFormatter;
|
|
55
66
|
labelFormatter?: CoordinateLabelFormatter;
|
|
67
|
+
tipType: ArrowTipType;
|
|
68
|
+
arrowHeadLength?: number;
|
|
69
|
+
arrowHeadWidth?: number;
|
|
70
|
+
showArrows: boolean;
|
|
71
|
+
xAxis: Arrow;
|
|
72
|
+
yAxis: Arrow;
|
|
73
|
+
get xAxisArrow(): Arrow;
|
|
74
|
+
get yAxisArrow(): Arrow;
|
|
56
75
|
rangeVersion: number;
|
|
57
76
|
private linePool;
|
|
58
77
|
private activeLineCount;
|
|
@@ -83,6 +102,7 @@ export declare class Axes extends CoordinateSystem {
|
|
|
83
102
|
* Adds numerical coordinate labels along the X and Y axes.
|
|
84
103
|
*/
|
|
85
104
|
addCoordinates(options?: CoordinateLabelOptions): this;
|
|
105
|
+
setTipType(type: ArrowTipType): this;
|
|
86
106
|
toPaths(): Path[];
|
|
87
107
|
getSubEntities(): VectorEntity[];
|
|
88
108
|
}
|
|
@@ -3,6 +3,10 @@ import { VectorEntity } from '../../../_core/VectorEntity';
|
|
|
3
3
|
import { Path } from '../../primitives/2d/Path';
|
|
4
4
|
import { Vec3, Vec3Type } from '../../../math/vector/Vec3';
|
|
5
5
|
import { Color } from '../../../math/Color';
|
|
6
|
+
import { Animation } from '../../../animation/Animation';
|
|
7
|
+
import { CreateOptions } from '../../../animation/creation/Create';
|
|
8
|
+
import { TrackBuilder } from '../../../animation/TrackBuilder';
|
|
9
|
+
import { PathEffect } from '../../../material/PathEffect';
|
|
6
10
|
export type ArrowTipType = 'triangle' | 'stealth' | 'line' | 'circle' | 'dot' | 'diamond' | 'bar' | 'tee' | 'square' | 'none';
|
|
7
11
|
export interface ArrowOptions extends EntityOptions {
|
|
8
12
|
points?: Vec3Type[];
|
|
@@ -10,6 +14,7 @@ export interface ArrowOptions extends EntityOptions {
|
|
|
10
14
|
tension?: number;
|
|
11
15
|
segments?: number;
|
|
12
16
|
color?: Color;
|
|
17
|
+
strokeShader?: PathEffect | string;
|
|
13
18
|
headLength?: number;
|
|
14
19
|
headWidth?: number;
|
|
15
20
|
headAngle?: number;
|
|
@@ -76,6 +81,7 @@ export declare class Arrow extends VectorEntity {
|
|
|
76
81
|
private lastT2;
|
|
77
82
|
private lastT1;
|
|
78
83
|
private lastStrokeWidth;
|
|
84
|
+
private lastOpacity;
|
|
79
85
|
constructor(start?: Vec3Type, end?: Vec3Type, options?: ArrowOptions);
|
|
80
86
|
setPoints(points: Vec3Type[]): void;
|
|
81
87
|
putStartAndEndOn(start: Vec3Type, end: Vec3Type): void;
|
|
@@ -90,6 +96,7 @@ export declare class Arrow extends VectorEntity {
|
|
|
90
96
|
width?: number;
|
|
91
97
|
color?: Color;
|
|
92
98
|
}): void;
|
|
99
|
+
setStrokeShader(shader?: PathEffect | string): void;
|
|
93
100
|
private addLineSegment;
|
|
94
101
|
private rebuildCurve;
|
|
95
102
|
private buildTipGeometry;
|
|
@@ -98,6 +105,14 @@ export declare class Arrow extends VectorEntity {
|
|
|
98
105
|
private rebuildSingleHead;
|
|
99
106
|
update(t: number, dt: number): void;
|
|
100
107
|
private syncArrowState;
|
|
108
|
+
/**
|
|
109
|
+
* Creation animation hook for TrackBuilder and `Create(arrow)` / `createAnim(arrow)`.
|
|
110
|
+
*/
|
|
111
|
+
createAnim(t?: TrackBuilder, options?: CreateOptions): Animation;
|
|
112
|
+
/**
|
|
113
|
+
* Erase/uncreate animation hook for `Uncreate(arrow)`.
|
|
114
|
+
*/
|
|
115
|
+
uncreateAnim(options?: CreateOptions): Animation;
|
|
101
116
|
/**
|
|
102
117
|
* Resolves the distinct animatable path structures inside the Arrow (the shaft and the tip(s)).
|
|
103
118
|
*/
|
|
@@ -107,3 +122,23 @@ export declare class Arrow extends VectorEntity {
|
|
|
107
122
|
*/
|
|
108
123
|
toPaths(): Path[];
|
|
109
124
|
}
|
|
125
|
+
export declare class ArrowCreateAnimation extends Animation {
|
|
126
|
+
private arrow;
|
|
127
|
+
private targetT1;
|
|
128
|
+
private targetT2;
|
|
129
|
+
private originalStroke;
|
|
130
|
+
private originalStrokeWidth;
|
|
131
|
+
private targetStroke;
|
|
132
|
+
private targetStrokeWidth;
|
|
133
|
+
constructor(arrow: Arrow, options?: CreateOptions);
|
|
134
|
+
prepare(): void;
|
|
135
|
+
update(dt: number): boolean;
|
|
136
|
+
}
|
|
137
|
+
export declare class ArrowUncreateAnimation extends Animation {
|
|
138
|
+
private arrow;
|
|
139
|
+
private startT1;
|
|
140
|
+
private startT2;
|
|
141
|
+
constructor(arrow: Arrow, options?: CreateOptions);
|
|
142
|
+
prepare(): void;
|
|
143
|
+
update(dt: number): boolean;
|
|
144
|
+
}
|
|
@@ -5,6 +5,9 @@ import { Vec3Type } from '../../../math/vector/Vec3';
|
|
|
5
5
|
import { Color } from '../../../math/Color';
|
|
6
6
|
import { VectorEntity } from '../../../_core/VectorEntity';
|
|
7
7
|
import { Path } from '../../primitives/2d/Path';
|
|
8
|
+
import { Animation } from '../../../animation/Animation';
|
|
9
|
+
import { CreateOptions } from '../../../animation/creation/Create';
|
|
10
|
+
import { TrackBuilder } from '../../../animation/TrackBuilder';
|
|
8
11
|
export interface Arrow3DOptions extends EntityOptions {
|
|
9
12
|
points?: Vec3Type[];
|
|
10
13
|
isSmooth?: boolean;
|
|
@@ -29,6 +32,34 @@ export declare class Arrow3D extends VectorEntity {
|
|
|
29
32
|
private rebuildCurve;
|
|
30
33
|
update(t: number, dt: number): void;
|
|
31
34
|
private syncArrowState;
|
|
35
|
+
/**
|
|
36
|
+
* Creation animation hook for TrackBuilder and `Create(arrow3D)` / `createAnim(arrow3D)`.
|
|
37
|
+
*/
|
|
38
|
+
createAnim(t?: TrackBuilder, options?: CreateOptions): Animation;
|
|
39
|
+
/**
|
|
40
|
+
* Erase/uncreate animation hook for `Uncreate(arrow3D)`.
|
|
41
|
+
*/
|
|
42
|
+
uncreateAnim(options?: CreateOptions): Animation;
|
|
32
43
|
getSubEntities(): VectorEntity[];
|
|
33
44
|
toPaths(): Path[];
|
|
34
45
|
}
|
|
46
|
+
export declare class Arrow3DCreateAnimation extends Animation {
|
|
47
|
+
private arrow;
|
|
48
|
+
private targetT1;
|
|
49
|
+
private targetT2;
|
|
50
|
+
private originalStroke;
|
|
51
|
+
private originalStrokeWidth;
|
|
52
|
+
private targetStroke;
|
|
53
|
+
private targetStrokeWidth;
|
|
54
|
+
constructor(arrow: Arrow3D, options?: CreateOptions);
|
|
55
|
+
prepare(): void;
|
|
56
|
+
update(dt: number): boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare class Arrow3DUncreateAnimation extends Animation {
|
|
59
|
+
private arrow;
|
|
60
|
+
private startT1;
|
|
61
|
+
private startT2;
|
|
62
|
+
constructor(arrow: Arrow3D, options?: CreateOptions);
|
|
63
|
+
prepare(): void;
|
|
64
|
+
update(dt: number): boolean;
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Shading } from './Shading';
|
|
2
|
+
export interface CelShadingOptions {
|
|
3
|
+
bands?: number;
|
|
4
|
+
rimStrength?: number;
|
|
5
|
+
rimPower?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Cartoon lighting bands with an optional silhouette highlight. */
|
|
8
|
+
export declare class CelShading extends Shading {
|
|
9
|
+
bands: number;
|
|
10
|
+
rimStrength: number;
|
|
11
|
+
rimPower: number;
|
|
12
|
+
constructor({ bands, rimStrength, rimPower }?: CelShadingOptions);
|
|
13
|
+
writeParameters(target: Float32Array, offset: number): void;
|
|
14
|
+
interpolate(start: CelShading, target: CelShading, t: number): void;
|
|
15
|
+
clone(): CelShading;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Shading } from './Shading';
|
|
2
|
+
export interface GoochShadingOptions {
|
|
3
|
+
warm?: number;
|
|
4
|
+
cool?: number;
|
|
5
|
+
}
|
|
6
|
+
/** Warm/cool lighting for technical illustrations. */
|
|
7
|
+
export declare class GoochShading extends Shading {
|
|
8
|
+
warm: number;
|
|
9
|
+
cool: number;
|
|
10
|
+
constructor({ warm, cool }?: GoochShadingOptions);
|
|
11
|
+
writeParameters(target: Float32Array, offset: number): void;
|
|
12
|
+
interpolate(start: GoochShading, target: GoochShading, t: number): void;
|
|
13
|
+
clone(): GoochShading;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum ShadingStyle {
|
|
2
|
+
PBR = "pbr",
|
|
3
|
+
GOOCH = "gooch",
|
|
4
|
+
CEL = "cel",
|
|
5
|
+
CLAY = "clay"
|
|
6
|
+
}
|
|
7
|
+
/** A surface lighting model. Numeric parameters are written to the material GPU buffer. */
|
|
8
|
+
export declare abstract class Shading {
|
|
9
|
+
readonly style: ShadingStyle;
|
|
10
|
+
readonly chunk: string;
|
|
11
|
+
readonly fragment: string;
|
|
12
|
+
protected constructor(style: ShadingStyle, chunk: string, fragment: string);
|
|
13
|
+
writeParameters(target: Float32Array, offset: number): void;
|
|
14
|
+
/** Interpolate numeric settings between two instances of this lighting model. */
|
|
15
|
+
interpolate(start: Shading, target: Shading, t: number): void;
|
|
16
|
+
abstract clone(): Shading;
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Shading, ShadingStyle } from './Shading';
|
|
2
|
+
export { PBRShading } from './PBRShading';
|
|
3
|
+
export { CelShading, type CelShadingOptions } from './CelShading';
|
|
4
|
+
export { GoochShading, type GoochShadingOptions } from './GoochShading';
|
|
5
|
+
export { ClayShading } from './ClayShading';
|
|
@@ -17,12 +17,7 @@ export declare enum DenoiserType {
|
|
|
17
17
|
OIDN = "oidn",
|
|
18
18
|
NATIVE = "native"
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
PBR = "pbr",
|
|
22
|
-
GOOCH = "gooch",
|
|
23
|
-
CEL = "cel",
|
|
24
|
-
CLAY = "clay"
|
|
25
|
-
}
|
|
20
|
+
export { ShadingStyle } from '../material/shading/Shading';
|
|
26
21
|
export declare enum ShadowMethod {
|
|
27
22
|
PCF = "pcf",
|
|
28
23
|
PCSS = "pcss"
|
|
@@ -37,12 +32,6 @@ export declare class RenderConfig {
|
|
|
37
32
|
shadowMethod: ShadowMethod;
|
|
38
33
|
lightSize: number;
|
|
39
34
|
frustumCulling: boolean;
|
|
40
|
-
shadingStyle: ShadingStyle;
|
|
41
|
-
celBands: number;
|
|
42
|
-
celRimStrength: number;
|
|
43
|
-
celRimPower: number;
|
|
44
|
-
goochWarm: number;
|
|
45
|
-
goochCool: number;
|
|
46
35
|
raytraceEnabled: boolean;
|
|
47
36
|
rtSamples: number;
|
|
48
37
|
rtMaxAccumulation: number;
|
|
@@ -51,15 +40,4 @@ export declare class RenderConfig {
|
|
|
51
40
|
bounce_count: number;
|
|
52
41
|
denoiser: DenoiserType;
|
|
53
42
|
oidnModel: string;
|
|
54
|
-
/** Apply Cel/Toon shading with optional parameters. Chainable. */
|
|
55
|
-
setCel(options?: {
|
|
56
|
-
bands?: number;
|
|
57
|
-
rimStrength?: number;
|
|
58
|
-
rimPower?: number;
|
|
59
|
-
}): this;
|
|
60
|
-
/** Apply Gooch technical illustration shading. Chainable. */
|
|
61
|
-
setGooch(options?: {
|
|
62
|
-
warm?: number;
|
|
63
|
-
cool?: number;
|
|
64
|
-
}): this;
|
|
65
43
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VectorEntity } from '../_core/VectorEntity';
|
|
2
|
+
import { VGroup } from '../entities/layout/VGroup';
|
|
3
|
+
import { Color } from '../math/Color';
|
|
4
|
+
import { Vec3 } from '../math/vector/Vec3';
|
|
5
|
+
export interface IndexInfo {
|
|
6
|
+
index: number;
|
|
7
|
+
symbol?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
center: Vec3;
|
|
10
|
+
bounds: Vec3;
|
|
11
|
+
}
|
|
12
|
+
export interface ShowIndicesOptions {
|
|
13
|
+
/** Font size of the numeric badge labels. Default: 9 */
|
|
14
|
+
fontSize?: number;
|
|
15
|
+
/** Foreground text color. Default: Color.fromHex("#facc15") (amber/yellow) */
|
|
16
|
+
color?: Color;
|
|
17
|
+
/** Overall badge opacity (0 = transparent, 1 = opaque). Default: 0.75 */
|
|
18
|
+
opacity?: number;
|
|
19
|
+
/** Whether to draw a circular badge backdrop behind each number. Default: true */
|
|
20
|
+
background?: boolean;
|
|
21
|
+
/** Badge background circle fill color. Default: Color.fromHex("#111827aa") (semi-transparent dark) */
|
|
22
|
+
backgroundColor?: Color;
|
|
23
|
+
/** Badge background circle stroke outline color. Default: Color.fromHex("#eab308cc") */
|
|
24
|
+
borderColor?: Color;
|
|
25
|
+
/** Badge circle radius in world units. Default: 7.5 */
|
|
26
|
+
radius?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Inspects all sub-paths of a VectorEntity (Tex, Text, SVG, VGroup, etc.)
|
|
30
|
+
* and logs a formatted table to console.table showing their indices, symbols, centers, and bounds.
|
|
31
|
+
*
|
|
32
|
+
* @param entity The vector entity to inspect.
|
|
33
|
+
* @returns Array of metadata objects for each child path.
|
|
34
|
+
*/
|
|
35
|
+
export declare function inspectIndices(entity: VectorEntity): IndexInfo[];
|
|
36
|
+
/**
|
|
37
|
+
* Generates an overlaid VGroup of numbered circular badges corresponding to each sub-path index.
|
|
38
|
+
* Useful during scene development to visually identify path indices directly on the canvas.
|
|
39
|
+
*
|
|
40
|
+
* @param entity The vector entity whose sub-path indices to show.
|
|
41
|
+
* @param options Styling options for the index badges.
|
|
42
|
+
* @returns A VGroup containing the visual badges.
|
|
43
|
+
*/
|
|
44
|
+
export declare function showIndices(entity: VectorEntity, options?: ShowIndicesOptions): VGroup;
|
|
@@ -18,6 +18,16 @@ export declare class PathEqualizer {
|
|
|
18
18
|
private static padPaths;
|
|
19
19
|
private static matchPathsSpatially;
|
|
20
20
|
private static getCentroid;
|
|
21
|
+
/**
|
|
22
|
+
* Solves minimum-weight bipartite matching.
|
|
23
|
+
* Uses exact permutation search for small N <= 8, or greedy fallback for larger.
|
|
24
|
+
*/
|
|
25
|
+
private static solveBipartite;
|
|
26
|
+
/**
|
|
27
|
+
* Hierarchical contour classification and matching.
|
|
28
|
+
* Outer boundaries strictly match Outer boundaries; Holes strictly match Holes.
|
|
29
|
+
* Matching is evaluated in normalized relative space to eliminate translation distortion.
|
|
30
|
+
*/
|
|
21
31
|
private static equalizePathContours;
|
|
22
32
|
private static padContours;
|
|
23
33
|
private static getControidOfContour;
|
|
@@ -26,6 +36,11 @@ export declare class PathEqualizer {
|
|
|
26
36
|
private static getSignedArea;
|
|
27
37
|
private static reverseContour;
|
|
28
38
|
private static shiftClosedPath;
|
|
39
|
+
/**
|
|
40
|
+
* Determines optimal cyclic shift for closed contours.
|
|
41
|
+
* Evaluates alignment in zero-centered local coordinates to prevent translation distance
|
|
42
|
+
* from skewing the cyclic dot product.
|
|
43
|
+
*/
|
|
29
44
|
private static findOptimalShift;
|
|
30
45
|
/**
|
|
31
46
|
* O(N) Single-Pass Subdivision.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -423,6 +423,7 @@ export * from './engine/utils/Builder';
|
|
|
423
423
|
export * from './engine/utils/Builder3D';
|
|
424
424
|
export * from './engine/utils/CurveSampleUtils';
|
|
425
425
|
export * from './engine/utils/CurveUtil';
|
|
426
|
+
export * from './engine/utils/IndexInspector';
|
|
426
427
|
export * from './engine/utils/GeometrySnapshot';
|
|
427
428
|
export * from './engine/utils/MarchingSquares';
|
|
428
429
|
export * from './engine/utils/OBJLoader';
|
|
@@ -436,3 +437,4 @@ export * from './engine/utils/SubdivisionEngine';
|
|
|
436
437
|
export * from './engine/utils/Utility';
|
|
437
438
|
export * from './engine/utils/gpu_utils';
|
|
438
439
|
export * from './plugins/OutlinePlugin';
|
|
440
|
+
export * from './engine/material/shading';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "retiam",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "WebGPU powered animation engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/retiam.es.js",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
46
46
|
"test:distribution": "node --import tsx --test test/library_portability_test.ts test/package_contents_test.mjs test/render_config_test.mjs",
|
|
47
47
|
"test:create": "node --test test/create_retiam_test.mjs",
|
|
48
|
+
"test:shading": "npm run build && node --test test/shading_test.mjs test/shading_browser.test.mjs",
|
|
48
49
|
"test:studio-layout": "node --test test/studio_layout.test.mjs",
|
|
49
50
|
"unit-test": "ts-node-esm test/test.ts",
|
|
50
51
|
"gen-context": "ts-node tools/context_gen/context_generator.ts ./src",
|
|
@@ -104,4 +105,4 @@
|
|
|
104
105
|
"woff2-encoder": "^2.0.0",
|
|
105
106
|
"ws": "^8.16.0"
|
|
106
107
|
}
|
|
107
|
-
}
|
|
108
|
+
}
|