Beispiel #1
0
        public void Halo1TestCOLLADAModelExport()
        {
            var settings = new TestColladaSettings(
                true,
                Path.Combine(kTestInstallationRootPath, kTestDataDir),
                AssetFormat.bmp);

            using (var handler = new TagIndexHandler <Managers.TagIndex>(BlamVersion.Halo1_CE, kTestInstallationRootPath, kTestTagsDir))
            {
                var tagindex = handler.IndexInterface;
                foreach (var model_def in ModelTestDefinitions)
                {
                    // load the tag with dependents
                    StartStopwatch();
                    {
                        model_def.Open(tagindex);
                        Console.WriteLine("{0} LOAD: Time taken: {1}", model_def.TypeString, m_testStopwatch.Elapsed);
                    }
                    Console.WriteLine("TAG INDEX: Time taken: {0}", StopStopwatch());

                    // create a halo1 collada interface with the gbxmodel datum
                    var    object_tag = tagindex[model_def.TagIndex].TagDefinition as Blam.Halo1.Tags.object_group;
                    var    tagManager = tagindex[object_tag.Model.Datum];
                    string name       = Path.GetFileNameWithoutExtension(model_def.Name);

                    var modelData       = new BlamLib.Render.COLLADA.Halo1.ModelData();
                    var modelShaderData = new BlamLib.Render.COLLADA.Halo1.ModelShaderData();

                    modelData.CollectData(tagindex, tagManager);
                    modelShaderData.CollectData(tagindex, tagManager);

                    var exporter = new BlamLib.Render.COLLADA.Halo1.ColladaModelExporter(settings,
                                                                                         tagindex,
                                                                                         tagManager);

                    exporter.MessageSent +=
                        (object sender, BlamLib.Messaging.MessageArgs args) =>
                    {
                        Console.WriteLine("COLLADA_ERROR: {0}", args.Message);
                    };

                    exporter.AddDataProvider(modelData);
                    exporter.AddDataProvider(modelShaderData);

                    StartStopwatch();

                    Assert.IsTrue(exporter.BuildColladaInstance(), "Failed to build collada instance for {0}", model_def.Name);
                    exporter.SaveDAE(Path.Combine(kTestResultsDataPath, modelData.GetRelativeURL()) + ".dae");

                    Console.WriteLine("EXPORT {0} TIME: Time taken: {1}", name, StopStopwatch());

                    model_def.Close(tagindex);
                }
            }
        }
Beispiel #2
0
        public void Halo1TestCOLLADABSPExport()
        {
            var settings = new TestColladaSettings(
                true,
                Path.Combine(kTestInstallationRootPath, kTestDataDir),
                AssetFormat.bmp);

            using (var handler = new TagIndexHandler <Managers.TagIndex>(BlamVersion.Halo1_CE, kTestInstallationRootPath, kTestTagsDir))
            {
                var tagindex = handler.IndexInterface;
                foreach (var model_def in BSPTestDefinitions)
                {
                    StartStopwatch();
                    {
                        model_def.Open(tagindex);
                        Console.WriteLine(model_def.TypeString + " LOAD: Time taken: {0}", m_testStopwatch.Elapsed);
                    }
                    Console.WriteLine("TAG INDEX: Time taken: {0}", StopStopwatch());

                    var tagManager = tagindex[model_def.TagIndex];

                    var bspData       = new BlamLib.Render.COLLADA.Halo1.StructureBSPData();
                    var bspShaderData = new BlamLib.Render.COLLADA.Halo1.StructureBSPShaderData();

                    bspData.CollectData(tagindex, tagManager);
                    bspShaderData.CollectData(tagindex, tagManager);

                    var exporter = new BlamLib.Render.COLLADA.Halo1.ColladaBSPExporter(settings,
                                                                                       tagindex,
                                                                                       tagManager);

                    exporter.MessageSent +=
                        (object sender, BlamLib.Messaging.MessageArgs args) =>
                    {
                        Console.WriteLine("COLLADA_ERROR: {0}", args.Message);
                    };

                    exporter.AddDataProvider(bspData);
                    exporter.AddDataProvider(bspShaderData);

                    StartStopwatch();

                    Assert.IsTrue(exporter.BuildColladaInstance(), "Failed to build collada instance for {0}", model_def.Name);
                    exporter.SaveDAE(Path.Combine(kTestResultsDataPath, tagManager.Name) + ".dae");

                    Console.WriteLine("EXPORT {0} TIME: Time taken: {1}", model_def.Name, StopStopwatch());

                    model_def.Close(tagindex);
                }
            }
        }
