lecodes-cli 1.0.0 → 2.0.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/dist/index.js +6211 -3649
- package/package.json +12 -8
- package/runtime/materials/lightmap.mat +115 -139
- package/runtime/materials/particles-quad.mat +6 -2
- package/runtime/materials/terrain-lightmap.mat +123 -0
- package/runtime/materials/terrain.mat +36 -55
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +5 -0
- package/runtime/web/assets/camera-5XOM8eHl.js +1 -0
- package/runtime/web/assets/creator-2d-D9WKYM6h.js +1 -0
- package/runtime/web/assets/creator-2d-ukvEmNEp.wasm +0 -0
- package/runtime/web/assets/creator-full-BBXzQlhq.js +1 -0
- package/runtime/web/assets/creator-full-D2dSDdDj.wasm +0 -0
- package/runtime/web/assets/creator-full.js-BYswGsqR.symbols +8124 -0
- package/runtime/web/assets/creator-ui-DIc92ion.wasm +0 -0
- package/runtime/web/assets/creator-ui-_1Z_AX2M.js +1 -0
- package/runtime/web/assets/geolocation-BjTKN9_P.js +1 -0
- package/runtime/web/assets/inspect-C7x78PNs.js +2 -0
- package/runtime/web/assets/map-CyBxOSV0.js +1 -0
- package/runtime/web/assets/map-XzoOFt0E.js +2 -0
- package/runtime/web/assets/mapImpl-bxvQ2h1Z.js +823 -0
- package/runtime/web/assets/maplibre-gl-worker-B7LXXUkR.js +8 -0
- package/runtime/web/assets/materials-uri4FvPE.bin +0 -0
- package/runtime/web/assets/materials-world-CQWt8TAm.bin +0 -0
- package/runtime/web/assets/qr-scanner-CK_cYoJR.js +1 -0
- package/runtime/web/assets/uberarchive-DLH-kBhM.bin +0 -0
- package/runtime/web/index.html +36 -0
- package/runtime/web/player.js +21 -0
- package/runtime/web-page/index.html +41 -0
- package/runtime/web-page/page.css +1 -0
- package/runtime/web-page/page.js +31 -0
- package/src/cli/help.ts +25 -0
- package/src/cli/index.ts +7 -7
- package/src/commands/app/android.ts +3 -1
- package/src/commands/app/desktop.ts +1 -1
- package/src/commands/app/desktopMac.ts +10 -9
- package/src/commands/app/icon.ts +9 -6
- package/src/commands/app/index.ts +3 -1
- package/src/commands/app/shared.ts +13 -5
- package/src/commands/app/templates/android.ts +10 -11
- package/src/commands/app/templates/ios.ts +1 -1
- package/src/commands/assets.ts +1 -1
- package/src/commands/compile.ts +15 -2
- package/src/commands/design/index.ts +4 -4
- package/src/commands/design/snapshot.ts +3 -3
- package/src/commands/desktop.ts +5 -1
- package/src/commands/dev.ts +82 -29
- package/src/commands/index.ts +64 -60
- package/src/commands/init/index.ts +11 -15
- package/src/commands/init/templates.ts +64 -21
- package/src/commands/lightmap.ts +459 -200
- package/src/commands/navmesh.ts +2 -2
- package/src/commands/plugin.ts +46 -0
- package/src/commands/render.ts +22 -16
- package/src/commands/scene.ts +6 -1
- package/src/commands/serve.ts +58 -0
- package/src/commands/shaders/new.ts +1 -1
- package/src/commands/test.ts +402 -398
- package/src/commands/update/index.ts +3 -3
- package/src/compile/designCompile.ts +1 -1
- package/src/compile/headlessBundle.ts +133 -133
- package/src/compile/nativeStack.ts +1 -1
- package/src/compile/projectCompile.ts +10 -2
- package/src/compile/sceneCompile.ts +8 -22
- package/src/declarations/lecodes-3d-editor.d.ts +4 -0
- package/src/declarations/lecodes-assets.d.ts +1 -1
- package/src/declarations/{lecodes-renderer.d.ts → lecodes-headless.d.ts} +3 -3
- package/src/dev/clientTemplates.ts +18 -14
- package/src/dev/devServer.ts +75 -38
- package/src/dev/iosDev.ts +180 -0
- package/src/dev/webRunner.ts +82 -14
- package/src/hosts/cmgenTool.ts +1 -1
- package/src/hosts/desktopRenderer.ts +98 -27
- package/src/hosts/desktopScript.ts +150 -35
- package/src/hosts/distRoot.ts +1 -1
- package/src/hosts/matcTool.ts +1 -1
- package/src/hosts/peerInstall.ts +5 -5
- package/src/hosts/peers.ts +2 -2
- package/src/index.ts +4 -1
- package/src/plugin/contract.ts +438 -0
- package/src/plugin/emitKotlin.ts +357 -0
- package/src/plugin/emitSdk.ts +259 -0
- package/src/plugin/emitSwift.ts +336 -0
- package/src/plugin/emitWeb.ts +383 -0
- package/src/plugin/generate.ts +157 -0
- package/src/plugin/lines.ts +28 -0
- package/src/plugin/lower.ts +231 -0
- package/src/plugin/manifest.ts +192 -0
- package/src/project/ignore.ts +164 -163
- package/runtime/materials/lightmap-baked-lite.mat +0 -180
- package/runtime/materials/lightmap-baked.mat +0 -181
- package/runtime/scene-harness.json +0 -1
- package/runtime/web/assets/__vite-browser-external-BIHI7g3E.js +0 -1
- package/runtime/web/assets/basis-C64VHDVD.js +0 -1
- package/runtime/web/assets/basis_transcoder-VXdx5NbI.wasm +0 -0
- package/runtime/web/assets/createViewerLite-DHqTFhWB.js +0 -866
- package/runtime/web/assets/draco-BiISTFcR.js +0 -118
- package/runtime/web/assets/draco_decoder-DsQ12WqX.wasm +0 -0
- package/runtime/web/assets/index-Q06c6oHx.js +0 -2
- package/runtime/web/assets/mapViewImpl-B2JcES8l.js +0 -810
- package/runtime/web/assets/maplibre-gl-worker-CJfwIrte.js +0 -8
- package/runtime/web/assets/worker-Caf-yYEI.js +0 -2
- package/runtime/web/embed.html +0 -32
- package/runtime/web/embed.js +0 -171
|
@@ -4,21 +4,26 @@
|
|
|
4
4
|
// terrain's local XZ in metres (creator-gl/src/terrain.cpp writes it), so `tiling` reads as metres
|
|
5
5
|
// per repeat and the control map is addressed as (uv / cellSize + 0.5) / gridSize.
|
|
6
6
|
//
|
|
7
|
+
// ROUGHNESS: a layer's is its `roughness` factor x the ALPHA of its albedo - the one free channel the sampler budget
|
|
8
|
+
// leaves (ground is opaque). An albedo without alpha reads 1, so the factor alone stands; with a roughness map packed
|
|
9
|
+
// into the alpha a wet patch or a trodden path shines inside one layer. No metallic: ground is a dielectric.
|
|
10
|
+
//
|
|
7
11
|
// Sampler budget: feature level 1 (every host, WebGL included) allows 9 samplers per material, so the
|
|
8
12
|
// normal maps come PACKED two per texture — normals01 = (layer 0 XY in RG, layer 1 XY in BA),
|
|
9
13
|
// normals23 likewise; Z is reconstructed. `lecodes assets` packs them; an unset pack (the shared
|
|
10
14
|
// 1x1 white) decodes to a flat normal, and normalScale 0 skips the read.
|
|
11
15
|
//
|
|
12
|
-
// Baked lighting:
|
|
13
|
-
// atlas
|
|
14
|
-
// applies the atlas to this material directly, no swap. Every sampler defaults to the shared 1x1
|
|
15
|
-
// white (applyIdentityDefaults): an unset layer is white, an unset lightmap is "fully lit".
|
|
16
|
+
// Baked lighting: none yet in the rewritten bake (2026-09-16) — a terrain is lit real-time; the
|
|
17
|
+
// creator-bake atlas comes back to this material in a later phase.
|
|
16
18
|
material {
|
|
17
19
|
name : terrain,
|
|
18
20
|
shadingModel : lit,
|
|
21
|
+
// geometric specular AA (Kaplanyan): the ground is a 1024² normal map at ×1.5–2 tiled every 2 m under a
|
|
22
|
+
// 100 000 lux sun — without this every minified texel is a sub-pixel mirror and the sand sparkles
|
|
23
|
+
// (Mountain, 2026-09-23; A/B with normalScale 0 showed nothing but the normal map does it)
|
|
24
|
+
specularAntiAliasing : true,
|
|
19
25
|
flipUV : false,
|
|
20
26
|
requires : [ uv0, uv1 ],
|
|
21
|
-
postLightingBlending : multiply,
|
|
22
27
|
parameters : [
|
|
23
28
|
{ type : sampler2d, name : control },
|
|
24
29
|
{ type : sampler2d, name : albedo0 },
|
|
@@ -37,37 +42,36 @@ material {
|
|
|
37
42
|
// samples along X and Z
|
|
38
43
|
{ type : float2, name : gridSize },
|
|
39
44
|
{ type : float, name : cellSize },
|
|
40
|
-
{ type : float3, name : tint }
|
|
41
|
-
{ type : sampler2d, name : lightmap },
|
|
42
|
-
// the point lights' baked irradiance, sRGB(E / lightScale), same rect; lightScale 0 = none (the 9th sampler)
|
|
43
|
-
{ type : sampler2d, name : lightmapLight },
|
|
44
|
-
{ type : float, name : lightScale },
|
|
45
|
-
// the light store's curve: texel = sRGB(pow(E / lightScale, 1 / lightGamma)); 0/1 = linear (v2 bakes), 2 = the square-root store
|
|
46
|
-
{ type : float, name : lightGamma },
|
|
47
|
-
{ type : float4, name : lightmapST },
|
|
48
|
-
{ type : float, name : ambientScale },
|
|
49
|
-
{ type : float, name : sunStrength },
|
|
50
|
-
// how much of the baked ambient occlusion applies (1 = all)
|
|
51
|
-
{ type : float, name : bakedAo }
|
|
45
|
+
{ type : float3, name : tint }
|
|
52
46
|
]
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
fragment {
|
|
56
|
-
|
|
50
|
+
// highp THROUGHOUT THE UV MATH. UV0 is the terrain's XZ IN METRES, so it runs to the plot's size
|
|
51
|
+
// (128 m here) — and the macOS / iOS materials are compiled for the MOBILE profile, where a
|
|
52
|
+
// fragment shader's default float is mediump = half on an Apple GPU. A half holds ~11 bits of
|
|
53
|
+
// mantissa, so at 64..128 m it steps by 6..12 cm: the ground came out as flat square patches of
|
|
54
|
+
// that size, whatever the texture (measured 2026-09-20 on Peremena — sharp in the WebGL host,
|
|
55
|
+
// which has no mediump, and sharp on a plain lit quad, whose UVs are 0..1).
|
|
56
|
+
vec4 triplanarSample(sampler2D tex, highp vec3 p, vec3 bw, float s) {
|
|
57
57
|
return texture(tex, p.zy / s) * bw.x + texture(tex, p.xz / s) * bw.y + texture(tex, p.xy / s) * bw.z;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// `slot` 0 = this layer's normal XY sits in the pack's RG, 1 = in its BA
|
|
61
61
|
void splatLayer(sampler2D alb, sampler2D pack, float slot, float tiling, float nscale, float tri, float w,
|
|
62
|
-
vec2 uv, vec3 wp, vec3 bw, inout vec3 albedo, inout vec3 nrm) {
|
|
62
|
+
highp vec2 uv, highp vec3 wp, vec3 bw, float rf, inout vec3 albedo, inout vec3 nrm, inout float rough) {
|
|
63
63
|
if (w <= 0.0) return;
|
|
64
64
|
float s = max(tiling, 1e-3);
|
|
65
65
|
if (tri > 0.5) {
|
|
66
|
-
|
|
66
|
+
vec4 c = triplanarSample(alb, wp, bw, s);
|
|
67
|
+
albedo += c.rgb * w;
|
|
68
|
+
rough += rf * c.a * w;
|
|
67
69
|
nrm += vec3(0.0, 0.0, 1.0) * w;
|
|
68
70
|
} else {
|
|
69
|
-
vec2 luv = uv / s;
|
|
70
|
-
|
|
71
|
+
highp vec2 luv = uv / s;
|
|
72
|
+
vec4 c = texture(alb, luv);
|
|
73
|
+
albedo += c.rgb * w;
|
|
74
|
+
rough += rf * c.a * w;
|
|
71
75
|
if (nscale > 0.0) {
|
|
72
76
|
vec4 p = texture(pack, luv);
|
|
73
77
|
vec2 xy = (slot > 0.5 ? p.ba : p.rg) * 2.0 - 1.0;
|
|
@@ -81,54 +85,31 @@ fragment {
|
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
void material(inout MaterialInputs material) {
|
|
84
|
-
vec2 uv = getUV0();
|
|
85
|
-
vec2 cuv = (uv / max(materialParams.cellSize, 1e-4) + 0.5) / max(materialParams.gridSize, vec2(1.0));
|
|
88
|
+
highp vec2 uv = getUV0();
|
|
89
|
+
highp vec2 cuv = (uv / max(materialParams.cellSize, 1e-4) + 0.5) / max(materialParams.gridSize, vec2(1.0));
|
|
86
90
|
vec4 w = texture(materialParams_control, cuv);
|
|
87
91
|
float ws = w.r + w.g + w.b + w.a;
|
|
88
92
|
w = ws > 1e-4 ? w / ws : vec4(1.0, 0.0, 0.0, 0.0);
|
|
89
93
|
|
|
90
|
-
vec3 wp = getUserWorldPosition();
|
|
94
|
+
highp vec3 wp = getUserWorldPosition();
|
|
91
95
|
vec3 gn = getWorldGeometricNormalVector();
|
|
92
96
|
vec3 bw = abs(gn);
|
|
93
97
|
bw = bw / max(bw.x + bw.y + bw.z, 1e-4);
|
|
94
98
|
|
|
95
99
|
vec3 albedo = vec3(0.0);
|
|
96
100
|
vec3 nrm = vec3(0.0);
|
|
97
|
-
|
|
98
|
-
splatLayer(
|
|
99
|
-
splatLayer(
|
|
100
|
-
splatLayer(
|
|
101
|
+
float rough = 0.0;
|
|
102
|
+
splatLayer(materialParams_albedo0, materialParams_normals01, 0.0, materialParams.tiling.x, materialParams.normalScale.x, materialParams.triplanar.x, w.r, uv, wp, bw, materialParams.roughness.x, albedo, nrm, rough);
|
|
103
|
+
splatLayer(materialParams_albedo1, materialParams_normals01, 1.0, materialParams.tiling.y, materialParams.normalScale.y, materialParams.triplanar.y, w.g, uv, wp, bw, materialParams.roughness.y, albedo, nrm, rough);
|
|
104
|
+
splatLayer(materialParams_albedo2, materialParams_normals23, 0.0, materialParams.tiling.z, materialParams.normalScale.z, materialParams.triplanar.z, w.b, uv, wp, bw, materialParams.roughness.z, albedo, nrm, rough);
|
|
105
|
+
splatLayer(materialParams_albedo3, materialParams_normals23, 1.0, materialParams.tiling.w, materialParams.normalScale.w, materialParams.triplanar.w, w.a, uv, wp, bw, materialParams.roughness.w, albedo, nrm, rough);
|
|
101
106
|
material.normal = normalize(nrm);
|
|
102
107
|
prepareMaterial(material);
|
|
103
108
|
|
|
104
109
|
material.baseColor = vec4(albedo * materialParams.tint, 1.0);
|
|
105
|
-
material.roughness =
|
|
110
|
+
material.roughness = rough;
|
|
106
111
|
material.metallic = 0.0;
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
vec3 n = gn;
|
|
110
|
-
vec2 luv = getUV1() * materialParams.lightmapST.xy + materialParams.lightmapST.zw;
|
|
111
|
-
vec2 lm = texture(materialParams_lightmap, luv).rg;
|
|
112
|
-
lm.g = mix(1.0, lm.g, materialParams.bakedAo);
|
|
113
|
-
material.ambientOcclusion = lm.g;
|
|
114
|
-
// the point lights' baked diffuse (lightmap.mat's emissive path; the terrain has no glTF emissive)
|
|
115
|
-
float lg = materialParams.lightGamma > 0.0 ? materialParams.lightGamma : 1.0;
|
|
116
|
-
vec3 baked = pow(texture(materialParams_lightmapLight, luv).rgb, vec3(lg)) * materialParams.lightScale;
|
|
117
|
-
material.emissive = vec4(material.baseColor.rgb * baked * (getExposure() / PI), 0.0);
|
|
118
|
-
|
|
119
|
-
float vis = mix(1.0, lm.r, materialParams.sunStrength);
|
|
120
|
-
vec3 sh = frameUniforms.iblSH[0].xyz
|
|
121
|
-
+ frameUniforms.iblSH[1].xyz * n.y + frameUniforms.iblSH[2].xyz * n.z + frameUniforms.iblSH[3].xyz * n.x
|
|
122
|
-
+ frameUniforms.iblSH[4].xyz * (n.y * n.x) + frameUniforms.iblSH[5].xyz * (n.y * n.z)
|
|
123
|
-
+ frameUniforms.iblSH[6].xyz * (3.0 * n.z * n.z - 1.0) + frameUniforms.iblSH[7].xyz * (n.z * n.x)
|
|
124
|
-
+ frameUniforms.iblSH[8].xyz * (n.x * n.x - n.y * n.y);
|
|
125
|
-
vec3 luma = vec3(0.2126, 0.7152, 0.0722);
|
|
126
|
-
float amb = max(dot(max(sh, 0.0), luma), 0.0) * frameUniforms.iblLuminance * materialParams.ambientScale * lm.g;
|
|
127
|
-
float nol = max(dot(n, frameUniforms.lightDirection), 0.0);
|
|
128
|
-
float sun = dot(frameUniforms.lightColorIntensity.rgb, luma) * frameUniforms.lightColorIntensity.w * nol / PI;
|
|
129
|
-
// the baked lamps ride the emissive slot the multiply scales too: same share on both sides
|
|
130
|
-
float lamp = dot(baked, luma) * (getExposure() / PI);
|
|
131
|
-
float k = (amb + sun * vis + lamp) / max(amb + sun + lamp, 1e-6);
|
|
132
|
-
material.postLightingColor = vec4(k, k, k, 1.0);
|
|
113
|
+
material.ambientOcclusion = 1.0;
|
|
133
114
|
}
|
|
134
115
|
}
|