@league-of-foundry-developers/foundry-vtt-types 9.238.1 → 9.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/package.json +1 -1
  2. package/src/foundry/common/constants.mjs.d.ts +1 -0
  3. package/src/foundry/common/data/data.mjs/adventureData.d.ts +21 -21
  4. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +3 -3
  5. package/src/foundry/common/data/data.mjs/userData.d.ts +10 -3
  6. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +2 -4
  7. package/src/foundry/common/utils/geometry.mjs.d.ts +148 -0
  8. package/src/foundry/common/utils/helpers.mjs.d.ts +37 -37
  9. package/src/foundry/common/utils/module.mjs.d.ts +1 -0
  10. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +1 -1
  11. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +2 -2
  12. package/src/foundry/foundry.js/audioContainer.d.ts +28 -10
  13. package/src/foundry/foundry.js/canvasAnimation.d.ts +30 -7
  14. package/src/foundry/foundry.js/clientDocuments/cards.d.ts +4 -13
  15. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +2 -2
  16. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +46 -44
  17. package/src/foundry/foundry.js/clientDocuments/combatant.d.ts +14 -17
  18. package/src/foundry/foundry.js/clientDocuments/rollTable.d.ts +2 -2
  19. package/src/foundry/foundry.js/clientKeybindings.d.ts +12 -2
  20. package/src/foundry/foundry.js/clientSettings.d.ts +1 -1
  21. package/src/foundry/foundry.js/collisionResult.d.ts +60 -0
  22. package/src/foundry/foundry.js/config.d.ts +33 -34
  23. package/src/foundry/foundry.js/hooks.d.ts +154 -85
  24. package/src/foundry/foundry.js/imageHelper.d.ts +26 -2
  25. package/src/foundry/foundry.js/keyboardManager.d.ts +2 -2
  26. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +2 -2
  27. package/src/foundry/foundry.js/pixi/containers/placeableObjects/token.d.ts +2 -2
  28. package/src/foundry/foundry.js/pixi/index.d.ts +1 -0
  29. package/src/foundry/foundry.js/pixi/points/index.d.ts +1 -0
  30. package/src/foundry/foundry.js/pixi/points/wallEndpoint.d.ts +92 -0
  31. package/src/foundry/foundry.js/pixi/polygons/index.d.ts +2 -1
  32. package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygon.d.ts +98 -0
  33. package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygons/clockwiseSweepPolygon.d.ts +388 -0
  34. package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygons/index.d.ts +1 -0
  35. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShader.d.ts +11 -37
  36. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShader.d.ts +114 -0
  37. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveBackgroundShader.d.ts +57 -0
  38. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShader.d.ts +47 -0
  39. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/bewitchingWaveColorationShader.d.ts +6 -0
  40. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/chromaColorationShader.d.ts +6 -0
  41. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/emanationColorationShader.d.ts +6 -0
  42. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/energyFieldColorationShader.d.ts +6 -0
  43. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/fairyLightColorationShader.d.ts +6 -0
  44. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/fogColorationShader.d.ts +6 -0
  45. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/ghostLightColorationShader.d.ts +1 -1
  46. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/hexaDomeColorationShader.d.ts +6 -0
  47. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/index.d.ts +5 -0
  48. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/lightDomeColorationShader.d.ts +6 -0
  49. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/pulseColorationShader.d.ts +1 -1
  50. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/radialRainbowColorationShader.d.ts +6 -0
  51. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/sunburstColorationShader.d.ts +1 -1
  52. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/swirlingRainbowColorationShader.d.ts +6 -0
  53. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/torchColorationShader.d.ts +3 -2
  54. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveColorationShaders/vortexColorationShader.d.ts +6 -0
  55. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardColorationShaders → adaptiveLightingShaders/adaptiveColorationShaders}/waveColorationShader.d.ts +1 -1
  56. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveIlluminationShader.d.ts +63 -0
  57. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveIlluminationShaders/bewitchingWaveIlluminationShader.d.ts +6 -0
  58. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/blackHoleIlluminationShader.d.ts +1 -1
  59. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveIlluminationShaders/fairyLightIlluminationShader.d.ts +6 -0
  60. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/ghostLightIlluminationShader.d.ts +1 -1
  61. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/index.d.ts +3 -0
  62. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/pulseIlluminationShader.d.ts +1 -1
  63. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/roilingIlluminationShader.d.ts +1 -1
  64. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/sunburstIlluminationShader.d.ts +1 -2
  65. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/torchIlluminationShader.d.ts +1 -1
  66. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/adaptiveIlluminationShaders/vortexIlluminationShader.d.ts +6 -0
  67. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/{standardIlluminationShaders → adaptiveLightingShaders/adaptiveIlluminationShaders}/waveIlluminationShader.d.ts +1 -1
  68. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/adaptiveLightingShaders/index.d.ts +5 -0
  69. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/baseSamplerShader.d.ts +22 -0
  70. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/index.d.ts +3 -4
  71. package/src/foundry/foundry.js/pixi/texts/preciseText.d.ts +10 -2
  72. package/src/foundry/foundry.js/pointSource.d.ts +59 -328
  73. package/src/foundry/foundry.js/pointSources/index.d.ts +3 -0
  74. package/src/foundry/foundry.js/pointSources/lightSource.d.ts +417 -0
  75. package/src/foundry/foundry.js/pointSources/soundSource.d.ts +46 -0
  76. package/src/foundry/foundry.js/pointSources/visionSource.d.ts +125 -0
  77. package/src/foundry/foundry.js/polygonEdge.d.ts +26 -0
  78. package/src/foundry/foundry.js/polygonVertex.d.ts +89 -0
  79. package/src/foundry/foundry.js/quadtreeCulling.d.ts +11 -0
  80. package/src/foundry/foundry.js/ray.d.ts +156 -162
  81. package/src/foundry/foundry.js/rays/index.d.ts +1 -0
  82. package/src/foundry/foundry.js/rays/sightRay.d.ts +34 -0
  83. package/src/foundry/foundry.js/roll.d.ts +27 -32
  84. package/src/foundry/foundry.js/screenCulling.d.ts +19 -0
  85. package/src/foundry/foundry.js/specialEffect.d.ts +1 -1
  86. package/src/foundry/index.d.ts +26 -27
  87. package/src/foundry/foundry.js/pixi/polygons/sourcePolygon.d.ts +0 -25
  88. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShader.d.ts +0 -21
  89. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/chromaColorationShader.d.ts +0 -18
  90. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/emanationColorationShader.d.ts +0 -17
  91. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/energyFieldColorationShader.d.ts +0 -18
  92. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/fogColorationShader.d.ts +0 -17
  93. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/hexaDomeColorationShader.d.ts +0 -17
  94. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardColorationShaders/lightDomeColorationShader.d.ts +0 -17
  95. package/src/foundry/foundry.js/pixi/shaders/abstractBaseShaders/standardIlluminationShader.d.ts +0 -22
