예제 #1
0
 /// <summary>
 /// Constructs the renderer.
 /// </summary>
 /// <param name="tengine">The relevant texture engine.</param>
 /// <param name="shaderdet">The relevant shader engine.</param>
 /// <param name="modelsdet">The relevant model engine.</param>
 public Renderer(TextureEngine tengine, ShaderEngine shaderdet, ModelEngine modelsdet)
 {
     TEngine = tengine;
     Shaders = shaderdet;
     Models  = modelsdet;
 }
예제 #2
0
 /// <summary>
 /// Constructs a GLFontEngine. Does not initialize.
 /// </summary>
 /// <param name="teng">The texture system.</param>
 /// <param name="sengine">The shader system.</param>
 public GLFontEngine(TextureEngine teng, ShaderEngine sengine)
 {
     Textures = teng;
     Shaders  = sengine;
 }
예제 #3
0
 /// <summary>
 /// Loads the skin for this model.
 /// </summary>
 /// <param name="texs">Texture engine.</param>
 public void LoadSkin(TextureEngine texs)
 {
     if (Skinned)
     {
         return;
     }
     Skinned = true;
     if (Engine.TheClient.Files.Exists("models/" + Name + ".skin"))
     {
         string[] data = Engine.TheClient.Files.ReadText("models/" + Name + ".skin").SplitFast('\n');
         int      c    = 0;
         foreach (string datum in data)
         {
             if (datum.Length > 0)
             {
                 string[] datums = datum.SplitFast('=');
                 if (datums.Length == 2)
                 {
                     Texture tex     = texs.GetTexture(datums[1]);
                     bool    success = false;
                     string  datic   = datums[0].BeforeAndAfter(":::", out string typer);
                     typer = typer.ToLowerFast();
                     for (int i = 0; i < Meshes.Count; i++)
                     {
                         if (Meshes[i].Name == datic)
                         {
                             if (typer == "specular")
                             {
                                 Meshes[i].vbo.Tex_Specular = tex;
                             }
                             else if (typer == "reflectivity")
                             {
                                 Meshes[i].vbo.Tex_Reflectivity = tex;
                             }
                             else if (typer == "normal")
                             {
                                 Meshes[i].vbo.Tex_Normal = tex;
                             }
                             else if (typer == "")
                             {
                                 Meshes[i].vbo.Tex = tex;
                             }
                             else
                             {
                                 SysConsole.Output(OutputType.WARNING, "Unknown skin entry typer: '" + typer + "', expected reflectivity, specular, or simply no specification!");
                             }
                             c++;
                             success = true;
                         }
                     }
                     if (!success)
                     {
                         SysConsole.Output(OutputType.WARNING, "Unknown skin entry " + datums[0]);
                         StringBuilder all = new StringBuilder(Meshes.Count * 100);
                         for (int i = 0; i < Meshes.Count; i++)
                         {
                             all.Append(Meshes[i].Name + ", ");
                         }
                         SysConsole.Output(OutputType.WARNING, "Available: " + all.ToString());
                     }
                 }
             }
         }
         if (c == 0)
         {
             SysConsole.Output(OutputType.WARNING, "No entries in " + Name + ".skin");
         }
     }
     else
     {
         SysConsole.Output(OutputType.WARNING, "Can't find models/" + Name + ".skin!");
     }
 }
예제 #4
0
 /// <summary>
 /// Constructs the renderer - Init() it after!
 /// </summary>
 /// <param name="tengine">Texture engine.</param>
 /// <param name="shaderdet">Shader engine.</param>
 public Renderer2D(TextureEngine tengine, ShaderEngine shaderdet)
 {
     Engine  = tengine;
     Shaders = shaderdet;
 }