예제 #1
0
 public void RenderMesh(Matrix4 location, Matrix4 VP, INormalShader shader)
 {
     shader.SetColor(Metal.Color);
     shader.SetModelspaceMatrix(location);
     shader.SetMVP(location * VP);
     MeshCollection.Ingot.Draw();
 }
예제 #2
0
 public void RenderWithShader(Matrix4 VP, INormalShader shader)
 {
     foreach (Entity e in entities)
     {
         e.Render(this, VP, shader);
     }
 }
예제 #3
0
        public override void Render(Scene s, Matrix4 VP, INormalShader shader)
        {
            base.Render(s, VP, shader);

            shader.SetModelspaceMatrix(doorModelspace);
            shader.SetMVP(doorModelspace * VP);
            door.Draw();
        }
예제 #4
0
 public override void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     shader.SetModelspaceMatrix(Modelspace);
     shader.SetMVP(Modelspace * VP);
     hatchHole.Draw();
     shader.SetModelspaceMatrix(hatchTransform * Modelspace);
     shader.SetMVP(hatchTransform * Modelspace * VP);
     hatch.Draw();
 }
예제 #5
0
 public override void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     shader.SetModelspaceMatrix(Modelspace);
     shader.SetMVP(Modelspace * VP);
     box.Draw();
     shader.SetModelspaceMatrix(lidModelMatrix);
     shader.SetMVP(lidModelMatrix * VP);
     lid.Draw();
 }
예제 #6
0
 public override void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     shader.SetModelspaceMatrix(bellowModelspace);
     shader.SetMVP(bellowModelspace * VP);
     bellow.Draw();
     shader.SetModelspaceMatrix(Modelspace);
     shader.SetMVP(Modelspace * VP);
     rig.Draw();
 }
예제 #7
0
 public override void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     shader.SetModelspaceMatrix(Modelspace);
     shader.SetMVP(Modelspace * VP);
     Draw(s);
     if (game.GameStats.CurrentCast != null)
     {
         UpdateCastMatrix();
         shader.SetModelspaceMatrix(castModelspace * Modelspace);
         shader.SetMVP(castModelspace * Modelspace * VP);
         shader.SetColor(game.GameStats.CurrentCast.GetColor());
         game.GameStats.CurrentCast.GetMesh().Draw();
         shader.ResetColor();
     }
 }
예제 #8
0
 public override void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     base.Render(s, VP, shader);
     for (int i = 0; i < game.GameStats.FoundryIngots.Capacity; i++)
     {
         if (game.GameStats.FoundryIngots [i] != null && game.GameStats.FoundryIngots [i].GetSolidProgress() > 0.2f)
         {
             game.GameStats.FoundryIngots [i].RenderMesh(Matrix4.CreateScale(1, 1, game.GameStats.FoundryIngots [i].GetSolidProgress()) * IngotMatrices [i] * Modelspace, VP, shader);
         }
     }
     if (game.GameStats.FoundryIngots.Count > 0)
     {
         shader.ResetColor();                  //Reset the color afterwards
     }
 }
예제 #9
0
        public void Render(Matrix4 VP, Vector3 eyePos)
        {
            foreach (Entity e in entities)
            {
                e.PreRender(this, VP);
            }

            ForAmbientShader.Instance.Bind();
            ForAmbientShader.Instance.SetAmbientLight(AmbientLight);
            ForAmbientShader.Instance.ResetColor();
            foreach (Entity e in entities)
            {
                e.Render(this, VP, ForAmbientShader.Instance);
                                #if TEST_COLOR_RESET
                if (!ForAmbientShader.Instance.IsColorReset())
                {
                    Console.Error.WriteLine("The shader's color wasn't reset after calling the render function of entity: " + e.ToString());
                    ForAmbientShader.Instance.ResetColor();
                }
                                #endif
            }


            foreach (ILight light in lights)
            {
                INormalShader shader = light.GetUseShader(this, eyePos);
                shader.ResetColor();

                GL.DepthFunc(DepthFunction.Equal);
                GL.DepthMask(false);
                GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);

                foreach (Entity e in entities)
                {
                    e.Render(this, VP, shader);
                }

                GL.DepthFunc(DepthFunction.Lequal);
                GL.DepthMask(true);
                GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            }

            foreach (Entity e in entities)
            {
                e.PostRender(this, VP);
            }
        }
예제 #10
0
 public virtual void Render(Scene s, Matrix4 VP, INormalShader shader)
 {
     shader.SetModelspaceMatrix(Modelspace);
     shader.SetMVP(Modelspace * VP);
     Draw(s);
 }