MikaFil commited on
Commit
27657e0
·
verified ·
1 Parent(s): de32495

Update viewer.js

Browse files
Files changed (1) hide show
  1. viewer.js +6 -12
viewer.js CHANGED
@@ -62,10 +62,6 @@ let sogsUrl, glbUrl, presentoirUrl;
62
 
63
  let color_bg_hex, color_bg;
64
 
65
- // --- Log user agent and page location ---
66
- console.log("%c[VIEWER DEBUG] User Agent:", "color: #0074D9;", navigator.userAgent);
67
- console.log("%c[VIEWER DEBUG] Page:", "color: #0074D9;", location.href);
68
-
69
  export async function initializeViewer(config, instanceId) {
70
  if (viewerInitialized) return;
71
 
@@ -199,19 +195,19 @@ export async function initializeViewer(config, instanceId) {
199
  };
200
 
201
  // --- LOG: asset list and all URLs
202
- console.log("%c[VIEWER DEBUG] About to load assets:", "color: #39CCCC;", JSON.stringify(
203
  Object.fromEntries(Object.entries(assets).map(([k, v]) => [k, v && v.url]))
204
  , null, 2));
205
  Object.entries(assets).forEach(([name, asset]) => {
206
  if (asset && asset.url) {
207
  console.log(`[VIEWER DEBUG] Asset "${name}" loading from: ${asset.url}`);
208
  }
209
- });
210
 
211
  for (const key in assets) app.assets.add(assets[key]);
212
 
213
  // --- LOG: asset load or error events
214
- Object.entries(assets).forEach(([name, asset]) => {
215
  if (!asset) return;
216
  asset.once('load', function(resource) {
217
  console.log(`%c[VIEWER DEBUG] Asset loaded: "${name}"`, "color: #2ECC40;", asset.url, resource);
@@ -219,7 +215,7 @@ export async function initializeViewer(config, instanceId) {
219
  asset.once('error', function(err) {
220
  console.error(`%c[VIEWER DEBUG] Asset failed to load: "${name}"`, "color: #FF4136;", asset.url, err);
221
  });
222
- });
223
 
224
  const loader = new pc.AssetListLoader(Object.values(assets), app.assets);
225
  loader.load(() => {
@@ -250,15 +246,13 @@ export async function initializeViewer(config, instanceId) {
250
  matSol.emissiveIntensity = 1;
251
  matSol.update();
252
 
253
- presentoirEntity.material = matSol;
254
-
255
- /*traverse(glbEntity, node => {
256
  if (node.render && node.render.meshInstances) {
257
  for (let mi of node.render.meshInstances) {
258
  mi.material = matSol;
259
  }
260
  }
261
- });*/
262
  }
263
 
264
  cameraEntity = new pc.Entity('camera');
 
62
 
63
  let color_bg_hex, color_bg;
64
 
 
 
 
 
65
  export async function initializeViewer(config, instanceId) {
66
  if (viewerInitialized) return;
67
 
 
195
  };
196
 
197
  // --- LOG: asset list and all URLs
198
+ /*console.log("%c[VIEWER DEBUG] About to load assets:", "color: #39CCCC;", JSON.stringify(
199
  Object.fromEntries(Object.entries(assets).map(([k, v]) => [k, v && v.url]))
200
  , null, 2));
201
  Object.entries(assets).forEach(([name, asset]) => {
202
  if (asset && asset.url) {
203
  console.log(`[VIEWER DEBUG] Asset "${name}" loading from: ${asset.url}`);
204
  }
205
+ });*/
206
 
207
  for (const key in assets) app.assets.add(assets[key]);
208
 
209
  // --- LOG: asset load or error events
210
+ /*Object.entries(assets).forEach(([name, asset]) => {
211
  if (!asset) return;
212
  asset.once('load', function(resource) {
213
  console.log(`%c[VIEWER DEBUG] Asset loaded: "${name}"`, "color: #2ECC40;", asset.url, resource);
 
215
  asset.once('error', function(err) {
216
  console.error(`%c[VIEWER DEBUG] Asset failed to load: "${name}"`, "color: #FF4136;", asset.url, err);
217
  });
218
+ });*/
219
 
220
  const loader = new pc.AssetListLoader(Object.values(assets), app.assets);
221
  loader.load(() => {
 
246
  matSol.emissiveIntensity = 1;
247
  matSol.update();
248
 
249
+ traverse(glbEntity, node => {
 
 
250
  if (node.render && node.render.meshInstances) {
251
  for (let mi of node.render.meshInstances) {
252
  mi.material = matSol;
253
  }
254
  }
255
+ });
256
  }
257
 
258
  cameraEntity = new pc.Entity('camera');