Skip to content

Commit

Permalink
Viewer html fix (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck authored Jan 10, 2025
1 parent ca36c71 commit f6cf99b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/splat-serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ const serializeViewer = async (splats: Splat[], options: ViewerExportSettings, w
const { viewerSettings } = options;

const html = ViewerHtmlTemplate
.replace('{{viewerSettingsURL}}', options.type === 'html' ? `data:application/json;base64,${encodeBase64(new TextEncoder().encode(JSON.stringify(viewerSettings)))}` : `./${settingsFilename}`)
.replace('{{settingsURL}}', options.type === 'html' ? `data:application/json;base64,${encodeBase64(new TextEncoder().encode(JSON.stringify(viewerSettings)))}` : `./${settingsFilename}`)
.replace('{{contentURL}}', options.type === 'html' ? `data:application/ply;base64,${encodeBase64(compressedData)}` : `./${sceneFilename}`);

if (options.type === 'html') {
Expand Down
14 changes: 3 additions & 11 deletions src/templates/viewer-html-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ const template = /* html */ `
{
"imports": {
"playcanvas": "https://cdn.jsdelivr.net/npm/[email protected]/build/playcanvas.mjs",
"viewerSettings": "{{viewerSettingsURL}}"
"viewerSettings": "{{settingsURL}}"
}
}
</script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@playcanvas/[email protected].10/dist/pwc.mjs"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@playcanvas/[email protected].11/dist/pwc.mjs"></script>
</head>
<body>
<pc-app antialias="false" depth="false" high-resolution="true" stencil="false">
Expand All @@ -94,7 +94,7 @@ const template = /* html */ `
<!-- Camera (with XR support) -->
<pc-entity name="camera root">
<pc-entity name="camera">
<pc-camera>
<pc-camera nearClip="0.01" farClip="1000" horizontalFov="true" tonemap="none"></pc-camera>
<pc-scripts>
<pc-script name="cameraControls"></pc-script>
</pc-scripts>
Expand Down Expand Up @@ -193,14 +193,6 @@ const template = /* html */ `
document.getElementById('loadingIndicator').classList.add('hidden');
const bbox = this.calcBound();
// configure camera
this.entity.camera.horizontalFov = true;
this.entity.camera.farClip = bbox.halfExtents.length() * 20;
this.entity.camera.nearClip = this.entity.camera.farClip * 0.001;
// set NONE tonemapping until https://github.com/playcanvas/engine/pull/7179 is deployed
this.entity.camera.toneMapping = 6;
if (bbox.halfExtents.length() > 100 || position || target) {
this.resetCamera(bbox);
} else {
Expand Down

0 comments on commit f6cf99b

Please sign in to comment.