Spaces:
Running
Running
Update viewer.js
Browse files
viewer.js
CHANGED
|
@@ -157,6 +157,19 @@ export async function initializeViewer(config, instanceId) {
|
|
| 157 |
resizeObserver = null;
|
| 158 |
});
|
| 159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
// 7. Asset loading (progress bar)
|
| 161 |
const assets = {
|
| 162 |
model: new pc.Asset('gsplat', 'gsplat', { url: plyUrl }),
|
|
|
|
| 157 |
resizeObserver = null;
|
| 158 |
});
|
| 159 |
|
| 160 |
+
// --- iOS-specific fix: robust binary loader for PLY ---
|
| 161 |
+
// If window.PLY_FORCE_ARRAYBUFFER is set, override asset loader for PLY
|
| 162 |
+
if (window.PLY_FORCE_ARRAYBUFFER) {
|
| 163 |
+
const origRequest = pc.Http.request;
|
| 164 |
+
pc.Http.request = function(options) {
|
| 165 |
+
// Only affect .ply or 'gsplat' asset
|
| 166 |
+
if (options && options.url && (options.url.endsWith('.ply') || options.responseType === 'gsplat')) {
|
| 167 |
+
options.responseType = 'arraybuffer';
|
| 168 |
+
}
|
| 169 |
+
return origRequest.call(this, options);
|
| 170 |
+
};
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
// 7. Asset loading (progress bar)
|
| 174 |
const assets = {
|
| 175 |
model: new pc.Asset('gsplat', 'gsplat', { url: plyUrl }),
|