From edb0d91f6fc899a7e11d875d4264067b6bdc31fc Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 10:33:06 -0300 Subject: [PATCH 01/36] Some cleanup --- DCL_PiXYZ/PXZEntryPoint.cs | 56 +++++++++---------- DCL_PiXYZ/PXZParams.cs | 12 ++-- .../PiXYZWorflow/PXZBeginCleanMaterials.cs | 1 - DCL_PiXYZ/PiXYZWorflow/PXZDecimateAndBake.cs | 1 - DCL_PiXYZ/PiXYZWorflow/PXZDecimator.cs | 1 - DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs | 1 - DCL_PiXYZ/PiXYZWorflow/PXZExporter.cs | 5 +- DCL_PiXYZ/PiXYZWorflow/PXZMergeMeshes.cs | 2 - DCL_PiXYZ/PiXYZWorflow/PXZRepairMesh.cs | 1 - DCL_PiXYZ/SceneImporter/SceneImporter.cs | 2 - .../SceneRepositioner/SceneRepositioner.cs | 1 - 11 files changed, 33 insertions(+), 50 deletions(-) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 390ebae1..9f82458c 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -33,7 +33,7 @@ private static async Task RunLODBuilder(string[] args) defaultScene = args[1]; defaultOutputPath = args[2]; defaultSceneLodManifestDirectory = args[3]; - isDebug = false; + bool.TryParse(args[4], out isDebug); } //Conversion type can be single or bulk @@ -46,7 +46,7 @@ private static async Task RunLODBuilder(string[] args) List roadCoordinates = LoadRoads(); CreateDirectories(sceneConversionInfo); - FrameworkInitialization(pathHandler.ManifestProjectDirectory); + FrameworkInitialization(pathHandler.ManifestProjectDirectory, isDebug); foreach (string currentScene in sceneConversionInfo.ScenesToAnalyze) { @@ -67,17 +67,14 @@ private static async Task RunLODBuilder(string[] args) foreach (string pointer in sceneConversionInfo.SceneImporter.GetCurrentScenePointersList()) sceneConversionInfo.AnalyzedScenes.Add(pointer); - if (CheckFaillingDebugScenes(sceneConversionInfo.SceneImporter.GetCurrentScenePointersList(), currentScene)) continue; - if (!await ManifestGeneratedSuccesfully(sceneConversionInfo, pathHandler, currentScene)) continue; if (!await sceneConversionInfo.SceneImporter.DownloadAllContent(pathHandler)) continue; - Console.WriteLine("Begin scene conversion for " + currentScene); + Console.WriteLine("BEGIN SCENE CONVERSION FOR " + currentScene); var pxzParams = new PXZParams { - DecimationType = sceneConversionInfo.DecimationType, ParcelAmount = sceneConversionInfo.SceneImporter.GetCurrentScenePointersList().Length, SceneContent = sceneConversionInfo.SceneImporter.sceneContent, SceneHash = sceneConversionInfo.SceneImporter.GetSceneHash(), - ScenePointer = sceneConversionInfo.SceneImporter.GetSceneBasePointer() + DecimationType = sceneConversionInfo.DecimationType, ParcelAmount = sceneConversionInfo.SceneImporter.GetCurrentScenePointersList().Length, SceneContent = sceneConversionInfo.SceneImporter.sceneContent }; foreach (var decimationValue in sceneConversionInfo.DecimationToAnalyze) { @@ -87,8 +84,21 @@ private static async Task RunLODBuilder(string[] args) pxzParams.LodLevel += 1; } GC.Collect(); - Console.WriteLine("END SCENE CONVERSION FOR SCENE " + currentScene); + Console.WriteLine("END SCENE CONVERSION FOR " + currentScene); } + + DoManifestCleanup(isDebug, pathHandler); + } + + private static void DoManifestCleanup(bool isDebug, SceneConversionPathHandler pathHandler) + { + if (isDebug) + return; + + var dir = new DirectoryInfo(pathHandler.ManifestOutputJsonDirectory); + + foreach (var fi in dir.GetFiles()) + fi.Delete(); } private static async Task DoConversion(PXZParams pxzParams, SceneConversionInfo sceneConversionInfo, string scene, SceneConversionPathHandler pathHandler) @@ -100,8 +110,7 @@ private static async Task DoConversion(PXZParams pxzParams, SceneConversionInfo //Check if they were converted stopwatch.Restart(); Console.WriteLine($"BEGIN CONVERTING {scene} WITH {pxzParams.DecimationValue}"); - await ConvertScene(pxzParams, pathHandler); - Console.WriteLine($"END CONVERTING {scene} WITH {pxzParams.DecimationValue}"); + await ConvertScene(pxzParams, pathHandler, sceneConversionInfo); stopwatch.Stop(); string elapsedTime = string.Format("{0:00}:{1:00}:{2:00}", @@ -153,17 +162,6 @@ private static async Task SceneDefinitionDownloadSuccesfully(SceneConversi return true; } - private static bool CheckFaillingDebugScenes(string[] currentPointersList, string scene) - { - if (currentPointersList[0].Equals("-15,-39") || currentPointersList[0].Equals("-27,-17") || currentPointersList[0].Equals("-75,-9") || currentPointersList[0].Equals("-5,36") || currentPointersList[0].Equals("16,34")) - { - Console.WriteLine($"Skipping scene {scene} because it was causing an exit without exception"); - return true; - } - - return false; - } - private static bool CheckEmptyScene(string[] currentPointersList, string scene) { //Check empty scenes @@ -206,11 +204,10 @@ private static async Task GenerateManifest(string sceneType, string sceneV } } - Console.WriteLine($"END MANIFEST GENERATION FOR SCENE {sceneValue}"); return true; // Return true as default, indicating success if no unignorable error was found. } - private static async Task ConvertScene(PXZParams pxzParams, SceneConversionPathHandler pathHandler) + private static async Task ConvertScene(PXZParams pxzParams, SceneConversionPathHandler pathHandler, SceneConversionInfo sceneConversionInfo) { SceneRepositioner.SceneRepositioner sceneRepositioner = new SceneRepositioner.SceneRepositioner(pathHandler.ManifestOutputJsonFile, pxzParams.SceneContent, pxz, pathHandler, pxzParams.LodLevel); @@ -225,12 +222,12 @@ private static async Task ConvertScene(PXZParams pxzParams, SceneConversionPathH if (pxzParams.LodLevel != 0) { modifiers.Add(new PXZDeleteByName(".*collider.*")); - modifiers.Add(new PXZDecimator(pxzParams.ScenePointer, pxzParams.DecimationType, + modifiers.Add(new PXZDecimator(sceneConversionInfo.SceneImporter.GetSceneBasePointer(), pxzParams.DecimationType, pxzParams.DecimationValue, pxzParams.ParcelAmount, pathHandler)); modifiers.Add(new PXZMergeMeshes(pxzParams.LodLevel)); } - modifiers.Add(new PXZExporter(pxzParams, pathHandler)); + modifiers.Add(new PXZExporter(pxzParams, pathHandler, sceneConversionInfo)); PXZStopwatch stopwatch = new PXZStopwatch(); foreach (var pxzModifier in modifiers) @@ -257,15 +254,14 @@ private static List LoadRoads() string filePath = Path.Combine(Directory.GetCurrentDirectory(), "RoadCoordinates.json"); return JsonConvert.DeserializeObject>(File.ReadAllText(filePath)); } - - private static void FrameworkInitialization(string sceneManifestDirectory) + + private static void FrameworkInitialization(string sceneManifestDirectory, bool isDebug) { Console.WriteLine("INSTALLING AND BUILDING NPM"); - NPMUtils.DoNPMInstall(sceneManifestDirectory); - Console.WriteLine("END INSTALLING AND BUILDING NPM"); + if (!isDebug) + NPMUtils.DoNPMInstall(sceneManifestDirectory); Console.WriteLine("INITIALIZING PIXYZ"); InitializePiXYZ(); - Console.WriteLine("END INITIALIZING PIXYZ"); } private static void InitializePiXYZ() diff --git a/DCL_PiXYZ/PXZParams.cs b/DCL_PiXYZ/PXZParams.cs index ff4c4893..bef8b8b4 100644 --- a/DCL_PiXYZ/PXZParams.cs +++ b/DCL_PiXYZ/PXZParams.cs @@ -8,8 +8,6 @@ namespace DCL_PiXYZ { public struct PXZParams { - public string SceneHash { get; set; } - public string ScenePointer { get; set; } public Dictionary SceneContent { get; set; } public int ParcelAmount { get; set; } public double DecimationValue { get; set; } @@ -95,19 +93,17 @@ public struct SceneConversionPathHandler public string FailGLBImporterFile; public string OutputPath; public string ManifestOutputJsonFile; + public string ManifestOutputJsonDirectory; public string ManifestProjectDirectory; private readonly string DefaultOutputPath; - public bool IsDebug; - public SceneConversionPathHandler(bool isDebug, string defaultOutputPath, string manifestProjectDirectory, string successFile, string failFile, string vertexCountFile, string failGlbImporterFile, string scene) { - IsDebug = isDebug; DefaultOutputPath = defaultOutputPath; ManifestProjectDirectory = manifestProjectDirectory; - if (IsDebug) + if (isDebug) { SuccessFile = Path.Combine(defaultOutputPath, successFile); FailFile = Path.Combine(defaultOutputPath, failFile); @@ -125,12 +121,14 @@ public SceneConversionPathHandler(bool isDebug, string defaultOutputPath, string OutputPath = ""; ManifestOutputJsonFile = ""; + ManifestOutputJsonDirectory = ""; } public void SetOutputPath(SceneImporter sceneSceneImporter) { OutputPath = Path.Combine(DefaultOutputPath, sceneSceneImporter.GetSceneBasePointer()); - ManifestOutputJsonFile = Path.Combine(ManifestProjectDirectory, "output-manifests", sceneSceneImporter.GetSceneHash() + "-lod-manifest.json"); + ManifestOutputJsonDirectory = Path.Combine(ManifestProjectDirectory, "output-manifests"); + ManifestOutputJsonFile = Path.Combine(ManifestOutputJsonDirectory, sceneSceneImporter.GetSceneHash() + "-lod-manifest.json"); Directory.CreateDirectory(DefaultOutputPath); Directory.CreateDirectory(OutputPath); diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZBeginCleanMaterials.cs b/DCL_PiXYZ/PiXYZWorflow/PXZBeginCleanMaterials.cs index bd7c6f49..cb8a8b0a 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZBeginCleanMaterials.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZBeginCleanMaterials.cs @@ -56,7 +56,6 @@ uint copyMaterial } }*/ - Console.WriteLine("END PXZ CLEAN MATERIALS"); } } } \ No newline at end of file diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZDecimateAndBake.cs b/DCL_PiXYZ/PiXYZWorflow/PXZDecimateAndBake.cs index ce6b60c1..6a226f7e 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZDecimateAndBake.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZDecimateAndBake.cs @@ -91,7 +91,6 @@ public async Task ApplyModification(PiXYZAPI pxz) { pxz.Core.SetProperty(occurence, "Name", "DecimateTargetBake " + pxz.Core.GetProperty(occurence, "Id")); }*/ - Console.WriteLine("END PXZ DECIMATE AND BAKE"); } } } \ No newline at end of file diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZDecimator.cs b/DCL_PiXYZ/PiXYZWorflow/PXZDecimator.cs index f381ae7c..affd2305 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZDecimator.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZDecimator.cs @@ -42,7 +42,6 @@ public async Task ApplyModification(PiXYZAPI pxz) pxz.Scene.GetPolygonCount(new OccurrenceList(new uint[] { pxz.Scene.GetRoot() }), true); pxz.Algo.DecimateTarget(new OccurrenceList(new uint[]{pxz.Scene.GetRoot()}), decimate); WriteFinalVertexAmount(pxz.Scene.GetPolygonCount(new OccurrenceList(new uint[] { pxz.Scene.GetRoot() }),true)); - Console.WriteLine("END PXZ MODIFIER DECIMATOR"); } private void WriteFinalVertexAmount(ulong polygonCount) diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs b/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs index 1fa78ccf..d7dc6d2a 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs @@ -22,7 +22,6 @@ public async Task ApplyModification(PiXYZAPI pxz) OccurrenceList occurenceToDelete = pxz.Scene.FindOccurrencesByProperty("Name", regex); foreach (uint u in occurenceToDelete.list) pxz.Scene.DeleteComponentByType(ComponentType.Part, u); - Console.WriteLine("END PXZ DELETE BY NAME FOR REGEX " + regex); } } } \ No newline at end of file diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZExporter.cs b/DCL_PiXYZ/PiXYZWorflow/PXZExporter.cs index 135dc640..cc9aa2ce 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZExporter.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZExporter.cs @@ -18,12 +18,12 @@ public class PXZExporter : IPXZModifier private readonly int lodLevel; private readonly SceneConversionPathHandler pathHandler; - public PXZExporter(PXZParams pxzParams, SceneConversionPathHandler pathHandler) + public PXZExporter(PXZParams pxzParams, SceneConversionPathHandler pathHandler, SceneConversionInfo sceneConversionInfo) { this.pathHandler = pathHandler; extensions = new List() { ".fbx", ".glb" }; path = pathHandler.OutputPath; - filename = $"{pxzParams.SceneHash}_{pxzParams.LodLevel}"; + filename = $"{sceneConversionInfo.SceneImporter.GetSceneHash()}_{pxzParams.LodLevel}"; lodLevel = pxzParams.LodLevel; } @@ -69,7 +69,6 @@ private void DoExportWithExtension(PiXYZAPI pxz, string extension) }), 1); } pxz.IO.ExportScene(Path.Combine(path, $"{filename}{extension}"), pxz.Scene.GetRoot()); - Console.WriteLine("END PXZ EXPORT "); } } } \ No newline at end of file diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZMergeMeshes.cs b/DCL_PiXYZ/PiXYZWorflow/PXZMergeMeshes.cs index 04db3476..1c944a31 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZMergeMeshes.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZMergeMeshes.cs @@ -53,7 +53,6 @@ public async Task ApplyModification(PiXYZAPI pxz) { Console.WriteLine(e); } - Console.WriteLine("END PXZ MERGE MESHES"); } private void MergeSubMeshes(OccurrenceList listToMerge, bool isOpaque) @@ -103,7 +102,6 @@ private void DoMerge(ulong currentVertexCount, OccurrenceList toMerge, bool isOp uint combineMeshes = pxz.Algo.CombineMeshes(toMerge, bakeOption); pxz.Core.SetProperty(combineMeshes, "Name", $"MERGED MESH {index} {(isOpaque ? "OPAQUE" : "FORCED_TRANSPARENT")}"); - Console.WriteLine("End merging meshes "); Console.WriteLine("Copying Material"); //Apply a copy of the material not to lose the reference diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZRepairMesh.cs b/DCL_PiXYZ/PiXYZWorflow/PXZRepairMesh.cs index 66f99c9e..27546253 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZRepairMesh.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZRepairMesh.cs @@ -24,7 +24,6 @@ public async Task ApplyModification(PiXYZAPI pxz) if (pxzModel.needsRepair) pxz.Algo.RepairMesh(new OccurrenceList(new uint[]{pxzModel.modelOcurrence}), 0.1, true, false); } - Console.WriteLine($"END PXZ MESH REPAIR"); } } } \ No newline at end of file diff --git a/DCL_PiXYZ/SceneImporter/SceneImporter.cs b/DCL_PiXYZ/SceneImporter/SceneImporter.cs index 94f5a27a..aeb8ed36 100644 --- a/DCL_PiXYZ/SceneImporter/SceneImporter.cs +++ b/DCL_PiXYZ/SceneImporter/SceneImporter.cs @@ -62,7 +62,6 @@ public async Task DownloadSceneDefinition() SetResult(sceneDefinitions[0].id); } } - Console.WriteLine("END SCENE DEFINITION DOWNLOAD"); } catch (Exception e) { @@ -103,7 +102,6 @@ public async Task DownloadAllContent(SceneConversionPathHandler pathHandle return false; } } - Console.WriteLine("END FILE CONTENT DOWNLOAD"); return true; } diff --git a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs index 63b7e2b2..5e51d641 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs @@ -51,7 +51,6 @@ public async Task> SetupSceneInPiXYZ() foreach (KeyValuePair dclRendereableEntity in renderableEntitiesDictionary) models.Add(dclRendereableEntity.Value.PositionAndInstantiteMesh(sceneContent, renderableEntitiesDictionary, _pathHandler, lodLevel)); - Console.WriteLine("END REPOSITIONING"); return models; } From 558379f865474132b77cefdf09e6d9415088f4fc Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 11:43:19 -0300 Subject: [PATCH 02/36] Added test case scenario --- .github/workflows/test-lod-conversion.yml | 72 ++++++++++++++++++++++ consumer-server/src/logic/lod-generator.ts | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-lod-conversion.yml diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml new file mode 100644 index 00000000..7ad97b51 --- /dev/null +++ b/.github/workflows/test-lod-conversion.yml @@ -0,0 +1,72 @@ +name: Test LOD Conversion + +on: + pull_request: {} + push: { branches: [main] } + +jobs: + build-and-run: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' + + - name: Publish with dotnet + run: dotnet publish -c Release -r win10-x64 -o ./publish --self-contained true + + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.0 + with: + vulkan_version: 1.3.268.0 + optional_components: com.lunarg.vulkan.vma + install_runtime: true + cache: true + destination: ${{ github.workspace }}/vulkan-sdt + + - name: Move Vulkan DLL to output directory + run: | + mv ./vulkan-sdt/1.3.268.0/runtime/x64/vulkan-1.dll ./publish/ + shell: bash + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18.14.2' + + - name: Run the application + run: .\publish\DCL_PiXYZ.exe "coords" "5,19" "${{ github.workspace }}\publish\OutputDirectoryPath" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" "false" + + - name: Check Output Files with Size Tolerance in KB + run: | + $basePath = "${{ github.workspace }}\publish\OutputDirectoryPath" + $files = @( + "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_0.fbx", + "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_1.fbx", + "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" + ) + $expectedSizesKB = @(6066, 619, 218) # Example sizes in KB, replace with actual expected sizes + $toleranceKB = 2 # 1 KB tolerance + + foreach ($i in 0..2) { + $filePath = Join-Path -Path $basePath -ChildPath $files[$i] + if (-Not (Test-Path $filePath)) { + throw "File not found: $filePath" + } + + $fileSizeBytes = (Get-Item $filePath).length + $fileSizeKB = [math]::Round($fileSizeBytes / 1024, 2) # Convert file size to KB and round to 2 decimal places + $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB + $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB + if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { + throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 2KB), Found: $fileSizeKB KB" + } + } + Write-Host "All files exist and are within the acceptable size range in KB." + shell: pwsh \ No newline at end of file diff --git a/consumer-server/src/logic/lod-generator.ts b/consumer-server/src/logic/lod-generator.ts index c3815b68..a3bb1344 100644 --- a/consumer-server/src/logic/lod-generator.ts +++ b/consumer-server/src/logic/lod-generator.ts @@ -23,7 +23,7 @@ export function createLodGeneratorComponent(): LodGeneratorComponent { outputPath: processOutput } - const commandToExecute = `${lodGeneratorProgram} "coords" "${basePointer}" "${outputPath}" "${sceneLodEntitiesManifestBuilder}"` + const commandToExecute = `${lodGeneratorProgram} "coords" "${basePointer}" "${outputPath}" "${sceneLodEntitiesManifestBuilder}" "false"` result = await new Promise((resolve, _) => { exec(commandToExecute, (error, _, stderr) => { if (error || stderr) { From af97397e3b8a6cdb968833107db89ab5dd47c2cd Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 12:19:50 -0300 Subject: [PATCH 03/36] Modified test script --- .github/workflows/test-lod-conversion.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 7ad97b51..6ed23837 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -20,6 +20,10 @@ jobs: - name: Publish with dotnet run: dotnet publish -c Release -r win10-x64 -o ./publish --self-contained true + + - name: Copy additional files to publish directory + run: | + cp -r path/to/your/folder ./publish/path/to/your/folder - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 @@ -47,7 +51,7 @@ jobs: run: | $basePath = "${{ github.workspace }}\publish\OutputDirectoryPath" $files = @( - "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_0.fbx", + "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_0.fbx", # Hash output for 5,19 "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_1.fbx", "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) From 1f272c556e77d7769f9dd32e84a9dbe103308d01 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 12:22:33 -0300 Subject: [PATCH 04/36] Fixed indentation --- .github/workflows/test-lod-conversion.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 6ed23837..cf3b15f4 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -21,9 +21,9 @@ jobs: - name: Publish with dotnet run: dotnet publish -c Release -r win10-x64 -o ./publish --self-contained true - - name: Copy additional files to publish directory - run: | - cp -r path/to/your/folder ./publish/path/to/your/folder + - name: Copy additional files to publish directory + run: | + cp -r path/to/your/folder ./publish/path/to/your/folder - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 From 804f722fd324bdd124be52660ec4beb99b21df49 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 12:39:30 -0300 Subject: [PATCH 05/36] Copying files manually --- .github/workflows/test-lod-conversion.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index cf3b15f4..c6b684e1 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -23,7 +23,9 @@ jobs: - name: Copy additional files to publish directory run: | - cp -r path/to/your/folder ./publish/path/to/your/folder + cp -r "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" + cp "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" "${{ github.workspace }}\publish\" + - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 From 73b6401ca1cace86907616c9a32f924483d2d696 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 13:32:03 -0300 Subject: [PATCH 06/36] Adding license copy --- .github/workflows/test-lod-conversion.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index c6b684e1..22dbf903 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -25,6 +25,7 @@ jobs: run: | cp -r "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" cp "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" "${{ github.workspace }}\publish\" + cp "${{ github.workspace }}\pixyzsdk-29022024.lic" "${{ github.workspace }}\publish\" - name: Install Vulkan SDK From b6344daf896690d7e0aa4949391ac6ebea6c5137 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 13:46:48 -0300 Subject: [PATCH 07/36] Changted copy to pwsh --- .github/workflows/test-lod-conversion.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 22dbf903..76772362 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -23,9 +23,11 @@ jobs: - name: Copy additional files to publish directory run: | - cp -r "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" - cp "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" "${{ github.workspace }}\publish\" - cp "${{ github.workspace }}\pixyzsdk-29022024.lic" "${{ github.workspace }}\publish\" + Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" -Destination "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" -Recurse + Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish\" + Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish\" + shell: pwsh + - name: Install Vulkan SDK From 4ec682b7ab3f4d3f7b7576b38dd52fcba45425e0 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 13:54:24 -0300 Subject: [PATCH 08/36] Separating copies and debugging --- .github/workflows/test-lod-conversion.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 76772362..460f0c7c 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -21,14 +21,23 @@ jobs: - name: Publish with dotnet run: dotnet publish -c Release -r win10-x64 -o ./publish --self-contained true - - name: Copy additional files to publish directory - run: | + - name: Copy manifest builder to publish directory + run: | Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" -Destination "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" -Recurse - Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish\" - Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish\" - shell: pwsh - - + shell: pwsh + + - name: Copy road coordinates + run: | + Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish\" + shell: pwsh + + - name: Copy license file + run: | + Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish\" + shell: pwsh + + - name: List files in the publish directory + run: ls -lah "${{ github.workspace }}/publish/" - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 From 3f98bd8d3faa30af3cca0fc37863e43f22ad3245 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:00:24 -0300 Subject: [PATCH 09/36] Fixed indentation --- .github/workflows/test-lod-conversion.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 460f0c7c..a1b78e89 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -22,22 +22,22 @@ jobs: run: dotnet publish -c Release -r win10-x64 -o ./publish --self-contained true - name: Copy manifest builder to publish directory - run: | + run: | Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\scene-lod-entities-manifest-builder" -Destination "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" -Recurse - shell: pwsh + shell: pwsh - name: Copy road coordinates - run: | + run: | Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish\" - shell: pwsh + shell: pwsh - name: Copy license file - run: | + run: | Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish\" - shell: pwsh + shell: pwsh - name: List files in the publish directory - run: ls -lah "${{ github.workspace }}/publish/" + run: ls -lah "${{ github.workspace }}/publish/" - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 From 2573986c1aa71bd97263f2ad97ed509eddd16949 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:03:31 -0300 Subject: [PATCH 10/36] Changed ls to powershel --- .github/workflows/test-lod-conversion.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index a1b78e89..c19132da 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -37,7 +37,8 @@ jobs: shell: pwsh - name: List files in the publish directory - run: ls -lah "${{ github.workspace }}/publish/" + run: Get-ChildItem -Path "${{ github.workspace }}\publish\" -Recurse | Format-Table -AutoSize + shell: pwsh - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 From 1859d38eefbe2a08a4177a602f2f5bdc078b21ce Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:08:31 -0300 Subject: [PATCH 11/36] Removed additional / --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index c19132da..02be033f 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -28,12 +28,12 @@ jobs: - name: Copy road coordinates run: | - Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish\" + Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish" shell: pwsh - name: Copy license file run: | - Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish\" + Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish" shell: pwsh - name: List files in the publish directory From fd69142950fa1dcf81ac1107d7181541fdba71f3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:18:06 -0300 Subject: [PATCH 12/36] Re-added license key to check export --- pixyzsdk-29022024.lic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pixyzsdk-29022024.lic b/pixyzsdk-29022024.lic index f69a9000..5a6f0757 100644 --- a/pixyzsdk-29022024.lic +++ b/pixyzsdk-29022024.lic @@ -66,5 +66,5 @@ - {LICENSE_KEY} - + 2c94e825665cc06c689f0944c0826662a12a9b454fc87152a23b06fd1c25f4047806a0a276e0f092aacdd88eeed0bd81ad0a5343ac684a4be6cebada8aca144af62e7bf69e0fa6d8e8c3f23c9c2e2a923851c81c4ccefa71a2b5bff19f16dff6a4ff6a88380548c4716cdc542fb6a350670e214f115aedd504f6f26528915c7f + \ No newline at end of file From 1687cbc4a88c472afe62e54b97abf3ea606f6aec Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:23:30 -0300 Subject: [PATCH 13/36] Fixed ouput path for size checking --- .github/workflows/test-lod-conversion.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 02be033f..e7f97bad 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -36,10 +36,6 @@ jobs: Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish" shell: pwsh - - name: List files in the publish directory - run: Get-ChildItem -Path "${{ github.workspace }}\publish\" -Recurse | Format-Table -AutoSize - shell: pwsh - - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 with: @@ -64,7 +60,7 @@ jobs: - name: Check Output Files with Size Tolerance in KB run: | - $basePath = "${{ github.workspace }}\publish\OutputDirectoryPath" + $basePath = "${{ github.workspace }}\publish\OutputDirectoryPath\5,19" $files = @( "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_0.fbx", # Hash output for 5,19 "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_1.fbx", From 03b9020f473dd8f89db1919e5fbb166b8119c432 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:31:11 -0300 Subject: [PATCH 14/36] Upgraded tolerance for file size --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index e7f97bad..1247ea0e 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -66,8 +66,8 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_1.fbx", "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) - $expectedSizesKB = @(6066, 619, 218) # Example sizes in KB, replace with actual expected sizes - $toleranceKB = 2 # 1 KB tolerance + $expectedSizesKB = @(6066, 620, 218) # Example sizes in KB, replace with actual expected sizes + $toleranceKB = 5 # 1 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] From 376abdc7ba6029274d5077d16d8467491012ebeb Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:32:40 -0300 Subject: [PATCH 15/36] Corrected log --- .github/workflows/test-lod-conversion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 1247ea0e..b6be0eca 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -80,7 +80,7 @@ jobs: $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { - throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 2KB), Found: $fileSizeKB KB" + throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 5KB), Found: $fileSizeKB KB" } } Write-Host "All files exist and are within the acceptable size range in KB." From 1d73090ef2b587e3eb89fde05b1bf138ce9ea7d0 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:36:27 -0300 Subject: [PATCH 16/36] Reduced tolerance --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index b6be0eca..6c6a9ff9 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -67,7 +67,7 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) $expectedSizesKB = @(6066, 620, 218) # Example sizes in KB, replace with actual expected sizes - $toleranceKB = 5 # 1 KB tolerance + $toleranceKB = 3 # 1 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] @@ -80,7 +80,7 @@ jobs: $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { - throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 5KB), Found: $fileSizeKB KB" + throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 3KB), Found: $fileSizeKB KB" } } Write-Host "All files exist and are within the acceptable size range in KB." From 944f7c6c7fd1ffe26f759f86daeab53b8912d6f7 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 14:42:25 -0300 Subject: [PATCH 17/36] Increased tolearance to 5KB --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 6c6a9ff9..3d864ef3 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -67,7 +67,7 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) $expectedSizesKB = @(6066, 620, 218) # Example sizes in KB, replace with actual expected sizes - $toleranceKB = 3 # 1 KB tolerance + $toleranceKB = 5 # 5 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] @@ -80,7 +80,7 @@ jobs: $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { - throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 3KB), Found: $fileSizeKB KB" + throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 5KB), Found: $fileSizeKB KB" } } Write-Host "All files exist and are within the acceptable size range in KB." From db08e9cb14424256bddea7250fdf01e58562a58e Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 16:10:44 -0300 Subject: [PATCH 18/36] Write the file size --- .github/workflows/test-lod-conversion.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 3d864ef3..e8c08aff 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -79,6 +79,7 @@ jobs: $fileSizeKB = [math]::Round($fileSizeBytes / 1024, 2) # Convert file size to KB and round to 2 decimal places $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB + Write-Host "The file size is $fileSizeBytes bytes" if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 5KB), Found: $fileSizeKB KB" } From b90816fa927dcbe7759776e810c228844b804236 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 16:26:45 -0300 Subject: [PATCH 19/36] Cleaned DCLGLTFMesh --- .github/workflows/test-lod-conversion.yml | 16 +- DCL_PiXYZ/PXZEntryPoint.cs | 4 +- .../JsonParsing/MeshRendererData.cs | 2 +- .../SceneBuilder/Entities/DCLGLTFMesh.cs | 202 ++++++++++-------- .../SceneBuilder/Entities/DCLPrimitiveMesh.cs | 2 +- .../Entities/DCLRendereableEntity.cs | 4 +- .../SceneRepositioner/SceneRepositioner.cs | 2 +- 7 files changed, 130 insertions(+), 102 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index e8c08aff..461476bc 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -66,8 +66,8 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_1.fbx", "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) - $expectedSizesKB = @(6066, 620, 218) # Example sizes in KB, replace with actual expected sizes - $toleranceKB = 5 # 5 KB tolerance + $expectedSizesB = @(6210224, 631424, 219776 ) # Expected sizes in bytes + $toleranceB = 500 # 0.5 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] @@ -75,13 +75,11 @@ jobs: throw "File not found: $filePath" } - $fileSizeBytes = (Get-Item $filePath).length - $fileSizeKB = [math]::Round($fileSizeBytes / 1024, 2) # Convert file size to KB and round to 2 decimal places - $lowerBoundKB = $expectedSizesKB[$i] - $toleranceKB - $upperBoundKB = $expectedSizesKB[$i] + $toleranceKB - Write-Host "The file size is $fileSizeBytes bytes" - if ($fileSizeKB -lt $lowerBoundKB -or $fileSizeKB -gt $upperBoundKB) { - throw "File size mismatch for $filePath. Expected: $($expectedSizesKB[$i]) KB (+/- 5KB), Found: $fileSizeKB KB" + $fileSizeInBytes = (Get-Item $filePath).length + $lowerBoundB = $expectedSizesB[$i] - $toleranceB + $upperBoundB = $expectedSizesB[$i] + $toleranceB + if ($fileSizeInBytes -lt $lowerBoundB -or $fileSizeInBytes -gt $upperBoundB) { + throw "File size mismatch for $filePath. Expected: $($expectedSizesB[$i]) B (+/- 500 B), Found: $fileSizeInBytes bytes" } } Write-Host "All files exist and are within the acceptable size range in KB." diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 9f82458c..76229550 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -67,11 +67,9 @@ private static async Task RunLODBuilder(string[] args) foreach (string pointer in sceneConversionInfo.SceneImporter.GetCurrentScenePointersList()) sceneConversionInfo.AnalyzedScenes.Add(pointer); + Console.WriteLine("BEGIN SCENE CONVERSION FOR " + currentScene); if (!await ManifestGeneratedSuccesfully(sceneConversionInfo, pathHandler, currentScene)) continue; - if (!await sceneConversionInfo.SceneImporter.DownloadAllContent(pathHandler)) continue; - - Console.WriteLine("BEGIN SCENE CONVERSION FOR " + currentScene); var pxzParams = new PXZParams { DecimationType = sceneConversionInfo.DecimationType, ParcelAmount = sceneConversionInfo.SceneImporter.GetCurrentScenePointersList().Length, SceneContent = sceneConversionInfo.SceneImporter.sceneContent diff --git a/DCL_PiXYZ/SceneRepositioner/JsonParsing/MeshRendererData.cs b/DCL_PiXYZ/SceneRepositioner/JsonParsing/MeshRendererData.cs index 2ffd97db..6fa2416b 100644 --- a/DCL_PiXYZ/SceneRepositioner/JsonParsing/MeshRendererData.cs +++ b/DCL_PiXYZ/SceneRepositioner/JsonParsing/MeshRendererData.cs @@ -19,7 +19,7 @@ public class MeshRendererData : ComponentData [Serializable] public abstract class DCLMesh { - public abstract PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary contentTable, SceneConversionPathHandler pathHandler, int lodLevel); + public abstract PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary contentTable, SceneConversionPathHandler pathHandler); } public struct PXZModel diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs index 6a5bdbd9..cce41d30 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs @@ -18,117 +18,149 @@ namespace AssetBundleConverter.LODs { public class DCLGLTFMesh : DCLMesh { - private SceneConversionPathHandler _pathHandler; + private SceneConversionPathHandler pathHandler; - private string src; + private readonly string src; public DCLGLTFMesh(string src) { this.src = src; } - public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary contentTable, SceneConversionPathHandler pathHandler, int lodLevel) + public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary contentTable, SceneConversionPathHandler pathHandler) { + this.pathHandler = pathHandler; + if (!contentTable.TryGetValue(src.ToLower(), out string modelPath)) { - Console.WriteLine($"ERROR: GLTF {src} file not found in sceneContent"); + LogError($"ERROR: GLTF {src} file not found in sceneContent"); + return PXYZConstants.EMPTY_MODEL; + } + + bool isModelProcessingSuccessful = TryProcessModel(modelPath); + + if (!TryImportGLTF(pxz, parent, modelPath, isModelProcessingSuccessful, out var pxzModel)) + { + Console.WriteLine($"ERROR: Importing GLTF {entityID} failed"); return PXYZConstants.EMPTY_MODEL; } - bool modelWorkSuccessfull = true; + return pxzModel; + } + + private bool TryProcessModel(string modelPath) + { try { - var readSettings = new ReadSettings(ValidationMode.TryFix); - var model = ModelRoot.Load(modelPath, readSettings); - foreach (var gltfMaterial in model.LogicalMaterials) - { - if (gltfMaterial.Alpha != AlphaMode.OPAQUE && !gltfMaterial.Name.Contains("FORCED_TRANSPARENT")) - gltfMaterial.Name += "FORCED_TRANSPARENT"; - } + ModifyModelMaterials(modelPath); + ExportModifiedModel(modelPath); + return true; + } + catch (Exception e) + { + LogError($"MODEL PROCESSING FAILED {modelPath} {e}"); + return false; + } + } + + private void ModifyModelMaterials(string modelPath) + { + var readSettings = new ReadSettings(ValidationMode.TryFix); + var model = ModelRoot.Load(modelPath, readSettings); + foreach (var gltfMaterial in model.LogicalMaterials) + { + if (gltfMaterial.Alpha != AlphaMode.OPAQUE && !gltfMaterial.Name.Contains("FORCED_TRANSPARENT")) + gltfMaterial.Name += "FORCED_TRANSPARENT"; + } + + SaveModel(model, modelPath); + } - if (Path.GetExtension(modelPath).Contains("glb", StringComparison.OrdinalIgnoreCase)) - model.SaveGLB(modelPath); - else - model.SaveGLTF(modelPath); + private void SaveModel(ModelRoot model, string modelPath) + { + if (Path.GetExtension(modelPath).Contains("glb", StringComparison.OrdinalIgnoreCase)) + model.SaveGLB(modelPath); + else + 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) { - //PXZEntryPoint.WriteToFile($"MODEL FAILED A {modelPath} {e}", "FAILEDIMPORTMODELS.txt"); - Console.WriteLine($"ERROR pre-processing GLTF material: {e}"); + LogError($"ERROR importing GLTF: {e}"); + pxzModel = PXYZConstants.EMPTY_MODEL; + return false; } - try - { - ReadSettings readSettings = new ReadSettings(ValidationMode.TryFix); - var model = ModelRoot.Load(modelPath, readSettings); - ModelRoot modelRoot = ModelRoot.CreateModel(); - Scene sceneModel = modelRoot.UseScene("Default"); - foreach (var modelLogicalNode in model.LogicalNodes) - { - if (modelLogicalNode.Mesh != null) - { - foreach(MeshPrimitive meshPrimitive in modelLogicalNode.Mesh.Primitives) - { - Mesh meshToExport = modelRoot.CreateMesh(modelLogicalNode.Name); - var positions = meshPrimitive.GetVertexAccessor("POSITION").AsVector3Array().ToArray(); - var normals = meshPrimitive.GetVertexAccessor("NORMAL").AsVector3Array().ToArray(); - var indices = (int[])(object)meshPrimitive.GetIndexAccessor().AsIndicesArray().ToArray(); - if (meshPrimitive.GetVertexAccessor("TEXCOORD_0") != null) - { - var texcoord = meshPrimitive.GetVertexAccessor("TEXCOORD_0").AsVector2Array().ToArray(); - meshToExport.CreatePrimitive() - .WithVertexAccessor("POSITION", positions) - .WithVertexAccessor("NORMAL", normals) - .WithVertexAccessor("TEXCOORD_0", texcoord) - .WithIndicesAccessor(PrimitiveType.TRIANGLES, indices) - .WithMaterial(modelRoot.CreateMaterial(meshPrimitive.Material.ToMaterialBuilder())); - } - else - { - meshToExport.CreatePrimitive() - .WithVertexAccessor("POSITION", positions) - .WithVertexAccessor("NORMAL", normals) - .WithIndicesAccessor(PrimitiveType.TRIANGLES, indices) - .WithMaterial(modelRoot.CreateMaterial(meshPrimitive.Material.ToMaterialBuilder())); - } - Node node = sceneModel.CreateNode(modelLogicalNode.Name).WithMesh(meshToExport); - node.WorldMatrix = modelLogicalNode.WorldMatrix; - } - } - } - modelRoot.SaveGLB(modelPath + "_EDITED.glb"); - } - catch (Exception e) - { - //PXZEntryPoint.WriteToFile($"MODEL FAILED B {modelPath} {e}", "FAILEDIMPORTMODELS.txt"); - modelWorkSuccessfull = false; - Console.WriteLine($"ERROR pre-processing GLTF: {e}"); - } - try + } + + private void ExportModifiedModel(string modelPath) + { + // Determine the output file path based on the original model path + string outputFile = $"{modelPath}_EDITED.glb"; + + // Check if the file already exists + if (File.Exists(outputFile)) + { + Console.WriteLine($"The file {outputFile} already exists. Skipping export."); + return; + } + + var readSettings = new ReadSettings(ValidationMode.TryFix); + var model = ModelRoot.Load(modelPath, readSettings); + + var modelRoot = ModelRoot.CreateModel(); + var sceneModel = modelRoot.UseScene("Default"); + foreach (var modelLogicalNode in model.LogicalNodes) + { + if (modelLogicalNode.Mesh != null) { - if (lodLevel != 0) + foreach (var meshPrimitive in modelLogicalNode.Mesh.Primitives) { - uint importedFileOccurrence = pxz.IO.ImportScene(modelPath); - pxz.Scene.SetParent(importedFileOccurrence, parent); - return new PXZModel(true, importedFileOccurrence); - } - else - { - uint importedFileOccurrence = pxz.IO.ImportScene(modelWorkSuccessfull ? modelPath + "_EDITED.glb" : modelPath); - pxz.Scene.SetParent(importedFileOccurrence, parent); - return new PXZModel(true, importedFileOccurrence); + var meshToExport = modelRoot.CreateMesh(modelLogicalNode.Name); + + BuildMesh(meshToExport.CreatePrimitive(), meshPrimitive.GetVertexAccessor("POSITION"), + meshPrimitive.GetVertexAccessor("NORMAL"), + meshPrimitive.GetVertexAccessor("TEXCOORD_0"), + (int[])(object)meshPrimitive.GetIndexAccessor().AsIndicesArray().ToArray(), + modelRoot.CreateMaterial(meshPrimitive.Material.ToMaterialBuilder())); + + var node = sceneModel.CreateNode(modelLogicalNode.Name).WithMesh(meshToExport); + node.WorldMatrix = modelLogicalNode.WorldMatrix; } } - catch(Exception e) - { - Console.WriteLine($"ERROR: Importing GLTF {src} failed with error {e}"); - return PXYZConstants.EMPTY_MODEL; - } + } + + SaveModel(model, modelPath + "_EDITED.glb"); + } + + private void BuildMesh(MeshPrimitive meshToExport, Accessor positions, Accessor normals, Accessor texcoord, int[] indices, Material material) + { + if (positions != null) + meshToExport.WithVertexAccessor("POSITION", positions.AsVector3Array().ToArray()); + + if (normals != null) + meshToExport.WithVertexAccessor("NORMAL", normals.AsVector3Array().ToArray()); + if (texcoord != null) + meshToExport.WithVertexAccessor("TEXCOORD_0", texcoord.AsVector2Array().ToArray()); + + meshToExport.WithIndicesAccessor(PrimitiveType.TRIANGLES, indices); + meshToExport.WithMaterial(material); } - + private void LogError(string message) + { + FileWriter.WriteToFile(message, pathHandler.FailGLBImporterFile); + } } - - -} +} \ No newline at end of file diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLPrimitiveMesh.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLPrimitiveMesh.cs index e6041d96..9db4bdaf 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLPrimitiveMesh.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLPrimitiveMesh.cs @@ -14,7 +14,7 @@ public abstract class DCLPrimitiveMesh : DCLMesh { protected abstract uint GetMesh(PiXYZAPI pxz, string entityID); - public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary sceneContent, SceneConversionPathHandler pathHandler, int lodLevel) + public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary sceneContent, SceneConversionPathHandler pathHandler) { uint mesh = GetMesh(pxz, entityID); Matrix4 matrix4 = new Matrix4(); diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLRendereableEntity.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLRendereableEntity.cs index d25c933b..776db03b 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLRendereableEntity.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLRendereableEntity.cs @@ -49,13 +49,13 @@ public void InitEntity(PiXYZAPI pxz, uint pxzRootOcurrence) this.pxz = pxz; } - public PXZModel PositionAndInstantiteMesh(Dictionary contentTable, Dictionary renderableEntities, SceneConversionPathHandler pathHandler, int lodLevel) + public PXZModel PositionAndInstantiteMesh(Dictionary contentTable, Dictionary renderableEntities, SceneConversionPathHandler pathHandler) { InstantiateTransform(renderableEntities); if (rendereableMesh != null) { uint material = dclMaterial.GetMaterial(pxz, entityID.ToString(), contentTable); - return rendereableMesh.InstantiateMesh(pxz, entityID.ToString(), instantiatedEntity, material, contentTable, pathHandler, lodLevel); + return rendereableMesh.InstantiateMesh(pxz, entityID.ToString(), instantiatedEntity, material, contentTable, pathHandler); } else return PXYZConstants.EMPTY_MODEL; diff --git a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs index 5e51d641..e8dce9d8 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneRepositioner.cs @@ -49,7 +49,7 @@ public async Task> SetupSceneInPiXYZ() dclRendereableEntity.Value.InitEntity(pxz, rootOccurrence); foreach (KeyValuePair dclRendereableEntity in renderableEntitiesDictionary) - models.Add(dclRendereableEntity.Value.PositionAndInstantiteMesh(sceneContent, renderableEntitiesDictionary, _pathHandler, lodLevel)); + models.Add(dclRendereableEntity.Value.PositionAndInstantiteMesh(sceneContent, renderableEntitiesDictionary, _pathHandler)); return models; From fda4e4dbd98b83c7f468c8c539285b6ddc77b3dc Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 17:28:57 -0300 Subject: [PATCH 20/36] reclean of DCLGLTFMesh.cs --- .../SceneBuilder/Entities/DCLGLTFMesh.cs | 72 +++++++------------ 1 file changed, 27 insertions(+), 45 deletions(-) diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs index cce41d30..eee50dda 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs @@ -26,40 +26,40 @@ public DCLGLTFMesh(string src) { this.src = src; } - + public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint parent, uint material, Dictionary contentTable, SceneConversionPathHandler pathHandler) { this.pathHandler = pathHandler; - + if (!contentTable.TryGetValue(src.ToLower(), out string modelPath)) { LogError($"ERROR: GLTF {src} file not found in sceneContent"); return PXYZConstants.EMPTY_MODEL; } - bool isModelProcessingSuccessful = TryProcessModel(modelPath); - - if (!TryImportGLTF(pxz, parent, modelPath, isModelProcessingSuccessful, out var pxzModel)) + bool modelRecreatedSuccessfully = true; + + try { - Console.WriteLine($"ERROR: Importing GLTF {entityID} failed"); - return PXYZConstants.EMPTY_MODEL; + ModifyModelMaterials(modelPath); + ExportModifiedModel(modelPath); + } + catch (Exception e) + { + LogError($"ERROR pre-processing GLTF with GLTFSharp: {e}"); + modelRecreatedSuccessfully = false; } - return pxzModel; - } - - private bool TryProcessModel(string modelPath) - { try { - ModifyModelMaterials(modelPath); - ExportModifiedModel(modelPath); - return true; + uint importedFileOccurrence = pxz.IO.ImportScene(modelRecreatedSuccessfully ? modelPath + "_EDITED.glb" : modelPath); + pxz.Scene.SetParent(importedFileOccurrence, parent); + return new PXZModel(true, importedFileOccurrence); } catch (Exception e) { - LogError($"MODEL PROCESSING FAILED {modelPath} {e}"); - return false; + Console.WriteLine($"ERROR: Importing GLTF {src} failed with error {e}"); + return PXYZConstants.EMPTY_MODEL; } } @@ -75,7 +75,7 @@ private void ModifyModelMaterials(string modelPath) SaveModel(model, modelPath); } - + private void SaveModel(ModelRoot model, string modelPath) { if (Path.GetExtension(modelPath).Contains("glb", StringComparison.OrdinalIgnoreCase)) @@ -83,25 +83,7 @@ private void SaveModel(ModelRoot model, string modelPath) else 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 @@ -116,7 +98,6 @@ private void ExportModifiedModel(string modelPath) var readSettings = new ReadSettings(ValidationMode.TryFix); var model = ModelRoot.Load(modelPath, readSettings); - var modelRoot = ModelRoot.CreateModel(); var sceneModel = modelRoot.UseScene("Default"); foreach (var modelLogicalNode in model.LogicalNodes) @@ -126,22 +107,20 @@ private void ExportModifiedModel(string modelPath) foreach (var meshPrimitive in modelLogicalNode.Mesh.Primitives) { var meshToExport = modelRoot.CreateMesh(modelLogicalNode.Name); - BuildMesh(meshToExport.CreatePrimitive(), meshPrimitive.GetVertexAccessor("POSITION"), meshPrimitive.GetVertexAccessor("NORMAL"), meshPrimitive.GetVertexAccessor("TEXCOORD_0"), (int[])(object)meshPrimitive.GetIndexAccessor().AsIndicesArray().ToArray(), modelRoot.CreateMaterial(meshPrimitive.Material.ToMaterialBuilder())); - var node = sceneModel.CreateNode(modelLogicalNode.Name).WithMesh(meshToExport); node.WorldMatrix = modelLogicalNode.WorldMatrix; } } } - SaveModel(model, modelPath + "_EDITED.glb"); + modelRoot.SaveGLB(modelPath + "_EDITED.glb"); } - + private void BuildMesh(MeshPrimitive meshToExport, Accessor positions, Accessor normals, Accessor texcoord, int[] indices, Material material) { if (positions != null) @@ -156,11 +135,14 @@ private void BuildMesh(MeshPrimitive meshToExport, Accessor positions, Accessor meshToExport.WithIndicesAccessor(PrimitiveType.TRIANGLES, indices); meshToExport.WithMaterial(material); } - - + private void LogError(string message) { FileWriter.WriteToFile(message, pathHandler.FailGLBImporterFile); } + + } -} \ No newline at end of file + + +} From 911a0de957b34b639fd8a27414d250ee79218170 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 17:33:58 -0300 Subject: [PATCH 21/36] Increased tolerance --- .github/workflows/test-lod-conversion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 461476bc..0749e397 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -67,7 +67,7 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) $expectedSizesB = @(6210224, 631424, 219776 ) # Expected sizes in bytes - $toleranceB = 500 # 0.5 KB tolerance + $toleranceB = 2000 # 2 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] From cc7314887abe196f9ec30ee8fd90af61294e50a2 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 18:05:01 -0300 Subject: [PATCH 22/36] Added converted scene external file --- DCL_PiXYZ/PXZEntryPoint.cs | 44 ++++++++++++++++++++++++++------------ DCL_PiXYZ/PXZParams.cs | 2 -- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 76229550..b1e12631 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -38,34 +38,37 @@ private static async Task RunLODBuilder(string[] args) //Conversion type can be single or bulk //If its single, we pass as many scenes as we want to parse separated by ; - //If its bulk, a single number will represent a square to parse, going from -value to value + //If its bulk, a single number will represent a square to parse, going from -value to value. + //Comment (Juani): Im living bulk implementation for reference, but currently Im invoking the creation of all the scenes through an external program + //PiXYZ was crashing and exiting the application if it was called form the same program //Scenes param is single coordinates or bulk value. Single scenes are separated by var sceneConversionInfo = new SceneConversionInfo("7000;3000;1000", "triangle", "coords", "single", defaultScene); var pathHandler = new SceneConversionPathHandler(isDebug, defaultOutputPath, defaultSceneLodManifestDirectory, "SuccessScenes.txt", "FailScenes.txt", "PolygonCount.txt" , "FailedGLBImport.txt" , defaultScene); List roadCoordinates = LoadRoads(); + var convertedScenes = LoadConvertedScenes(); CreateDirectories(sceneConversionInfo); FrameworkInitialization(pathHandler.ManifestProjectDirectory, isDebug); foreach (string currentScene in sceneConversionInfo.ScenesToAnalyze) { if (IsRoad(roadCoordinates, currentScene)) continue; - - if (HasSceneBeenAnalyzed(sceneConversionInfo.AnalyzedScenes, currentScene)) continue; + + if (HasSceneBeenAnalyzed(convertedScenes, currentScene)) continue; sceneConversionInfo.SceneImporter = new SceneImporter(sceneConversionInfo.ConversionType, currentScene, sceneConversionInfo.WebRequestsHandler); if (!await SceneDefinitionDownloadSuccesfully(sceneConversionInfo, currentScene, pathHandler)) continue; - pathHandler.SetOutputPath(sceneConversionInfo.SceneImporter); - - if (HasSceneBeenConverted(pathHandler, currentScene)) continue; + if (HasSceneBeenConverted(convertedScenes, sceneConversionInfo.SceneImporter.GetSceneBasePointer())) continue; if (CheckEmptyScene(sceneConversionInfo.SceneImporter.GetCurrentScenePointersList(), currentScene)) continue; + pathHandler.SetOutputPath(sceneConversionInfo.SceneImporter); + //Add it to the analyzed scenes array foreach (string pointer in sceneConversionInfo.SceneImporter.GetCurrentScenePointersList()) - sceneConversionInfo.AnalyzedScenes.Add(pointer); + convertedScenes.Add(pointer); Console.WriteLine("BEGIN SCENE CONVERSION FOR " + currentScene); if (!await ManifestGeneratedSuccesfully(sceneConversionInfo, pathHandler, currentScene)) continue; @@ -83,8 +86,8 @@ private static async Task RunLODBuilder(string[] args) } GC.Collect(); Console.WriteLine("END SCENE CONVERSION FOR " + currentScene); + UpdateConvertedScenesFile(convertedScenes); } - DoManifestCleanup(isDebug, pathHandler); } @@ -122,10 +125,9 @@ private static async Task DoConversion(PXZParams pxzParams, SceneConversionInfo } } - private static bool HasSceneBeenConverted(SceneConversionPathHandler pathHandler, string scene) + private static bool HasSceneBeenConverted(List convertedScenes, string scene) { - var d = new DirectoryInfo(pathHandler.OutputPath); - if (d.Exists && d.GetFiles().Length > 0) + if (convertedScenes.Contains(scene)) { Console.WriteLine($"Skipping scene {scene} since its already converted"); return true; @@ -210,12 +212,10 @@ private static async Task ConvertScene(PXZParams pxzParams, SceneConversionPathH SceneRepositioner.SceneRepositioner sceneRepositioner = new SceneRepositioner.SceneRepositioner(pathHandler.ManifestOutputJsonFile, pxzParams.SceneContent, pxz, pathHandler, pxzParams.LodLevel); List models = await sceneRepositioner.SetupSceneInPiXYZ(); - List modifiers = new List(); modifiers.Add(new PXZBeginCleanMaterials()); modifiers.Add(new PXZRepairMesh(models)); - if (pxzParams.LodLevel != 0) { @@ -253,6 +253,23 @@ private static List LoadRoads() return JsonConvert.DeserializeObject>(File.ReadAllText(filePath)); } + private static List LoadConvertedScenes() + { + string convertedScenePathFile = Path.Combine(Directory.GetCurrentDirectory(), "ConvertedScenes.json"); + if (File.Exists(convertedScenePathFile)) + { + return JsonConvert.DeserializeObject>(File.ReadAllText(convertedScenePathFile)); + } + + return new List(); + } + + private static void UpdateConvertedScenesFile(List convertedScenes) + { + string convertedScenePathFile = Path.Combine(Directory.GetCurrentDirectory(), "ConvertedScenes.json"); + File.WriteAllText(convertedScenePathFile, JsonConvert.SerializeObject(convertedScenes)); + } + private static void FrameworkInitialization(string sceneManifestDirectory, bool isDebug) { Console.WriteLine("INSTALLING AND BUILDING NPM"); @@ -275,7 +292,6 @@ private static void InitializePiXYZ() private static void CreateDirectories(SceneConversionInfo sceneConversionInfo) { Directory.CreateDirectory(PXYZConstants.RESOURCES_DIRECTORY); - } public static void CloseApplication(string errorMessage) diff --git a/DCL_PiXYZ/PXZParams.cs b/DCL_PiXYZ/PXZParams.cs index bef8b8b4..c0da29ed 100644 --- a/DCL_PiXYZ/PXZParams.cs +++ b/DCL_PiXYZ/PXZParams.cs @@ -23,7 +23,6 @@ public struct SceneConversionInfo public string DecimationType { get; } public string DecimationValues { get; } public List ScenesToAnalyze { get; set; } - public List AnalyzedScenes { get; set; } public List DecimationToAnalyze { get; set; } public SceneImporter SceneImporter; @@ -38,7 +37,6 @@ public SceneConversionInfo(string decimationValues, string decimationType, strin DecimationType = decimationType; DecimationValues = decimationValues; ScenesToAnalyze = new List(); - AnalyzedScenes = new List(); DecimationToAnalyze = new List(); SceneImporter = null; WebRequestsHandler = new WebRequestsHandler(); From 3b6c0e69a48ab583c8f3b5be18d8e02c494389e3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 18:25:31 -0300 Subject: [PATCH 23/36] Added possibility for outside bulk conversion --- DCL_PiXYZ/PXZEntryPoint.cs | 13 ++++++--- PS1_Files/BulkConversion.ps1 | 31 ++++++++++++++++++++++ consumer-server/src/logic/lod-generator.ts | 2 +- 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 PS1_Files/BulkConversion.ps1 diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index b1e12631..6d1e9987 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -27,6 +27,8 @@ private static async Task RunLODBuilder(string[] args) string defaultSceneLodManifestDirectory = Path.Combine(Directory.GetCurrentDirectory(), "scene-lod-entities-manifest-builder/"); bool isDebug = true; + bool installNPM = true; + if (args.Length > 0) { @@ -34,6 +36,7 @@ private static async Task RunLODBuilder(string[] args) defaultOutputPath = args[2]; defaultSceneLodManifestDirectory = args[3]; bool.TryParse(args[4], out isDebug); + bool.TryParse(args[5], out installNPM); } //Conversion type can be single or bulk @@ -49,7 +52,7 @@ private static async Task RunLODBuilder(string[] args) List roadCoordinates = LoadRoads(); var convertedScenes = LoadConvertedScenes(); CreateDirectories(sceneConversionInfo); - FrameworkInitialization(pathHandler.ManifestProjectDirectory, isDebug); + FrameworkInitialization(pathHandler.ManifestProjectDirectory, installNPM); foreach (string currentScene in sceneConversionInfo.ScenesToAnalyze) { @@ -270,11 +273,13 @@ private static void UpdateConvertedScenesFile(List convertedScenes) File.WriteAllText(convertedScenePathFile, JsonConvert.SerializeObject(convertedScenes)); } - private static void FrameworkInitialization(string sceneManifestDirectory, bool isDebug) + private static void FrameworkInitialization(string sceneManifestDirectory, bool installAndBuildNPM) { - Console.WriteLine("INSTALLING AND BUILDING NPM"); - if (!isDebug) + if (installAndBuildNPM) + { + Console.WriteLine("INSTALLING AND BUILDING NPM"); NPMUtils.DoNPMInstall(sceneManifestDirectory); + } Console.WriteLine("INITIALIZING PIXYZ"); InitializePiXYZ(); } diff --git a/PS1_Files/BulkConversion.ps1 b/PS1_Files/BulkConversion.ps1 new file mode 100644 index 00000000..962b1d86 --- /dev/null +++ b/PS1_Files/BulkConversion.ps1 @@ -0,0 +1,31 @@ +# Get the directory of the current script +$scriptDirectory = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition + +# Construct the path to the directory on the same level as the script +# Replace 'OutputDirectoryPath' with the actual directory name you're targeting +$outputDirectoryPath = Join-Path -Path $scriptDirectory -ChildPath "built-lods" + +# Construct the path to the directory on the same level as the script +$manifestDirectoryPath = Join-Path -Path $scriptDirectory -ChildPath "scene-lod-entities-manifest-builder" + +# We install the manifest project +Set-Location -Path $manifestDirectoryPath +Invoke-Expression "npm i" +Invoke-Expression "npm run build" +Set-Location -Path $scriptDirectory + + +# Define the limit +$limitInt = 5 # Change this to your desired limit + +# Initialize an empty array to hold the strings +$ScenesToAnalyze = @() + +# Nested loops to generate the strings +for ($i = - $limitInt; $i -le $limitInt; $i++) { + for ($j = - $limitInt; $j -le $limitInt; $j++) { + Write-Host "Running for $i,$j" + Start-Process -FilePath "DCL_Pixyz.exe" -ArgumentList @("coords", "$i,$j", $outputDirectoryPath, $manifestDirectoryPath, "true", "false") -Wait + Write-Host "End running for $i,$j" + } +} diff --git a/consumer-server/src/logic/lod-generator.ts b/consumer-server/src/logic/lod-generator.ts index a3bb1344..7577b5f8 100644 --- a/consumer-server/src/logic/lod-generator.ts +++ b/consumer-server/src/logic/lod-generator.ts @@ -23,7 +23,7 @@ export function createLodGeneratorComponent(): LodGeneratorComponent { outputPath: processOutput } - const commandToExecute = `${lodGeneratorProgram} "coords" "${basePointer}" "${outputPath}" "${sceneLodEntitiesManifestBuilder}" "false"` + const commandToExecute = `${lodGeneratorProgram} "coords" "${basePointer}" "${outputPath}" "${sceneLodEntitiesManifestBuilder}" "false" "false"` result = await new Promise((resolve, _) => { exec(commandToExecute, (error, _, stderr) => { if (error || stderr) { From 01a99f76c4be0fa3450423da6b8a9bc946acda04 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Mon, 26 Feb 2024 18:29:48 -0300 Subject: [PATCH 24/36] Added extra parameter in lod conversion test Signed-off-by: Juan Ignacio Molteni --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 0749e397..07374538 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -56,7 +56,7 @@ jobs: node-version: '18.14.2' - name: Run the application - run: .\publish\DCL_PiXYZ.exe "coords" "5,19" "${{ github.workspace }}\publish\OutputDirectoryPath" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" "false" + run: .\publish\DCL_PiXYZ.exe "coords" "5,19" "${{ github.workspace }}\publish\OutputDirectoryPath" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" "false" "true" - name: Check Output Files with Size Tolerance in KB run: | @@ -83,4 +83,4 @@ jobs: } } Write-Host "All files exist and are within the acceptable size range in KB." - shell: pwsh \ No newline at end of file + shell: pwsh From 54e6e7bdbcbd29bcad100325a0d645c02e285dcf Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 28 Feb 2024 06:49:25 -0300 Subject: [PATCH 25/36] Better logging description for DCLGLTFMesh --- .../SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs index eee50dda..2bddffe7 100644 --- a/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs +++ b/DCL_PiXYZ/SceneRepositioner/SceneBuilder/Entities/DCLGLTFMesh.cs @@ -46,7 +46,7 @@ public override PXZModel InstantiateMesh(PiXYZAPI pxz, string entityID, uint par } catch (Exception e) { - LogError($"ERROR pre-processing GLTF with GLTFSharp: {e}"); + LogError($"ERROR pre-processing GLTF with GLTFSharp for file {src}: {e}"); modelRecreatedSuccessfully = false; } From 7b37f7ad1a44409f26632eb8c0eb275e68b1f21c Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 28 Feb 2024 06:56:42 -0300 Subject: [PATCH 26/36] Added case insensitive fix --- DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs b/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs index d7dc6d2a..6224983b 100644 --- a/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs +++ b/DCL_PiXYZ/PiXYZWorflow/PXZDeleteByName.cs @@ -19,7 +19,7 @@ public async Task ApplyModification(PiXYZAPI pxz) { Console.WriteLine("BEGIN PXZ DELETE BY NAME FOR REGEX " + regex); - OccurrenceList occurenceToDelete = pxz.Scene.FindOccurrencesByProperty("Name", regex); + var occurenceToDelete = pxz.Scene.FindOccurrencesByProperty("Name", regex, caseInsensitive: true); foreach (uint u in occurenceToDelete.list) pxz.Scene.DeleteComponentByType(ComponentType.Part, u); } From e1aafad78a6619c745b06780c75b72a2adc13712 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Thu, 29 Feb 2024 11:51:50 -0300 Subject: [PATCH 27/36] Added remote license --- DCL_PiXYZ/PXZEntryPoint.cs | 7 ++-- consumer-server/src/components.ts | 2 +- pixyzsdk-29022024.lic | 70 ------------------------------- 3 files changed, 4 insertions(+), 75 deletions(-) delete mode 100644 pixyzsdk-29022024.lic diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 6d1e9987..3f968d31 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -286,12 +286,11 @@ private static void FrameworkInitialization(string sceneManifestDirectory, bool private static void InitializePiXYZ() { - pxz = - PiXYZAPI.Initialize("PixyzSDKCSharp", - "204dda67aa3ea8bcb22a76bff9aa1224823b253144396405300e235e434c4711591892c19069c7"); + pxz = PiXYZAPI.Initialize("PixyzDecentralandSDK", + "205721ba17a42f2f2d1a7cbd9924ae7f6b3b2531443973231b2c0f45450a0d01260f06716a212dc567b1bf577a"); // if no license is found, try to configure a license server if (!pxz.Core.CheckLicense()) - pxz.Core.InstallLicense("pixyzsdk-29022024.lic"); + pxz.Core.ConfigureLicenseServer("18.204.36.86", 27000); } private static void CreateDirectories(SceneConversionInfo sceneConversionInfo) diff --git a/consumer-server/src/components.ts b/consumer-server/src/components.ts index 0aeb6f99..d74388de 100644 --- a/consumer-server/src/components.ts +++ b/consumer-server/src/components.ts @@ -41,7 +41,7 @@ export async function initComponents(): Promise { const messageConsumer = await createMessagesConsumerComponent({ logs, queue, messageHandler }) - await buildLicense({ config, logs }) + //await buildLicense({ config, logs }) return { config, diff --git a/pixyzsdk-29022024.lic b/pixyzsdk-29022024.lic deleted file mode 100644 index 5a6f0757..00000000 --- a/pixyzsdk-29022024.lic +++ /dev/null @@ -1,70 +0,0 @@ - - - 1 - - - - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2c94e825665cc06c689f0944c0826662a12a9b454fc87152a23b06fd1c25f4047806a0a276e0f092aacdd88eeed0bd81ad0a5343ac684a4be6cebada8aca144af62e7bf69e0fa6d8e8c3f23c9c2e2a923851c81c4ccefa71a2b5bff19f16dff6a4ff6a88380548c4716cdc542fb6a350670e214f115aedd504f6f26528915c7f - \ No newline at end of file From 49ac8d346d596d1d59094d5b638478fe156cfeec Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Thu, 29 Feb 2024 11:59:13 -0300 Subject: [PATCH 28/36] removed copy of license file --- .github/workflows/test-lod-conversion.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 07374538..f525b24d 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -30,12 +30,7 @@ jobs: run: | Copy-Item -Path "${{ github.workspace }}\DCL_PiXYZ\bin\Release\netcoreapp3.1\win10-x64\RoadCoordinates.json" -Destination "${{ github.workspace }}\publish" shell: pwsh - - - name: Copy license file - run: | - Copy-Item -Path "${{ github.workspace }}\pixyzsdk-29022024.lic" -Destination "${{ github.workspace }}\publish" - shell: pwsh - + - name: Install Vulkan SDK uses: jakoch/install-vulkan-sdk-action@v1.0.0 with: From 91a8ff0793e0b6af208d007a62de8034919c1a2e Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 6 Mar 2024 08:12:40 -0300 Subject: [PATCH 29/36] Add wanted tokens --- DCL_PiXYZ/PXZEntryPoint.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 3f968d31..441eee1f 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json; using SceneImporter; using UnityEngine.Pixyz.API; +using UnityEngine.Pixyz.Core; namespace DCL_PiXYZ { @@ -288,6 +289,10 @@ private static void InitializePiXYZ() { pxz = PiXYZAPI.Initialize("PixyzDecentralandSDK", "205721ba17a42f2f2d1a7cbd9924ae7f6b3b2531443973231b2c0f45450a0d01260f06716a212dc567b1bf577a"); + + foreach (string s in pxz.Core.ListTokens().list) + pxz.Core.AddWantedToken(s); + // if no license is found, try to configure a license server if (!pxz.Core.CheckLicense()) pxz.Core.ConfigureLicenseServer("18.204.36.86", 27000); From 5afc4bdcfd2489c513509b37dc4f1a9c236c068b Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 6 Mar 2024 15:45:04 -0300 Subject: [PATCH 30/36] Setting token via env variable --- DCL_PiXYZ/PXZEntryPoint.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index 441eee1f..d79c6a06 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -287,8 +287,7 @@ private static void FrameworkInitialization(string sceneManifestDirectory, bool private static void InitializePiXYZ() { - pxz = PiXYZAPI.Initialize("PixyzDecentralandSDK", - "205721ba17a42f2f2d1a7cbd9924ae7f6b3b2531443973231b2c0f45450a0d01260f06716a212dc567b1bf577a"); + pxz = PiXYZAPI.Initialize(Environment.GetEnvironmentVariable("PiXYZProductName"), Environment.GetEnvironmentVariable("PiXYZToken")); foreach (string s in pxz.Core.ListTokens().list) pxz.Core.AddWantedToken(s); From 8a114d9198c934f8af1cc5ce1d86bfc3d00b0372 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 6 Mar 2024 16:15:55 -0300 Subject: [PATCH 31/36] Changed case of env variable name --- DCL_PiXYZ/PXZEntryPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCL_PiXYZ/PXZEntryPoint.cs b/DCL_PiXYZ/PXZEntryPoint.cs index d79c6a06..98ada1a5 100644 --- a/DCL_PiXYZ/PXZEntryPoint.cs +++ b/DCL_PiXYZ/PXZEntryPoint.cs @@ -287,7 +287,7 @@ private static void FrameworkInitialization(string sceneManifestDirectory, bool private static void InitializePiXYZ() { - pxz = PiXYZAPI.Initialize(Environment.GetEnvironmentVariable("PiXYZProductName"), Environment.GetEnvironmentVariable("PiXYZToken")); + pxz = PiXYZAPI.Initialize(Environment.GetEnvironmentVariable("PIXYZPRODUCTNAME"), Environment.GetEnvironmentVariable("PIXYZTOKEN")); foreach (string s in pxz.Core.ListTokens().list) pxz.Core.AddWantedToken(s); From 5db41a383e5e07491d3ebe5e4fbe9d1733120bcc Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Wed, 6 Mar 2024 16:17:17 -0300 Subject: [PATCH 32/36] Update test-lod-conversion.yml Signed-off-by: Juan Ignacio Molteni --- .github/workflows/test-lod-conversion.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index f525b24d..b5bbdb3d 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -51,6 +51,9 @@ jobs: node-version: '18.14.2' - name: Run the application + env: + PIXYZPRODUCTNAME: ${{ secrets.PIXYZPRODUCTNAME }} + PIXYZTOKEN: ${{ secrets.PIXYZTOKEN }} run: .\publish\DCL_PiXYZ.exe "coords" "5,19" "${{ github.workspace }}\publish\OutputDirectoryPath" "${{ github.workspace }}\publish\scene-lod-entities-manifest-builder" "false" "true" - name: Check Output Files with Size Tolerance in KB From 507ea6c6be2ba6472dd3731f32e2afaea28679d6 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Thu, 7 Mar 2024 11:15:28 -0300 Subject: [PATCH 33/36] fix: properly remove license-builder component --- consumer-server/src/components.ts | 3 --- consumer-server/src/utils/license-builder.ts | 22 -------------------- 2 files changed, 25 deletions(-) delete mode 100644 consumer-server/src/utils/license-builder.ts diff --git a/consumer-server/src/components.ts b/consumer-server/src/components.ts index d74388de..688cf24b 100644 --- a/consumer-server/src/components.ts +++ b/consumer-server/src/components.ts @@ -8,7 +8,6 @@ import { AppComponents, GlobalContext } from './types' import { metricDeclarations } from './metrics' import { createSqsAdapter } from './adapters/sqs' import { createMessagesConsumerComponent } from './logic/message-consumer' -import { buildLicense } from './utils/license-builder' import { createLodGeneratorComponent } from './logic/lod-generator' import { createMessageHandlerComponent } from './logic/message-handler' import { createCloudStorageAdapter } from './adapters/storage' @@ -41,8 +40,6 @@ export async function initComponents(): Promise { const messageConsumer = await createMessagesConsumerComponent({ logs, queue, messageHandler }) - //await buildLicense({ config, logs }) - return { config, logs, diff --git a/consumer-server/src/utils/license-builder.ts b/consumer-server/src/utils/license-builder.ts deleted file mode 100644 index 7549e8bf..00000000 --- a/consumer-server/src/utils/license-builder.ts +++ /dev/null @@ -1,22 +0,0 @@ -import path from 'path' -import fs from 'fs' - -import { AppComponents } from '../types' - -export async function buildLicense({ config, logs }: Pick): Promise { - const logger = logs.getLogger('license-builder') - const licenseKey = (await config.getString('LODS_GENERATOR_LICENSE')) || '' // this is a SSM parameter pulled from AWS - const projectRoot = path.resolve(__dirname, '..', '..', '..') - - try { - const licenseKeyPath = path.resolve(projectRoot, 'pixyzsdk-29022024.lic') - const licenseKeyFile = fs.readFileSync(licenseKeyPath, 'utf8') - const replacedLicenseKey = licenseKeyFile.replace('{LICENSE_KEY}', licenseKey) - - fs.writeFileSync(licenseKeyPath, replacedLicenseKey, 'utf8') - logger.info('PiXYZ license built correctly') - } catch (error: any) { - logger.error('Could not build PiXYZ license', { error: error.message.replace(licenseKey, '****') || '' }) - throw error - } -} From c269ff2ac8a7030e633a5c6b756538dddda92673 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Thu, 7 Mar 2024 11:16:10 -0300 Subject: [PATCH 34/36] refactor: trigger test lod conversion only on PRs --- .github/workflows/test-lod-conversion.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index b5bbdb3d..69c69de3 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -1,8 +1,7 @@ name: Test LOD Conversion on: - pull_request: {} - push: { branches: [main] } + pull_request: jobs: build-and-run: From 795b1f34aafd8c0180756340ed5206282d3d790b Mon Sep 17 00:00:00 2001 From: Juan Ignacio Molteni Date: Thu, 7 Mar 2024 11:24:06 -0300 Subject: [PATCH 35/36] Update test-lod-conversion.yml Signed-off-by: Juan Ignacio Molteni --- .github/workflows/test-lod-conversion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-lod-conversion.yml b/.github/workflows/test-lod-conversion.yml index 69c69de3..96c7f2c4 100644 --- a/.github/workflows/test-lod-conversion.yml +++ b/.github/workflows/test-lod-conversion.yml @@ -64,7 +64,7 @@ jobs: "bafkreictrpcnce5eoink3tdtrm74vgbniho7afl6xoi46lk3iag2u7aju4_2.fbx" ) $expectedSizesB = @(6210224, 631424, 219776 ) # Expected sizes in bytes - $toleranceB = 2000 # 2 KB tolerance + $toleranceB = 3000 # 2 KB tolerance foreach ($i in 0..2) { $filePath = Join-Path -Path $basePath -ChildPath $files[$i] @@ -76,7 +76,7 @@ jobs: $lowerBoundB = $expectedSizesB[$i] - $toleranceB $upperBoundB = $expectedSizesB[$i] + $toleranceB if ($fileSizeInBytes -lt $lowerBoundB -or $fileSizeInBytes -gt $upperBoundB) { - throw "File size mismatch for $filePath. Expected: $($expectedSizesB[$i]) B (+/- 500 B), Found: $fileSizeInBytes bytes" + throw "File size mismatch for $filePath. Expected: $($expectedSizesB[$i]) B (+/- 3000 B), Found: $fileSizeInBytes bytes" } } Write-Host "All files exist and are within the acceptable size range in KB." From 19d9e43b8f3f78cee92b204dfd18270bc528eb51 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Thu, 7 Mar 2024 12:13:32 -0300 Subject: [PATCH 36/36] fix: docker build by removing unused lic --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 97612d43..725a777f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,7 +87,6 @@ COPY --from=dotnet-build /build/publish/ . WORKDIR /app COPY RoadCoordinates.json ./ -COPY ./pixyzsdk-29022024.lic ./pixyzsdk-29022024.lic COPY --from=scene-lod-build /scene-lod/dist ./scene-lod/dist COPY --from=scene-lod-build /scene-lod/package.json ./scene-lod/package.json COPY --from=scene-lod-build /scene-lod/package-lock.json ./scene-lod/package-lock.json