melonjs 19.9.1 → 20.1.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.
- package/README.md +25 -14
- package/build/application/application.d.ts +70 -16
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +2 -2
- package/build/application/settings.d.ts +150 -53
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +13 -11
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/camera/effects/mask_effect.d.ts.map +1 -1
- package/build/const.d.ts +55 -26
- package/build/const.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +156 -0
- package/build/geometries/box3d.d.ts.map +1 -0
- package/build/index.d.ts +34 -24
- package/build/index.d.ts.map +1 -1
- package/build/index.js +22171 -8029
- package/build/index.js.map +4 -4
- package/build/lang/deprecated.d.ts +4 -4
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +4 -0
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +42 -6
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/gltf/srgb.d.ts +20 -0
- package/build/level/gltf/srgb.d.ts.map +1 -0
- package/build/level/level.d.ts +21 -2
- package/build/level/level.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +61 -13
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +49 -21
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts +18 -0
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts +49 -0
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/loader/parsers/pbr.d.ts +63 -0
- package/build/loader/parsers/pbr.d.ts.map +1 -0
- package/build/loader/parsers/shader.d.ts +32 -24
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +86 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +35 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +123 -15
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +186 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +59 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -0
- package/build/physics/response.d.ts +32 -0
- package/build/physics/response.d.ts.map +1 -1
- package/build/physics/world.d.ts +1 -0
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts +92 -0
- package/build/renderable/groundshadow.d.ts.map +1 -0
- package/build/renderable/instanced_mesh.d.ts +286 -0
- package/build/renderable/instanced_mesh.d.ts.map +1 -0
- package/build/renderable/mesh.d.ts +242 -23
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -4
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +17 -6
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -40
- package/build/system/device.d.ts.map +1 -1
- package/build/system/platform.d.ts +0 -16
- package/build/system/platform.d.ts.map +1 -1
- package/build/utils/utils.d.ts +2 -0
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +22 -16
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
- package/build/video/effects/blur.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
- package/build/video/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
- package/build/video/effects/desaturate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
- package/build/video/effects/dissolve.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
- package/build/video/effects/flash.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
- package/build/video/effects/glow.d.ts.map +1 -0
- package/build/video/effects/glsl_realization.d.ts +18 -0
- package/build/video/effects/glsl_realization.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
- package/build/video/effects/hologram.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
- package/build/video/effects/invert.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
- package/build/video/effects/outline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
- package/build/video/effects/pixelate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
- package/build/video/effects/radialGradient.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
- package/build/video/effects/scanline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
- package/build/video/effects/sepia.d.ts.map +1 -0
- package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
- package/build/video/effects/shadereffect.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
- package/build/video/effects/shine.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
- package/build/video/effects/tintPulse.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
- package/build/video/effects/vignette.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
- package/build/video/effects/wave.d.ts.map +1 -0
- package/build/video/effects/wgsl/layout.d.ts +28 -0
- package/build/video/effects/wgsl/layout.d.ts.map +1 -0
- package/build/video/effects/wgsl/parse.d.ts +9 -0
- package/build/video/effects/wgsl/parse.d.ts.map +1 -0
- package/build/video/effects/wgsl/scaffold.d.ts +43 -0
- package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
- package/build/video/effects/wgsl_realization.d.ts +83 -0
- package/build/video/effects/wgsl_realization.d.ts.map +1 -0
- package/build/video/gpu/batcher.d.ts +71 -0
- package/build/video/gpu/batcher.d.ts.map +1 -0
- package/build/video/gpu/instancerecord.d.ts +164 -0
- package/build/video/gpu/instancerecord.d.ts.map +1 -0
- package/build/video/gpu/meshchunk.d.ts +49 -0
- package/build/video/gpu/meshchunk.d.ts.map +1 -0
- package/build/video/gpu/meshvertex.d.ts +54 -0
- package/build/video/gpu/meshvertex.d.ts.map +1 -0
- package/build/video/gpu/primitives.d.ts +60 -0
- package/build/video/gpu/primitives.d.ts.map +1 -0
- package/build/video/gpu/quadcorners.d.ts +11 -0
- package/build/video/gpu/quadcorners.d.ts.map +1 -0
- package/build/video/gpu/textureslots.d.ts +122 -0
- package/build/video/gpu/textureslots.d.ts.map +1 -0
- package/build/video/gpu/texturestore.d.ts +139 -0
- package/build/video/gpu/texturestore.d.ts.map +1 -0
- package/build/video/gpu/topology.d.ts +43 -0
- package/build/video/gpu/topology.d.ts.map +1 -0
- package/build/video/gpu/vertexformat.d.ts +72 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -0
- package/build/video/gradient.d.ts +14 -5
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +153 -8
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +2 -2
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +20 -2
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +2 -2
- package/build/video/utils/autodetect.d.ts.map +1 -1
- package/build/video/video.d.ts +1 -55
- package/build/video/video.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +132 -35
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +1 -1
- package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
- package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts +101 -8
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +20 -8
- package/build/video/webgl/lighting/constants.d.ts.map +1 -1
- package/build/video/webgl/lighting/pack.d.ts +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +27 -11
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
- package/build/video/webgl/lighting/std140.d.ts +110 -0
- package/build/video/webgl/lighting/std140.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
- package/build/video/webgl/texture/store.d.ts +52 -0
- package/build/video/webgl/texture/store.d.ts.map +1 -0
- package/build/video/webgl/utils/maxtextures.d.ts +37 -0
- package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
- package/build/video/webgl/utils/samplercache.d.ts +69 -0
- package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
- package/build/video/webgl/utils/string.d.ts +16 -0
- package/build/video/webgl/utils/string.d.ts.map +1 -1
- package/build/video/webgl/utils/topology.d.ts +24 -0
- package/build/video/webgl/utils/topology.d.ts.map +1 -0
- package/build/video/webgl/utils/vertexformat.d.ts +27 -0
- package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +148 -30
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
- package/build/video/webgpu/buffer/arena.d.ts +64 -0
- package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
- package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
- package/build/video/webgpu/effect_binding.d.ts +17 -0
- package/build/video/webgpu/effect_binding.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/cache.d.ts +173 -0
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
- package/build/video/webgpu/texture/compressed.d.ts +33 -0
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
- package/build/video/webgpu/texture/frametexture.d.ts +65 -0
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
- package/build/video/webgpu/texture/store.d.ts +149 -0
- package/build/video/webgpu/texture/store.d.ts.map +1 -0
- package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
- package/package.json +2 -2
- package/build/video/webgl/effects/blur.d.ts.map +0 -1
- package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
- package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
- package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
- package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
- package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
- package/build/video/webgl/effects/flash.d.ts.map +0 -1
- package/build/video/webgl/effects/glow.d.ts.map +0 -1
- package/build/video/webgl/effects/hologram.d.ts.map +0 -1
- package/build/video/webgl/effects/invert.d.ts.map +0 -1
- package/build/video/webgl/effects/outline.d.ts.map +0 -1
- package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
- package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
- package/build/video/webgl/effects/scanline.d.ts.map +0 -1
- package/build/video/webgl/effects/sepia.d.ts.map +0 -1
- package/build/video/webgl/effects/shine.d.ts.map +0 -1
- package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
- package/build/video/webgl/effects/vignette.d.ts.map +0 -1
- package/build/video/webgl/effects/wave.d.ts.map +0 -1
- package/build/video/webgl/shadereffect.d.ts.map +0 -1
|
@@ -25,7 +25,7 @@ export class CanvasTexture extends CanvasRenderTarget {
|
|
|
25
25
|
* @param {number} width - the desired width of the canvas
|
|
26
26
|
* @param {number} height - the desired height of the canvas
|
|
27
27
|
* @param {object} attributes - The attributes to create both the canvas and context
|
|
28
|
-
* @param {boolean} [attributes.context="2d"] - the context type to be created ("2d", "webgl"
|
|
28
|
+
* @param {boolean} [attributes.context="2d"] - the context type to be created ("2d", "webgl" — creates a WebGL 2 context)
|
|
29
29
|
* @param {boolean} [attributes.offscreenCanvas=false] - will create an offscreenCanvas if true instead of a standard canvas
|
|
30
30
|
* @param {boolean} [attributes.willReadFrequently=false] - Indicates whether or not a lot of read-back operations are planned
|
|
31
31
|
* @param {boolean} [attributes.antiAlias=false] - Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
@@ -39,9 +39,9 @@ export class CanvasTexture extends CanvasRenderTarget {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated since 18.1.0
|
|
42
|
-
* @see
|
|
42
|
+
* @see WebGLBatcher
|
|
43
43
|
*/
|
|
44
|
-
export class Compositor extends
|
|
44
|
+
export class Compositor extends WebGLBatcher {
|
|
45
45
|
/** @param {any[]} args */
|
|
46
46
|
constructor(...args: any[]);
|
|
47
47
|
}
|
|
@@ -63,7 +63,7 @@ export class QuadCompositor extends QuadBatcher {
|
|
|
63
63
|
}
|
|
64
64
|
export * as Math from "./../math/math.ts";
|
|
65
65
|
import CanvasRenderTarget from "../video/rendertarget/canvasrendertarget.js";
|
|
66
|
-
import {
|
|
66
|
+
import { WebGLBatcher } from "../video/webgl/batchers/batcher.js";
|
|
67
67
|
import PrimitiveBatcher from "../video/webgl/batchers/primitive_batcher.js";
|
|
68
68
|
import QuadBatcher from "../video/webgl/batchers/quad_batcher.js";
|
|
69
69
|
//# sourceMappingURL=deprecated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/lang/deprecated.js"],"names":[],"mappings":"AAuJA;;;;;;;;GAQG;AACH,4CAHW,OAAO,QAsBjB;AAED;;;;;;GAMG;AACH,uCAeC;AA7LD;;;GAGG;AACH;IACC;;;;;;;;OAQG;IACH,mBARW,MAAM,UACN,MAAM,cAEd;QAA6B,OAAO;QACP,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EAIA;CACD;AA4BD;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;AAED;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;AAED;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;;+
|
|
1
|
+
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/lang/deprecated.js"],"names":[],"mappings":"AAuJA;;;;;;;;GAQG;AACH,4CAHW,OAAO,QAsBjB;AAED;;;;;;GAMG;AACH,uCAeC;AA7LD;;;GAGG;AACH;IACC;;;;;;;;OAQG;IACH,mBARW,MAAM,UACN,MAAM,cAEd;QAA6B,OAAO;QACP,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EAIA;CACD;AA4BD;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;AAED;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;AAED;;;GAGG;AACH;IACC,0BAA0B;IAC1B,qBADY,GAAG,EAAE,EAIhB;CACD;;+BA3F8B,6CAA6C;6BAC/C,oCAAoC;6BACpC,8CAA8C;wBACnD,yCAAyC"}
|
|
@@ -26,11 +26,15 @@ export default class GLTFModel extends Container {
|
|
|
26
26
|
* @param {number} [options.scale=1] - pixels per glTF unit (uniform scene scale)
|
|
27
27
|
* @param {boolean} [options.rightHanded=true] - glTF Y-up → engine Y-down via a rotation (no mirror)
|
|
28
28
|
* @param {boolean} [options.lit=false] - render the part meshes through the lit batcher
|
|
29
|
+
* @param {boolean} [options.castGroundShadow] - give the parts a ground shadow; omit to inherit the application setting
|
|
30
|
+
* @param {number} [options.shadowGroundY] - world Y of the floor those shadows land on
|
|
29
31
|
*/
|
|
30
32
|
constructor(data: object, options?: {
|
|
31
33
|
scale?: number | undefined;
|
|
32
34
|
rightHanded?: boolean | undefined;
|
|
33
35
|
lit?: boolean | undefined;
|
|
36
|
+
castGroundShadow?: boolean | undefined;
|
|
37
|
+
shadowGroundY?: number | undefined;
|
|
34
38
|
});
|
|
35
39
|
_zSign: number;
|
|
36
40
|
/** the node hierarchy keyed by glTF node index @ignore */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLTFModel.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFModel.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IACC;;;;;;;;OAQG;IACH,kBARW,MAAM,YAEd;QAAyB,KAAK;QACJ,WAAW;QACX,GAAG;QACH,gBAAgB;QACjB,aAAa;KACxC,EA2LA;IA/KA,eAAoD;IAepD,0DAA0D;IAC1D,YAA8B;IAC9B,gCAAgC;IAChC,YAA8B;IAC9B,4EAA4E;IAC5E,gBAAqB;IACrB,qEAAqE;IACrE,gBAAqB;IACrB;;;;;;OAMG;IACH,WAAgB;IA+FhB,8EAA8E;IAC9E,SAAc;IAiBd;;;;OAIG;IACH,gBAHU,MAAM,CAGO;IAEvB;;;;OAIG;IACH,gBAHU,OAAO,CAGU;IAE3B;;;;OAIG;IAIH,cAAc;IACd;;;;MAAsD;IACtD,gEAAgE;IAChE,uFAA0B;IAC1B,yEAAyE;IACzE,mBAAsB;IAOvB;;;;;OAKG;IACH,qBAJa,MAAM,EAAE,CAMpB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;;;;;OAeG;IACH,0BAXW,MAAM,YACN,MAAM,cAAU,gBAAgB,iBAChC,OAAO,GACL,SAAS,CAsDrB;IAED;;;;;;;;;;;;;OAaG;IACH,YATW,MAAM,YACN,MAAM,cAAU,gBAAgB,GAC9B,SAAS,CAarB;IAED;;;;OAIG;IACH,SAFa,SAAS,CAKrB;IAED;;;;;;OAMG;IACH,QAFa,SAAS,CAarB;IAyCD;;;;;OAKG;IACH,cAMC;IAED;;;;OAIG;IACH,4DAqBC;IAED;;;;;;OAMG;IACH,2CAHa,MAAM,EAAE,CAwCpB;IAED;;;;;;;OAOG;IACH,+CASC;CACD;sBA7gBqB,+BAA+B;sCAUhB,+BAA+B"}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fill an {@link InstancedMesh}'s records from an
|
|
3
|
+
* `EXT_mesh_gpu_instancing` node's per-instance TRS arrays.
|
|
4
|
+
*
|
|
5
|
+
* The records are written in the node's own (glTF, Y-up, right-handed)
|
|
6
|
+
* space, **verbatim** — no scene scale, no axis bridge. That is not a
|
|
7
|
+
* simplification but the consequence of where the instance transform sits
|
|
8
|
+
* in the chain the shader evaluates:
|
|
9
|
+
*
|
|
10
|
+
* clip = projection × view × model(group) × instance × vertex
|
|
11
|
+
*
|
|
12
|
+
* The group's model matrix already carries the scene scale and the Y/Z
|
|
13
|
+
* bridge, and it is applied AFTER the instance transform — so an instance
|
|
14
|
+
* expressed in the same space as the vertices comes out placed correctly.
|
|
15
|
+
* Pre-scaling or pre-bridging the records here applies both twice (which
|
|
16
|
+
* put the first version of this forest 26× too far out, and well outside
|
|
17
|
+
* the far plane).
|
|
18
|
+
* @param {InstancedMesh} mesh - the mesh to fill
|
|
19
|
+
* @param {object} instances - `{count, translation, rotation, scale}`
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
22
|
+
export function fillInstances(mesh: InstancedMesh, instances: object): void;
|
|
1
23
|
/**
|
|
2
24
|
* @classdesc
|
|
3
25
|
* A loadable 3D scene parsed from a glTF / GLB asset. Instances are created
|
|
@@ -50,18 +72,30 @@ export default class GLTFScene {
|
|
|
50
72
|
* @param {boolean} [options.rightHanded=true] - convert glTF Y-up right-handed
|
|
51
73
|
* geometry to the engine's Y-down via a rotation (no mirror). See the wiki.
|
|
52
74
|
* @param {boolean} [options.lights=true] - add the scene's authored
|
|
53
|
-
* `KHR_lights_punctual`
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* lighting yourself with
|
|
75
|
+
* `KHR_lights_punctual` lights — directional suns, point and spot lamps
|
|
76
|
+
* (plus a soft ambient fill) — to the world as {@link Light3d}
|
|
77
|
+
* renderables, so the meshes are lit as set up in the authoring tool.
|
|
78
|
+
* Set false to keep the meshes unlit / manage lighting yourself with
|
|
79
|
+
* `world.addChild(new Light3d(...))`. Each instantiated light carries
|
|
80
|
+
* its authored name, so `world.getChildByName("Sun")` finds it for
|
|
81
|
+
* runtime tuning (day/night cycles, flicker).
|
|
82
|
+
* @param {number} [options.lightIntensityScale] - multiply each light's
|
|
83
|
+
* AUTHORED intensity by this factor instead of normalizing it to 1.
|
|
84
|
+
* glTF stores physical units — lux for suns (a Blender daylight sun is
|
|
85
|
+
* ~1000+), candela for lamps — which blow out the engine's stylized
|
|
86
|
+
* half-Lambert shading when used raw, so the default keeps every light
|
|
87
|
+
* at unit intensity and lets the app tune. With this option the
|
|
88
|
+
* authored ratios survive: e.g. `0.001` maps a 1000-lux sun to 1 while
|
|
89
|
+
* a half-strength 500-lux fill lands at 0.5.
|
|
57
90
|
*/
|
|
58
91
|
addTo(container: Container, options?: {
|
|
59
92
|
scale?: number | undefined;
|
|
60
93
|
rightHanded?: boolean | undefined;
|
|
61
94
|
lights?: boolean | undefined;
|
|
95
|
+
lightIntensityScale?: number | undefined;
|
|
62
96
|
}): void;
|
|
63
97
|
/**
|
|
64
|
-
* Add the scene's authored directional
|
|
98
|
+
* Add the scene's authored lights — directional, point and spot — (plus a soft ambient fill) to
|
|
65
99
|
* the world as {@link Light3d} renderables, so the meshes are lit by the
|
|
66
100
|
* same sun set up in the authoring tool (Blender etc.). Shared by the static
|
|
67
101
|
* and animated paths. The lights are ordinary world children — the level
|
|
@@ -69,10 +103,11 @@ export default class GLTFScene {
|
|
|
69
103
|
* {@link Light2d}, so there's nothing to track or tear down here.
|
|
70
104
|
* @param {Container} container - the target container the lights are added to
|
|
71
105
|
* @param {number} zSign - the Y-up→Y-down Z bridge sign (rightHanded → -1)
|
|
106
|
+
* @param {number} scale - the scene's world scale (positions/ranges follow it)
|
|
72
107
|
* @param {object} options - the `addTo` options (`lights` toggle)
|
|
73
108
|
* @ignore
|
|
74
109
|
*/
|
|
75
|
-
_addLights(container: Container, zSign: number, options: object): void;
|
|
110
|
+
_addLights(container: Container, zSign: number, scale: number, options: object): void;
|
|
76
111
|
/**
|
|
77
112
|
* Director cleanup hook (parity with `TMXTileMap.destroy`). Nothing to do —
|
|
78
113
|
* the meshes and lights are ordinary world children, removed by the
|
|
@@ -81,4 +116,5 @@ export default class GLTFScene {
|
|
|
81
116
|
*/
|
|
82
117
|
destroy(): void;
|
|
83
118
|
}
|
|
119
|
+
import InstancedMesh from "../../renderable/instanced_mesh.js";
|
|
84
120
|
//# sourceMappingURL=GLTFScene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFScene.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFScene.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GLTFScene.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/GLTFScene.js"],"names":[],"mappings":"AA6VA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oCAJW,aAAa,aACb,MAAM,QAwChB;AA7YD;;;;;;;;;;GAUG;AACH;IACC;;OAEG;IACH,qBAFW,MAAM,EAkBhB;IAfA;;;OAGG;IACH,MAFU,MAAM,CAEG;IACnB;;;OAGG;IACH,QAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,MAFU,MAAM,CAEY;IAG7B;;;;OAIG;IACH,cAFa,MAAM,GAAC,SAAS,CAI5B;IAED;;;;OAIG;IACH,qBAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iBAtBW,SAAS,YAEjB;QAAyB,KAAK;QACJ,WAAW;QAEX,MAAM;QAQP,mBAAmB;KAQ9C,QA4KA;IAED;;;;;;;;;;;;OAYG;IACH,sBANW,SAAS,SACT,MAAM,SACN,MAAM,WACN,MAAM,QAqEhB;IAED;;;;;OAKG;IACH,gBAAY;CACZ;0BAvVyB,oCAAoC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color-space bridge for glTF material factors.
|
|
3
|
+
*
|
|
4
|
+
* glTF 2.0 defines `pbrMetallicRoughness.baseColorFactor` in **linear** space
|
|
5
|
+
* (spec §3.9.2), while a melonJS `tint` is an 8-bit **sRGB** value — the same
|
|
6
|
+
* space as a CSS color or a texel out of a PNG. Handing the linear number
|
|
7
|
+
* straight to `tint.setColor(f * 255)` therefore displays every untextured
|
|
8
|
+
* glTF material far too light and desaturated: a linear `0.29` shows up as
|
|
9
|
+
* sRGB `0.58`, so an authored mid-green renders as pale mint.
|
|
10
|
+
*
|
|
11
|
+
* The encode below is the standard sRGB transfer function.
|
|
12
|
+
* @module level/gltf/srgb
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Encode one linear channel (0..1) to an 8-bit sRGB value (0..255).
|
|
16
|
+
* @param {number} c - linear channel value
|
|
17
|
+
* @returns {number} the sRGB-encoded channel, rounded to 0..255
|
|
18
|
+
*/
|
|
19
|
+
export function linearToSrgb8(c: number): number;
|
|
20
|
+
//# sourceMappingURL=srgb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"srgb.d.ts","sourceRoot":"","sources":["../../../src/level/gltf/srgb.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,iCAHW,MAAM,GACJ,MAAM,CAQlB"}
|
package/build/level/level.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export namespace level {
|
|
|
24
24
|
* @param {boolean} [options.setViewportBounds=true] - (TMX only) if true, set the viewport bounds to the map size
|
|
25
25
|
* @param {number} [options.scale=1] - (glTF/GLB only) pixels per glTF unit applied to the whole scene
|
|
26
26
|
* @param {boolean} [options.rightHanded=true] - (glTF/GLB only) convert the right-handed (Y-up) source to the engine's Y-down via a rotation rather than a mirror
|
|
27
|
+
* @param {boolean} [options.lights=true] - (glTF/GLB only) add the scene's authored `KHR_lights_punctual` lights (plus a soft ambient fill) as {@link Light3d} world children; each carries its authored name for `getChildByName` lookups
|
|
28
|
+
* @param {number} [options.lightIntensityScale] - (glTF/GLB only) multiply each light's authored physical intensity (lux/candela) by this factor instead of normalizing it to 1 — see {@link GLTFScene#addTo}
|
|
29
|
+
* @param {boolean} [options.castGroundShadow] - (glTF/GLB only) give this scene's meshes a ground shadow ({@link Mesh#castGroundShadow}). Overrides the application's `castGroundShadow` setting for this scene, in both directions; omit it to inherit. As a scene-wide opt-in it skips nodes with no vertical extent — a scene's ground plane is exactly that, and shadowing it with itself smears a blob across the whole floor
|
|
30
|
+
* @param {number} [options.shadowGroundY] - (glTF/GLB only) world Y of the floor those shadows land on ({@link Mesh#shadowGroundY}); omit it and each blob sits at its own object's base at full strength, which is right for a scene whose props already rest on the ground
|
|
27
31
|
* @returns {boolean} true if the level was successfully loaded
|
|
28
32
|
* @example
|
|
29
33
|
* // the game assets to be be preloaded
|
|
@@ -50,6 +54,16 @@ export namespace level {
|
|
|
50
54
|
* levelContainer.translate(-levelContainer.width / 2, -levelContainer.height / 2 );
|
|
51
55
|
* // add it to the game world
|
|
52
56
|
* app.world.addChild(levelContainer);
|
|
57
|
+
*
|
|
58
|
+
* // load a glTF/GLB scene (preloaded with type "glb") under a Camera3d:
|
|
59
|
+
* // 50 pixels per glTF unit, authored lux/candela intensities kept at
|
|
60
|
+
* // a 1/1000 scale instead of being normalized to 1
|
|
61
|
+
* me.level.load("diorama", { scale: 50, lightIntensityScale: 0.001 });
|
|
62
|
+
* // …and give every prop in it a ground shadow landing on the floor at y = 0
|
|
63
|
+
* // (the scene's own ground plane is skipped — it has no height to cast)
|
|
64
|
+
* me.level.load("diorama", { scale: 50, castGroundShadow: true, shadowGroundY: 0 });
|
|
65
|
+
* // the authored lights are world children — grab the sun for a day/night cycle
|
|
66
|
+
* const sun = app.world.getChildByName("Sun")[0];
|
|
53
67
|
*/
|
|
54
68
|
function load(levelId: string, options?: {
|
|
55
69
|
container?: any;
|
|
@@ -58,6 +72,10 @@ export namespace level {
|
|
|
58
72
|
setViewportBounds?: boolean | undefined;
|
|
59
73
|
scale?: number | undefined;
|
|
60
74
|
rightHanded?: boolean | undefined;
|
|
75
|
+
lights?: boolean | undefined;
|
|
76
|
+
lightIntensityScale?: number | undefined;
|
|
77
|
+
castGroundShadow?: boolean | undefined;
|
|
78
|
+
shadowGroundY?: number | undefined;
|
|
61
79
|
}): boolean;
|
|
62
80
|
/**
|
|
63
81
|
* return the current level id<br>
|
|
@@ -74,9 +92,9 @@ export namespace level {
|
|
|
74
92
|
* @name getCurrentLevel
|
|
75
93
|
* @memberof level
|
|
76
94
|
* @public
|
|
77
|
-
* @returns {TMXTileMap}
|
|
95
|
+
* @returns {TMXTileMap|GLTFScene} the current level object (a TMXTileMap for Tiled maps, a GLTFScene for glTF/GLB scenes)
|
|
78
96
|
*/
|
|
79
|
-
function getCurrentLevel(): TMXTileMap;
|
|
97
|
+
function getCurrentLevel(): TMXTileMap | GLTFScene;
|
|
80
98
|
/**
|
|
81
99
|
* reload the current level
|
|
82
100
|
* @name reload
|
|
@@ -135,4 +153,5 @@ export namespace level {
|
|
|
135
153
|
function levelCount(): number;
|
|
136
154
|
}
|
|
137
155
|
import TMXTileMap from "./tiled/TMXTileMap.js";
|
|
156
|
+
import GLTFScene from "./gltf/GLTFScene.js";
|
|
138
157
|
//# sourceMappingURL=level.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../src/level/level.js"],"names":[],"mappings":";IA4FC;;;;;;;;;OASG;IACH,qBALW,MAAM,WACN,MAAM,wBAEJ,OAAO,CAkCnB;IAED
|
|
1
|
+
{"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../src/level/level.js"],"names":[],"mappings":";IA4FC;;;;;;;;;OASG;IACH,qBALW,MAAM,WACN,MAAM,wBAEJ,OAAO,CAkCnB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsDG;IACH,uBAjDW,MAAM,YAEd;QAA4B,SAAS;QACV,QAAQ;QACT,OAAO;QACP,iBAAiB;QAClB,KAAK;QACJ,WAAW;QACX,MAAM;QACP,mBAAmB;QAClB,gBAAgB;QACjB,aAAa;KACtC,GAAU,OAAO,CAoEnB;IAED;;;;;;OAMG;IACH,8BAFa,MAAM,CAIlB;IAED;;;;;;;;OAQG;IACH,4BAFa,UAAU,GAAC,SAAS,CAIhC;IAED;;;;;;;;;;OAUG;IACH,0BALG;QAA4B,SAAS;QACV,QAAQ;QACT,OAAO;KACjC,GAAU,MAAM,CAMlB;IAED;;;;;;;;;;OAUG;IACH,wBALG;QAA4B,SAAS;QACV,QAAQ;QACT,OAAO;KACjC,GAAU,OAAO,CASnB;IAED;;;;;;;;;;OAUG;IACH,4BALG;QAA4B,SAAS;QACV,QAAQ;QACT,OAAO;KACjC,GAAU,OAAO,CASnB;IAED;;;;;;OAMG;IACH,uBAFa,MAAM,CAIlB;;uBApTqB,uBAAuB;sBADxB,qBAAqB"}
|
|
@@ -7,13 +7,18 @@ import Renderable from "../renderable/renderable.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface Light3dOptions {
|
|
9
9
|
/**
|
|
10
|
-
* light type
|
|
11
|
-
*
|
|
10
|
+
* light type: `"directional"` (a sun), `"ambient"` (a flat fill added to
|
|
11
|
+
* every lit pixel), `"point"` (radiates from `position` with quadratic
|
|
12
|
+
* falloff over `range`) or `"spot"` (a point light confined to a cone
|
|
13
|
+
* along `direction`).
|
|
14
|
+
*/
|
|
15
|
+
type?: "directional" | "ambient" | "point" | "spot";
|
|
16
|
+
/**
|
|
17
|
+
* world-space direction the light travels along (directional lights,
|
|
18
|
+
* and the cone axis of spot lights).
|
|
12
19
|
*/
|
|
13
|
-
type?: "directional" | "ambient" | "point";
|
|
14
|
-
/** world-space direction the light travels along (directional lights). */
|
|
15
20
|
direction?: [number, number, number];
|
|
16
|
-
/** world-space position (point
|
|
21
|
+
/** world-space position (point and spot lights). */
|
|
17
22
|
position?: [number, number, number];
|
|
18
23
|
/**
|
|
19
24
|
* light color — a {@link Color}, a CSS color string, or an `[r, g, b]`
|
|
@@ -22,6 +27,23 @@ export interface Light3dOptions {
|
|
|
22
27
|
color?: Color | string | [number, number, number];
|
|
23
28
|
/** scalar multiplier on the light's contribution. Defaults to `1`. */
|
|
24
29
|
intensity?: number;
|
|
30
|
+
/**
|
|
31
|
+
* falloff distance in world units (point and spot lights): the light
|
|
32
|
+
* fades quadratically from full strength at its position to zero at
|
|
33
|
+
* `range` — the same stylized model as {@link Light2d}'s radius, not a
|
|
34
|
+
* physical inverse-square. Defaults to `1000`.
|
|
35
|
+
*/
|
|
36
|
+
range?: number;
|
|
37
|
+
/**
|
|
38
|
+
* spot cone: angle (radians) from the axis where the light is at full
|
|
39
|
+
* strength. Defaults to `0`.
|
|
40
|
+
*/
|
|
41
|
+
innerConeAngle?: number;
|
|
42
|
+
/**
|
|
43
|
+
* spot cone: angle (radians) from the axis where the light reaches
|
|
44
|
+
* zero, fading smoothly from `innerConeAngle`. Defaults to `π/4`.
|
|
45
|
+
*/
|
|
46
|
+
outerConeAngle?: number;
|
|
25
47
|
}
|
|
26
48
|
/**
|
|
27
49
|
* A 3D light source for the mesh lighting path — the 3D counterpart of
|
|
@@ -30,15 +52,20 @@ export interface Light3dOptions {
|
|
|
30
52
|
* with the active {@link Stage}, so any lit mesh in that scene is shaded by it.
|
|
31
53
|
* Remove it from the world to turn it off. A light draws nothing itself.
|
|
32
54
|
*
|
|
33
|
-
*
|
|
55
|
+
* Four types are shaded:
|
|
34
56
|
* - **`"directional"`** — a sun: a world-space `direction`, no falloff. Shaded
|
|
35
57
|
* via half-Lambert diffuse.
|
|
36
58
|
* - **`"ambient"`** — a flat fill added to every lit pixel (the dark side of a
|
|
37
59
|
* mesh never goes fully black). `direction` / `position` are ignored.
|
|
60
|
+
* - **`"point"`** — radiates from `position`, fading quadratically to zero at
|
|
61
|
+
* `range` (the same stylized falloff as {@link Light2d}'s radius).
|
|
62
|
+
* - **`"spot"`** — a point light confined to a cone along `direction`, at
|
|
63
|
+
* full strength inside `innerConeAngle` and fading smoothly to zero at
|
|
64
|
+
* `outerConeAngle`.
|
|
38
65
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `
|
|
66
|
+
* Fields are public and mutable, so a light can be animated at runtime
|
|
67
|
+
* (e.g. a day/night cycle rotating `direction`, a flickering torch fading
|
|
68
|
+
* `intensity`, a searchlight sweeping its cone).
|
|
42
69
|
* @category Lighting
|
|
43
70
|
* @example
|
|
44
71
|
* import { Light3d } from "melonjs";
|
|
@@ -48,20 +75,41 @@ export interface Light3dOptions {
|
|
|
48
75
|
* app.world.addChild(sun);
|
|
49
76
|
* app.world.addChild(new Light3d({ type: "ambient", intensity: 0.3 }));
|
|
50
77
|
*
|
|
78
|
+
* // a street lamp pool and a searchlight cone
|
|
79
|
+
* app.world.addChild(new Light3d({
|
|
80
|
+
* type: "point", position: [120, -40, 60], color: "#ffb45e", range: 300,
|
|
81
|
+
* }));
|
|
82
|
+
* app.world.addChild(new Light3d({
|
|
83
|
+
* type: "spot", position: [0, -200, 0], direction: [0, 1, 0],
|
|
84
|
+
* range: 800, innerConeAngle: 0.2, outerConeAngle: 0.45,
|
|
85
|
+
* }));
|
|
86
|
+
*
|
|
51
87
|
* // animate the sun in-game (direction is the way light travels)
|
|
52
88
|
* sun.direction.set(Math.sin(t), 1, Math.cos(t)).normalize();
|
|
53
89
|
*/
|
|
54
90
|
export declare class Light3d extends Renderable {
|
|
55
|
-
/** `"directional"
|
|
56
|
-
type: "directional" | "ambient" | "point";
|
|
57
|
-
/**
|
|
91
|
+
/** `"directional"`, `"ambient"`, `"point"` or `"spot"`. */
|
|
92
|
+
type: "directional" | "ambient" | "point" | "spot";
|
|
93
|
+
/**
|
|
94
|
+
* world-space travel direction (directional lights, spot cone axis);
|
|
95
|
+
* kept normalized.
|
|
96
|
+
*/
|
|
58
97
|
direction: Vector3d;
|
|
59
|
-
/** world-space position (point
|
|
98
|
+
/** world-space position (point and spot lights). */
|
|
60
99
|
position: Vector3d;
|
|
61
100
|
/** the light color. */
|
|
62
101
|
color: Color;
|
|
63
102
|
/** scalar multiplier on the light's contribution. */
|
|
64
103
|
intensity: number;
|
|
104
|
+
/**
|
|
105
|
+
* falloff distance in world units (point/spot) — full strength at the
|
|
106
|
+
* position, zero at `range`.
|
|
107
|
+
*/
|
|
108
|
+
range: number;
|
|
109
|
+
/** spot cone inner angle (radians) — full strength inside it. */
|
|
110
|
+
innerConeAngle: number;
|
|
111
|
+
/** spot cone outer angle (radians) — zero beyond it. */
|
|
112
|
+
outerConeAngle: number;
|
|
65
113
|
/**
|
|
66
114
|
* @param [options] - see {@link Light3dOptions}
|
|
67
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light3d.d.ts","sourceRoot":"","sources":["../../src/lighting/light3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAGrD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B
|
|
1
|
+
{"version":3,"file":"light3d.d.ts","sourceRoot":"","sources":["../../src/lighting/light3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAGrD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACpD;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,OAAQ,SAAQ,UAAU;IACtC,2DAA2D;IAClD,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5D;;;OAGG;IACH,SAAS,EAAE,QAAQ,CAAC;IACpB,oDAAoD;IACpD,QAAQ,EAAE,QAAQ,CAAC;IACnB,uBAAuB;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;gBACS,OAAO,GAAE,cAAmB;IAmDxC;;;;OAIG;IACM,eAAe;IAIxB;;;OAGG;IACM,iBAAiB;IAI1B;;;OAGG;IACM,IAAI;CACb"}
|
package/build/loader/loader.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export function setOptions(options: {
|
|
|
32
32
|
* @name setBaseURL
|
|
33
33
|
* @memberof loader
|
|
34
34
|
* @public
|
|
35
|
-
* @param {string} type - "*", "audio", "video", "binary", "image", "json", "js", "tmx", "tsx", "fontface", "aseprite", "shader"
|
|
35
|
+
* @param {string} type - "*", "audio", "video", "binary", "image", "json", "js", "tmx", "tsx", "fontface", "aseprite", "shader", "obj", "mtl", "gltf", "glb"
|
|
36
36
|
* @param {string} [url="./"] - default base URL
|
|
37
37
|
* @example
|
|
38
38
|
* // change the base URL relative address for audio assets
|
|
@@ -47,7 +47,7 @@ export function setBaseURL(type: string, url?: string): void;
|
|
|
47
47
|
* @typedef {object} Asset
|
|
48
48
|
* @memberof loader
|
|
49
49
|
* @property {string} name - name of the asset
|
|
50
|
-
* @property {string} type - the type of the asset ("audio"|"binary"|"image"|"json"|"js"|"tmx"|"tmj"|"tsx"|"tsj"|"fontface"|"video"|"aseprite"|"shader")
|
|
50
|
+
* @property {string} type - the type of the asset ("audio"|"binary"|"image"|"json"|"js"|"tmx"|"tmj"|"tsx"|"tsj"|"fontface"|"video"|"aseprite"|"shader"|"obj"|"mtl"|"gltf"|"glb")
|
|
51
51
|
* @property {string|string[]} [src] - path and/or file name of the resource (for audio assets only the path is required).
|
|
52
52
|
* For image assets, an array of sources can be provided as a fallback chain (e.g. compressed texture formats by priority, with a PNG fallback).
|
|
53
53
|
* The loader will try each source in order and use the first one that loads successfully.
|
|
@@ -88,6 +88,14 @@ export function setBaseURL(type: string, url?: string): void;
|
|
|
88
88
|
* { name: "'kenpixel'", type: "fontface", src: "data/font/kenvector_future.woff2" }
|
|
89
89
|
* // video resources
|
|
90
90
|
* {name: "intro", type: "video", src: "data/video/"}
|
|
91
|
+
* // 3D assets: Wavefront OBJ model + MTL material library
|
|
92
|
+
* {name: "ship", type: "obj", src: "data/models/ship.obj"}
|
|
93
|
+
* {name: "ship", type: "mtl", src: "data/models/ship.mtl"}
|
|
94
|
+
* // glTF / GLB scene (auto-registers with the level director)
|
|
95
|
+
* {name: "diorama", type: "glb", src: "data/scenes/diorama.glb"}
|
|
96
|
+
* // shader assets: an effect body, or a complete dual-backend program
|
|
97
|
+
* {name: "flash", type: "shader", src: "shaders/flash.frag"}
|
|
98
|
+
* {name: "toon", type: "shader", src: {vertex: "shaders/toon.vert", fragment: "shaders/toon.frag", wgsl: "shaders/toon.wgsl"}}
|
|
91
99
|
*/
|
|
92
100
|
/**
|
|
93
101
|
* specify a parser/preload function for the given asset type
|
|
@@ -292,21 +300,24 @@ export function getJSON(elt: string): JSON;
|
|
|
292
300
|
* // data.uvs — Float32Array of u,v texture coordinates
|
|
293
301
|
* // data.indices — Uint16Array of triangle vertex indices
|
|
294
302
|
* // data.vertexCount — number of unique vertices
|
|
303
|
+
* // data.groups — usemtl material groups ({materialName, start, count} index ranges)
|
|
295
304
|
* });
|
|
296
305
|
*/
|
|
297
306
|
export function getOBJ(elt: string): object;
|
|
298
307
|
/**
|
|
299
308
|
* a parsed glTF/GLB scene descriptor, as returned by {@link loader.getGLTF}
|
|
300
309
|
* @typedef {object} GLTFData
|
|
301
|
-
* @property {object[]} nodes - one entry per mesh primitive
|
|
310
|
+
* @property {object[]} nodes - one entry per mesh primitive: accumulated `world` transform, `vertices`, `normals`, `uvs`, `indices`, `vertexCount`, decoded baseColor `image` (or `null`), `baseColorFactor`, per-vertex `colors`, sampler-derived `textureRepeat`/`textureFilter`, `alphaCutoff`, `emissive`, `unlit` (KHR_materials_unlit), `doubleSided`, and the source node `name`
|
|
302
311
|
* @property {Array<{world: number[], type?: string, perspective?: {yfov?: number, aspectRatio?: number, znear?: number, zfar?: number}, orthographic?: object}>} cameras - glTF cameras, each with its `world` transform + the glTF camera parameters (`perspective` for perspective cameras, `orthographic` otherwise)
|
|
303
|
-
* @property {object[]} lights - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, world-space `direction`/`position`, `name`)
|
|
312
|
+
* @property {object[]} lights - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, `innerConeAngle`/`outerConeAngle` for spots, world-space `direction`/`position`, `name`)
|
|
304
313
|
* @property {{min: number[], max: number[]}} bounds - world-space scene bounds in glTF units
|
|
314
|
+
* @property {object[]} graph - the full node graph (every node's TRS/matrix + children), for custom traversal
|
|
315
|
+
* @property {object[]} animations - parsed node animations (consumed by `GLTFModel` playback)
|
|
305
316
|
*/
|
|
306
317
|
/**
|
|
307
318
|
* return the parsed glTF/GLB scene descriptor for the given asset name.
|
|
308
319
|
*
|
|
309
|
-
* The descriptor is `{ nodes, cameras, lights, bounds }`:
|
|
320
|
+
* The descriptor is `{ nodes, cameras, lights, bounds, graph, animations }`:
|
|
310
321
|
* - `nodes` — one entry per mesh primitive, each carrying its accumulated
|
|
311
322
|
* `world` transform (16 floats, column-major), `vertices`, `normals`,
|
|
312
323
|
* `uvs`, `indices`, `vertexCount`, a decoded baseColor `image` (or `null`),
|
|
@@ -314,8 +325,10 @@ export function getOBJ(elt: string): object;
|
|
|
314
325
|
* - `cameras` — glTF cameras, each with its `world` transform + perspective
|
|
315
326
|
* parameters.
|
|
316
327
|
* - `lights` — parsed `KHR_lights_punctual` lights (`type`, `color`,
|
|
317
|
-
* `intensity`,
|
|
318
|
-
*
|
|
328
|
+
* `intensity`, `range`, spot cone angles, world-space
|
|
329
|
+
* `direction`/`position`, `name`); empty without the extension. The
|
|
330
|
+
* level director instantiates directional, point and spot lights
|
|
331
|
+
* automatically (see {@link level.load} options).
|
|
319
332
|
* - `bounds` — world-space `{ min, max }` (glTF units), handy for framing.
|
|
320
333
|
*
|
|
321
334
|
* Most code never needs this: a preloaded glTF/GLB auto-registers with the
|
|
@@ -359,18 +372,21 @@ export function getGLTF(elt: string): GLTFData | null;
|
|
|
359
372
|
* is reset to `false`, so it is auto-destroyed with the renderable it is
|
|
360
373
|
* assigned to, like any hand-constructed effect.
|
|
361
374
|
*
|
|
362
|
-
* A shader asset declared as a
|
|
363
|
-
*
|
|
364
|
-
*
|
|
375
|
+
* A shader asset declared as a **complete program** — a
|
|
376
|
+
* `{vertex, fragment}` GLSL pair and/or a full `wgsl` module (see the
|
|
377
|
+
* example) — compiles into a raw {@link GLShader} instead, carrying one
|
|
378
|
+
* realization per GPU backend (`isWebGL` / `isWebGPU`): the type the
|
|
379
|
+
* hosted paths take directly (a `Mesh` custom shader,
|
|
365
380
|
* `renderer.customShader`, a custom batcher). Same shared-instance
|
|
366
381
|
* semantics, and `GLShader.clone()` likewise yields a caller-owned copy.
|
|
367
382
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
383
|
+
* Degradation is never fatal: a fragment-body asset without a body in the
|
|
384
|
+
* active renderer's language (or on Canvas) is an inert `ShaderEffect`
|
|
385
|
+
* stub, and a complete-program asset without a realization for the active
|
|
386
|
+
* backend is an inert `GLShader` — assigning either just keeps the
|
|
387
|
+
* built-in rendering. Note that shader assets require an initialized
|
|
388
|
+
* Application (`await app.init()`) — an inherent precondition of the
|
|
389
|
+
* preload flow, since the loading screen itself needs the renderer.
|
|
374
390
|
* @memberof loader
|
|
375
391
|
* @param {string} elt - name of the shader asset (as specified in the preload list)
|
|
376
392
|
* @returns {ShaderEffect|GLShader|null} the shared, precompiled shader, or `null` if not found
|
|
@@ -384,18 +400,21 @@ export function getGLTF(elt: string): GLTFData | null;
|
|
|
384
400
|
* uniform float uIntensity;
|
|
385
401
|
* vec4 apply(vec4 color, vec2 uv) { return mix(color, vec4(1.0), uIntensity); }
|
|
386
402
|
* ` },
|
|
387
|
-
* // or a complete {vertex, fragment}
|
|
403
|
+
* // or a complete program — a {vertex, fragment} GLSL pair and/or a
|
|
404
|
+
* // full WGSL module → one GLShader carrying both realizations; the
|
|
405
|
+
* // active renderer hosts the one it speaks
|
|
388
406
|
* { name: "toonMesh", type: "shader", src: {
|
|
389
407
|
* vertex: "shaders/toon.vert",
|
|
390
408
|
* fragment: "shaders/toon.frag",
|
|
409
|
+
* wgsl: "shaders/toon.wgsl",
|
|
391
410
|
* } },
|
|
392
411
|
* ], () => {
|
|
393
412
|
* // one shared program — same uniform state for every user
|
|
394
413
|
* mySprite.shader = me.loader.getShader("waterRipple");
|
|
395
414
|
* // private copy with its own uniforms (caller-owned, shared = false)
|
|
396
415
|
* boss.shader = me.loader.getShader("flash").clone();
|
|
397
|
-
* // a program
|
|
398
|
-
*
|
|
416
|
+
* // a complete program hosts on a mesh, replacing the built-in shading
|
|
417
|
+
* myMesh.shader = me.loader.getShader("toonMesh");
|
|
399
418
|
* });
|
|
400
419
|
*/
|
|
401
420
|
export function getShader(elt: string): ShaderEffect | GLShader | null;
|
|
@@ -425,6 +444,7 @@ export function getShader(elt: string): ShaderEffect | GLShader | null;
|
|
|
425
444
|
* const materials = me.loader.getMTL("fox");
|
|
426
445
|
* // materials["colormap"].Kd — [r, g, b] diffuse color (0-1 range)
|
|
427
446
|
* // materials["colormap"].d — opacity (0-1)
|
|
447
|
+
* // materials["colormap"].Ke — [r, g, b] emissive color (glow, applied as Mesh.emissive)
|
|
428
448
|
* // materials["colormap"].map_Kd — resolved texture URL
|
|
429
449
|
* });
|
|
430
450
|
*/
|
|
@@ -538,7 +558,7 @@ export type Asset = object;
|
|
|
538
558
|
*/
|
|
539
559
|
export type GLTFData = {
|
|
540
560
|
/**
|
|
541
|
-
* - one entry per mesh primitive
|
|
561
|
+
* - one entry per mesh primitive: accumulated `world` transform, `vertices`, `normals`, `uvs`, `indices`, `vertexCount`, decoded baseColor `image` (or `null`), `baseColorFactor`, per-vertex `colors`, sampler-derived `textureRepeat`/`textureFilter`, `alphaCutoff`, `emissive`, `unlit` (KHR_materials_unlit), `doubleSided`, and the source node `name`
|
|
542
562
|
*/
|
|
543
563
|
nodes: object[];
|
|
544
564
|
/**
|
|
@@ -556,7 +576,7 @@ export type GLTFData = {
|
|
|
556
576
|
orthographic?: object;
|
|
557
577
|
}>;
|
|
558
578
|
/**
|
|
559
|
-
* - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, world-space `direction`/`position`, `name`)
|
|
579
|
+
* - parsed `KHR_lights_punctual` lights (`type`, `color`, `intensity`, `range`, `innerConeAngle`/`outerConeAngle` for spots, world-space `direction`/`position`, `name`)
|
|
560
580
|
*/
|
|
561
581
|
lights: object[];
|
|
562
582
|
/**
|
|
@@ -566,5 +586,13 @@ export type GLTFData = {
|
|
|
566
586
|
min: number[];
|
|
567
587
|
max: number[];
|
|
568
588
|
};
|
|
589
|
+
/**
|
|
590
|
+
* - the full node graph (every node's TRS/matrix + children), for custom traversal
|
|
591
|
+
*/
|
|
592
|
+
graph: object[];
|
|
593
|
+
/**
|
|
594
|
+
* - parsed node animations (consumed by `GLTFModel` playback)
|
|
595
|
+
*/
|
|
596
|
+
animations: object[];
|
|
569
597
|
};
|
|
570
598
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAuFA;;;GAGG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;;;GAcG;AACH,iCATW,MAAM,QACN,MAAM,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.js"],"names":[],"mappings":"AAuFA;;;GAGG;AACH,mDAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oCAdG;IAAyB,WAAW;IACV,OAAO;IACP,eAAe;CACzC,QAqBF;AAED;;;;;;;;;;;;;;GAcG;AACH,iCATW,MAAM,QACN,MAAM,QA6BhB;AAqID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gCAnBW,MAAM,4BA6BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,gCAhDW,KAAK,EAAE,2CAEP,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAoFzB;AAED;;;;;;;;;;;;;;;IAeI;AACJ,4BAbW,MAAM,QAqChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,4BAhCW,KAAK,0CAGH,MAAM,GAAC,OAAO,CAAC,IAAI,CAAC,CAqGhC;AAED;;;;;;;GAOG;AACH,8BALW,KAAK,GACH,OAAO,CA6HnB;AAED;;;;;GAKG;AACH,kCAyGC;AAED;;;;;;GAMG;AACH,4BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;GAMG;AACH,+BAJW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;;GAMG;AACH,gCAJW,MAAM,GACJ,gBAAgB,GAAC,eAAe,GAAC,IAAI,CAWjD;AAED;;;;;;GAMG;AACH,6BAJW,MAAM,GACJ,IAAI,CAUhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,4BA3BW,MAAM,GACJ,MAAM,CAiClB;AAED;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,6BAhBW,MAAM,GACJ,QAAQ,GAAC,IAAI,CAqBzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,+BA7BW,MAAM,GACJ,YAAY,GAAC,QAAQ,GAAC,IAAI,CAkCtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,4BA3BW,MAAM,GACJ,MAAM,CAgClB;AAED;;;;;;GAMG;AACH,8BAJW,MAAM,GACJ,gBAAgB,CAU5B;AAED;;;;;;GAMG;AACH,6BAJW,MAAM,GACJ,QAAQ,CAUpB;AAjnCD;;;GAGG;AAGH,2BAAwB;AAExB;;GAEG;AACH;;EAA0B;AAE1B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAbU,MAAM,CAaO;AAEvB;;;;;;;;;;;;;;;;GAgBG;AACH,4BAbU,OAAO,CAakB;AA8EnC;;;;;;;;;GASG;AACH,4BAAkB;AAElB;;;;;;;;;;;GAWG;AACH,gCAAsB;AAEtB;;;;;;;;;;GAUG;AACH,6BAAmB;;;;oBAgGN,MAAM;;;;;;;;WA0qBL,MAAM,EAAE;;;;aACR,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;;;;YAClJ,MAAM,EAAE;;;;YACR;QAAC,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,EAAE,CAAA;KAAC;;;;WAC9B,MAAM,EAAE;;;;gBACR,MAAM,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/gltf.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gltf.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/gltf.js"],"names":[],"mappings":"AA0CA;;;;;GAKG;AACH,sCAJW,WAAW,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,CAkCpD;AAmED;;;;GAIG;AACH,+EAgCC;AA0KD;;;;;;;;;;GAUG;AACH,oCAPW,MAAM,EAAE,eACR,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAoCpB;AAED;;;;;;;GAOG;AACH,wCANW,MAAM,EAAE,YACR,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,EAAE,CAKpB;AAED,6EAA6E;AAC7E,gDASC;AAiED;;;;;GAKG;AACH,kEAWC;AAED,oFAAoF;AACpF,oDAEC;AA8HD;;;;;;;;;;GAUG;AACH,uCATW,WAAW,YACX,MAAM,aAGN,MAAM,GAEJ,OAAO,CAAC,MAAM,CAAC,CAqa3B;AAED;;;;;;;;GAQG;AACH,kCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CA6BlB"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a Wavefront MTL file into material data.
|
|
3
|
+
* Supports: `newmtl`, `Kd` (diffuse color), `Ke` (emissive color), `Ks`/`Ns`
|
|
4
|
+
* (specular color and exponent), `Pr`/`Pm` (the PBR roughness/metalness
|
|
5
|
+
* extension, approximated onto the specular terms when `Ks`/`Ns` are absent),
|
|
6
|
+
* `map_Kd` (diffuse texture), `map_d` (alpha map), `d`/`Tr`
|
|
7
|
+
* (opacity/transparency).
|
|
8
|
+
*
|
|
9
|
+
* Limitations:
|
|
10
|
+
* - Ambient (`Ka`), optical density (`Ni`) and illumination model (`illum`) are parsed but ignored
|
|
11
|
+
* - Normal maps (`map_bump`, `bump`), specular maps (`map_Ks`), and other texture maps are not supported
|
|
12
|
+
*
|
|
13
|
+
* @param {string} text - raw MTL file contents
|
|
14
|
+
* @param {string} basePath - base URL path for resolving texture references
|
|
15
|
+
* @returns {object} map of material names to their properties
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
export function parseMTL(text: string, basePath: string): object;
|
|
1
19
|
/**
|
|
2
20
|
* Parse/preload a Wavefront MTL material file.
|
|
3
21
|
* @param {loader.Asset} data - asset data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mtl.d.ts","sourceRoot":"","sources":["../../../src/loader/parsers/mtl.js"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;;GAgBG;AACH,+BALW,MAAM,YACN,MAAM,GACJ,MAAM,CAkJlB;AAED;;;;;;;;GAQG;AACH,iCAPW,MAAM,CAAC,KAAK,oDAGZ,MAAM,GACJ,MAAM,CAwElB"}
|