Example #1
0
        /// <summary>
        /// Creates geometries for the relevant lightmap meshes that are to be included in the collada file
        /// </summary>
        void CreateGeometryList()
        {
            H2.Tags.scenario_structure_bsp_group definition = tagManager.TagDefinition as H2.Tags.scenario_structure_bsp_group;

            if (bspInfo.IncludeRenderMesh())
            {
                // create a list of all the shaders used
                List <string> shader_list = new List <string>();
                foreach (var material in definition.Materials)
                {
                    shader_list.Add(Path.GetFileNameWithoutExtension(material.Shader.ToString()));
                }

                // create a geometry element for each cluster
                for (int i = 0; i < definition.Clusters.Count; i++)
                {
                    string name = String.Format("{0}-{1}", ColladaUtilities.FormatName(tagName, " ", "_"), i);

                    // create the geometry element
                    CreateGeometryHalo2(name, false,
                                        definition.Clusters[i].SectionInfo,
                                        definition.Clusters[i].ClusterData[0].Section.Value,
                                        shader_list);
                }
            }
            if (bspInfo.IncludePortalsMesh())
            {
                // create a geometry element for each cluster portal
                for (int i = 0; i < definition.ClusterPortals.Count; i++)
                {
                    CreatePortalsGeometry(i);
                }
            }
        }
Example #2
0
        protected override bool BuildColladaInstanceImpl()
        {
            COLLADAFile = new ColladaFile();

            COLLADAFile.Version = "1.4.1";
            AddAsset(
                System.Environment.UserName,
                "OpenSauceIDE:ColladaBuilder",
                "meter", 0.0254, Enums.ColladaUpAxisEnum.Z_UP);

            if (bspInfo.IncludeRenderMesh())
            {
                CreateImageList();
                CreateEffectList();
                CreateMaterialList();
            }

            if (bspInfo.IncludePortalsMesh())
            {
                CreateEffectListPortals();
                CreateMaterialListPortals();
            }

            CreateGeometryList();
            CreateNodeList();
            CreateMarkerList();

            AddLibraryImages();
            AddLibraryEffects();
            AddLibraryMaterials();
            AddLibraryGeometries();
            AddLibraryVisualScenes();
            AddScene("main");

            return(true);
        }