@@ -0,0 +1,98 @@
1
+ interface PointSourcePolygonConfig {
2
+ /** The type of polygon being computed */
3
+ type?: foundry.CONST.WALL_RESTRICTION_TYPES;
4
+
5
+ /** The angle of emission, if limited */
6
+ angle?: number;
7
+
8
+ /** The desired density of padding rays, a number per PI */
9
+ density?: number;
10
+
11
+ /** A limited radius of the resulting polygon */
12
+ radius?: number;
13
+
14
+ /** The direction of facing, required if the angle is limited */
15
+ rotation?: number;
16
+
17
+ /** Display debugging visualization and logging for the polygon */
18
+ debug?: boolean;
19
+
20
+ /** Is this polygon constrained by any walls? */
21
+ walls?: boolean;
22
+
23
+ /** The object (if any) that spawned this polygon. */
24
+ source?: PointSource;
25
+ }
26
+
27
+ /**
28
+ * An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source.
29
+ */
30
+ declare abstract class PointSourcePolygon extends PIXI.Polygon {
31
+ /**
32
+ * The origin point of the source polygon.
33
+ */
34
+ origin: Point;
35
+
36
+ /**
37
+ * The configuration of this polygon.
38
+ * @defaultValue `{}`
39
+ */
40
+ config: PointSourcePolygonConfig;
41
+
42
+ /**
43
+ * A cached array of SightRay objects used to compute the polygon.
44
+ * @defaultValue `[]`
45
+ */
46
+ rays: SightRay[];
47
+
48
+ /**
49
+ * Compute the rectangular bounds for the Polygon.
50
+ * @param points - The initially provided array of coordinates
51
+ * @returns The computed Rectangular bounds
52
+ */
53
+ protected _getBounds(points: number[]): PIXI.Rectangle;
54
+
55
+ /**
56
+ * Benchmark the performance of polygon computation for this source
57
+ * @param iterations - The number of test iterations to perform
58
+ * @param args - Arguments passed to the compute method
59
+ */
60
+ static benchmark(
61
+ iterations: number,
62
+ ...args: Parameters<typeof PointSourcePolygon['create']>
63
+ ): ReturnType<typeof foundry.utils.benchmark>;
64
+
65
+ /**
66
+ * Compute the polygon given a point origin and radius
67
+ * @param origin - The origin source point
68
+ * @param config - Configuration options which customize the polygon computation
69
+ * @returns The computed polygon instance
70
+ */
71
+ static create(
72
+ origin: Point,
73
+ config: Parameters<PointSourcePolygon['initialize']>[1]
74
+ ): ReturnType<PointSourcePolygon['compute']>;
75
+
76
+ /**
77
+ * Compute the polygon using the origin and configuration options.
78
+ * @returns The computed polygon
79
+ */
80
+ compute(): this;
81
+
82
+ /**
83
+ * Perform the implementation-specific computation
84
+ */
85
+ protected abstract _compute(): void;
86
+
87
+ /**
88
+ * Customize the provided configuration object for this polygon type.
89
+ * @param origin - The provided polygon origin
90
+ * @param config - The provided configuration object
91
+ */
92
+ initialize(origin: Point, config: PointSourcePolygonConfig): void;
93
+
94
+ /**
95
+ * Visualize the polygon, displaying its computed area, rays, and collision points
96
+ */
97
+ visualize(): void;
98
+ }
@@ -0,0 +1,388 @@
1
+ import type { ConfiguredObjectClassForName } from '../../../../../types/helperTypes.js';
2
+
3
+ declare global {
4
+ type VertexMap = Map<number, PolygonVertex>;
5
+
6
+ type EdgeSet = Set<PolygonEdge>;
7
+
8
+ interface ClockwiseSweepPolygonConfig extends PointSourcePolygonConfig {
9
+ /** @defaultValue `canvas.dimensions.maxR` */
10
+ radius?: number;
11
+
12
+ /** @defaultValue `360` */
13
+ angle?: number;
14
+
15
+ /** @defaultValue `0` */
16
+ rotation?: number;
17
+
18
+ /**
19
+ * The desired density of padding rays, a number per PI
20
+ * @defaultValue `12`
21
+ */
22
+ density?: number;
23
+
24
+ /**
25
+ * The minimum angle of emission
26
+ * @defaultValue `config.hasLimitedAngle ? Math.normalizeRadians(Math.toRadians(config.rotation + 90 - (config.angle / 2))) : -Math.PI`
27
+ */
28
+ aMin?: number;
29
+
30
+ /**
31
+ * The maximum angle of emission
32
+ * @defaultValue `config.hasLimitedAngle ? config.aMin + Math.toRadians(config.angle) : Math.PI`
33
+ */
34
+ aMax?: number;
35
+
36
+ /**
37
+ * The minimum ray of emission
38
+ * @defaultValue `Ray.fromAngle(origin.x, origin.y, config.aMin, config.radius)`
39
+ */
40
+ rMin?: Ray;
41
+
42
+ /**
43
+ * The maximum ray of emission
44
+ * @defaultValue `config.hasLimitedAngle && Ray.fromAngle(origin.x, origin.y, config.aMax, config.radius)`
45
+ */
46
+ rMax?: Ray;
47
+
48
+ /**
49
+ * Does this polygon have a limited radius?
50
+ * @defaultValue `config.radius > 0`
51
+ */
52
+ hasLimitedRadius?: boolean;
53
+
54
+ /**
55
+ * Does this polygon have a limited angle?
56
+ * @defaultValue `config.angle !== 0`
57
+ */
58
+ hasLimitedAngle?: boolean;
59
+
60
+ /**
61
+ * The squared radius of the polygon, for faster computation later
62
+ * @defaultValue `Math.pow(config.radius, 2)`
63
+ */
64
+ radius2?: number;
65
+
66
+ /**
67
+ * A small epsilon used for avoiding floating point precision issues
68
+ * @defaultValue `0.5 / config.radius`
69
+ */
70
+ radiusE?: number;
71
+ }
72
+
73
+ /**
74
+ * A PointSourcePolygon implementation that uses CCW (counter-clockwise) geometry orientation.
75
+ * Sweep around the origin, accumulating collision points based on the set of active walls.
76
+ * This algorithm was created with valuable contributions from https://github.com/caewok
77
+ */
78
+ class ClockwiseSweepPolygon extends PointSourcePolygon {
79
+ /**
80
+ * The configuration of this polygon.
81
+ */
82
+ config:
83
+ | ClockwiseSweepPolygonConfig
84
+ | ClockwiseSweepPolygon.InitializedConfig
85
+ | ClockwiseSweepPolygon.LimitedAngleConfig;
86
+
87
+ /**
88
+ * A mapping of vertices which define potential collision points
89
+ */
90
+ vertices: VertexMap;
91
+
92
+ /**
93
+ * The set of edges which define potential boundaries of the polygon
94
+ */
95
+ edges: EdgeSet;
96
+
97
+ /**
98
+ * A collection of rays which are fired at vertices
99
+ */
100
+ rays: SightRay[];
101
+
102
+ static benchmark(
103
+ iterations: number,
104
+ ...args: Parameters<typeof ClockwiseSweepPolygon['create']>
105
+ ): ReturnType<typeof foundry.utils.benchmark>;
106
+
107
+ static create(
108
+ origin: Point,
109
+ config: Parameters<ClockwiseSweepPolygon['initialize']>[1]
110
+ ): ReturnType<ClockwiseSweepPolygon['compute']>;
111
+
112
+ /**
113
+ * @override
114
+ * @param origin - The provided polygon origin
115
+ * @param config - The provided configuration object
116
+ */
117
+ initialize(origin: Point, config: ClockwiseSweepPolygon.InitConfig): void;
118
+
119
+ /** @override */
120
+ protected _compute(): void;
121
+
122
+ /**
123
+ * Translate walls and other obstacles into edges which limit visibility
124
+ * @internal
125
+ */
126
+ protected _identifyEdges(): void;
127
+
128
+ /**
129
+ * Get the super-set of walls which could potentially apply to this polygon.
130
+ * @internal
131
+ */
132
+ protected _getWalls(): ConfiguredObjectClassForName<'Wall'>[];
133
+
134
+ /**
135
+ * Restrict the set of candidate edges to those which appear within the limited angle of emission.
136
+ * @internal
137
+ */
138
+ protected _restrictEdgesByAngle(): void;
139
+
140
+ /**
141
+ * Process the candidate edges to further constrain them using a circular radius of effect.
142
+ * @internal
143
+ */
144
+ protected _constrainEdgesByRadius(): void;
145
+
146
+ /**
147
+ * Consolidate all vertices from identified edges and register them as part of the vertex mapping.
148
+ * @internal
149
+ */
150
+ protected _identifyVertices(): void;
151
+
152
+ /**
153
+ * Add additional vertices for intersections between edges.
154
+ * @param wallEdgeMap - A mapping of wall IDs to PolygonEdge instances
155
+ * @internal
156
+ */
157
+ protected _identifyIntersections(wallEdgeMap: Map<string, PolygonEdge>): void;
158
+
159
+ /**
160
+ * Execute the sweep over wall vertices
161
+ * @internal
162
+ */
163
+ protected _executeSweep(): void;
164
+
165
+ /**
166
+ * Determine the initial set of active edges as those which intersect with the initial ray
167
+ * @returns A set of initially active edges
168
+ * @internal
169
+ */
170
+ protected _initializeActiveEdges(): EdgeSet;
171
+
172
+ /**
173
+ * Sort vertices clockwise from the initial ray (due west).
174
+ * @returns The array of sorted vertices
175
+ * @internal
176
+ */
177
+ protected _sortVertices(): PolygonVertex[];
178
+
179
+ /**
180
+ * Test whether a target vertex is behind some closer active edge
181
+ * @param ray - The ray being evaluated
182
+ * (unused)
183
+ * @param vertex - The target vertex
184
+ * @param activeEdges - The set of active edges
185
+ * @returns Is the target vertex behind some closer edge?
186
+ * @internal
187
+ */
188
+ protected _isVertexBehindActiveEdges(
189
+ ray: Ray,
190
+ vertex: PolygonVertex,
191
+ activeEdges: EdgeSet
192
+ ): { isBehind: boolean; wasLimited: boolean };
193
+
194
+ /**
195
+ * Determine the final result of a candidate ray.
196
+ * @param ray - The candidate ray being tested
197
+ * @param vertex - The target vertex
198
+ * @param result - The result being prepared
199
+ * @param activeEdges - The set of active edges
200
+ * @internal
201
+ */
202
+ protected _determineRayResult(ray: Ray, vertex: PolygonVertex, result: CollisionResult, activeEdges: EdgeSet): void;
203
+
204
+ /**
205
+ * Jump to a new closest active edge.
206
+ * In this case, our target vertex will be the primary collision.
207
+ * We may have a secondary collision if other active edges exist or if the vertex is prior to the ray endpoint.
208
+ * @internal
209
+ *
210
+ * @param ray - The ray being emitted
211
+ * @param result - The pending collision result
212
+ * @param activeEdges - The set of currently active edges
213
+ * @param isBinding - Is the target vertex a binding collision point?
214
+ * @param secondaryBefore - Whether to add secondary collision points before ("unshift") or after ("push")
215
+ * (default: `true`)
216
+ */
217
+ protected _beginNewEdge(
218
+ ray: Ray,
219
+ result: CollisionResult,
220
+ activeEdges: EdgeSet,
221
+ isBinding: boolean,
222
+ secondaryBefore?: boolean
223
+ ): void;
224
+
225
+ /**
226
+ * If the target vertex is connected to a currently active edge, we are terminating that edge.
227
+ * We know the target vertex is not behind another edge, so the target is our initial collision.
228
+ * There may be a second collision afterwards if no connected walls continue clockwise.
229
+ * @internal
230
+ *
231
+ * @param ray - The ray being emitted
232
+ * @param result - The pending collision result
233
+ * @param activeEdges - The set of currently active edges
234
+ * @param isBinding - Is the target vertex a binding collision point?
235
+ */
236
+ protected _completeCurrentEdge(ray: Ray, result: CollisionResult, activeEdges: EdgeSet, isBinding: boolean): void;
237
+
238
+ /**
239
+ * Augment a CollisionResult with an additional secondary collision.
240
+ * Require secondary collisions to be a greater distance than the target vertex.
241
+ * @param ray - The ray being evaluated
242
+ * @param result - The collision result
243
+ * @param edges - The subset of active edges which are candidates for collision
244
+ * @internal
245
+ */
246
+ protected _getSecondaryCollisions(ray: Ray, result: CollisionResult, edges: EdgeSet): PolygonVertex[];
247
+
248
+ /**
249
+ * Identify collision points for a required terminal ray.
250
+ * @internal
251
+ *
252
+ * @param ray - The ray being emitted
253
+ * @param result - The pending collision result
254
+ * @param activeEdges - The set of currently active edges
255
+ */
256
+ protected _findRequiredCollision(ray: Ray, result: CollisionResult, activeEdges: EdgeSet): void;
257
+
258
+ /**
259
+ * Identify the collision points between an emitted Ray and a set of active edges.
260
+ * @param ray - The candidate ray to test
261
+ * @param activeEdges - The set of active edges
262
+ * @returns A sorted array of collision points
263
+ * @internal
264
+ */
265
+ protected _getRayCollisions(
266
+ ray: Ray,
267
+ activeEdges: EdgeSet,
268
+ {
269
+ minimumDistance
270
+ }?: {
271
+ /**
272
+ * Require collisions to exceed some minimum distance
273
+ * @defaultValue `0`
274
+ */
275
+ minimumDistance?: number;
276
+ }
277
+ ): PolygonVertex[];
278
+
279
+ /**
280
+ * Update the set of active edges given the result of an emitted ray.
281
+ * @param result - The collision result
282
+ * @param activeEdges - The set of currently active edges
283
+ * @internal
284
+ */
285
+ protected _updateActiveEdges(result: CollisionResult, activeEdges: EdgeSet): void;
286
+
287
+ /**
288
+ * Construct the polygon from ray collision points
289
+ * @internal
290
+ */
291
+ protected _constructPolygonPoints(): void;
292
+
293
+ /**
294
+ * Add additional points to limited-radius polygons to approximate the curvature of a circle
295
+ * @param r0 - The prior ray that collided with some vertex
296
+ * @param r1 - The next ray that collides with some vertex
297
+ * @internal
298
+ */
299
+ protected _getPaddingPoints(r0: Ray, r1: Ray): Point[];
300
+
301
+ /**
302
+ * Test whether a wall should be included in the computed polygon for a given origin and type
303
+ * @param wall - The Wall being considered
304
+ * @param origin - The origin point for the ray or polygon
305
+ * @param type - The type of perception or movement restriction being imposed
306
+ * @returns Should the wall be included?
307
+ *
308
+ */
309
+ static testWallInclusion(
310
+ wall: ConfiguredObjectClassForName<'Wall'>,
311
+ origin: Point,
312
+ type: foundry.CONST.WALL_RESTRICTION_TYPES
313
+ ): boolean;
314
+
315
+ /**
316
+ * Test whether a vertex lies between two boundary rays
317
+ * @param vertex - The target vertex
318
+ * @param rMin - The counter-clockwise bounding ray
319
+ * @param rMax - The clockwise bounding ray
320
+ * @param angle - The angle being tested, in degrees
321
+ * @returns Is the vertex between the two rays?
322
+ */
323
+ static pointBetweenRays(vertex: PolygonVertex, rMin: Ray, rMax: Ray, angle: number): boolean;
324
+
325
+ /** @override */
326
+ visualize(): void;
327
+
328
+ /**
329
+ * Check whether a given ray intersects with walls.
330
+ * @param ray - The Ray being tested
331
+ * @param options - Options which customize how collision is tested
332
+ * @returns Whether any collision occurred if mode is "any"
333
+ * An array of collisions, if mode is "all"
334
+ * The closest collision, if mode is "closest"
335
+ */
336
+ static getRayCollisions<Mode extends 'any' | 'closest' | 'all'>(
337
+ ray: Ray,
338
+ options?: {
339
+ /**
340
+ * Which collision type to check, a value in CONST.WALL_RESTRICTION_TYPES
341
+ * @defaultValue `"move"`
342
+ */
343
+ type?: foundry.CONST.WALL_RESTRICTION_TYPES;
344
+
345
+ /**
346
+ * Which type of collisions are returned: any, closest, all
347
+ * @defaultValue `"all"`
348
+ */
349
+ mode?: Mode;
350
+
351
+ /**
352
+ * Visualize some debugging data to help understand the collision test
353
+ * @defaultValue `false`
354
+ */
355
+ debug?: boolean;
356
+ }
357
+ ): Mode extends 'any' ? boolean : Mode extends 'closest' ? PolygonVertex : PolygonVertex[];
358
+
359
+ /**
360
+ * Visualize the polygon, displaying its computed area, rays, and collision points
361
+ * @internal
362
+ */
363
+ protected static _visualizeCollision(ray: Ray, edges: EdgeSet, collisions: PolygonVertex[]): void;
364
+ }
365
+
366
+ namespace ClockwiseSweepPolygon {
367
+ type InitConfig = Partial<Pick<ClockwiseSweepPolygonConfig, 'radius' | 'angle' | 'rotation' | 'density'>>;
368
+
369
+ interface InitializedConfig extends ClockwiseSweepPolygonConfig {
370
+ hasLimitedRadius: boolean;
371
+ radius: number;
372
+ radius2: number;
373
+ radiusE: number;
374
+ aMin: number;
375
+ aMax: number;
376
+ angle: number;
377
+ rotation: number;
378
+ hasLimitedAngle: boolean;
379
+ density: number;
380
+ rMin: Ray;
381
+ }
382
+
383
+ interface LimitedAngleConfig extends InitializedConfig {
384
+ hasLimitedAngle: true;
385
+ rMax: Ray;
386
+ }
387
+ }
388
+ }
@@ -0,0 +1 @@
1
+ import './clockwiseSweepPolygon';
@@ -2,6 +2,9 @@
2
2
  * This class defines an interface which all shaders utilize
