Exemplo n.º 1
0
 public static void BoolToIntShaderUniform(Shader shader, bool value, string name)
 {
     // Else if is faster than ternary operator.
     if (value)
     {
         GL.Uniform1(shader.GetVertexAttributeUniformLocation(name), 1);
     }
     else
     {
         GL.Uniform1(shader.GetVertexAttributeUniformLocation(name), 0);
     }
 }
Exemplo n.º 2
0
 private static void SetVertexAttributes(Shader shader)
 {
     // Set the nud vertex attributes.
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vPosition"), 3, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 0);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vNormal"), 3, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 12);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vTangent"), 3, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 24);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vBiTangent"), 3, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 36);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vUV"), 2, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 48);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vColor"), 4, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 56);
     GL.VertexAttribIPointer(shader.GetVertexAttributeUniformLocation("vBone"), 4, VertexAttribIntegerType.Int, NUD.DisplayVertex.Size, new IntPtr(72));
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vWeight"), 4, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 88);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vUV2"), 2, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 104);
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("vUV3"), 2, VertexAttribPointerType.Float, false, NUD.DisplayVertex.Size, 112);
 }
Exemplo n.º 3
0
        public static void DrawScreenTriangle(Shader shader, BufferObject vbo)
        {
            shader.EnableVertexAttributes();
            vbo.Bind();

            // Set everytime because multiple shaders use this for drawing.
            GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("position"), 3, VertexAttribPointerType.Float, false, sizeof(float) * 3, 0);

            GL.DrawArrays(PrimitiveType.Triangles, 0, 3);
            shader.DisableVertexAttributes();
        }
Exemplo n.º 4
0
 public static void SystemColorVector3Uniform(Shader shader, System.Drawing.Color color, string name)
 {
     GL.Uniform3(shader.GetVertexAttributeUniformLocation(name), ColorTools.Vector4FromColor(color).Xyz);
 }
Exemplo n.º 5
0
 public static void LightColorVector3Uniform(Shader shader, LightColor color, string name)
 {
     GL.Uniform3(shader.GetVertexAttributeUniformLocation(name), color.R, color.G, color.B);
 }
Exemplo n.º 6
0
 private void SetVertexAttributes(Shader shader)
 {
     shader.UseProgram();
     GL.VertexAttribPointer(shader.GetVertexAttributeUniformLocation("position"), 3, VertexAttribPointerType.Float, false, sizeof(float) * 3, 0);
 }