@playcanvas/supersplat-viewer 1.17.3 → 1.17.4
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 +1 -1
- package/package.json +1 -1
- package/public/index.js +29 -19
- package/public/index.js.map +1 -1
package/package.json
CHANGED
package/public/index.js
CHANGED
|
@@ -72033,16 +72033,15 @@ const migrateV2 = (v1) => {
|
|
|
72033
72033
|
animTracks: v1.animTracks.map((animTrackV1) => {
|
|
72034
72034
|
return migrateAnimTrackV2(animTrackV1, v1.camera.fov || 60);
|
|
72035
72035
|
}),
|
|
72036
|
-
cameras: [{
|
|
72036
|
+
cameras: (v1.camera.position && v1.camera.target) ? [{
|
|
72037
72037
|
initial: {
|
|
72038
|
-
position:
|
|
72039
|
-
target:
|
|
72038
|
+
position: v1.camera.position,
|
|
72039
|
+
target: v1.camera.target,
|
|
72040
72040
|
fov: v1.camera.fov || 75
|
|
72041
72041
|
}
|
|
72042
|
-
}],
|
|
72042
|
+
}] : [],
|
|
72043
72043
|
annotations: [],
|
|
72044
|
-
startMode: v1.camera.startAnim === 'animTrack' ? 'animTrack' : 'default'
|
|
72045
|
-
hasStartPose: !!(v1.camera.position && v1.camera.target)
|
|
72044
|
+
startMode: v1.camera.startAnim === 'animTrack' ? 'animTrack' : 'default'
|
|
72046
72045
|
};
|
|
72047
72046
|
};
|
|
72048
72047
|
// import a json object to conform to the latest settings schema. settings is assumed to be one of the well-formed schemas
|
|
@@ -74178,9 +74177,12 @@ class CameraManager {
|
|
|
74178
74177
|
camera = new Camera();
|
|
74179
74178
|
constructor(global, bbox, collider = null) {
|
|
74180
74179
|
const { config, events, settings, state } = global;
|
|
74181
|
-
const camera0 = settings.cameras[0]
|
|
74182
|
-
const
|
|
74183
|
-
const
|
|
74180
|
+
const camera0 = settings.cameras[0]?.initial;
|
|
74181
|
+
const defaultFov = camera0?.fov ?? 75;
|
|
74182
|
+
const frameCamera = createFrameCamera(bbox, defaultFov);
|
|
74183
|
+
const resetCamera = camera0 ?
|
|
74184
|
+
createCamera(new Vec3(camera0.position), new Vec3(camera0.target), camera0.fov) :
|
|
74185
|
+
frameCamera;
|
|
74184
74186
|
const getAnimTrack = (initial, isObjectExperience) => {
|
|
74185
74187
|
const { animTracks } = settings;
|
|
74186
74188
|
// extract the camera animation track from settings
|
|
@@ -74197,7 +74199,7 @@ class CameraManager {
|
|
|
74197
74199
|
};
|
|
74198
74200
|
// object experience starts outside the bounding box
|
|
74199
74201
|
const isObjectExperience = !bbox.containsPoint(resetCamera.position);
|
|
74200
|
-
const animTrack = getAnimTrack(
|
|
74202
|
+
const animTrack = getAnimTrack(resetCamera, isObjectExperience);
|
|
74201
74203
|
const controllers = {
|
|
74202
74204
|
orbit: new OrbitController(),
|
|
74203
74205
|
fly: new FlyController(),
|
|
@@ -75985,19 +75987,21 @@ class Viewer {
|
|
|
75985
75987
|
const { graphicsDevice } = app;
|
|
75986
75988
|
// enable anonymous CORS for image loading in safari
|
|
75987
75989
|
app.loader.getHandler('texture').imgParser.crossOrigin = 'anonymous';
|
|
75990
|
+
// render skybox as plain equirect
|
|
75991
|
+
const glsl = ShaderChunks.get(graphicsDevice, 'glsl');
|
|
75992
|
+
glsl.set('skyboxPS', glsl.get('skyboxPS').replace('mapRoughnessUv(uv, mipLevel)', 'uv'));
|
|
75993
|
+
const wgsl = ShaderChunks.get(graphicsDevice, 'wgsl');
|
|
75994
|
+
wgsl.set('skyboxPS', wgsl.get('skyboxPS').replace('mapRoughnessUv(uv, uniform.mipLevel)', 'uv'));
|
|
75988
75995
|
this.origChunks = {
|
|
75989
75996
|
glsl: {
|
|
75990
|
-
gsplatOutputVS:
|
|
75997
|
+
gsplatOutputVS: glsl.get('gsplatOutputVS'),
|
|
75998
|
+
skyboxPS: glsl.get('skyboxPS')
|
|
75991
75999
|
},
|
|
75992
76000
|
wgsl: {
|
|
75993
|
-
gsplatOutputVS:
|
|
76001
|
+
gsplatOutputVS: wgsl.get('gsplatOutputVS'),
|
|
76002
|
+
skyboxPS: wgsl.get('skyboxPS')
|
|
75994
76003
|
}
|
|
75995
76004
|
};
|
|
75996
|
-
// render skybox as plain equirect
|
|
75997
|
-
const glsl = ShaderChunks.get(graphicsDevice, 'glsl');
|
|
75998
|
-
glsl.set('skyboxPS', glsl.get('skyboxPS').replace('mapRoughnessUv(uv, mipLevel)', 'uv'));
|
|
75999
|
-
const wgsl = ShaderChunks.get(graphicsDevice, 'wgsl');
|
|
76000
|
-
wgsl.set('skyboxPS', wgsl.get('skyboxPS').replace('mapRoughnessUv(uv, uniform.mipLevel)', 'uv'));
|
|
76001
76005
|
// disable auto render, we'll render only when camera changes
|
|
76002
76006
|
app.autoRender = false;
|
|
76003
76007
|
// configure the camera
|
|
@@ -76246,6 +76250,10 @@ class Viewer {
|
|
|
76246
76250
|
// force gsplat shader to write gamma-space colors
|
|
76247
76251
|
ShaderChunks.get(app.graphicsDevice, 'glsl').set('gsplatOutputVS', gammaChunkGlsl);
|
|
76248
76252
|
ShaderChunks.get(app.graphicsDevice, 'wgsl').set('gsplatOutputVS', gammaChunkWgsl);
|
|
76253
|
+
// force skybox shader to write gamma-space colors (inline pow replaces the
|
|
76254
|
+
// gammaCorrectOutput call which is a no-op under CameraFrame's GAMMA_NONE)
|
|
76255
|
+
ShaderChunks.get(app.graphicsDevice, 'glsl').set('skyboxPS', this.origChunks.glsl.skyboxPS.replace('gammaCorrectOutput(toneMap(processEnvironment(linear)))', 'pow(toneMap(processEnvironment(linear)) + 0.0000001, vec3(1.0 / 2.2))'));
|
|
76256
|
+
ShaderChunks.get(app.graphicsDevice, 'wgsl').set('skyboxPS', this.origChunks.wgsl.skyboxPS.replace('gammaCorrectOutput(toneMap(processEnvironment(linear)))', 'pow(toneMap(processEnvironment(linear)) + 0.0000001, vec3f(1.0 / 2.2))'));
|
|
76249
76257
|
// ensure the final compose blit doesn't perform linear->gamma conversion.
|
|
76250
76258
|
RenderTarget.prototype.isColorBufferSrgb = function (index) {
|
|
76251
76259
|
return this === app.graphicsDevice.backBuffer ? true : origIsColorBufferSrgb.call(this, index);
|
|
@@ -76258,9 +76266,11 @@ class Viewer {
|
|
|
76258
76266
|
this.cameraFrame.destroy();
|
|
76259
76267
|
this.cameraFrame = null;
|
|
76260
76268
|
}
|
|
76261
|
-
// restore
|
|
76269
|
+
// restore shader chunks to engine defaults
|
|
76262
76270
|
ShaderChunks.get(app.graphicsDevice, 'glsl').set('gsplatOutputVS', this.origChunks.glsl.gsplatOutputVS);
|
|
76263
76271
|
ShaderChunks.get(app.graphicsDevice, 'wgsl').set('gsplatOutputVS', this.origChunks.wgsl.gsplatOutputVS);
|
|
76272
|
+
ShaderChunks.get(app.graphicsDevice, 'glsl').set('skyboxPS', this.origChunks.glsl.skyboxPS);
|
|
76273
|
+
ShaderChunks.get(app.graphicsDevice, 'wgsl').set('skyboxPS', this.origChunks.wgsl.skyboxPS);
|
|
76264
76274
|
// restore original isColorBufferSrgb behavior
|
|
76265
76275
|
RenderTarget.prototype.isColorBufferSrgb = origIsColorBufferSrgb;
|
|
76266
76276
|
if (!app.xr.active) {
|
|
@@ -78134,7 +78144,7 @@ const initXr = (global) => {
|
|
|
78134
78144
|
});
|
|
78135
78145
|
};
|
|
78136
78146
|
|
|
78137
|
-
var version = "1.17.
|
|
78147
|
+
var version = "1.17.4";
|
|
78138
78148
|
|
|
78139
78149
|
const loadGsplat = async (app, config, progressCallback) => {
|
|
78140
78150
|
const { contents, contentUrl, unified, aa } = config;
|