Skip to content

Commit

Permalink
new baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
dalkia committed Feb 22, 2024
1 parent 3d33679 commit 1ddfe51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
2 changes: 1 addition & 1 deletion DCL_PiXYZ/PXZEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/");

Expand Down
26 changes: 4 additions & 22 deletions DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<PXZModel>> SetupSceneInPiXYZ()
Expand Down

0 comments on commit 1ddfe51

Please sign in to comment.