Exemplo n.º 1
0
 public void DrawPhong(Texture texture, Light light, Vector3 ambientColor, Texture specularMap, DepthTexture shadowMapTexture = null, float shadowBias = 0.005f)
 {
     this.Bind();
     this.shader.SetUniform("use_phong", 1f);
     this.shader.SetUniform("light_vector", light.Vector);
     this.shader.SetUniform("light_color", light.Color);
     this.shader.SetUniform("ambient", ambientColor);
     this.shader.SetUniform("shadow_bias", shadowBias);
     if (shadowMapTexture != null)
     {
         this.shader.SetUniform("use_shadow_map", 1f);
         shadowMapTexture.Bind(1);
         this.shader.SetUniform("shadow_map_tex", 1);
         this.shader.SetUniform("depth_vp", light.ShadowProjection);
     }
     if (specularMap != null)
     {
         this.shader.SetUniform("use_specular_map", 1f);
         specularMap.Bind(2);
         this.shader.SetUniform("specular_tex", 2);
     }
     this.DrawTexture(texture);
     this.shader.SetUniform("use_phong", -1f);
     this.shader.SetUniform("use_specular_map", -1f);
     this.shader.SetUniform("use_shadow_map", -1f);
 }
Exemplo n.º 2
0
 public void DrawGouraud(Texture texture, Light light, DepthTexture shadowMapTexture = null, float shadowBias = 0.005f)
 {
     this.Bind();
     this.shader.SetUniform("use_gouraud", 1f);
     this.shader.SetUniform("light_vector", light.Vector);
     this.shader.SetUniform("light_color", light.Color);
     this.shader.SetUniform("shadow_bias", shadowBias);
     if (shadowMapTexture != null)
     {
         this.shader.SetUniform("use_shadow_map", 1f);
         shadowMapTexture.Bind(1);
         this.shader.SetUniform("shadow_map_tex", 1);
         this.shader.SetUniform("depth_vp", light.ShadowProjection);
     }
     this.DrawTexture(texture);
     this.shader.SetUniform("use_gouraud", -1f);
     this.shader.SetUniform("use_shadow_map", -1f);
 }
Exemplo n.º 3
0
 public void DrawPhong(Vector4 color, Light light, Vector3 ambientColor, float shininess = 0, DepthTexture shadowMapTexture = null, float shadowBias = 0.005f)
 {
     this.Bind();
     this.shader.SetUniform("use_phong", 1f);
     this.shader.SetUniform("light_vector", light.Vector);
     this.shader.SetUniform("light_color", light.Color);
     this.shader.SetUniform("ambient", ambientColor);
     this.shader.SetUniform("shadow_bias", shadowBias);
     if (shadowMapTexture != null)
     {
         this.shader.SetUniform("use_shadow_map", 1f);
         shadowMapTexture.Bind(1);
         this.shader.SetUniform("shadow_map_tex", 1);
         this.shader.SetUniform("depth_vp", light.ShadowProjection);
     }
     this.DrawColor(color.X, color.Y, color.Z, color.W);
     this.shader.SetUniform("use_phong", -1f);
     this.shader.SetUniform("use_shadow_map", -1f);
 }
Exemplo n.º 4
0
 public void DrawCel(Texture texture, Light light, Vector3 ambientColor, float threshold = 0.75f, DepthTexture shadowMapTexture = null, float shadowBias = 0.005f)
 {
     this.Bind();
     this.shader.SetUniform("use_cel", 1f);
     this.shader.SetUniform("light_vector", light.Vector);
     this.shader.SetUniform("light_color", light.Color);
     this.shader.SetUniform("ambient", ambientColor);
     this.shader.SetUniform("shininess", 0f);
     this.shader.SetUniform("threshold", threshold);
     this.shader.SetUniform("shadow_bias", shadowBias);
     if (shadowMapTexture != null)
     {
         this.shader.SetUniform("use_shadow_map", 1f);
         shadowMapTexture.Bind(1);
         this.shader.SetUniform("shadow_map_tex", 1);
         this.shader.SetUniform("depth_vp", light.ShadowProjection);
     }
     this.DrawTexture(texture);
     this.shader.SetUniform("use_cel", -1f);
     this.shader.SetUniform("use_shadow_map", -1f);
 }