public void Green_fern_bush_a_MaterialFileExists() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\CryEngine\green_fern_bush_a.cgf" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(3, actualMaterialsCount); var libraryGeometry = colladaData.DaeObject.Library_Geometries; Assert.AreEqual(3, libraryGeometry.Geometry.Length); // Validate geometry and colors var mesh = colladaData.DaeObject.Library_Geometries.Geometry[0].Mesh; Assert.AreEqual(4, mesh.Source.Length); Assert.AreEqual(2, mesh.Triangles.Length); // Validate Triangles Assert.AreEqual(918, mesh.Triangles[0].Count); Assert.AreEqual("green_fern_bush-material", mesh.Triangles[0].Material); Assert.IsTrue(mesh.Triangles[0].P.Value_As_String.StartsWith("0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 1 1 1 1 1 1 1 1 0 0 0 0 3 3 3 3 5")); Assert.AreEqual(4, mesh.Triangles[0].Input.Length); testUtils.ValidateColladaXml(colladaData); }
public void UnknownSource_spriggan_proto_mesh_skin_NoMaterialFile() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\spriggan_proto_mesh.skin" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); Assert.AreEqual((uint)41, cryData.Models[0].NumChunks); Assert.AreEqual(ChunkTypeEnum.Node, cryData.Models[0].ChunkMap[47].ChunkType); var datastream = cryData.Models[0].ChunkMap[40] as ChunkDataStream_801; Assert.AreEqual((uint)12, datastream.BytesPerElement); Assert.AreEqual((uint)22252, datastream.NumElements); Assert.AreEqual(0.29570183, datastream.Vertices[0].x, testUtils.delta); Assert.AreEqual(0.42320457, datastream.Vertices[0].y, testUtils.delta); Assert.AreEqual(3.24175549, datastream.Vertices[0].z, testUtils.delta); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(0, actualMaterialsCount); //Assert.AreEqual(); testUtils.ValidateColladaXml(colladaData); }
public void TechnomancerPillar_ValidateGeometry() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\Crucible\technomancerpillar.cgf", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); Assert.AreEqual((uint)11, cryData.Models[0].NumChunks); Assert.AreEqual(ChunkTypeEnum.Node, cryData.Models[0].ChunkMap[22].ChunkType); var datastream = cryData.Models[0].ChunkMap[16] as ChunkDataStream_801; Assert.AreEqual((uint)8, datastream.BytesPerElement); Assert.AreEqual((uint)96, datastream.NumElements); Assert.AreEqual(-1.390625, datastream.Vertices[0].x, testUtils.delta); Assert.AreEqual(1.9326171875, datastream.Vertices[0].y, testUtils.delta); Assert.AreEqual(1.9189453125, datastream.Vertices[0].z, testUtils.delta); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(1, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void JungleChase_ValidateGeometry() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SonicBoom\jungle_chase.cgf", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); Assert.AreEqual((uint)24, cryData.Models[0].NumChunks); Assert.AreEqual(ChunkTypeEnum.Node, cryData.Models[0].ChunkMap[47].ChunkType); var datastream = cryData.Models[0].ChunkMap[40] as ChunkDataStream_80000800; Assert.AreEqual((uint)12, datastream.BytesPerElement); Assert.AreEqual((uint)46244, datastream.NumElements); Assert.AreEqual(-130.51466369, datastream.Vertices[0].x, testUtils.delta); Assert.AreEqual(36.3558387756, datastream.Vertices[0].y, testUtils.delta); Assert.AreEqual(24.2049655914, datastream.Vertices[0].z, testUtils.delta); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(12, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void JungleChaseb_ValidateGeometry() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SonicBoom\jungle_chase_b.cgf", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); Assert.AreEqual((uint)30, cryData.Models[0].NumChunks); Assert.AreEqual(ChunkTypeEnum.Node, cryData.Models[0].ChunkMap[59].ChunkType); var datastream = cryData.Models[0].ChunkMap[52] as ChunkDataStream_80000800; Assert.AreEqual((uint)12, datastream.BytesPerElement); Assert.AreEqual((uint)60794, datastream.NumElements); Assert.AreEqual(104.20726013183594, datastream.Vertices[0].x, testUtils.delta); Assert.AreEqual(137.044921875, datastream.Vertices[0].y, testUtils.delta); Assert.AreEqual(24.923294067382812, datastream.Vertices[0].z, testUtils.delta); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(18, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void Checkpoint_ValidateGeometry() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SonicBoom\checkpoint.cgf", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); Assert.AreEqual((uint)17, cryData.Models[0].NumChunks); Assert.AreEqual(ChunkTypeEnum.Node, cryData.Models[0].ChunkMap[33].ChunkType); var datastream = cryData.Models[0].ChunkMap[23] as ChunkDataStream_80000800; Assert.AreEqual((uint)12, datastream.BytesPerElement); Assert.AreEqual((uint)629, datastream.NumElements); Assert.AreEqual(-0.1071479171, datastream.Vertices[0].x, testUtils.delta); Assert.AreEqual(0, datastream.Vertices[0].y, testUtils.delta); Assert.AreEqual(0.983217179775238, datastream.Vertices[0].z, testUtils.delta); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(2, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void ArcheAge_ChrFileTest() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\ArcheAge\coupleduckship_foot.chr", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); }
public void SC_hangar_asteroid_controlroom_fan() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\hangar_asteroid_controlroom_fan.cgf", "-dds", "-dae", "-objectdir", @"..\..\ResourceFiles\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); testUtils.ValidateColladaXml(colladaData); }
public void BehrRifle_312IvoFile() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SC\3.12.0\brfl_fps_behr_p4ar.chr", "-dds", "-dae" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); var colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); var daeObject = colladaData.DaeObject; Assert.AreEqual(1, cryData.Materials.Count); }
public void MWO_candycane_a_MaterialFileNotAvailable() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\candycane_a.chr", "-dds", "-dae", "-objectdir", @"..\..\ResourceFiles\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(2, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void UnknownSource_spriggan_proto_skel_chr_NoMaterialFile() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\spriggan_proto_skel.chr" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(0, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void Prey_Dahl_GenMaleBody01_MaterialFileNotAvailable() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\Prey\Dahl_GenMaleBody01.skin" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(1, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void GhostSniper3_raquel_eyeoverlay_skin() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\Test01\raquel_eyeoverlay.skin", "-dds", "-dae", "-objectdir", @"..\..\ResourceFiles\Test01\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(6, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void SC_LR7_UOPP_VerifyImageFilePath() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SC\LR-7_UOPP.cga" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(2, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void Evolve_griffin_menu_harpoon_skin_NoMaterialFile() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\Evolve\griffin_menu_harpoon.skin" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(0, actualMaterialsCount); testUtils.ValidateColladaXml(colladaData); }
public void AEGS_Avenger_IntegrationTest() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\SC\AEGS_Avenger.cga", "-dds", "-dae", "-objectdir", @"..\..\ResourceFiles\SC\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); var colladaData = new COLLADA(testUtils.argsHandler, cryData); var daeObject = colladaData.DaeObject; colladaData.GenerateDaeObject(); // Make sure Rotations are still right const string frontLGDoorLeftMatrix = "1.000000 0.000000 0.000000 -0.300001 0.000000 -0.938131 -0.346280 0.512432 0.000000 0.346280 -0.938131 -1.835138 0.000000 0.000000 0.000000 1.000000"; var noseNode = daeObject.Library_Visual_Scene.Visual_Scene[0].Node[0].node[0]; Assert.AreEqual("Nose", noseNode.ID); Assert.AreEqual("Front_LG_Door_Left", noseNode.node[28].ID); Assert.AreEqual(frontLGDoorLeftMatrix, noseNode.node[28].Matrix[0].Value_As_String); }
public static int Main(string[] args) { Utils.LogLevel = LogLevelEnum.Warning; Utils.DebugLevel = LogLevelEnum.Debug; string oldTitle = Console.Title; #if DEV_DOLKENSP Utils.LogLevel = LogLevelEnum.None; // Display NO error logs Utils.DebugLevel = LogLevelEnum.Debug; args = new String[] { @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak\pisces_int.soc", "-objectdir", @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak", "-obj", "-outdir", @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak\out" }; #endif #if DEV_MARKEMP Utils.LogLevel = LogLevelEnum.Verbose; // Display ALL error logs in the console Utils.DebugLevel = LogLevelEnum.Debug; // Send all to the IDE Output window //args = new String[] { @"D:\depot\mwo\Objects\mechs\catapult\body\catapult.chr", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" }; //args = new String[] { @"D:\depot\mwo\Objects\environments\frontend\mechlab_a\mechbay_ceilings\mechbay_ceilinga.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" }; //args = new String[] { @"D:\depot\mwo\Objects\environments\industrial\mf_maglev_loader_a.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" }; //args = new String[] { @"D:\depot\MWO\Objects\characters\pilot\pilot_body.chr", "-dds", "-dae", "-objectdir", @"d:\blender projects\mechs\" }; //args = new String[] { @"D:\depot\MWO\Objects\environments\city\im_roads_zone_05\im_zone05_block16.cgf", "-objectdir", @"d:\blender projects\mechs", "-dae" }; //args = new String[] { @"D:\depot\SC\Data\Objects\animals\fish\Fish_JellyFish_prop_animal_01.cga", "-objectdir", @"d:\depot\sc\data", "-dae" }; //args = new String[] { @"D:\depot\SC\Data\Objects\animals\fish\CleanerFish_clean_prop_animal_01.chr", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"d:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Gladius\AEGS_Gladius.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"d:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Retaliator\AEGS_retaliator.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Redeemer\AEGS_Redeemer.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Spaceships\Ships\DRAK\Cutlass\DRAK_Cutlass.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"d:\depot\SC\Data\Objects\buildingsets\human\lowtech\bravo\grimhex\anchor\anchor_gun_a.cgf", "-objectdir", @"d:\depot\sc\data", "-dds", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\heads\male\npc\male09\male09_t1_head.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\export\bhm_skeleton_v7.chr", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\buildingsets\human\universal\org\trees\tree_ash_a.cgf", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\armor\rsi\m_rsi_pilot_flightsuit_01.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\armor\slaver\m_slaver_medium_armor_01_core.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" }; //args = new String[] { @"d:\temp\prey\dahl_genmalebody01.skin", "-objectdir", @"d:\temp\prey", "-dae", "-dds" }; //args = new string[] { @"c:\users\ggerb\source\repos\Cryengine-Converter\cgfconvertertests\resourcefiles\sonicboom\checkpoint.cgf" }; #endif CultureInfo customCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; Thread.CurrentThread.CurrentCulture = customCulture; ArgsHandler argsHandler = new ArgsHandler(); #if !DEBUG try { #endif if (argsHandler.ProcessArgs(args) == 0) { foreach (String inputFile in argsHandler.InputFiles) { try { // Read CryEngine Files CryEngine cryData = new CryEngine(inputFile, argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); if (argsHandler.OutputBlender == true) { Blender blendFile = new Blender(argsHandler, cryData); blendFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1); } if (argsHandler.OutputWavefront == true) { Wavefront objFile = new Wavefront(argsHandler, cryData); objFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1); } if (argsHandler.OutputCryTek == true) { CryRender cryFile = new CryRender(argsHandler, cryData); cryFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1); } if (argsHandler.OutputCollada == true) { COLLADA daeFile = new COLLADA(argsHandler, cryData); daeFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1); } } catch (Exception ex) { Utils.Log(LogLevelEnum.Critical); Utils.Log(LogLevelEnum.Critical, "********************************************************************************"); Utils.Log(LogLevelEnum.Critical, "There was an error rendering {0}", inputFile); Utils.Log(LogLevelEnum.Critical); Utils.Log(LogLevelEnum.Critical, ex.Message); Utils.Log(LogLevelEnum.Critical); Utils.Log(LogLevelEnum.Critical, ex.StackTrace); Utils.Log(LogLevelEnum.Critical, "********************************************************************************"); Utils.Log(LogLevelEnum.Critical); return(1); } } } #if !DEBUG } catch (Exception) { if (argsHandler.Throw) { throw; } } #endif Console.Title = oldTitle; #if (DEV_DOLKENSP || DEV_MARKEMP) Console.WriteLine("Done..."); Console.ReadKey(); #endif return(0); }
public void MWO_timberwolf_chr() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\timberwolf.chr", "-dds", "-dae", "-objectdir", @"d:\depot\lol\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); COLLADA colladaData = new COLLADA(testUtils.argsHandler, cryData); var daeObject = colladaData.DaeObject; colladaData.GenerateDaeObject(); int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); Assert.AreEqual(11, actualMaterialsCount); Assert.AreEqual("Scene", daeObject.Scene.Visual_Scene.Name); Assert.AreEqual("#Scene", daeObject.Scene.Visual_Scene.URL); // Visual Scene Check Assert.AreEqual(1, daeObject.Library_Visual_Scene.Visual_Scene.Length); Assert.AreEqual("Scene", daeObject.Library_Visual_Scene.Visual_Scene[0].ID); Assert.AreEqual(2, daeObject.Library_Visual_Scene.Visual_Scene[0].Node.Length); // Armature Node check var node = daeObject.Library_Visual_Scene.Visual_Scene[0].Node[0]; Assert.AreEqual("Armature", node.ID); Assert.AreEqual("Bip01", node.sID); Assert.AreEqual("Bip01", node.Name); Assert.AreEqual("JOINT", node.Type.ToString()); Assert.AreEqual("0 -1 0 0 1 0 0 0 0 0 1 0 0 0 0 1", node.Matrix[0].Value_As_String); var pelvisNode = node.node[0]; Assert.AreEqual("Armature_Bip01_Pelvis", pelvisNode.ID); Assert.AreEqual("Bip01_Pelvis", pelvisNode.Name); Assert.AreEqual("Bip01_Pelvis", pelvisNode.sID); Assert.AreEqual("JOINT", pelvisNode.Type.ToString()); Assert.AreEqual("0 1 0 0 0 0 1 -0.000001 1 0 0 8.346858 0 0 0 1", pelvisNode.Matrix[0].Value_As_String); Assert.AreEqual(3, pelvisNode.node.Length); var pitchNode = pelvisNode.node.Where(a => a.ID == "Armature_Bip01_Pitch").FirstOrDefault(); var leftHipNode = pelvisNode.node.Where(a => a.ID == "Armature_Bip01_L_Hip").FirstOrDefault(); var rightHipNode = pelvisNode.node.Where(a => a.ID == "Armature_Bip01_R_Hip").FirstOrDefault(); Assert.IsNotNull(pitchNode); Assert.AreEqual("Bip01_Pitch", pitchNode.sID); Assert.AreEqual("0 0.999753 0.022217 -0.000001 0 -0.022217 0.999753 0 1 0 0 1.627025 0 0 0 1", leftHipNode.Matrix[0].Value_As_String); Assert.AreEqual("0 -0.999753 0.022217 -0.000002 0 0.022217 0.999753 0 -1 0 0 -1.627022 0 0 0 1", rightHipNode.Matrix[0].Value_As_String); Assert.AreEqual("0.452222 0.891861 0.008838 0.779598 -0.891905 0.452200 0.004481 0 0 -0.009909 0.999951 0.000001 0 0 0 1", pitchNode.Matrix[0].Value_As_String); // Geometry Node check node = daeObject.Library_Visual_Scene.Visual_Scene[0].Node[1]; Assert.AreEqual("timberwolf.chr", node.ID); Assert.AreEqual("timberwolf.chr", node.Name); Assert.AreEqual("NODE", node.Type.ToString()); Assert.IsNull(node.Instance_Geometry); Assert.AreEqual(1, node.Instance_Controller.Length); Assert.AreEqual("#Armature", node.Instance_Controller[0].Skeleton[0].Value); // Controller check var controller = daeObject.Library_Controllers.Controller[0]; Assert.AreEqual("Controller", controller.ID); var skin = controller.Skin; Assert.AreEqual("#timberwolf-mesh", skin.source); Assert.AreEqual("1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1", skin.Bind_Shape_Matrix.Value_As_String); Assert.AreEqual(3, skin.Source.Length); var controllerJoints = skin.Source.Where(a => a.ID == "Controller-joints").First(); var controllerBindPose = skin.Source.Where(a => a.ID == "Controller-bind_poses").First(); var controllerWeights = skin.Source.Where(a => a.ID == "Controller-weights").First(); var joints = skin.Joints; Assert.AreEqual(64, controllerJoints.Name_Array.Count); Assert.AreEqual("Controller-joints-array", controllerJoints.Name_Array.ID); var nameArray = controllerJoints.Name_Array.Value(); Assert.AreEqual(64, nameArray.Count()); Assert.IsTrue(nameArray.Contains("Bip01")); Assert.IsTrue(nameArray.Contains("Bip01_L_Thigh")); Assert.IsTrue(nameArray.Contains("Bip01_R_Toe0Nub")); var bindPoseArray = "0 1 0 0 -1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 -8.346858 0 1 0 0.000002 -1 0 0 -0.000001 0 0 0 1 -1 0 0 -1.627027 0 -0.022216 0.999753 -8.344796 0 0.999753 0.022216 -0.185437"; Assert.AreEqual(1024, controllerBindPose.Float_Array.Count); Assert.IsTrue(controllerBindPose.Float_Array.Value_As_String.StartsWith(bindPoseArray));; testUtils.ValidateColladaXml(colladaData); }
public void MWO_hbr_right_torso_cga() { var args = new string[] { $@"{userHome}\OneDrive\ResourceFiles\hbr_right_torso.cga", "-dds", "-dae", "-objectdir", @"..\..\ResourceFiles\" }; int result = testUtils.argsHandler.ProcessArgs(args); Assert.AreEqual(0, result); CryEngine cryData = new CryEngine(args[0], testUtils.argsHandler.DataDir.FullName); cryData.ProcessCryengineFiles(); var colladaData = new COLLADA(testUtils.argsHandler, cryData); var daeObject = colladaData.DaeObject; //colladaData.GenerateDaeObject(); colladaData.GenerateDaeObject(); Assert.AreEqual("Scene", daeObject.Scene.Visual_Scene.Name); Assert.AreEqual("#Scene", daeObject.Scene.Visual_Scene.URL); // Visual Scene Check Assert.AreEqual(1, daeObject.Library_Visual_Scene.Visual_Scene.Length); Assert.AreEqual("Scene", daeObject.Library_Visual_Scene.Visual_Scene[0].ID); Assert.AreEqual(1, daeObject.Library_Visual_Scene.Visual_Scene[0].Node.Length); // Node check var node = daeObject.Library_Visual_Scene.Visual_Scene[0].Node[0]; Assert.AreEqual("hbr_right_torso", node.ID); Assert.AreEqual("hbr_right_torso", node.Name); Assert.AreEqual(1, node.Instance_Geometry.Length); Assert.AreEqual(2, node.node.Length); Assert.AreEqual(1, node.Matrix.Length); Assert.AreEqual(1, node.Instance_Geometry.Length); Assert.AreEqual("hbr_right_torso_case", node.node[0].ID); Assert.AreEqual("hbr_right_torso_case", node.node[0].Name); Assert.AreEqual("hbr_right_torso_fx", node.node[1].Name); Assert.AreEqual(Grendgine_Collada_Node_Type.NODE, node.node[0].Type); const string caseMatrix = "-1.000000 -0.000005 0.000008 1.830486 0.000001 -0.866025 -0.500000 -2.444341 0.000009 -0.500000 0.866025 -1.542505 0.000000 0.000000 0.000000 1.000000"; const string fxMatrix = "1.000000 0.000000 0.000009 1.950168 0.000000 1.000000 0.000000 0.630385 -0.000009 0.000000 1.000000 -0.312732 0.000000 0.000000 0.000000 1.000000"; Assert.AreEqual(caseMatrix, node.node[0].Matrix[0].Value_As_String); Assert.AreEqual(fxMatrix, node.node[1].Matrix[0].Value_As_String); // Node Matrix check const string matrix = "1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000"; Assert.AreEqual(matrix, node.Matrix[0].Value_As_String); Assert.AreEqual("transform", node.Matrix[0].sID); // Instance Geometry check Assert.AreEqual("hbr_right_torso", node.Instance_Geometry[0].Name); Assert.AreEqual("#hbr_right_torso-mesh", node.Instance_Geometry[0].URL); Assert.AreEqual(1, node.Instance_Geometry[0].Bind_Material.Length); Assert.AreEqual(1, node.Instance_Geometry[0].Bind_Material[0].Technique_Common.Instance_Material.Length); Assert.AreEqual("hellbringer_body-material", node.Instance_Geometry[0].Bind_Material[0].Technique_Common.Instance_Material[0].Symbol); Assert.AreEqual("#hellbringer_body-material", node.Instance_Geometry[0].Bind_Material[0].Technique_Common.Instance_Material[0].Target); // library_materials Check int actualMaterialsCount = colladaData.DaeObject.Library_Materials.Material.Count(); var materials = colladaData.DaeObject.Library_Materials; Assert.AreEqual(5, actualMaterialsCount); Assert.AreEqual("hellbringer_body-material", materials.Material[0].ID); Assert.AreEqual("decals-material", materials.Material[1].ID); Assert.AreEqual("hellbringer_variant-material", materials.Material[2].ID); Assert.AreEqual("hellbringer_window-material", materials.Material[3].ID); Assert.AreEqual("Material #0-material", materials.Material[4].ID); Assert.AreEqual("#hellbringer_body-effect", materials.Material[0].Instance_Effect.URL); Assert.AreEqual("#decals-effect", materials.Material[1].Instance_Effect.URL); Assert.AreEqual("#hellbringer_variant-effect", materials.Material[2].Instance_Effect.URL); Assert.AreEqual("#hellbringer_window-effect", materials.Material[3].Instance_Effect.URL); Assert.AreEqual("#Material #0-effect", materials.Material[4].Instance_Effect.URL); // library_geometries check Assert.AreEqual(1, colladaData.DaeObject.Library_Geometries.Geometry.Length); var geometry = colladaData.DaeObject.Library_Geometries.Geometry[0]; Assert.AreEqual("hbr_right_torso-mesh", geometry.ID); Assert.AreEqual("hbr_right_torso", geometry.Name); Assert.AreEqual(4, geometry.Mesh.Source.Length); Assert.AreEqual("hbr_right_torso-vertices", geometry.Mesh.Vertices.ID); Assert.AreEqual(1, geometry.Mesh.Triangles.Length); Assert.AreEqual(1908, geometry.Mesh.Triangles[0].Count); var source = geometry.Mesh.Source; var vertices = geometry.Mesh.Vertices; var triangles = geometry.Mesh.Triangles; // Triangles check Assert.AreEqual("hellbringer_body-material", triangles[0].Material); Assert.AreEqual("#hbr_right_torso-mesh-pos", vertices.Input[0].source); Assert.IsTrue(triangles[0].P.Value_As_String.StartsWith("0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 5 5 5 6 6 6 3 3 3 7 7 7 8 8 8 9 9 9 9 9 9")); // Source check Assert.AreEqual("hbr_right_torso-mesh-pos", source[0].ID); Assert.AreEqual("hbr_right_torso-pos", source[0].Name); Assert.AreEqual("hbr_right_torso-mesh-pos-array", source[0].Float_Array.ID); Assert.AreEqual(7035, source[0].Float_Array.Count); var floatArray = source[0].Float_Array.Value_As_String; Assert.IsTrue(floatArray.StartsWith("2.525999 -1.729837 -1.258107 2.526004 -1.863573 -1.080200 2.525999 -1.993050 -1.255200 2.740049 -0.917271 0.684382 2.740053 -0.917271 0.840976 2.793932")); Assert.IsTrue(floatArray.EndsWith("-3.263152 2.340879 -1.480840 -3.231119 2.352005 -1.494859 -3.268093 2.329598 -1.478497 -3.234514 2.335588 -1.491449 -3.273033 2.320036 -1.471824 -3.237391")); Assert.AreEqual((uint)2345, source[0].Technique_Common.Accessor.Count); Assert.AreEqual((uint)0, source[0].Technique_Common.Accessor.Offset); Assert.AreEqual(3, source[0].Technique_Common.Accessor.Param.Length); Assert.AreEqual("X", source[0].Technique_Common.Accessor.Param[0].Name); Assert.AreEqual("float", source[0].Technique_Common.Accessor.Param[0].Type); Assert.AreEqual("hbr_right_torso", daeObject.Library_Visual_Scene.Visual_Scene[0].Node[0].ID); Assert.AreEqual(1, daeObject.Library_Visual_Scene.Visual_Scene[0].Node[0].Instance_Geometry.Length); testUtils.ValidateColladaXml(colladaData); }
public void ProcessCryengineFiles_FileNotFoundException() { var ce = new CryEngine("filename.chr", "datadir"); ce.ProcessCryengineFiles(); }
public void ProcessCryengineFiles_UnsupportedException() { var ce = new CryEngine("filename.bad", "datadir"); ce.ProcessCryengineFiles(); }