@threenative/procedural-environment 0.1.7 → 0.1.9

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 CHANGED
@@ -4278,7 +4278,7 @@ var cityRoadDefaults = {
4278
4278
  };
4279
4279
  var cityBakeDefaults = {
4280
4280
  emissiveSigns: false,
4281
- opaqueGlass: false
4281
+ opaqueGlass: true
4282
4282
  };
4283
4283
  var cityRoadEdgeModules = [
4284
4284
  "straight",
@@ -4479,6 +4479,12 @@ function applyMaterialOptions(material, bake) {
4479
4479
  }
4480
4480
  }
4481
4481
  if (bake.opaqueGlass && typeof material.transmission === "number" && material.transmission > 0) {
4482
+ const kept = 1 - Math.min(1, material.transmission);
4483
+ if (material.color) {
4484
+ material.color.r *= kept;
4485
+ material.color.g *= kept;
4486
+ material.color.b *= kept;
4487
+ }
4482
4488
  material.transmission = 0;
4483
4489
  if (typeof material.thickness === "number") material.thickness = 0;
4484
4490
  }
@@ -16,6 +16,9 @@ interface IStylizedScene {
16
16
 
17
17
  declare const uniforms: { uTime: { value: number } };
18
18
 
19
+ /** Set pusher `index` (0 to 3) to a sphere at x, y, z of `radius` metres; radius 0 turns it off. */
20
+ declare function toyboxPush(index: number, x: number, y: number, z: number, radius: number): void;
21
+
19
22
  /**
20
23
  * Build a gradient sky dome with the Stylized Biome Kit's WebGL shader.
21
24
  * @situation a procedural stylized gradient sky dome for an alpine, snow, or desert scene
@@ -70,7 +73,7 @@ declare const stylizedMaterials: Record<string, Material>;
70
73
  interface IStylizedAsset {
71
74
  id: string;
72
75
  name: string;
73
- kind: "stylized" | "dungeon";
76
+ kind: "stylized" | "dungeon" | "village" | "toybox";
74
77
  category: string;
75
78
  biomes: string[];
76
79
  variants: number;
@@ -85,15 +88,20 @@ interface IStylizedAssetOptions {
85
88
  * List the Stylized Biome Kit pieces and scenes, including available variants.
86
89
  * @situation browse procedural stylized biome assets for alpine forest, snow peaks, or desert canyon
87
90
  * @situation browse modular dungeon walls, stone floors, arches, doors, props, fixtures, and assembled dungeon scenes
91
+ * @situation browse stylized village houses, timber walls, fences, paths, props, and the assembled village green
92
+ * @situation browse toybox platformer modules: grass blocks, cliffs, ramps, deck panels, bounce pads, coins, cannons, floating islands, palms, crates, cut-stone ruins, spinners, spike traps, a goal gate, open sea with shore foam, and assembled garden, obstacle-course and island-cove scenes
88
93
  * @requires npm i @threenative/procedural-environment
89
94
  * @example const rows = stylizedAssets();
90
95
  */
91
96
  declare function stylizedAssets(): IStylizedAsset[];
92
97
  /**
93
- * Generate a Stylized Biome Kit or Dungeon piece or scene with its Three.js materials.
98
+ * Generate a Stylized Biome Kit, Dungeon, Village or Toybox piece or scene with its Three.js materials.
94
99
  * @situation create stylized mountain ridges, snowy trees, sandstone formations, or animated water
95
100
  * @situation create modular dungeon walls, stairs, arches, dungeon props and fixtures in an overgrown, frozen, or volcanic theme
101
+ * @situation create a stylized medieval village: cottages, tavern, barn, windmill, forge, market stall, well, fences and props in a meadow, snowy, or desert theme
102
+ * @situation build a 3D platformer level from modular toy-like pieces with realistic materials: snap-together 2 m grass blocks, spinning coins, a jumping bounce pad, hover platforms, and a blurred sky backdrop
96
103
  * @constraint the biome shaders, dungeon surface finish, and fire motion use Three.js WebGL materials
104
+ * @constraint toybox pieces animate only when the game sets `stylizedUniforms.uTime` and calls `update(seconds)` each frame; `backdrop` is an image URL the game shows behind the scene
97
105
  * @requires npm i @threenative/procedural-environment
98
106
  * @example const { group } = createStylizedAsset("mountain-snow", { seed: 8, variant: 1 });
99
107
  */
@@ -103,6 +111,8 @@ declare function createStylizedAsset(id: string, options?: IStylizedAssetOptions
103
111
  update?: (seconds: number) => void;
104
112
  view?: IStylizedScene["view"];
105
113
  env?: IStylizedScene["env"];
114
+ /** Toybox: a blurred backdrop image URL to show behind the scene. */
115
+ backdrop?: string;
106
116
  };
107
117
 
108
- export { type IStylizedAsset, type IStylizedAssetOptions, createStylizedAsset, scatter, sky, stylizedAssets, stylizedMaterials, uniforms as stylizedUniforms, terrain };
118
+ export { type IStylizedAsset, type IStylizedAssetOptions, createStylizedAsset, scatter, sky, stylizedAssets, stylizedMaterials, uniforms as stylizedUniforms, terrain, toyboxPush };