Spaces:
Running
Running
Update deplacement_dans_env/viewer_pr_env.js
Browse files
deplacement_dans_env/viewer_pr_env.js
CHANGED
|
@@ -121,16 +121,6 @@ export async function initializeViewer(config, instanceId) {
|
|
| 121 |
// --- Configuration ---
|
| 122 |
sogsUrl = config.sogs_json_url;
|
| 123 |
|
| 124 |
-
glbUrl =
|
| 125 |
-
config.glb_url !== undefined
|
| 126 |
-
? config.glb_url
|
| 127 |
-
: "https://huggingface.co/datasets/MikaFil/viewer_gs/resolve/main/ressources/espace_expo/sol_blanc_2.glb";
|
| 128 |
-
|
| 129 |
-
presentoirUrl =
|
| 130 |
-
config.presentoir_url !== undefined
|
| 131 |
-
? config.presentoir_url
|
| 132 |
-
: "https://huggingface.co/datasets/MikaFil/viewer_gs/resolve/main/ressources/espace_expo/sol_blanc_2.glb";
|
| 133 |
-
|
| 134 |
minZoom = parseFloat(config.minZoom || "1");
|
| 135 |
maxZoom = parseFloat(config.maxZoom || "20");
|
| 136 |
minAngle = parseFloat(config.minAngle || "-45");
|
|
@@ -325,8 +315,6 @@ export async function initializeViewer(config, instanceId) {
|
|
| 325 |
// --- Enregistre les assets (SAUF orbit script : chargé globalement) ---
|
| 326 |
const assets = {
|
| 327 |
sogs: new pc.Asset("gsplat", "gsplat", { url: sogsUrl }),
|
| 328 |
-
glb: new pc.Asset("glb", "container", { url: glbUrl }),
|
| 329 |
-
presentoir: new pc.Asset("presentoir", "container", { url: presentoirUrl })
|
| 330 |
};
|
| 331 |
for (const k in assets) app.assets.add(assets[k]);
|
| 332 |
|
|
@@ -347,33 +335,6 @@ export async function initializeViewer(config, instanceId) {
|
|
| 347 |
modelEntity.setLocalScale(modelScale, modelScale, modelScale);
|
| 348 |
app.root.addChild(modelEntity);
|
| 349 |
|
| 350 |
-
// --- Sol / environnement ---
|
| 351 |
-
const glbEntity = assets.glb.resource.instantiateRenderEntity();
|
| 352 |
-
app.root.addChild(glbEntity);
|
| 353 |
-
|
| 354 |
-
const presentoirEntity = assets.presentoir.resource.instantiateRenderEntity();
|
| 355 |
-
presentoirEntity.setLocalScale(presentoirScaleX, presentoirScaleY, presentoirScaleZ);
|
| 356 |
-
app.root.addChild(presentoirEntity);
|
| 357 |
-
|
| 358 |
-
if (!espace_expo_bool) {
|
| 359 |
-
const matSol = new pc.StandardMaterial();
|
| 360 |
-
matSol.blendType = pc.BLEND_NONE;
|
| 361 |
-
matSol.emissive = new pc.Color(color_bg);
|
| 362 |
-
matSol.emissiveIntensity = 1;
|
| 363 |
-
matSol.useLighting = false;
|
| 364 |
-
matSol.update();
|
| 365 |
-
|
| 366 |
-
traverse(presentoirEntity, (node) => {
|
| 367 |
-
if (node.render && node.render.meshInstances) {
|
| 368 |
-
for (const mi of node.render.meshInstances) mi.material = matSol;
|
| 369 |
-
}
|
| 370 |
-
});
|
| 371 |
-
|
| 372 |
-
traverse(glbEntity, (node) => {
|
| 373 |
-
if (node.render && node.render.meshInstances) {
|
| 374 |
-
for (const mi of node.render.meshInstances) mi.material = matSol;
|
| 375 |
-
}
|
| 376 |
-
});
|
| 377 |
}
|
| 378 |
|
| 379 |
// --- Caméra + scripts d’input (disponibles car orbit chargé globalement) ---
|
|
|
|
| 121 |
// --- Configuration ---
|
| 122 |
sogsUrl = config.sogs_json_url;
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
minZoom = parseFloat(config.minZoom || "1");
|
| 125 |
maxZoom = parseFloat(config.maxZoom || "20");
|
| 126 |
minAngle = parseFloat(config.minAngle || "-45");
|
|
|
|
| 315 |
// --- Enregistre les assets (SAUF orbit script : chargé globalement) ---
|
| 316 |
const assets = {
|
| 317 |
sogs: new pc.Asset("gsplat", "gsplat", { url: sogsUrl }),
|
|
|
|
|
|
|
| 318 |
};
|
| 319 |
for (const k in assets) app.assets.add(assets[k]);
|
| 320 |
|
|
|
|
| 335 |
modelEntity.setLocalScale(modelScale, modelScale, modelScale);
|
| 336 |
app.root.addChild(modelEntity);
|
| 337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
}
|
| 339 |
|
| 340 |
// --- Caméra + scripts d’input (disponibles car orbit chargé globalement) ---
|