예제 #1
0
        private void SetTexture(Dictionary <string, OGLTexture> textures)
        {
            switch (mesh.render.renderMode)
            {
            case MeshRenderModeEnum.Texture:
                texture = textures[mesh.render.textures[0].name];
                break;

            case MeshRenderModeEnum.Material:
                texture = textures["pink"];
                break;
            }
        }
예제 #2
0
        private void LoadTextures(List <Mesh> mesh)
        {
            string baseFolder   = Appli.Instance.Settings.RogueSysemFileRoot;
            string shipFolder   = "/Mod/RogSysCM/Ships/" + Appli.Instance.ShipName + "/";
            string commonFolder = "/Mod/RogSysCM/Shared/Art/Maps/";

            OGLTexture tex = new OGLTexture();

            tex.LoadFromFile(baseFolder + commonFolder + "pink.tex");
            textures["pink"] = tex;

            foreach (Mesh m in mesh)
            {
                if (m.meshType != MeshTypeEnum.LIGHT && m.render.renderMode != MeshRenderModeEnum.Material)
                {
                    string name = m.render.textures[0].name;
                    if (!textures.ContainsKey(name))
                    {
                        tex = new OGLTexture();

                        string filename       = baseFolder + shipFolder + name + ".tex";
                        string commonFilename = baseFolder + commonFolder + name + ".tex";
                        if (File.Exists(filename))
                        {
                            tex.LoadFromFile(filename);
                        }
                        else if (File.Exists(commonFilename))
                        {
                            tex.LoadFromFile(commonFilename);
                        }
                        else
                        {
                            tex.LoadFromFile(baseFolder + commonFolder + "pink.tex");
                        }

                        textures[name] = tex;
                    }
                }
            }
        }