littlejsengine 1.23.1 → 1.24.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/CHANGELOG.md +261 -0
- package/COPYRIGHT.txt +0 -27
- package/FAQ.md +4 -9
- package/README.md +4 -3
- package/REFERENCE.md +34 -18
- package/dist/littlejs.d.ts +160 -105
- package/dist/littlejs.esm.js +490 -277
- package/dist/littlejs.esm.min.js +3 -3
- package/dist/littlejs.js +489 -273
- package/dist/littlejs.min.js +2 -2
- package/dist/littlejs.release.js +463 -264
- package/package.json +2 -1
- package/plugins/box2d.js +1 -1
- package/plugins/pluginExport.js +0 -4
- package/plugins/render3d.js +93 -17
- package/plugins/render3dEditor.js +9 -3
- package/plugins/render3dExtras.js +169 -70
- package/plugins/render3dLevel.js +24 -4
- package/plugins/render3dVoxels.js +15 -8
- package/src/engine.js +1 -1
- package/src/engineAudio.js +2 -2
- package/src/engineBuild.mjs +0 -1
- package/src/engineEditor.js +17 -6
- package/src/engineExport.js +1 -0
- package/src/engineSettings.js +5 -1
- package/src/engineTileLayer.js +154 -1
- package/plugins/zzfxm.js +0 -162
package/dist/littlejs.d.ts
CHANGED
|
@@ -194,6 +194,36 @@ declare module "littlejsengine" {
|
|
|
194
194
|
* - Decides whether a particle stops where it hits the level, a filter as in 2D
|
|
195
195
|
*/
|
|
196
196
|
export type Particle3DCollideCallback = (particle: Particle3D, level: EngineObject3D, pos: Vector3) => boolean | void;
|
|
197
|
+
/**
|
|
198
|
+
* A part of a lens flare
|
|
199
|
+
*/
|
|
200
|
+
export type LensFlareElement = {
|
|
201
|
+
/**
|
|
202
|
+
* - Where along the line: 0 the sun, 1 the middle of the screen, 2 as far past it
|
|
203
|
+
*/
|
|
204
|
+
at: number;
|
|
205
|
+
/**
|
|
206
|
+
* - How big across, as a part of the screen's height, a vector for a part wider
|
|
207
|
+
* than it is tall
|
|
208
|
+
*/
|
|
209
|
+
size: number | Vector2;
|
|
210
|
+
/**
|
|
211
|
+
* - Its color, the alpha how bright
|
|
212
|
+
*/
|
|
213
|
+
color: Color;
|
|
214
|
+
/**
|
|
215
|
+
* - glow, disc, ring, hex, streak or star, a glow when left out
|
|
216
|
+
*/
|
|
217
|
+
shape?: string;
|
|
218
|
+
/**
|
|
219
|
+
* - A tile of the game's own to draw in place of a shape, best white on clear
|
|
220
|
+
*/
|
|
221
|
+
tileInfo?: TileInfo;
|
|
222
|
+
/**
|
|
223
|
+
* - How far it is turned, in radians
|
|
224
|
+
*/
|
|
225
|
+
angle?: number;
|
|
226
|
+
};
|
|
197
227
|
/**
|
|
198
228
|
* What VoxelMap.raycast finds: how far along the ray, the block's cell and type, and the normal of the face it comes in
|
|
199
229
|
* through
|
|
@@ -3579,7 +3609,7 @@ declare module "littlejsengine" {
|
|
|
3579
3609
|
* - 2D spatial audio based on camera position with distance-based falloff
|
|
3580
3610
|
* - Sound instance management (pause, resume, stop)
|
|
3581
3611
|
* - Speech synthesis for text-to-speech
|
|
3582
|
-
* - Music playback
|
|
3612
|
+
* - Music playback from audio files, looping by default
|
|
3583
3613
|
* - Web Audio API integration with master gain control
|
|
3584
3614
|
* - Sounds and the master bus can route through effects, see the audio effects plugin
|
|
3585
3615
|
* @namespace Audio
|
|
@@ -4239,6 +4269,10 @@ declare module "littlejsengine" {
|
|
|
4239
4269
|
* Load tile layers from exported data
|
|
4240
4270
|
* - Tiled maps come in as they are, flipped and turned tiles included, from one tileset image (a second tileset's
|
|
4241
4271
|
* tiles continue its numbering), finite maps in the CSV or array layer format; layer offsets and parallax are not read
|
|
4272
|
+
* - A tileset kept in the map with a margin or a spacing, a sheet with gaps between its tiles, is read where its
|
|
4273
|
+
* tiles are, whatever padding the tile info has; one in a file of its own (a tsx) is not read, pass a tile info
|
|
4274
|
+
* with its padding
|
|
4275
|
+
* - An LDtk level loads through tileLayersFromLDtk, which makes it a map like these
|
|
4242
4276
|
* - Group layers are flattened in order, each replaced by the layers inside it, so the layer indices
|
|
4243
4277
|
* (collisionLayer and the returned array) count that flattened list; a group's tint, opacity and
|
|
4244
4278
|
* visibility carry to the layers inside it
|
|
@@ -4248,11 +4282,38 @@ declare module "littlejsengine" {
|
|
|
4248
4282
|
* @param {Object} tileMapData - Level data from exported data
|
|
4249
4283
|
* @param {TileInfo} [tileInfo] - Default tile info (used for size and texture), tile() by default, none when no image is loaded
|
|
4250
4284
|
* @param {number} [renderOrder] - Render order of the top layer
|
|
4251
|
-
* @param {number}
|
|
4285
|
+
* @param {number|string} [collisionLayer] - Layer to use for collision if any, by its index or its name
|
|
4252
4286
|
* @param {boolean} [draw] - Should the layer be drawn automatically
|
|
4253
4287
|
* @return {Array<TileCollisionLayer>}
|
|
4254
4288
|
* @memberof TileLayers */
|
|
4255
|
-
export function tileLayersLoad(tileMapData: any, tileInfo?: TileInfo, renderOrder?: number, collisionLayer?: number, draw?: boolean): Array<TileCollisionLayer>;
|
|
4289
|
+
export function tileLayersLoad(tileMapData: any, tileInfo?: TileInfo, renderOrder?: number, collisionLayer?: number | string, draw?: boolean): Array<TileCollisionLayer>;
|
|
4290
|
+
/**
|
|
4291
|
+
* Make a Tiled map of a level of an LDtk project, to load with tileLayersLoad and objectLayersLoad
|
|
4292
|
+
* - Each Tiles, AutoLayer and IntGrid layer is a tile layer, the bottom one first as in Tiled; where LDtk stacks
|
|
4293
|
+
* tiles in a cell, an edge over a fill, each tile over another goes in a layer of its own just above, named with
|
|
4294
|
+
* (2), (3) and so on, and a tile LDtk draws see-through goes in one of its own with that opacity, times the
|
|
4295
|
+
* layer's, named with it, like Ground .25
|
|
4296
|
+
* - An IntGrid layer is a hidden layer of its values under its own name, for collision, whatever tiles its rules
|
|
4297
|
+
* make, which are layers over it named with tiles, like Collisions tiles; pass the name as collisionLayer, since
|
|
4298
|
+
* the stacked and see-through layers change the indices from level to level:
|
|
4299
|
+
* tileLayersLoad(map, tile(0, 16), 0, 'Collisions')
|
|
4300
|
+
* - An Entities layer is an object layer: an entity's name is its type for objectLayersAddType, it is placed at
|
|
4301
|
+
* its middle, and its Int, Float, Bool, String, Color and FilePath fields are its properties (an enum is a string)
|
|
4302
|
+
* - The tileset is the first tile layer's, with its padding and spacing; give tileLayersLoad a tile info of its image
|
|
4303
|
+
* - The level is in the project file (not saved as separate level files), its layers of one grid size; a layer of
|
|
4304
|
+
* another grid size or another tileset is left out, with a warning in debug builds, and a project with no tileset
|
|
4305
|
+
* keeps its tiles for the tile info the game gives; a project of several worlds has its levels counted in order
|
|
4306
|
+
* - Layer offsets are not read
|
|
4307
|
+
* - The level editor edits the map this returns, and saves it as a Tiled map
|
|
4308
|
+
* @param {Object} ldtk - The LDtk project, its JSON
|
|
4309
|
+
* @param {number|string} [level] - Which level, by its index or its identifier
|
|
4310
|
+
* @return {Object} - A Tiled map: width, height, tilewidth, tileheight, tilesets and layers
|
|
4311
|
+
* @example
|
|
4312
|
+
* const map = tileLayersFromLDtk(await fetchJSON('world.ldtk'), 'Level_0');
|
|
4313
|
+
* const layers = tileLayersLoad(map, tile(0, 16), 0, 'Collisions'); // its IntGrid layer is solid
|
|
4314
|
+
* objectLayersLoad(map);
|
|
4315
|
+
* @memberof TileLayers */
|
|
4316
|
+
export function tileLayersFromLDtk(ldtk: any, level?: number | string): any;
|
|
4256
4317
|
/** Add a type of object, so objectLayersLoad makes one wherever a map's object layer has an object of that type
|
|
4257
4318
|
* - The name is the object's type in Tiled (its class in Tiled 1.9); it is a string because minified builds
|
|
4258
4319
|
* rename classes
|
|
@@ -5314,58 +5375,6 @@ declare module "littlejsengine" {
|
|
|
5314
5375
|
* called by LightSystemPlugin after the lightmap is applied */
|
|
5315
5376
|
renderGlow(): void;
|
|
5316
5377
|
}
|
|
5317
|
-
/**
|
|
5318
|
-
* LittleJS ZzFXM Plugin
|
|
5319
|
-
* - A port of ZzFXM, the Zuper Zmall Zound Zynth music player, by Keith Clark and Frank Force, MIT licensed,
|
|
5320
|
-
* https://github.com/keithclark/ZzFXM; its notice is in COPYRIGHT.txt
|
|
5321
|
-
* @namespace ZzFXM
|
|
5322
|
-
*/
|
|
5323
|
-
/**
|
|
5324
|
-
* Music Object - Stores a zzfx music track for later use
|
|
5325
|
-
*
|
|
5326
|
-
* <a href=https://keithclark.github.io/ZzFXM/>Create music with the ZzFXM tracker.</a>
|
|
5327
|
-
* @extends Sound
|
|
5328
|
-
* @memberof ZzFXM
|
|
5329
|
-
* @example
|
|
5330
|
-
* // create some music
|
|
5331
|
-
* const music_example = new ZzFXMusic(
|
|
5332
|
-
* [
|
|
5333
|
-
* [ // instruments
|
|
5334
|
-
* [,0,400] // simple note
|
|
5335
|
-
* ],
|
|
5336
|
-
* [ // patterns
|
|
5337
|
-
* [ // pattern 1
|
|
5338
|
-
* [ // channel 0
|
|
5339
|
-
* 0, -1, // instrument 0, left speaker
|
|
5340
|
-
* 1, 0, 9, 1 // channel notes
|
|
5341
|
-
* ],
|
|
5342
|
-
* [ // channel 1
|
|
5343
|
-
* 0, 1, // instrument 0, right speaker
|
|
5344
|
-
* 0, 12, 17, -1 // channel notes
|
|
5345
|
-
* ]
|
|
5346
|
-
* ],
|
|
5347
|
-
* ],
|
|
5348
|
-
* [0, 0, 0, 0], // sequence, play pattern 0 four times
|
|
5349
|
-
* 90 // BPM
|
|
5350
|
-
* ]);
|
|
5351
|
-
*
|
|
5352
|
-
* // play the music on a loop
|
|
5353
|
-
* music_example.playMusic();
|
|
5354
|
-
*/
|
|
5355
|
-
export class ZzFXMusic extends Sound {
|
|
5356
|
-
/** Create a music object and cache the zzfx music samples for later use
|
|
5357
|
-
* @param {[Array, Array, Array, number?, ...any[]]} zzfxMusic - Array of zzfx music parameters: instruments, patterns, sequence, and an optional BPM; anything after it, like the tracker's metadata, is ignored
|
|
5358
|
-
*/
|
|
5359
|
-
constructor(zzfxMusic: [any[], any[], any[], number?, ...any[]]);
|
|
5360
|
-
}
|
|
5361
|
-
/** Generate samples for a ZzFM song with given parameters
|
|
5362
|
-
* @param {Array} instruments - Array of ZzFX sound parameters
|
|
5363
|
-
* @param {Array} patterns - Array of pattern data
|
|
5364
|
-
* @param {Array} sequence - Array of pattern indexes
|
|
5365
|
-
* @param {number} [BPM] - Playback speed of the song in BPM
|
|
5366
|
-
* @return {Array} - Left and right channel sample data
|
|
5367
|
-
* @memberof ZzFXM */
|
|
5368
|
-
export function zzfxM(instruments: any[], patterns: any[], sequence: any[], BPM?: number): any[];
|
|
5369
5378
|
/**
|
|
5370
5379
|
* LittleJS Audio Effects Plugin
|
|
5371
5380
|
* - Web Audio effects with a wet/dry mix: filter, reverb, delay, distortion, compressor
|
|
@@ -8682,8 +8691,8 @@ declare module "littlejsengine" {
|
|
|
8682
8691
|
* @return {Vector3|undefined} - undefined when the ray misses the plane */
|
|
8683
8692
|
screenToGround(screenPos: Vector2, groundHeight?: number, canvasSize?: Vector2): Vector3 | undefined;
|
|
8684
8693
|
/** Find the nearest object under a screen position or along a ray, for clicking on things
|
|
8685
|
-
* -
|
|
8686
|
-
*
|
|
8694
|
+
* - A mesh is hit on its triangles, the ones that face the ray as they are drawn, both sides of a doubleSided
|
|
8695
|
+
* mesh; a sprite is hit as the quad it draws, and a height map or a voxel map on its surface
|
|
8687
8696
|
* - engineObjectsRaycast3D is the other half of this, every object along a ray instead of the nearest
|
|
8688
8697
|
* @param {Vector2|Ray3D} from - A screen position like mousePosScreen, or a ray to look along
|
|
8689
8698
|
* @param {Array<EngineObject>} [objects] - Defaults to every object; only those with a mesh or a sprite count
|
|
@@ -9717,11 +9726,12 @@ declare module "littlejsengine" {
|
|
|
9717
9726
|
/** @type {Array<Vector3>} */
|
|
9718
9727
|
chunkCenters: Array<Vector3>;
|
|
9719
9728
|
chunksChanged: Set<any>;
|
|
9720
|
-
/** @type {Array<{faces: Array<number>, seeThrough: boolean, transparent: boolean}|undefined>} */
|
|
9729
|
+
/** @type {Array<{faces: Array<number>, seeThrough: boolean, transparent: boolean, doubleSided: boolean}|undefined>} */
|
|
9721
9730
|
blockTypes: Array<{
|
|
9722
9731
|
faces: Array<number>;
|
|
9723
9732
|
seeThrough: boolean;
|
|
9724
9733
|
transparent: boolean;
|
|
9734
|
+
doubleSided: boolean;
|
|
9725
9735
|
} | undefined>;
|
|
9726
9736
|
tiles: Map<any, any>;
|
|
9727
9737
|
/** The block type at a cell, 0 for empty or outside the map
|
|
@@ -9749,25 +9759,28 @@ declare module "littlejsengine" {
|
|
|
9749
9759
|
* @param {number} type - 1 to 255
|
|
9750
9760
|
* @param {number|Array<number>|{top?: number, side: number, bottom?: number}} faces - A tile index for every face,
|
|
9751
9761
|
* six in the order +x, -x, +y, -y, +z, -z, or the side's with the top and bottom's, which default to the side's
|
|
9752
|
-
* @param {{seeThrough?: boolean, transparent?: boolean}} [options] - seeThrough for holes
|
|
9753
|
-
* leaves, so the blocks beside it keep their faces; transparent to blend, like glass or
|
|
9754
|
-
* transparent stage, and see-through too
|
|
9762
|
+
* @param {{seeThrough?: boolean, transparent?: boolean, doubleSided?: boolean}} [options] - seeThrough for holes
|
|
9763
|
+
* in its texture, like leaves, so the blocks beside it keep their faces; transparent to blend, like glass or
|
|
9764
|
+
* water, drawn in the transparent stage, and see-through too; doubleSided for faces seen from inside the
|
|
9765
|
+
* block as well, like water, whose surface then shows from under it */
|
|
9755
9766
|
setBlockType(type: number, faces: number | Array<number> | {
|
|
9756
9767
|
top?: number;
|
|
9757
9768
|
side: number;
|
|
9758
9769
|
bottom?: number;
|
|
9759
|
-
}, { seeThrough, transparent }?: {
|
|
9770
|
+
}, { seeThrough, transparent, doubleSided }?: {
|
|
9760
9771
|
seeThrough?: boolean;
|
|
9761
9772
|
transparent?: boolean;
|
|
9773
|
+
doubleSided?: boolean;
|
|
9762
9774
|
}): void;
|
|
9763
9775
|
/** A block type's faces and how it is seen through
|
|
9764
9776
|
* @param {number} type
|
|
9765
|
-
* @return {{faces: Array<number>, seeThrough: boolean, transparent: boolean}}
|
|
9777
|
+
* @return {{faces: Array<number>, seeThrough: boolean, transparent: boolean, doubleSided: boolean}}
|
|
9766
9778
|
* @ignore */
|
|
9767
9779
|
blockType(type: number): {
|
|
9768
9780
|
faces: Array<number>;
|
|
9769
9781
|
seeThrough: boolean;
|
|
9770
9782
|
transparent: boolean;
|
|
9783
|
+
doubleSided: boolean;
|
|
9771
9784
|
};
|
|
9772
9785
|
/** Build every chunk again, after changing data directly or ambientOcclusion */
|
|
9773
9786
|
rebuild(): void;
|
|
@@ -9839,10 +9852,12 @@ declare module "littlejsengine" {
|
|
|
9839
9852
|
* - radius is a world distance, so scale3D does not change it
|
|
9840
9853
|
* - An alpha, an intensity or a radius of 0 switches it off, and a light that is off takes none of those slots
|
|
9841
9854
|
* - Draws nothing but its glow, when it has one; add a small emissive mesh if the lamp itself should be seen
|
|
9855
|
+
* - addFlare gives it a lens flare, see LensFlare3D
|
|
9842
9856
|
* @extends EngineObject3D
|
|
9843
9857
|
* @memberof Render3D
|
|
9844
9858
|
* @example
|
|
9845
9859
|
* const torch = new Light3D(vec3(0, 3, 0), 10, hsl(.1, 1, .65));
|
|
9860
|
+
* torch.addFlare(); // light in the lens when the torch is in view
|
|
9846
9861
|
*/
|
|
9847
9862
|
export class Light3D extends EngineObject3D {
|
|
9848
9863
|
/** Create a point light
|
|
@@ -9870,6 +9885,23 @@ declare module "littlejsengine" {
|
|
|
9870
9885
|
/** @property {number} - How fast the glow fades from its middle: 1 by default, .5 a wide haze, 2 a tight
|
|
9871
9886
|
* bright core */
|
|
9872
9887
|
glowFalloff: number;
|
|
9888
|
+
/** @type {LensFlare3D|undefined} */
|
|
9889
|
+
flareObject: LensFlare3D | undefined;
|
|
9890
|
+
/** Give the light a lens flare, made with the arguments of LensFlare3D, in place of the one it had
|
|
9891
|
+
* @param {number} [size] - Scales every part of it
|
|
9892
|
+
* @param {number} [count] - How many ghosts there are, besides the glow at the light
|
|
9893
|
+
* @param {number} [intensity] - How bright it is
|
|
9894
|
+
* @param {number} [saturation] - How colorful the ghosts are
|
|
9895
|
+
* @param {Color} [color] - Tints the flare, with the light's own color
|
|
9896
|
+
* @return {LensFlare3D} - The flare, to change: light.addFlare().shapes = ['hex'] */
|
|
9897
|
+
addFlare(size?: number, count?: number, intensity?: number, saturation?: number, color?: Color): LensFlare3D;
|
|
9898
|
+
set flare(arg: LensFlare3D);
|
|
9899
|
+
/** The light's lens flare, undefined for none: addFlare makes it, or set a LensFlare3D of your own, and
|
|
9900
|
+
* destroying the flare takes it away
|
|
9901
|
+
* - The flare is the light's: it is attached to the light as its child, so it stays through a scene change
|
|
9902
|
+
* when the light does, and is destroyed with the light or when another takes its place
|
|
9903
|
+
* @type {LensFlare3D|undefined} */
|
|
9904
|
+
get flare(): LensFlare3D;
|
|
9873
9905
|
}
|
|
9874
9906
|
/**
|
|
9875
9907
|
* DirectionalLight3D - A Light3D that shines from far away with no falloff, like sunlight
|
|
@@ -10165,16 +10197,31 @@ declare module "littlejsengine" {
|
|
|
10165
10197
|
clear(): void;
|
|
10166
10198
|
worldPos3D: Vector3;
|
|
10167
10199
|
}
|
|
10200
|
+
/**
|
|
10201
|
+
* A part of a lens flare
|
|
10202
|
+
* @typedef {Object} LensFlareElement
|
|
10203
|
+
* @property {number} at - Where along the line: 0 the sun, 1 the middle of the screen, 2 as far past it
|
|
10204
|
+
* @property {number|Vector2} size - How big across, as a part of the screen's height, a vector for a part wider
|
|
10205
|
+
* than it is tall
|
|
10206
|
+
* @property {Color} color - Its color, the alpha how bright
|
|
10207
|
+
* @property {string} [shape] - glow, disc, ring, hex, streak or star, a glow when left out
|
|
10208
|
+
* @property {TileInfo} [tileInfo] - A tile of the game's own to draw in place of a shape, best white on clear
|
|
10209
|
+
* @property {number} [angle] - How far it is turned, in radians
|
|
10210
|
+
* @memberof Render3D
|
|
10211
|
+
*/
|
|
10168
10212
|
/**
|
|
10169
10213
|
* LensFlare3D - The sun's lens flare, the old kind: a glow at the sun and a row of discs and rings of different
|
|
10170
10214
|
* sizes along the line from the sun through the middle of the screen
|
|
10171
10215
|
* - Make one and it shows, over the 3D scene and under what the game draws after, a HUD; destroy it to take it away
|
|
10172
10216
|
* - It follows render3D.sunDirection, and fades out as the sun leaves the screen or goes behind something
|
|
10217
|
+
* - A Light3D gets one of its own with light.addFlare()
|
|
10173
10218
|
* - flareSize, count, intensity and saturation set its look, seed picks another arrangement, and its color tints it,
|
|
10174
|
-
* with the sun's own color;
|
|
10175
|
-
*
|
|
10219
|
+
* with the sun's own color; shapes says what its ghosts are, glowSize and ghostSize how big its parts are; or
|
|
10220
|
+
* give it elements of your own, which may be tiles of the game's
|
|
10221
|
+
* - visible is how much of the sun shows, 0 to 1, eased over fadeTime, there for a game to read; it is 0 while the
|
|
10222
|
+
* sun is too far off the screen for the flare to show, a third of the screen past its edge, where nothing is tested
|
|
10176
10223
|
* - What hides the sun is found with a ray from the camera, against the level and every object that is not see
|
|
10177
|
-
* through, each
|
|
10224
|
+
* through, each on the triangles of its mesh, see render3D.pick; turn it off with occlusion
|
|
10178
10225
|
* - It needs WebGL, and it draws nothing in the shadow of renderAfter2D
|
|
10179
10226
|
* @extends EngineObject3D
|
|
10180
10227
|
* @memberof Render3D
|
|
@@ -10200,67 +10247,74 @@ declare module "littlejsengine" {
|
|
|
10200
10247
|
saturation: number;
|
|
10201
10248
|
/** @property {number} - Picks the arrangement of the ghosts, another seed is another flare */
|
|
10202
10249
|
seed: number;
|
|
10203
|
-
/** @property {Array<
|
|
10204
|
-
*
|
|
10205
|
-
*
|
|
10206
|
-
*
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10250
|
+
/** @property {Array<string>|undefined} - The shapes the ghosts are picked from, glow, disc, ring, hex,
|
|
10251
|
+
* streak or star: ['hex'] makes every ghost a hexagon, and a shape listed twice is picked twice as often;
|
|
10252
|
+
* discs, rings and glows when not set
|
|
10253
|
+
* @type {Array<string>|undefined} */
|
|
10254
|
+
shapes: Array<string> | undefined;
|
|
10255
|
+
/** @property {number} - Scales the glow at the sun, 0 for none */
|
|
10256
|
+
glowSize: number;
|
|
10257
|
+
/** @property {number} - Scales the ghosts */
|
|
10258
|
+
ghostSize: number;
|
|
10259
|
+
/** @property {Array<LensFlareElement>|undefined} - The parts of the flare, to set your own in place of the
|
|
10260
|
+
* ones made from count, seed, saturation, shapes, glowSize and ghostSize
|
|
10261
|
+
* @type {Array<LensFlareElement>|undefined} */
|
|
10262
|
+
elements: Array<LensFlareElement> | undefined;
|
|
10214
10263
|
/** @property {Light3D|undefined} - A light the flare is of in place of the sun, a lamp or a spotlight: the
|
|
10215
10264
|
* flare is at the light and in its color, smaller from farther than the light reaches, hidden by what is
|
|
10216
|
-
* in front of the light,
|
|
10265
|
+
* in front of the light but its lamp, a mesh around it no wider than half its radius, and a spotlight's
|
|
10266
|
+
* shows from inside its beam only; a DirectionalLight3D's is far
|
|
10267
|
+
* away where it shines from, like the sun's; the flare is destroyed when its light is; light.addFlare
|
|
10268
|
+
* sets this
|
|
10217
10269
|
* @type {Light3D|undefined} */
|
|
10218
10270
|
light: Light3D | undefined;
|
|
10219
10271
|
/** @property {boolean} - Fade out when something is between the camera and the sun */
|
|
10220
10272
|
occlusion: boolean;
|
|
10221
10273
|
/** @property {number} - Seconds the flare takes to fade out or in when the sun is hidden or shows again */
|
|
10222
10274
|
fadeTime: number;
|
|
10223
|
-
/** @property {number} - How much of the sun shows, 0 hidden or behind the camera to 1 in
|
|
10275
|
+
/** @property {number} - How much of the sun shows, 0 hidden, off the screen or behind the camera to 1 in
|
|
10276
|
+
* plain view, eased */
|
|
10224
10277
|
visible: number;
|
|
10225
10278
|
madeKey: string;
|
|
10226
|
-
/** @type {Array<
|
|
10227
|
-
made:
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
}[];
|
|
10233
|
-
/** The parts of the flare: the elements set by hand, or the ones made from count, seed and saturation, a glow
|
|
10234
|
-
* and a core at the sun and the ghosts, made again when one of those changes
|
|
10235
|
-
* @return {Array<{at: number, size: number, color: Color, shape: string}>} */
|
|
10236
|
-
getElements(): Array<{
|
|
10237
|
-
at: number;
|
|
10238
|
-
size: number;
|
|
10239
|
-
color: Color;
|
|
10240
|
-
shape: string;
|
|
10241
|
-
}>;
|
|
10279
|
+
/** @type {Array<LensFlareElement>} */
|
|
10280
|
+
made: Array<LensFlareElement>;
|
|
10281
|
+
/** The parts of the flare: the elements set by hand, or the ones made from count, seed, saturation, shapes,
|
|
10282
|
+
* glowSize and ghostSize, a glow and a core at the sun and the ghosts, made again when one of those changes
|
|
10283
|
+
* @return {Array<LensFlareElement>} */
|
|
10284
|
+
getElements(): Array<LensFlareElement>;
|
|
10242
10285
|
flareSource(): {
|
|
10243
10286
|
direction: Vector3;
|
|
10244
10287
|
distance: number;
|
|
10245
10288
|
pos: Vector3;
|
|
10246
10289
|
};
|
|
10290
|
+
flareLook(): {
|
|
10291
|
+
sun: Vector2;
|
|
10292
|
+
center: Vector2;
|
|
10293
|
+
strength: number;
|
|
10294
|
+
tint: Color;
|
|
10295
|
+
height: number;
|
|
10296
|
+
};
|
|
10247
10297
|
/** Where the sun, or the flare's light, is on the screen, in pixels like mousePosScreen, undefined when it is
|
|
10248
10298
|
* behind the camera
|
|
10249
10299
|
* @return {Vector2|undefined} */
|
|
10250
|
-
|
|
10251
|
-
/** The parts of the flare as they are drawn now: each one's place on the screen, its size in pixels
|
|
10252
|
-
* color, dimmed by how much of the sun shows; empty when there is nothing to draw
|
|
10253
|
-
* @return {Array<{pos: Vector2, size: number, color: Color, shape: string
|
|
10300
|
+
getScreenPos(): Vector2 | undefined;
|
|
10301
|
+
/** The parts of the flare as they are drawn now: each one's place on the screen, its size in pixels, a vector
|
|
10302
|
+
* when the element's is, and its color, dimmed by how much of the sun shows; empty when there is nothing to draw
|
|
10303
|
+
* @return {Array<{pos: Vector2, size: number|Vector2, color: Color, shape: string|undefined,
|
|
10304
|
+
* tileInfo: TileInfo|undefined, angle: number}>} */
|
|
10254
10305
|
getScreenElements(): Array<{
|
|
10255
10306
|
pos: Vector2;
|
|
10256
|
-
size: number;
|
|
10307
|
+
size: number | Vector2;
|
|
10257
10308
|
color: Color;
|
|
10258
|
-
shape: string;
|
|
10309
|
+
shape: string | undefined;
|
|
10310
|
+
tileInfo: TileInfo | undefined;
|
|
10311
|
+
angle: number;
|
|
10259
10312
|
}>;
|
|
10260
10313
|
/** Is something between the camera and the sun, or the flare's light: the level, or an object that is not see
|
|
10261
|
-
* through
|
|
10314
|
+
* through, hit on its triangles as render3D.pick hits it, so a mesh the camera is inside hides nothing unless
|
|
10315
|
+
* it is doubleSided
|
|
10262
10316
|
* @return {boolean} */
|
|
10263
|
-
|
|
10317
|
+
isHidden(): boolean;
|
|
10264
10318
|
}
|
|
10265
10319
|
/**
|
|
10266
10320
|
* Collect the EngineObject3D objects whose boxes overlap a sphere or a box, the 3D twin of engineObjectsCollect
|
|
@@ -10602,8 +10656,9 @@ declare module "littlejsengine" {
|
|
|
10602
10656
|
* are added before its objects are made, one the game added itself keeps its place
|
|
10603
10657
|
* - A level may set the scene too, in a scene block beside its objects: sky, three colors for straight up, the
|
|
10604
10658
|
* horizon and straight down, ambient, how much of them lights the scene, .5 when not given, sunDirection and
|
|
10605
|
-
* sunColor, fog, its start and end, fogColor, the horizon color when not given, and
|
|
10606
|
-
* leaves out stays as the game set it, and a level with no block changes
|
|
10659
|
+
* sunColor, fog, its start and end, fogColor, the horizon color when not given, shadows, and lensFlare, the
|
|
10660
|
+
* sun's lens flare; what the block leaves out stays as the game set it, and a level with no block changes
|
|
10661
|
+
* nothing
|
|
10607
10662
|
* @param {Object} level - The level, the level editor edits this same object
|
|
10608
10663
|
* @return {Array<any>} - What each object's type made, a function that made nothing is left out
|
|
10609
10664
|
* @memberof Level3D */
|