From 1ddfe51bc7083fc1b229d7336ead7902ac53c9f3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 21 Feb 2024 21:44:44 -0300 Subject: [PATCH] new baseline --- DCL_PiXYZ/PXZEntryPoint.cs | 2 +- .../SceneBuilder/Entities/DCLGLTFMesh.cs | 26 +++---------------- .../SceneRepositioner/SceneRepositioner.cs | 2 +- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 390ebae1..d64246e3 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -22,7 +22,7 @@ static async Task Main(string[] args) private static async Task RunLODBuilder(string[] args) { - string defaultScene = "5,19"; + string defaultScene = "0,0;5,19"; string defaultOutputPath = Path.Combine(Directory.GetCurrentDirectory(), "built-lods") ; string defaultSceneLodManifestDirectory = Path.Combine(Directory.GetCurrentDirectory(), "scene-lod-entities-manifest-builder/"); diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs index c23e739f..f17054b7 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; @@ -39,7 +40,7 @@ public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint par bool isModelProcessingSuccessful = TryProcessModel(modelPath); try { - if (lodLevel != 0) + if (lodLevel == 0) { uint importedFileOccurrence = pxz.IO.ImportScene(modelPath); pxz.Scene.SetParent(importedFileOccurrence, parent); @@ -54,7 +55,7 @@ public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint par } catch (Exception e) { - Console.WriteLine($"ERROR: Importing GLTF {src} failed with error {e}"); + LogError($"ERROR: Importing GLTF {src} failed with error {e}"); return PXYZConstants.EMPTY_MODEL; } @@ -91,25 +92,6 @@ private void ModifyModelMaterials(string modelPath) model.SaveGLTF(modelPath); } - private bool TryImportGLTF(PiXYZAPI pxz, uint parent, string modelPath, bool isModelProcessed, out PXZModel pxzModel) - { - try - { - string finalModelPath = isModelProcessed ? $"{modelPath}_EDITED.glb" : modelPath; - - uint importedFileOccurrence = pxz.IO.ImportScene(finalModelPath); - pxz.Scene.SetParent(importedFileOccurrence, parent); - pxzModel = new PXZModel(true, importedFileOccurrence); - return true; - } - catch (Exception e) - { - LogError($"ERROR importing GLTF: {e}"); - pxzModel = PXYZConstants.EMPTY_MODEL; - return false; - } - } - private void ExportModifiedModel(string modelPath) { // Determine the output file path based on the original model path @@ -118,7 +100,7 @@ private void ExportModifiedModel(string modelPath) // Check if the file already exists if (File.Exists(outputFile)) { - Console.WriteLine($"The file {outputFile} already exists. Skipping export."); + Console.WriteLine($"The file {outputFile} already exists."); return; } diff --git a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs index 63b7e2b2..8daec373 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs @@ -23,7 +23,7 @@ public SceneRepositioner(string sceneManifestJSONPath, this.sceneContent = sceneContent; this.pxz = pxz; _pathHandler = pathHandler; - //this.lodLevel = lodLevel; + this.lodLevel = lodLevel; } public async Task> SetupSceneInPiXYZ()