@splnlss/3d-story-viewer 0.8.3 → 0.8.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.
package/README.md CHANGED
@@ -82,7 +82,7 @@ ellipsoidal height in meters. Caller-supplied positions are accepted from
82
82
  -12,000 through 100,000 meters. Internal conversions do not clamp or range-limit
83
83
  derived heights, so orbiting above 100 km and changing view mode remain valid.
84
84
  ECEF positions and local east-north-up (ENU) translations are meters;
85
- camera pitch, yaw, and roll and Gaussian XYZ rotations are degrees. Gaussian
85
+ camera pitch, yaw, and roll and local-model XYZ rotations are degrees. Local
86
86
  scale is positive and dimensionless. 3D Tiles and mesh longitude/latitude
87
87
  offsets are degrees, and their altitude offsets are ellipsoidal meters. Missing
88
88
  offset members default independently to zero, while an explicit zero is
@@ -95,6 +95,15 @@ the existing geometry; it does not georeference a local model. A missing or
95
95
  invalid origin emits `CONTENT_LAYER_ERROR` and leaves the loaded mesh attached
96
96
  without the offset.
97
97
 
98
+ Ungeoreferenced GLB models can instead use `options.transform`. Its `anchor`
99
+ is WGS84 longitude/latitude in decimal degrees and ellipsoidal altitude in
100
+ meters. `translationENU` is east/north/up in meters, `rotationDegrees` is a
101
+ model-local XYZ Euler rotation in degrees, and `scale` is positive and
102
+ dimensionless. The default `[90, 0, 0]` rotation maps glTF +Y Up to ENU +Up;
103
+ set an explicit rotation when the model's authored axes differ. A local
104
+ transform cannot be combined with legacy `offset` or `offsetOrigin`. Existing
105
+ ECEF GLBs without a transform keep their coordinates.
106
+
98
107
  All accepted geospatial and camera values must be finite. Labels require
99
108
  longitude, latitude, and altitude on every update. At an exact pole, ECEF to
100
109
  geodetic conversion returns longitude 0 degrees because longitude is
@@ -150,6 +159,41 @@ RAD hosts must support HTTP byte ranges and cross-origin `GET`/`HEAD` requests.
150
159
  Expose `Content-Length`, `Content-Range`, and `Accept-Ranges`; relative RAD
151
160
  sidecar files must use the same policy.
152
161
 
162
+ ## Local GLB Placement and Targeted Updates
163
+
164
+ ```js
165
+ const localBarn = {
166
+ id: 'barn', name: 'Barn', type: 'mesh', labels: ['barn'],
167
+ data: { url: 'https://assets.example.com/barn.glb' },
168
+ options: {
169
+ transform: {
170
+ anchor: { longitude: -105.2, latitude: 39.96, altitude: 1700 },
171
+ translationENU: [0, 0, 0], rotationDegrees: [90, 0, 0], scale: 1,
172
+ },
173
+ },
174
+ };
175
+ viewer.replaceContentLayer(localBarn.id, localBarn); // add or replace one layer
176
+ viewer.replaceContentLayer(localBarn.id, null); // remove one layer
177
+ ```
178
+
179
+ `replaceContentLayer` preserves unrelated layer objects and resources. It
180
+ reports an invalid layer definition through `CONTENT_LAYER_ERROR`; an invalid
181
+ ID or a mismatched replacement ID throws synchronously. A failed replacement
182
+ leaves the previous layer in place. Existing `defineContentLayers` calls still
183
+ replace the full set while retaining the current enabled-label selection.
184
+
185
+ ### Migrating From 0.8.4
186
+
187
+ Version 0.8.5 adds optional local GLB placement and targeted content
188
+ replacement. Existing mesh and 3D Tiles definitions keep their 0.8.4
189
+ coordinates and offsets. Callers adding local GLBs should supply a WGS84
190
+ anchor and review the glTF Y-up default in the scene.
191
+ Transformed local GLBs render in the terrain depth pass with their authored
192
+ glTF materials and the viewer's shared Draco/KTX2 decoders. Their render order
193
+ is fixed to 0 so a catalog overlay order cannot make them show through terrain.
194
+ GLBs without a transform retain the legacy layer-6 patch rendering and
195
+ coordinate behavior.
196
+
153
197
  ## Environment Variables
154
198
 
155
199
  Viewer tokens can be passed directly in the constructor or provided through Vite environment variables: