@threenative/terrain 0.1.7 → 0.1.8
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/AGENT_GUIDE.md +19 -4
- package/dist/editor/index.d.ts +160 -5
- package/dist/editor/index.js +3783 -1406
- package/dist/editor/server.d.ts +2 -2
- package/dist/editor/server.js +555 -121
- package/dist/editor/worker.d.ts +33 -1
- package/dist/editor/worker.js +444 -110
- package/dist/export.d.ts +11 -9
- package/dist/export.js +22 -34
- package/dist/index.d.ts +727 -73
- package/dist/index.js +2434 -553
- package/dist/kit.d.ts +56 -0
- package/dist/kit.js +2524 -0
- package/dist/mcp/cook-child.d.ts +2 -0
- package/dist/mcp/cook-child.js +3705 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +3279 -0
- package/dist/{server-ByM2hmYJ.d.ts → server-C8Ydr_IM.d.ts} +3 -2
- package/dist/starter.d.ts +143 -0
- package/dist/starter.js +1030 -0
- package/dist/{terrain-gPnkCU6S.d.ts → terrain-B3DkduPw.d.ts} +3 -2
- package/dist/three.d.ts +1 -1
- package/dist/{types-Ant8-Axc.d.ts → types-CPYAc9vo.d.ts} +13 -4
- package/dist/world-package-B7KGYIou.d.ts +94 -0
- package/package.json +28 -6
- package/starter/alpine/README.md +77 -1
- package/starter/alpine/bake.mjs +4 -116
- package/starter/alpine/biome.data.json +114 -0
- package/starter/alpine/heightmap.r16 +0 -0
- package/starter/alpine/recipe.json +3 -66051
- package/starter/alpine/world.ts +45 -293
- package/starter/coastal/README.md +77 -1
- package/starter/coastal/bake.mjs +4 -116
- package/starter/coastal/biome.data.json +135 -0
- package/starter/coastal/heightmap.r16 +0 -0
- package/starter/coastal/recipe.json +3 -66051
- package/starter/coastal/sea.ts +49 -16
- package/starter/coastal/world.ts +53 -318
- package/starter/desert/README.md +77 -1
- package/starter/desert/bake.mjs +4 -116
- package/starter/desert/biome.data.json +114 -0
- package/starter/desert/heightmap.r16 +0 -0
- package/starter/desert/recipe.json +3 -66051
- package/starter/desert/world.ts +45 -293
- package/starter/forest/README.md +84 -4
- package/starter/forest/assets.json +32 -0
- package/starter/forest/bake.mjs +6 -116
- package/starter/forest/biome.data.json +150 -0
- package/starter/forest/heightmap.r16 +0 -0
- package/starter/forest/recipe.json +192 -4428
- package/starter/forest/sky.ts +11 -0
- package/starter/forest/water.ts +30 -20
- package/starter/forest/world.ts +86 -322
- package/starter/tundra/README.md +77 -1
- package/starter/tundra/bake.mjs +4 -116
- package/starter/tundra/biome.data.json +131 -0
- package/starter/tundra/heightmap.r16 +0 -0
- package/starter/tundra/recipe.json +18 -66066
- package/starter/tundra/world.ts +65 -319
- package/starter-assets.json +6 -0
- package/{starter-assets/credits.json → starter-credits.json} +12 -105
- package/starter-assets/bark_brown_02/bark_brown_02_diff_1k.jpg +0 -0
- package/starter-assets/bark_brown_02/bark_brown_02_nor_gl_1k.jpg +0 -0
- package/starter-assets/bark_brown_02/bark_brown_02_rough_1k.jpg +0 -0
- package/starter-assets/boulder_01/boulder-mid.glb +0 -0
- package/starter-assets/boulder_01/boulder-near.glb +0 -0
- package/starter-assets/cliff_side/cliff_side_ao_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_diff_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_nor_gl_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_rough_1k.jpg +0 -0
- package/starter-assets/fern_02/fern_02_alpha_512.png +0 -0
- package/starter-assets/fern_02/fern_02_diff_512.jpg +0 -0
- package/starter-assets/fern_02/fern_02_nor_gl_512.jpg +0 -0
- package/starter-assets/fir_tree_01/fir-b-lod1.glb +0 -0
- package/starter-assets/fir_tree_01/fir-b-lod2.glb +0 -0
- package/starter-assets/fir_tree_01/fir-c-lod1.glb +0 -0
- package/starter-assets/fir_tree_01/fir-c-lod2.glb +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_arm_1k.jpg +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_diff_1k.jpg +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_nor_gl_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_ao_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_diff_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_nor_gl_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_rough_1k.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_arm_512.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_diff_512.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_nor_gl_512.jpg +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_alpha_512.png +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_diff_512.jpg +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_nor_gl_512.jpg +0 -0
- package/starter-assets/hdri/kloofendal_48d_partly_cloudy_1k.hdr +0 -0
- package/starter-assets/leafy_grass/leafy_grass_ao_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_diff_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_nor_gl_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_rough_1k.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_arm_512.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_diff_512.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_nor_gl_512.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_ao_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_diff_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_nor_gl_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_rough_1k.jpg +0 -0
- package/starter-assets/needle-atlas.png +0 -0
- package/starter-assets/needle-surface.png +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_arm_512.jpg +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_diff_512.jpg +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_nor_gl_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_arm_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_diff_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_nor_gl_512.jpg +0 -0
- package/starter-assets/rocks/boulder-mid.glb +0 -0
- package/starter-assets/rocks/boulder-near.glb +0 -0
- package/starter-assets/rocks/boulder-prep.json +0 -37
- package/starter-assets/rocks/rock01-mid.glb +0 -0
- package/starter-assets/rocks/rock01-near.glb +0 -0
- package/starter-assets/rocks/rock01-prep.json +0 -37
- package/starter-assets/rocks/rock04-mid.glb +0 -0
- package/starter-assets/rocks/rock04-near.glb +0 -0
- package/starter-assets/rocks/rock04-prep.json +0 -37
- package/starter-assets/sand_01/sand_01_ao_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_diff_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_nor_gl_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_rough_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_ao_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_diff_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_nor_gl_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_rough_1k.jpg +0 -0
package/dist/export.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mesh, Object3D, Matrix4 } from 'three';
|
|
2
|
-
import { I as ITerrainState } from './types-
|
|
2
|
+
import { I as ITerrainState } from './types-CPYAc9vo.js';
|
|
3
3
|
|
|
4
4
|
interface IWorldGLBInput {
|
|
5
5
|
readonly revision: string;
|
|
@@ -41,14 +41,16 @@ interface IWorldGLBExport {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Prepare the game's validated, frozen portable scene; the server cook owns GLB encoding.
|
|
45
45
|
* @requires npm i -D @threenative/terrain
|
|
46
|
-
* @situation export terrain
|
|
47
|
-
* @situation
|
|
48
|
-
* @constraint browser authoring
|
|
49
|
-
* @example const
|
|
50
|
-
* @override actual static models, final matrices and baked PBR maps are supplied by the game
|
|
46
|
+
* @situation export the terrain as a glb for another three.js project via the headless cook
|
|
47
|
+
* @situation prepare the terrain editor's resolved world for headless portable GLB cooking
|
|
48
|
+
* @constraint browser authoring FileReader/canvas; all appearance and coherent water come from the game
|
|
49
|
+
* @example const prepared = await prepareWorldGLTF(input);
|
|
51
50
|
*/
|
|
52
|
-
declare function
|
|
51
|
+
declare function prepareWorldGLTF(input: IWorldGLBInput): Promise<{
|
|
52
|
+
json: Record<string, unknown>;
|
|
53
|
+
report: IWorldGLBExport["report"];
|
|
54
|
+
}>;
|
|
53
55
|
|
|
54
|
-
export { type IWorldGLBExport, type IWorldGLBInput,
|
|
56
|
+
export { type IWorldGLBExport, type IWorldGLBInput, prepareWorldGLTF };
|
package/dist/export.js
CHANGED
|
@@ -110,7 +110,7 @@ function staticModel(source, name, terrain = false) {
|
|
|
110
110
|
for (const object of excluded) object.removeFromParent();
|
|
111
111
|
return copy;
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
113
|
+
async function prepareWorldGLTF(input) {
|
|
114
114
|
const { state } = input;
|
|
115
115
|
if (!/^[a-f0-9]{64}$/.test(input.revision) || !Number.isFinite(input.snapshotTime))
|
|
116
116
|
throw new Error("World export requires a content revision and finite snapshot time");
|
|
@@ -198,7 +198,7 @@ async function exportWorldGLB(input) {
|
|
|
198
198
|
root.add(copy);
|
|
199
199
|
}
|
|
200
200
|
if (typeof FileReader === "undefined" || typeof document === "undefined")
|
|
201
|
-
throw new Error("
|
|
201
|
+
throw new Error("prepareWorldGLTF needs browser authoring FileReader/canvas");
|
|
202
202
|
const geometries = /* @__PURE__ */ new Map();
|
|
203
203
|
const materials = /* @__PURE__ */ new Map();
|
|
204
204
|
const textures = /* @__PURE__ */ new Map();
|
|
@@ -243,7 +243,7 @@ async function exportWorldGLB(input) {
|
|
|
243
243
|
materials.set(source, copy);
|
|
244
244
|
return copy;
|
|
245
245
|
}
|
|
246
|
-
let
|
|
246
|
+
let json;
|
|
247
247
|
try {
|
|
248
248
|
root.traverse((object) => {
|
|
249
249
|
if (!(object instanceof Mesh)) return;
|
|
@@ -253,8 +253,8 @@ async function exportWorldGLB(input) {
|
|
|
253
253
|
object.material = Array.isArray(object.material) ? object.material.map(freezeMaterial) : freezeMaterial(object.material);
|
|
254
254
|
});
|
|
255
255
|
root.updateMatrixWorld(true);
|
|
256
|
-
|
|
257
|
-
binary:
|
|
256
|
+
json = await new GLTFExporter().parseAsync(root, {
|
|
257
|
+
binary: false,
|
|
258
258
|
onlyVisible: true,
|
|
259
259
|
includeCustomExtensions: false
|
|
260
260
|
});
|
|
@@ -263,35 +263,23 @@ async function exportWorldGLB(input) {
|
|
|
263
263
|
for (const value of materials.values()) value.dispose();
|
|
264
264
|
for (const value of textures.values()) value.dispose();
|
|
265
265
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
revision: input.revision,
|
|
281
|
-
resolution: n,
|
|
282
|
-
snapshotTime: input.snapshotTime,
|
|
283
|
-
placementIds: [...ids],
|
|
284
|
-
waterIds: [...waterIds],
|
|
285
|
-
receivingGameSupplies: [
|
|
286
|
-
"lighting",
|
|
287
|
-
"sky/environment",
|
|
288
|
-
"fog",
|
|
289
|
-
"exposure",
|
|
290
|
-
"post-processing",
|
|
291
|
-
"live water/wind"
|
|
292
|
-
]
|
|
293
|
-
}
|
|
266
|
+
const report = {
|
|
267
|
+
revision: input.revision,
|
|
268
|
+
resolution: n,
|
|
269
|
+
snapshotTime: input.snapshotTime,
|
|
270
|
+
placementIds: [...ids],
|
|
271
|
+
waterIds: [...waterIds],
|
|
272
|
+
receivingGameSupplies: [
|
|
273
|
+
"lighting",
|
|
274
|
+
"sky/environment",
|
|
275
|
+
"fog",
|
|
276
|
+
"exposure",
|
|
277
|
+
"post-processing",
|
|
278
|
+
"live water/wind"
|
|
279
|
+
]
|
|
294
280
|
};
|
|
281
|
+
if (json instanceof ArrayBuffer) throw new Error("Expected prepared glTF JSON");
|
|
282
|
+
return { json, report };
|
|
295
283
|
}
|
|
296
284
|
|
|
297
|
-
export {
|
|
285
|
+
export { prepareWorldGLTF };
|