Spaces:
Running
Running
Update viewer.js
Browse files
viewer.js
CHANGED
|
@@ -207,16 +207,18 @@ export async function initializeViewer(config, instanceId) {
|
|
| 207 |
modelEntity.setLocalScale(modelScale, modelScale, modelScale);
|
| 208 |
app.root.addChild(modelEntity);
|
| 209 |
|
| 210 |
-
if (assets.glb && assets.glb.resource && assets.glb.resource.instantiateRenderEntity) {
|
| 211 |
const glbEntity = assets.glb.resource.instantiateRenderEntity();
|
| 212 |
app.root.addChild(glbEntity);
|
| 213 |
-
}
|
|
|
|
|
|
|
| 214 |
|
| 215 |
const presentoirEntity =assets.presentoir.resource.instantiateRenderEntity();
|
| 216 |
presentoirEntity.setLocalScale(presentoirScaleX, presentoirScaleY, presentoirScaleZ);
|
| 217 |
app.root.addChild(presentoirEntity);
|
| 218 |
|
| 219 |
-
if(config.
|
| 220 |
let matSol = new pc.StandardMaterial();
|
| 221 |
matSol.blendType = pc.BLEND_NORMAL;
|
| 222 |
matSol.emissivve = new pc.Color(color_bg);
|
|
@@ -224,12 +226,20 @@ export async function initializeViewer(config, instanceId) {
|
|
| 224 |
matSol.update();
|
| 225 |
|
| 226 |
traverse(presentoirEntity, node => {
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
console.log("matSol : ok");
|
| 235 |
}
|
|
|
|
| 207 |
modelEntity.setLocalScale(modelScale, modelScale, modelScale);
|
| 208 |
app.root.addChild(modelEntity);
|
| 209 |
|
| 210 |
+
/*if (assets.glb && assets.glb.resource && assets.glb.resource.instantiateRenderEntity) {
|
| 211 |
const glbEntity = assets.glb.resource.instantiateRenderEntity();
|
| 212 |
app.root.addChild(glbEntity);
|
| 213 |
+
}*/
|
| 214 |
+
const glbEntity = assets.glb.resource.instantiateRenderEntity();
|
| 215 |
+
app.root.addChild(glbEntity);
|
| 216 |
|
| 217 |
const presentoirEntity =assets.presentoir.resource.instantiateRenderEntity();
|
| 218 |
presentoirEntity.setLocalScale(presentoirScaleX, presentoirScaleY, presentoirScaleZ);
|
| 219 |
app.root.addChild(presentoirEntity);
|
| 220 |
|
| 221 |
+
if(config.glbUrl == undefined){
|
| 222 |
let matSol = new pc.StandardMaterial();
|
| 223 |
matSol.blendType = pc.BLEND_NORMAL;
|
| 224 |
matSol.emissivve = new pc.Color(color_bg);
|
|
|
|
| 226 |
matSol.update();
|
| 227 |
|
| 228 |
traverse(presentoirEntity, node => {
|
| 229 |
+
if (node.render && node.render.meshInstances) {
|
| 230 |
+
for (let mi of node.render.meshInstances) {
|
| 231 |
+
mi.material = matSol;
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
});
|
| 235 |
+
|
| 236 |
+
traverse(glbEntity, node => {
|
| 237 |
+
if (node.render && node.render.meshInstances) {
|
| 238 |
+
for (let mi of node.render.meshInstances) {
|
| 239 |
+
mi.material = matSol;
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
});
|
| 243 |
|
| 244 |
console.log("matSol : ok");
|
| 245 |
}
|