tosijs-3d 0.10.4 → 0.10.5

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/b3d-planet.d.ts +28 -0
  3. package/dist/b3d-planet.d.ts.map +1 -1
  4. package/dist/b3d-planet.js +270 -47
  5. package/dist/b3d-planet.js.map +1 -1
  6. package/dist/b3d-star-system.d.ts +34 -3
  7. package/dist/b3d-star-system.d.ts.map +1 -1
  8. package/dist/b3d-star-system.js +423 -198
  9. package/dist/b3d-star-system.js.map +1 -1
  10. package/dist/b3d-star.d.ts +1 -0
  11. package/dist/b3d-star.d.ts.map +1 -1
  12. package/dist/b3d-star.js +48 -59
  13. package/dist/b3d-star.js.map +1 -1
  14. package/dist/gas-giant.d.ts +1 -1
  15. package/dist/gas-giant.d.ts.map +1 -1
  16. package/dist/gas-giant.js +36 -15
  17. package/dist/gas-giant.js.map +1 -1
  18. package/dist/index.d.ts +9 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +5 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/landform.d.ts +43 -0
  23. package/dist/landform.d.ts.map +1 -1
  24. package/dist/landform.js +84 -11
  25. package/dist/landform.js.map +1 -1
  26. package/dist/planet-clouds.d.ts.map +1 -1
  27. package/dist/planet-clouds.js +9 -3
  28. package/dist/planet-clouds.js.map +1 -1
  29. package/dist/planet-map.d.ts.map +1 -1
  30. package/dist/planet-map.js +2 -3
  31. package/dist/planet-map.js.map +1 -1
  32. package/dist/planet-surface-material.d.ts +5 -0
  33. package/dist/planet-surface-material.d.ts.map +1 -1
  34. package/dist/planet-surface-material.js +26 -7
  35. package/dist/planet-surface-material.js.map +1 -1
  36. package/dist/rocky-world.d.ts +73 -0
  37. package/dist/rocky-world.d.ts.map +1 -0
  38. package/dist/rocky-world.js +260 -0
  39. package/dist/rocky-world.js.map +1 -0
  40. package/dist/sol.d.ts +3 -0
  41. package/dist/sol.d.ts.map +1 -0
  42. package/dist/sol.js +138 -0
  43. package/dist/sol.js.map +1 -0
  44. package/dist/solar-system.d.ts +2 -0
  45. package/dist/solar-system.d.ts.map +1 -0
  46. package/dist/solar-system.js +133 -0
  47. package/dist/solar-system.js.map +1 -0
  48. package/dist/space-backdrop.d.ts +17 -0
  49. package/dist/space-backdrop.d.ts.map +1 -0
  50. package/dist/space-backdrop.js +54 -0
  51. package/dist/space-backdrop.js.map +1 -0
  52. package/dist/star-material.d.ts +12 -0
  53. package/dist/star-material.d.ts.map +1 -0
  54. package/dist/star-material.js +102 -0
  55. package/dist/star-material.js.map +1 -0
  56. package/dist/system-layout.d.ts +120 -0
  57. package/dist/system-layout.d.ts.map +1 -0
  58. package/dist/system-layout.js +135 -0
  59. package/dist/system-layout.js.map +1 -0
  60. package/package.json +1 -1
  61. package/static/attributes.json +58 -43
  62. package/static/attributes.txt +18 -14
  63. package/dist/rocket-ascent.d.ts +0 -20
  64. package/dist/rocket-ascent.d.ts.map +0 -1
  65. package/dist/rocket-ascent.js +0 -410
  66. package/dist/rocket-ascent.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ All notable changes to **tosijs-3d**. This project is pre-1.0 (`0.x`), so minor
6
6
  versions may carry breaking peer-dependency changes — each is called out in a
7
7
  **⚠️ Breaking** block in its version section below, with what a consumer must do.
8
8
 
