public static int GetTriangleCount(RenderModelInfoInternal model_info, TagManager manager)
            {
                var definition = manager.TagDefinition as Blam.Halo2.Tags.render_model_group;

                int count = 0;

                for (int i = 0; i < model_info.GetGeometryCount(); i++)
                {
                    count += definition.Sections[model_info.GetGeometryIndex(i)].SectionInfo.Value.TotalTriangleCount;
                }
                return(count);
            }
            public static void AddShaderDatums(RenderModelInfoInternal model_info, TagManager manager)
            {
                var definition = manager.TagDefinition as Blam.Halo2.Tags.render_model_group;

                for (int i = 0; i < model_info.GetGeometryCount(); i++)
                {
                    foreach (var part in definition.Sections[model_info.GetGeometryIndex(i)].SectionData[0].Section.Value.Parts)
                    {
                        model_info.AddShaderDatum(definition.Materials[part.Material].Shader.Datum,
                                                  definition.Materials[part.Material].Shader.ToString());
                    }
                }
            }
        void ExportRenderModel(string file_name)
        {
            RenderModelInfoInternal model_info = new RenderModelInfoInternal();

            List <int> added_permutations = new List <int>();

            foreach (int index in registeredInfos)
            {
                RenderModelInfoInternal info = internalInfoList[index] as RenderModelInfoInternal;

                if (!added_permutations.Contains(info.Permutation))
                {
                    added_permutations.Add(info.Permutation);
                }

                for (int i = 0; i < info.GetShaderCount(); i++)
                {
                    model_info.AddShaderDatum(info.GetShaderDatum(i), info.GetShaderName(i));
                }
                for (int i = 0; i < info.GetGeometryCount(); i++)
                {
                    model_info.AddGeometry(info.GetGeometryName(i), info.GetGeometryIndex(i));
                }
            }

            if (added_permutations.Count == 1)
            {
                model_info.Permutation = added_permutations[0];
            }
            else
            {
                model_info.IsMultiplePermutations = true;
            }

            ColladaExportArgs arguments = new ColladaExportArgs(Overwrite, RelativeFilePath, BitmapFormat);
            var exporter = new Halo2.ColladaRenderModelExporter(arguments, model_info, tagIndex, tagManager);

            ExportSave(exporter, RelativeFilePath + file_name + ".dae");
        }
示例#4
0
			public static int GetTriangleCount(RenderModelInfoInternal model_info, TagManager manager)
			{
				var definition = manager.TagDefinition as Blam.Halo2.Tags.render_model_group;

				int count = 0;
				for (int i = 0; i < model_info.GetGeometryCount(); i++)
					count += definition.Sections[model_info.GetGeometryIndex(i)].SectionInfo.Value.TotalTriangleCount;
				return count;
			}
示例#5
0
			public static void AddShaderDatums(RenderModelInfoInternal model_info, TagManager manager)
			{
				var definition = manager.TagDefinition as Blam.Halo2.Tags.render_model_group;

				for(int i = 0; i <  model_info.GetGeometryCount(); i++)
				{
					foreach (var part in definition.Sections[model_info.GetGeometryIndex(i)].SectionData[0].Section.Value.Parts)
						model_info.AddShaderDatum(definition.Materials[part.Material].Shader.Datum,
							definition.Materials[part.Material].Shader.ToString());
				}
			}