3
3
  */
4
4
  declare abstract class AbstractBaseShader extends PIXI.Shader {
5
+ /** The current uniforms of the Shader */
6
+ uniforms: AbstractBaseShader.Uniforms;
7
+
5
8
  constructor(program: PIXI.Program, uniforms: AbstractBaseShader.Uniforms);
6
9
 
7
10
  /**
@@ -10,12 +13,16 @@ declare abstract class AbstractBaseShader extends PIXI.Shader {
10
13
  protected _defaults: AbstractBaseShader.Uniforms;
11
14
 
12
15
  /**
13
- * The default vertex shader used by all instances of AbstractBaseShader
16
+ * The raw vertex shader used by this class.
17
+ * A subclass of AbstractBaseShader must implement the fragmentShader static field.
18
+ * @defaultValue `""`
19
+ *
20
+ * @remarks This is abstract, subclasses must implement it.
14
21
  */
15
22
  static vertexShader: string;
16
23
 
17
24
  /**
18
- * The fragment shader which renders this source.
25
+ * The raw fragment shader used by this class.
19
26
  * A subclass of AbstractBaseShader must implement the fragmentShader static field.
20
27
  * @defaultValue `""`
21
28
  *
@@ -39,42 +46,9 @@ declare abstract class AbstractBaseShader extends PIXI.Shader {
39
46
 
40
47
  /**
41
48
  * Reset the shader uniforms back to their provided default values
49
+ * @internal
42
50
  */
43
51
  protected reset(): void;
44
-
45
- /**
46
- * A Vec3 pseudo-random generator, based on uv position
47
- */
48
- static PRNG3D: string;
49
-
50
- /**
51
- * A conventional pseudo-random number generator with the "golden" numbers, based on uv position
52
- */
53
- static PRNG: string;
54
-
55
- /**
56
- * A conventional noise generator
57
- */
58
- static NOISE: string;
59
-
60
- /**
61
- * Fractional Brownian Motion for a given number of octaves
62
- * @param octaves - (default: `4`)
63
- * @param amp - (default: `1.0`)
64
- */
65
- static FBM(octaves?: number, amp?: number): string;
66
-
67
- /**
68
- * Fade easing to use with distance in interval [0,1]
69
- * @param amp - (default: `3`)
70
- * @param coef - (default: `0.80`)
71
- */
72
- static FADE(amp?: number, coef?: number): string;
73
-
74
- /**
75
- * Convert a Hue-Saturation-Brightness color to RGB - useful to convert polar coordinates to RGB
76
- */
77
- static HSB2RGB: string;
78
52
  }