9
+ ## 0.10.5
10
+
11
+ ### Added
12
+
13
+ - **The Solar System demo** (Demos): our own system from the library's parts, every planet and moon a planet, Phobos, Deimos, Vesta and Pallas as lumpy rocks, the asteroid belt, a `look at` camera that follows a body from its sunlit side, and **real maps** for the Earth, the Moon and Mars at the flick of a toggle. `SOL` is the system as data; a star system draws any `SystemSpec` you give its `system` property (`maps="on"` uses a body's real maps), and `layoutSystem` takes known moons and belt bodies. A new `ice` world (Europa, Enceladus, Triton).
14
+ - **Rocky worlds: `<tosi-b3d-planet world="moon">`.** `ROCKY_WORLDS` has the Moon, Mercury, Mars, Venus, Io, Titan and an Earth as data (sea and its colour, air, clouds, relief, craters, climate, and for Io and Titan their own ground colours), the rocky half of `GAS_GIANTS`. `world` is a preset: choosing one writes its values into the planet's own settings, which stay yours to tune (`worldOverrides` changes the preset for one planet). A planet takes `seaShallow`/`seaDeep` for its sea's colour (Titan's methane). The colours are the biome chart's (a dry warm world is red, a dry cold one grey).
15
+ - **`spaceBackdrop()`: space, set up once.** A sun and the airless star sky with the galaxy tilted off the scene's plane, to spread into a `b3d(…)`. The planet, gas giant and planet-map demos share it (untilted, the Milky Way ran exactly along Saturn's rings). Defaults to the pinned versioned sky, `PINNED_SKY_URL`. The planet demo has a world picker.
16
+ - **A star system is made of real planets.** `<tosi-b3d-star-system>` draws every body as a `<tosi-b3d-planet>`: giants banded and ringed, rocky worlds picked from what the generator says about each (`rockyWorldFor`: airless rock, seas, a toxic hot sky, or dust), moons locked to their planets, and an asteroid belt (`beltCount` rocks, thin-instanced, with its few big bodies picked out) in a wide gap before the first giant. Its `bodies` list names every planet, moon and named asteroid with the node that carries it, and the demo's `look at` follows one with the camera, under the shared star sky (`spaceBackdrop({ sun: false })`: a system lights itself). ⚠️ It looks different: distances are on a log scale and sizes on a square root (`system-layout`, pure and tested), so a system fits on a screen without being empty.
17
+ - **Craters on a planet.** `sphereCraters` (landform) is `craterField` on a whole body: no seam, no squeeze at the poles, and an `asymmetry` toward a direction, for a tidally locked moon's leading side. A planet takes `craters`, `craterSize`, `craterWear` and `craterAsymmetry`, or its `world`'s. `craterProfile` is the one crater shape both share.
18
+
19
+ ### Removed
20
+
21
+ - ⚠️ **The Rocket Ascent demo and `rocketAscent()`**, outdated; the Solar System demo replaces it in the demos.
22
+
23
+ ### Changed
24
+
25
+ - **Stars look like stars.** `<tosi-b3d-star>` and a star system's star share one surface material (`star-material`): white-hot in the middle and shading into the star's own colour toward a darker limb (only a warm star reddens there), slowly boiling granulation and a few sunspots; the glow peaks at the edge and fades outward instead of washing the disc out. They were a flat emissive colour, a white ball. The spectral colours are stylised so each class reads as its own: O white with a trace of violet, B violet-blue, A blue, F green, G a clear yellow (the Sun too), K orange, M red.
26
+ - **Gas giants tear at their band edges.** Turbulence is eddies where the wind reverses, in patches along the edges, instead of a warp that made every band wavy; inside a band the texture is billow filaments along the wind. A storm brighter than the zones (Neptune's) is dark with bright cloud at its rim.
27
+ - **A planet's ring lies in its equator.** It was tipped off it, and as the planet turned the ring precessed.
28
+
29
+ ### Fixed
30
+
31
+ - **A gas giant's storm had a seam** where its swirl read noise at an angle that jumps a full turn.
32
+ - **Gas giant poles had a dark blotch**, a cap of a different colour; the bands now close in on the pole, a little darker.
33
+ - **Rings are sharp, and no longer flicker.** The density along the radius is 1D noise at several scales, terraced into plateaus of different widths with edges about a pixel wide, under a broad profile (faint inside, brightest a little out), with a wide gap and a narrow one cut clean. A shepherd moon's wake ripples the edges either side of the narrow gap. Only detail finer than a pixel fades to its average, which is what stopped the flicker; the band frequency no longer grows with the seed.
34
+
35
+ Size: barrel (min, packages external) 1042.5 KB raw / 353.5 KB gz, +3.67% on 0.10.4.
36
+
9
37
  ## 0.10.4
10
38
 
11
39
  ### Added
@@ -63,6 +91,13 @@ versions may carry breaking peer-dependency changes — each is called out in a
63
91
 
64
92
  ### Fixed
65
93
 
94
+ - **A dry world's crater floors were drawn as sea bed**, a flat dark patch: the classifier took the zero height for a sea. A world with no sea now has none under its ground, and its classifier works at the planet's own scale (a datum at 0.001 had put its noise past float precision).
95
+ - **Small bodies in a star system were coarse** (a belt body's mesh was 16 divisions a face, so crater rims drew straight lines across Ceres); moons and named asteroids are 40 now.
96
+ - **A large planet was frozen and speckled.** The biome's lengths (height cooling, climate noise, dither, strata, the latitude wobble, surf) were tuned on radius 50; they scale with the planet's radius now, so a radius-3000 world reads as one at 50 does (board #3280, from Manta).
97
+ - **A world's volcanism outlived it**: Io's glowing plates stayed on the next world chosen.
98
+ - **A planet's cooling with height stuck from its first build**, so a dry world chosen after one with a sea was frozen pale.
99
+ - **Planet clouds can close**: `clouds` runs past 1, to 3 for a solid deck (Venus); at 1 it still left holes.
100
+ - **Rock on a planet was blocky.** The cliff test read a slope that was constant across each triangle (from screen derivatives), so bare rock stepped in squares. On land, and anywhere on a world with no sea, it reads the mesh's own smooth normal now; only a sea bed, held flat in the mesh, still needs the derivative one.
66
101
  - **A sphere world was drier than a flat one.** The rain shadow's wind was fixed in the planet's frame, so level ground on one side of the planet read as a leeward slope everywhere, about 0.12 off the moisture. The wind now blows along the ground: slopes still get wet and dry sides, level ground gets neither. The decorator's mirror of it had the same bias and now has none.
67
102
  - **Changing a terrain's `surfaceType` or radius rebuilds its surface.** The sampler was built once at scene-ready, so the tiles kept the old shape while everything that reads the radius live moved on.
68
103
  - **Land and Sky: the eye height slider works in a headset.** It moved the flat camera only; the headset's rig took its height once, on entry.
@@ -2,6 +2,7 @@ import { B3dChild } from './b3d-utils.js';
2
2
  import type { BiomePlugin } from './biome-plugin.js';
3
3
  import { type PlanetSurface } from './sphere-map.js';
4
4
  import { type PlanetStorm } from './planet-clouds.js';
5
+ import { type RockyWorldLook } from './rocky-world.js';
5
6
  import * as BABYLON from '@babylonjs/core';
6
7
  import type { B3d } from './tosi-b3d.js';
7
8
  import type { GradientFilter } from './gradient-filter.js';
@@ -31,6 +32,13 @@ export declare class B3dPlanet extends B3dChild {
31
32
  ringOuter: number;
32
33
  ringOpacity: number;
33
34
  ringColor: string;
35
+ world: string;
36
+ craters: number;
37
+ seaShallow: string;
38
+ seaDeep: string;
39
+ craterSize: number;
40
+ craterWear: number;
41
+ craterAsymmetry: number;
34
42
  seed: number;
35
43
  radius: number;
36
44
  subdivisions: number;
@@ -59,6 +67,12 @@ export declare class B3dPlanet extends B3dChild {
59
67
  * settings are unused and the sea sits at the surface's sea level.
60
68
  */
61
69
  surface: PlanetSurface | null;
70
+ /**
71
+ * Changes to the `world`'s look for THIS planet (`{ ocean: 0.3 }`), read
72
+ * at the next build. The star system uses it to give each Earth-like
73
+ * world its own share of sea.
74
+ */
75
+ worldOverrides: Partial<RockyWorldLook> | null;
62
76
  /**
63
77
  * STORMS placed on the weather (needs `clouds` above 0): up to four, each
64
78
  * `{ lat, lon, size, intensity, lightning }`. A storm is a cyclone that
@@ -125,6 +139,20 @@ export declare class B3dPlanet extends B3dChild {
125
139
  */
126
140
  private buildOcean;
127
141
  private buildRings;
142
+ /** The rocky world's look, when `world` names one (and it is not a gas giant). */
143
+ private _look;
144
+ /** A look setting: the attribute (a `world` writes its own in once). */
145
+ private _val;
146
+ /** Which world's look was last written into the attributes. */
147
+ private _worldOf;
148
+ private _applyWorld;
149
+ /** The craters' height function for this build, or null for none. */
150
+ private _craters;
151
+ /** The radius the biome params' lengths were last scaled for. */
152
+ private _paramsRadius;
153
+ /** Which world's climate was last written into the params. */
154
+ private _climateOf;
155
+ private _makeCraters;
128
156
  private heightAt;
129
157
  /** Rebuild planet mesh with current noise settings */
130
158
  regenerate(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"b3d-planet.d.ts","sourceRoot":"","sources":["../src/b3d-planet.ts"],"names":[],"mappings":"AAuLA,OAAO,EAAS,QAAQ,EAA4B,MAAM,gBAAgB,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAErE,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAQzE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAoB1D,qBAAa,SAAU,SAAQ,QAAQ;IACrC,MAAM,CAAC,gBAAgB,SAAoB;IAE3C,MAAM,CAAC,eAAe;;;;MAIrB;IAED,MAAM,CAAC,cAAc;eAIH,IAAI,GAAG,KAAK;;;;;iBAaV,IAAI,GAAG,KAAK;;;qBAKR,IAA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