Beispiel #3
0
		public void Halo1TestCOLLADAScenarioExport()
		{
			var settings = new TestColladaSettings(
				true,
				Path.Combine(kTestInstallationRootPath, kTestDataDir),
				AssetFormat.bmp);

			using (var handler = new TagIndexHandler<Managers.TagIndex>(BlamVersion.Halo1_CE, kTestInstallationRootPath, kTestDataDir))
			{
				var tagindex = handler.IndexInterface;
				foreach (var scenario_def in ScenarioTestDefinitions)
				{
					StartStopwatch();
					{
						scenario_def.Open(tagindex);
						Console.WriteLine(scenario_def.TypeString + " LOAD: Time taken: {0}", m_testStopwatch.Elapsed);
					}
					Console.WriteLine("TAG INDEX: Time taken: {0}", StopStopwatch());

					var tagManager = tagindex[scenario_def.TagIndex];

					var scenarioData = new BlamLib.Render.COLLADA.Halo1.ScenarioData();

					scenarioData.CollectData(tagindex, tagManager);

					var exporter = new BlamLib.Render.COLLADA.Halo1.ColladaScenarioExporter(settings,
						tagindex,
						tagManager);

					exporter.MessageSent +=
						(object sender, BlamLib.Messaging.MessageArgs args) =>
						{
							Console.WriteLine("COLLADA_ERROR: {0}", args.Message);
						};

					exporter.AddDataProvider(scenarioData);

					StartStopwatch();

					Assert.IsTrue(exporter.BuildColladaInstance(), "Failed to build collada instance for {0}", scenario_def.Name);
					exporter.SaveDAE(Path.Combine(kTestResultsDataPath, tagManager.Name) + "-objects.dae");

					Console.WriteLine("EXPORT {0} TIME: Time taken: {1}", scenario_def.Name, StopStopwatch());

					scenario_def.Close(tagindex);
				}
			}
		}
Beispiel #4
0
		public void Halo1TestCOLLADAModelExport()
		{
			var settings = new TestColladaSettings(
				true,
				Path.Combine(kTestInstallationRootPath, kTestDataDir),
				AssetFormat.bmp);

			using (var handler = new TagIndexHandler<Managers.TagIndex>(BlamVersion.Halo1_CE, kTestInstallationRootPath, kTestTagsDir))
			{
				var tagindex = handler.IndexInterface;
				foreach (var model_def in ModelTestDefinitions)
				{
					// load the tag with dependents
					StartStopwatch();
					{
						model_def.Open(tagindex);
						Console.WriteLine("{0} LOAD: Time taken: {1}", model_def.TypeString, m_testStopwatch.Elapsed);
					}
					Console.WriteLine("TAG INDEX: Time taken: {0}", StopStopwatch());
					
					// create a halo1 collada interface with the gbxmodel datum
					var object_tag = tagindex[model_def.TagIndex].TagDefinition as Blam.Halo1.Tags.object_group;
					var tagManager = tagindex[object_tag.Model.Datum];
					string name = Path.GetFileNameWithoutExtension(model_def.Name);

					var modelData = new BlamLib.Render.COLLADA.Halo1.ModelData();
					var modelShaderData = new BlamLib.Render.COLLADA.Halo1.ModelShaderData();
					
					modelData.CollectData(tagindex, tagManager);
					modelShaderData.CollectData(tagindex, tagManager);

					var exporter = new BlamLib.Render.COLLADA.Halo1.ColladaModelExporter(settings,
						tagindex,
						tagManager);

					exporter.MessageSent +=
						(object sender, BlamLib.Messaging.MessageArgs args) =>
						{
							Console.WriteLine("COLLADA_ERROR: {0}", args.Message);
						};

					exporter.AddDataProvider(modelData);
					exporter.AddDataProvider(modelShaderData);

					StartStopwatch();

					Assert.IsTrue(exporter.BuildColladaInstance(), "Failed to build collada instance for {0}", model_def.Name);
					exporter.SaveDAE(Path.Combine(kTestResultsDataPath, modelData.GetRelativeURL()) + ".dae");

					Console.WriteLine("EXPORT {0} TIME: Time taken: {1}", name, StopStopwatch());

					model_def.Close(tagindex);
				}
			}
		}