roamwright 0.61.4 → 0.61.6

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.
@@ -3,6 +3,7 @@ import {
3
3
  buildCamel,
4
4
  buildCanine,
5
5
  buildCattle,
6
+ buildFenceRing,
6
7
  caninePose,
7
8
  createDaylightSky,
8
9
  createHouseKit,
@@ -12,11 +13,12 @@ import {
12
13
  GeometryBuilder,
13
14
  horsePose,
14
15
  rigHorse,
16
+ scatterTrees,
17
+ scatterTussocks,
15
18
  } from 'roamwright';
16
19
  import { sstep } from 'roamwright/math/scalar.js';
17
20
  import { createProps } from 'roamwright/geometry/props.js';
18
21
  import { initExample, makeRollingGround } from './stage.js';
19
- import { buildCircularFence, scatterTrees, scatterTussocks } from './stage-kits.js';
20
22
 
21
23
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
22
24
  fallbackSeed: 42,
@@ -53,7 +55,7 @@ const ground = makeRollingGround({
53
55
  worldGroup.add(ground);
54
56
 
55
57
  // Timber post-and-rail paddock fence and watering trough.
56
- buildCircularFence({ worldGroup, groundAt, radius: 16.5, posts: 28, random, postHeight: 1.28, railHeights: [0.48, 0.92] });
58
+ buildFenceRing({ parent: worldGroup, groundAt, radius: 16.5, posts: 28, random, postHeight: 1.28, railHeights: [0.48, 0.92] });
57
59
 
58
60
  // Haycock and farm well beside the back fence.
59
61
  const houseKit = createHouseKit({ shapes });
@@ -71,7 +73,7 @@ hayMesh.position.set(8.8, 0, -6.2);
71
73
 
72
74
  // Trees and meadow tussocks outside and along the fence line.
73
75
  const { material: leafMat } = scatterTrees({
74
- worldGroup,
76
+ parent: worldGroup,
75
77
  noise,
76
78
  hash,
77
79
  seed,
@@ -90,7 +92,7 @@ const { material: leafMat } = scatterTrees({
90
92
  });
91
93
 
92
94
  scatterTussocks({
93
- worldGroup,
95
+ parent: worldGroup,
94
96
  seed: seed * 11,
95
97
  random,
96
98
  groundAt,
@@ -11,13 +11,14 @@ import {
11
11
  grazeRound,
12
12
  planCampWalkers,
13
13
  planTownsfolk,
14
+ scatterTrees,
15
+ scatterTussocks,
14
16
  } from 'roamwright';
15
17
  import { sharedFields } from 'roamwright/motion/crowd-camp.js';
16
18
  import { sstep } from 'roamwright/math/scalar.js';
17
19
  import { C } from 'roamwright/geometry/primitives.js';
18
20
  import { createProps } from 'roamwright/geometry/props.js';
19
21
  import { initExample, makeRollingGround } from './stage.js';
20
- import { scatterTrees, scatterTussocks } from './stage-kits.js';
21
22
 
22
23
  const {
23
24
  canvas,
@@ -122,7 +123,7 @@ createHouseKitMeshes({ materials: createHouseKitMaterials({ doubleSide: true })
122
123
 
123
124
  // Trees and grass tussocks framing the meadow, market backdrop and pasture.
124
125
  const { material: leafMat } = scatterTrees({
125
- worldGroup,
126
+ parent: worldGroup,
126
127
  noise,
127
128
  hash,
128
129
  seed,
@@ -143,7 +144,7 @@ const { material: leafMat } = scatterTrees({
143
144
  });
144
145
 
145
146
  scatterTussocks({
146
- worldGroup,
147
+ parent: worldGroup,
147
148
  seed: seed * 13,
148
149
  random: rng,
149
150
  groundAt: groundHeight,
@@ -1,26 +1,27 @@
1
1
  import * as THREE from 'three';
2
2
  import {
3
+ createFireLightWatch,
3
4
  createHouseKit,
4
5
  createHouseKitMaterials,
5
6
  createHouseKitMeshes,
6
7
  createOrbitCamera,
8
+ createParticleNoiseTexture,
9
+ createParticleSystem,
10
+ createSiteSchedule,
7
11
  createSkyPanorama,
8
12
  GeometryBuilder,
13
+ scatterTrees,
9
14
  } from 'roamwright';
10
15
  import { sstep } from 'roamwright/math/scalar.js';
11
16
  import { C, TRS } from 'roamwright/geometry/primitives.js';
12
17
  import { createProps } from 'roamwright/geometry/props.js';
13
- import { createParticleSystem } from 'roamwright/rendering/particles.js';
14
18
  import { createParticleEmitters, shakeCamera } from 'roamwright/rendering/particle-emitters.js';
15
19
  import { createParticleBursts } from 'roamwright/rendering/particle-bursts.js';
16
20
  import { createGroundMarks } from 'roamwright/rendering/ground-marks.js';
17
21
  import { createSmokeShadows } from 'roamwright/rendering/smoke-shadows.js';
18
22
  import { FLAME_KINDS, createFlameSources } from 'roamwright/rendering/flame-sources.js';
19
- import { createFireLightWatch } from 'roamwright/rendering/fire-light-watch.js';
20
23
  import { perspectivePointScale } from 'roamwright/rendering/viewport.js';
21
- import { createSiteSchedule } from 'roamwright/runtime/effect-sites.js';
22
24
  import { initExample } from './stage.js';
23
- import { makeParticleNoiseTexture, scatterTrees } from './stage-kits.js';
24
25
 
25
26
  const { canvas, renderer, camera, scene, worldGroup, fxScene, seed, random, noise, hash, shapes } = initExample({
26
27
  fallbackSeed: 3,
@@ -130,7 +131,7 @@ const rockMesh = rocks.mesh(new THREE.MeshStandardMaterial({ vertexColors: true,
130
131
  rockMesh.castShadow = rockMesh.receiveShadow = true;
131
132
 
132
133
  scatterTrees({
133
- worldGroup,
134
+ parent: worldGroup,
134
135
  noise,
135
136
  hash,
136
137
  seed,
@@ -152,7 +153,7 @@ scatterTrees({
152
153
  });
153
154
 
154
155
  // Particles, noise sheet, and effect systems.
155
- const noiseTexture = makeParticleNoiseTexture(noise, 128);
156
+ const noiseTexture = createParticleNoiseTexture({ noise, size: 128 });
156
157
 
157
158
  const pointScale = { value: 600 },
158
159
  particles = createParticleSystem({
@@ -1,6 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
3
  import {
4
+ buildFenceRing,
4
5
  createDaylightSky,
5
6
  createFigureAssembler,
6
7
  createFigureBuilder,
@@ -8,11 +9,12 @@ import {
8
9
  figureActor,
9
10
  geometryOf,
10
11
  rigHorse,
12
+ scatterTrees,
13
+ scatterTussocks,
11
14
  } from 'roamwright';
12
15
  import { sstep } from 'roamwright/math/scalar.js';
13
- import { createWind } from '../motion/wind.js';
16
+ import { createWind } from 'roamwright/motion/wind.js';
14
17
  import { initExample, makeRollingGround } from './stage.js';
15
- import { buildCircularFence, scatterTrees, scatterTussocks } from './stage-kits.js';
16
18
 
17
19
  const doing = document.getElementById('doing');
18
20
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash } = initExample({
@@ -45,11 +47,11 @@ const meadow = makeRollingGround({
45
47
  worldGroup.add(meadow);
46
48
 
47
49
  // Timber post-and-rail paddock fence ringing the 20 m training ground.
48
- buildCircularFence({ worldGroup, groundAt, radius: 20.5, posts: 32, random, postHeight: 1.32, railHeights: [0.52, 0.96] });
50
+ buildFenceRing({ parent: worldGroup, groundAt, radius: 20.5, posts: 32, random, postHeight: 1.32, railHeights: [0.52, 0.96] });
49
51
 
50
52
  // Trees and meadow tussocks framing the paddock.
51
53
  const { material: leafMat } = scatterTrees({
52
- worldGroup,
54
+ parent: worldGroup,
53
55
  noise,
54
56
  hash,
55
57
  seed,
@@ -65,7 +67,7 @@ const { material: leafMat } = scatterTrees({
65
67
  });
66
68
 
67
69
  scatterTussocks({
68
- worldGroup,
70
+ parent: worldGroup,
69
71
  seed: seed * 17,
70
72
  random,
71
73
  groundAt,
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { createDaylightSky, createOrbitCamera, createStreetLamps } from 'roamwright';
2
+ import { createDaylightSky, createOrbitCamera, createStreetLamps, scatterTrees, scatterTussocks } from 'roamwright';
3
3
  import { sstep } from 'roamwright/math/scalar.js';
4
4
  import { GB } from 'roamwright/geometry/builder.js';
5
5
  import { C, TRS } from 'roamwright/geometry/primitives.js';
@@ -14,7 +14,6 @@ import { createLongFlierCompany } from 'roamwright/rendering/flier-long-body-com
14
14
  import { createFlierShapes, createSwarm } from 'roamwright/rendering/flier-swarm.js';
15
15
  import { createFlock } from 'roamwright/rendering/flocks.js';
16
16
  import { initExample, makeRollingGround } from './stage.js';
17
- import { scatterTrees, scatterTussocks } from './stage-kits.js';
18
17
 
19
18
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
20
19
  fallbackSeed: 7,
@@ -83,7 +82,7 @@ worldGroup.add(lampLight);
83
82
 
84
83
  // Trees and meadow tussocks framing the crag and distant ridge.
85
84
  const { material: leafMat } = scatterTrees({
86
- worldGroup,
85
+ parent: worldGroup,
87
86
  noise,
88
87
  hash,
89
88
  seed,
@@ -105,7 +104,7 @@ const { material: leafMat } = scatterTrees({
105
104
  });
106
105
 
107
106
  scatterTussocks({
108
- worldGroup,
107
+ parent: worldGroup,
109
108
  seed: seed * 19,
110
109
  random,
111
110
  groundAt,
@@ -1,6 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import {
3
3
  buildPortalGateway,
4
+ createCityFortification,
4
5
  createDaylightSky,
5
6
  createHouseKit,
6
7
  createHouseKitMaterials,
@@ -9,12 +10,12 @@ import {
9
10
  createSimpleWater,
10
11
  createSpaces,
11
12
  mulberry32,
13
+ scatterTrees,
12
14
  } from 'roamwright';
13
15
  import { townFrame } from 'roamwright/geometry/land-town-ground.js';
14
16
  import { C } from 'roamwright/geometry/primitives.js';
15
17
  import { sstep } from 'roamwright/math/scalar.js';
16
18
  import { initExample, makeRollingGround } from './stage.js';
17
- import { createShowcaseFortification, scatterTrees } from './stage-kits.js';
18
19
 
19
20
  const { canvas, renderer, camera, scene, worldGroup, seed, noise, hash, shapes } = initExample({
20
21
  fallbackSeed: 11,
@@ -70,7 +71,7 @@ function ground(x, z) {
70
71
  }
71
72
 
72
73
  const { addBox } = createSpaces({ ground });
73
- const fort = createShowcaseFortification({ ground, addBox, shapes, houseKit });
74
+ const fort = createCityFortification({ ground, addBox, shapes, houseKit });
74
75
 
75
76
  const plan = {
76
77
  yaw: 0,
@@ -226,7 +227,7 @@ if (coastal) {
226
227
 
227
228
  // Sparse cypress/cedar trees dotting the slopes outside the walls.
228
229
  scatterTrees({
229
- worldGroup,
230
+ parent: worldGroup,
230
231
  noise,
231
232
  hash,
232
233
  seed,
@@ -1,9 +1,15 @@
1
1
  import * as THREE from 'three';
2
- import { createDaylightSky, createHouseKit, createHouseKitMaterials, createHouseKitMeshes, createOrbitCamera } from 'roamwright';
2
+ import {
3
+ createDaylightSky,
4
+ createHouseKit,
5
+ createHouseKitMaterials,
6
+ createHouseKitMeshes,
7
+ createOrbitCamera,
8
+ scatterTrees,
9
+ } from 'roamwright';
3
10
  import { sstep } from 'roamwright/math/scalar.js';
4
11
  import { createProps } from 'roamwright/geometry/props.js';
5
12
  import { initExample, makeRollingGround } from './stage.js';
6
- import { scatterTrees } from './stage-kits.js';
7
13
 
8
14
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
9
15
  fallbackSeed: 42,
@@ -130,7 +136,7 @@ kitStatic(propKit, houses);
130
136
 
131
137
  // Trees framing the green hills behind the square.
132
138
  scatterTrees({
133
- worldGroup,
139
+ parent: worldGroup,
134
140
  noise,
135
141
  hash,
136
142
  seed,
@@ -14,12 +14,12 @@ import {
14
14
  groundRenderOrder,
15
15
  readDevice,
16
16
  resolveDevicePresets,
17
+ scatterTrees,
17
18
  } from 'roamwright';
18
19
  import { sstep } from 'roamwright/math/scalar.js';
19
20
  import { createDiagnosticLog } from 'roamwright/runtime/diagnostic-log.js';
20
21
  import { estimateMemory } from 'roamwright/rendering/memory-estimate.js';
21
22
  import { initExample, makeRollingGround } from './stage.js';
22
- import { scatterTrees } from './stage-kits.js';
23
23
 
24
24
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
25
25
  fallbackSeed: 42,
@@ -141,7 +141,7 @@ createHouseKitMeshes({ materials: createHouseKitMaterials({ roughness: 0.9 }) })
141
141
  const treeGroup = new THREE.Group();
142
142
  worldGroup.add(treeGroup);
143
143
  scatterTrees({
144
- worldGroup: treeGroup,
144
+ parent: treeGroup,
145
145
  noise,
146
146
  hash,
147
147
  seed,
package/examples/rooms.js CHANGED
@@ -1,13 +1,18 @@
1
1
  import * as THREE from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { bindKeyboardOrbit, createRoomKit, createRoomMaterials, finishRoom } from 'roamwright';
4
- import { createParticleEmitters } from '../rendering/particle-emitters.js';
5
- import { createParticleSystem } from '../rendering/particles.js';
6
- import { updateRoomLight } from '../rendering/room-light.js';
7
- import { perspectivePointScale } from '../rendering/viewport.js';
8
- import { createSiteSchedule } from '../runtime/effect-sites.js';
3
+ import {
4
+ bindKeyboardOrbit,
5
+ createParticleNoiseTexture,
6
+ createParticleSystem,
7
+ createRoomKit,
8
+ createRoomMaterials,
9
+ createSiteSchedule,
10
+ finishRoom,
11
+ } from 'roamwright';
12
+ import { createParticleEmitters } from 'roamwright/rendering/particle-emitters.js';
13
+ import { updateRoomLight } from 'roamwright/rendering/room-light.js';
14
+ import { perspectivePointScale } from 'roamwright/rendering/viewport.js';
9
15
  import { initExample } from './stage.js';
10
- import { makeParticleNoiseTexture } from './stage-kits.js';
11
16
 
12
17
  const { canvas, renderer, camera, scene, worldGroup, seed, noise, hash, shapes } = initExample({
13
18
  fallbackSeed: 42,
@@ -145,7 +150,7 @@ const finish = (R, def) =>
145
150
  const rooms = { small: await smallRoom(), hall: await hall() };
146
151
 
147
152
  // Real engine fire inside the small room's hearth, using the fire site emitted by kit.hearth().
148
- const noiseTexture = makeParticleNoiseTexture(noise, 128);
153
+ const noiseTexture = createParticleNoiseTexture({ noise, size: 128 });
149
154
  const pointScale = { value: 520 };
150
155
  let fireClock = 0;
151
156
  const particles = createParticleSystem({
package/examples/ships.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  createShipMeshes,
10
10
  createSimpleWater,
11
11
  GeometryBuilder,
12
+ scatterTrees,
12
13
  SHIP_PRESETS,
13
14
  } from 'roamwright';
14
15
  import { sstep } from 'roamwright/math/scalar.js';
@@ -18,7 +19,6 @@ import { YARD_STOWED } from 'roamwright/geometry/ship-rig.js';
18
19
  import { createBoatSailing, openWaterCourse } from 'roamwright/motion/boat-sailing.js';
19
20
  import { createProps } from 'roamwright/geometry/props.js';
20
21
  import { initExample, makeRollingGround } from './stage.js';
21
- import { scatterTrees } from './stage-kits.js';
22
22
 
23
23
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
24
24
  fallbackSeed: 42,
@@ -141,7 +141,7 @@ kitStatic(propKit, portGroup);
141
141
 
142
142
  // Coastal pines and cedars along the headland behind the warehouses.
143
143
  scatterTrees({
144
- worldGroup,
144
+ parent: worldGroup,
145
145
  noise,
146
146
  hash,
147
147
  seed,
@@ -1,10 +1,9 @@
1
1
  import * as THREE from 'three';
2
- import { createSimpleWater, GeometryBuilder, mulberry32 } from 'roamwright';
2
+ import { buildFenceRing, createSimpleWater, GeometryBuilder, mulberry32, scatterTrees, scatterTussocks } from 'roamwright';
3
3
  import { sstep } from 'roamwright/math/scalar.js';
4
4
  import { C, TRS } from 'roamwright/geometry/primitives.js';
5
5
  import { createReeds } from 'roamwright/rendering/plant-reeds.js';
6
6
  import { makeRollingGround } from './stage.js';
7
- import { buildCircularFence, scatterTrees, scatterTussocks } from './stage-kits.js';
8
7
 
9
8
  /**
10
9
  * Builds the coastal valley terrain, river mouth, bay water, stone harbour quay,
@@ -81,8 +80,8 @@ export function buildSmallWorldLand({ world, worldGroup, seed, rng, noise, hash,
81
80
  quayMesh.castShadow = quayMesh.receiveShadow = true;
82
81
 
83
82
  // Timber paddock fence enclosing the grazing pasture east of the town.
84
- buildCircularFence({
85
- worldGroup,
83
+ buildFenceRing({
84
+ parent: worldGroup,
86
85
  groundAt,
87
86
  cx: world.pasture.x,
88
87
  cz: world.pasture.z,
@@ -94,7 +93,7 @@ export function buildSmallWorldLand({ world, worldGroup, seed, rng, noise, hash,
94
93
 
95
94
  // Woodland, meadow tussocks and swaying river reeds.
96
95
  const { material: leafMat } = scatterTrees({
97
- worldGroup,
96
+ parent: worldGroup,
98
97
  noise,
99
98
  hash,
100
99
  seed,
@@ -117,7 +116,7 @@ export function buildSmallWorldLand({ world, worldGroup, seed, rng, noise, hash,
117
116
  });
118
117
 
119
118
  scatterTussocks({
120
- worldGroup,
119
+ parent: worldGroup,
121
120
  seed: seed * 13,
122
121
  random: rng,
123
122
  groundAt,
@@ -1,8 +1,14 @@
1
1
  import * as THREE from 'three';
2
- import { createHouseKit, createHouseKitMaterials, createHouseKitMeshes, createStreetLamps, GeometryBuilder } from 'roamwright';
2
+ import {
3
+ createCityFortification,
4
+ createHouseKit,
5
+ createHouseKitMaterials,
6
+ createHouseKitMeshes,
7
+ createStreetLamps,
8
+ GeometryBuilder,
9
+ } from 'roamwright';
3
10
  import { townFrame } from 'roamwright/geometry/land-town-ground.js';
4
11
  import { createProps } from 'roamwright/geometry/props.js';
5
- import { createShowcaseFortification } from './stage-kits.js';
6
12
 
7
13
  const STYLES = {
8
14
  town: {
@@ -43,7 +49,7 @@ const ROOF_PALETTE = [0x8c4c38, 0x674b3d, 0x9b5f3d, 0x5c686a];
43
49
  */
44
50
  export function buildSmallWorldTown({ world, worldGroup, seed, rng, noise, hash, shapes, groundAt, spaceKit }) {
45
51
  const houseKit = createHouseKit({ shapes, styles: STYLES });
46
- const fort = createShowcaseFortification({ ground: groundAt, addBox: spaceKit.addBox, shapes, houseKit });
52
+ const fort = createCityFortification({ ground: groundAt, addBox: spaceKit.addBox, shapes, houseKit });
47
53
  const frame = townFrame({ ...world.town, water: -1.5 });
48
54
  const townSpace = { id: world.town.id, decks: [], grid: new Map(), ground: groundAt };
49
55
  const K = fort.cityKit(townSpace, frame);
@@ -8,14 +8,18 @@ import {
8
8
  createHouseKitMaterials,
9
9
  createHouseKitMeshes,
10
10
  createOrbitCamera,
11
+ createScriptFoley,
11
12
  createShipKit,
12
13
  createShipMeshes,
13
14
  createSimpleWater,
15
+ createSoundscape,
16
+ createStrideFoley,
14
17
  figureActor,
15
18
  GeometryBuilder,
16
19
  geometryOf,
17
20
  mulberry32,
18
21
  rigHorse,
22
+ scatterTrees,
19
23
  SHIP_PRESETS,
20
24
  } from 'roamwright';
21
25
  import { sstep } from 'roamwright/math/scalar.js';
@@ -23,12 +27,8 @@ import { C, TRS } from 'roamwright/geometry/primitives.js';
23
27
  import { oneOf } from 'roamwright/geometry/ship-kit.js';
24
28
  import { createProps } from 'roamwright/geometry/props.js';
25
29
  import { createReeds } from 'roamwright/rendering/plant-reeds.js';
26
- import { createWind } from '../motion/wind.js';
27
- import { createScriptFoley } from '../runtime/foley-script.js';
28
- import { createStrideFoley } from '../runtime/foley-strides.js';
29
- import { createSoundscape } from '../runtime/soundscape.js';
30
+ import { createWind } from 'roamwright/motion/wind.js';
30
31
  import { initExample, makeRollingGround } from './stage.js';
31
- import { scatterTrees } from './stage-kits.js';
32
32
 
33
33
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
34
34
  fallbackSeed: 42,
@@ -143,7 +143,7 @@ createHouseKitMeshes({ materials: createHouseKitMaterials({ doubleSide: true })
143
143
 
144
144
  // Trees framing the lakeside meadow and swaying reeds along the water's edge.
145
145
  scatterTrees({
146
- worldGroup,
146
+ parent: worldGroup,
147
147
  noise,
148
148
  hash,
149
149
  seed,
package/examples/towns.js CHANGED
@@ -14,13 +14,13 @@ import {
14
14
  GeometryBuilder,
15
15
  layVillage,
16
16
  mulberry32,
17
+ scatterTrees,
17
18
  } from 'roamwright';
18
19
  import { createPieceBatch, TIGHT } from 'roamwright/rendering/piece-batch.js';
19
20
  import { C, TRS } from 'roamwright/geometry/primitives.js';
20
21
  import { litShare } from 'roamwright/math/lit-share.js';
21
22
  import { sstep } from 'roamwright/math/scalar.js';
22
23
  import { initExample, makeRollingGround } from './stage.js';
23
- import { scatterTrees } from './stage-kits.js';
24
24
 
25
25
  const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
26
26
  fallbackSeed: 7,
@@ -170,7 +170,7 @@ worldGroup.add(wallMesh);
170
170
 
171
171
  // Trees framing the pastures around the village.
172
172
  scatterTrees({
173
- worldGroup,
173
+ parent: worldGroup,
174
174
  noise,
175
175
  hash,
176
176
  seed,