79
53
 
80
54
  declare namespace AbstractBaseShader {
@@ -91,5 +65,5 @@ declare namespace AbstractBaseShader {
91
65
  | { x: number; y: number; z: number; w: number }[]
92
66
  | PIXI.Texture;
93
67
 
94
- type Uniforms = Partial<Record<string, AbstractBaseShader.UniformValue>>;
68
+ type Uniforms = Record<string, AbstractBaseShader.UniformValue>;
95
69
  }
@@ -0,0 +1,114 @@
1
+ interface LightingTechnique {
2
+ /** The numeric identifier of the technique */
3
+ id: number;
4
+
5
+ /** The localization string that labels the technique */
6
+ label: string;
7
+
8
+ /** The shader fragment when the technique is used */
9
+ shader: string;
10
+ }
11
+
12
+ /**
13
+ * This class defines an interface which all adaptive lighting shaders extend.
14
+ */
15
+ declare class AdaptiveLightingShader extends AbstractBaseShader {
16
+ /** @override */
17
+ static vertexShader: string;
18
+
19
+ /**
20
+ * Useful constant values computed at compile time
21
+ */
22
+ static CONSTANTS: string;
23
+
24
+ /**
25
+ * The coloration technique shader fragment
26
+ */
27
+ static get ADAPTIVE_COLORATION(): string;
28
+
29
+ /**
30
+ * Fade easing to use with distance in interval [0,1]
31
+ * @param amp - (default: `3`)
32
+ * @param coef - (default: `0.80`)
33
+ */
34
+ static FADE(amp?: number, coef?: number): string;
35
+
36
+ /**
37
+ * Fractional Brownian Motion for a given number of octaves
38
+ * @param octaves - (default: `4`)
39
+ * @param amp - (default: `1.0`)
40
+ */
41
+ static FBM(octaves?: number, amp?: number): string;
42
+
43
+ /**
44
+ * A conventional pseudo-random number generator with the "golden" numbers, based on uv position
45
+ */
46
+ static PRNG: string;
47
+
48
+ /**
49
+ * A Vec3 pseudo-random generator, based on uv position
50
+ */
51
+ static PRNG3D: string;
52
+
53
+ /**
54
+ * A conventional noise generator
55
+ */
56
+ static NOISE: string;
57
+
58
+ /**
59
+ * Convert a Hue-Saturation-Brightness color to RGB - useful to convert polar coordinates to RGB
60
+ */
61
+ static HSB2RGB: string;
62
+
63
+ /**
64
+ * Fast approximate perceived brightness computation
65
+ * Using Digital ITU BT.709 : Exact luminance factors
66
+ */
67
+ static PERCEIVED_BRIGHTNESS: string;
68
+
69
+ /**
70
+ * Switch between an inner and outer color, by comparing distance from center to ratio
71
+ * Apply a strong gradient between the two areas if gradual uniform is set to true
72
+ */
73
+ static SWITCH_COLOR: string;
74
+
75
+ /**
76
+ * Transition between bright and dim colors, if requested
77
+ */
78
+ static TRANSITION: string;
79
+
80
+ /**
81
+ * Constrain light to LOS
82
+ */
83
+ static CONSTRAIN_TO_LOS: string;
84
+
85
+ /**
86
+ * Incorporate falloff if a gradual uniform is requested
87
+ */
88
+ static FALLOFF: string;
89
+
90
+ /**
91
+ * Compute distance from the light center
92
+ */
93
+ static DISTANCE: string;
94
+
95
+ /**
96
+ * A mapping of available coloration techniques
97
+ */
98
+ static COLORATION_TECHNIQUES: AdaptiveLightingShader.ColorationTechniques;
99
+ }
100
+
101
+ declare namespace AdaptiveLightingShader {
102
+ interface ColorationTechniques extends Record<string, LightingTechnique> {
103
+ LEGACY: LightingTechnique;
104
+ LUMINANCE: LightingTechnique;
105
+ INTERNAL_HALO: LightingTechnique;
106
+ EXTERNAL_HALO: LightingTechnique;
107
+ COLOR_BURN: LightingTechnique;
108
+ INTERNAL_BURN: LightingTechnique;
109
+ EXTERNAL_BURN: LightingTechnique;
110
+ LOW_ABSORPTION: LightingTechnique;
111
+ HIGH_ABSORPTION: LightingTechnique;
112
+ INVERT_ABSORPTION: LightingTechnique;
113
+ }
114
+ }