Skip to content

Instantly share code, notes, and snippets.

@mahulst
Last active February 26, 2018 20:27
Show Gist options
  • Save mahulst/cacdf340ce969f482c3507bd266f45b5 to your computer and use it in GitHub Desktop.
Save mahulst/cacdf340ce969f482c3507bd266f45b5 to your computer and use it in GitHub Desktop.

Revisions

  1. mahulst revised this gist Feb 26, 2018. 2 changed files with 11 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@

    void main () {
    float y = calculateSurface(position.x, position.y);

    vec3 p1 = vec3(vert1.x, calculateSurface(vert1.x, vert1.y), vert1.y);
    vec3 p2 = vec3(vert2.x, calculateSurface(vert2.x, vert2.y), vert2.y);
    vec3 p3 = vec3(vert3.x, calculateSurface(vert3.x, vert3.y), vert3.y);
    vec3 normal = normalize(cross(p2 - p3, p1 - p2));

    gl_Position = perspective * camera * vec4(vec3(position.x, y, position.y), 1.0);
    vcolor = normal;
    }
    11 changes: 11 additions & 0 deletions vertexShader.glsl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    void main () {
    float y = calculateSurface(position.x, position.y);

    vec3 p1 = vec3(vert1.x, calculateSurface(vert1.x, vert1.y), vert1.y);
    vec3 p2 = vec3(vert2.x, calculateSurface(vert2.x, vert2.y), vert2.y);
    vec3 p3 = vec3(vert3.x, calculateSurface(vert3.x, vert3.y), vert3.y);
    vec3 normal = normalize(cross(p2 - p3, p1 - p2));

    gl_Position = perspective * camera * vec4(vec3(position.x, y, position.y), 1.0);
    vcolor = normal;
    }
  2. mahulst created this gist Feb 26, 2018.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@

    void main () {
    float y = calculateSurface(position.x, position.y);

    vec3 p1 = vec3(vert1.x, calculateSurface(vert1.x, vert1.y), vert1.y);
    vec3 p2 = vec3(vert2.x, calculateSurface(vert2.x, vert2.y), vert2.y);
    vec3 p3 = vec3(vert3.x, calculateSurface(vert3.x, vert3.y), vert3.y);
    vec3 normal = normalize(cross(p2 - p3, p1 - p2));

    gl_Position = perspective * camera * vec4(vec3(position.x, y, position.y), 1.0);
    vcolor = normal;
    }