This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 core | |
// Vertex shader for rendering an infinite plane. | |
void main() {} // vertex shader does nothing. All the work is done in the geometry shader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 core | |
// Simplified vertex shader for rendering an infinite plane. | |
layout(location = 1) uniform mat4 projection = mat4(1); | |
layout(location = 2) uniform mat4 view = mat4(1); | |
layout(location = 3) uniform mat4 model = mat4( | |
1, 0, 0, 0, | |
0, 1, 0, 0, | |
0, 0, 1, 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 core | |
in vec4 intersection_model; // in model space | |
out vec4 frag_color; | |
void main() | |
{ | |
// simple but expensive 2: discard pixels not on the plane | |
if (intersection_model.w > 0) | |
discard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 core | |
// Simplified vertex shader for rendering an infinite plane. | |
layout(location = 1) uniform mat4 projection = mat4(1); | |
layout(location = 2) uniform mat4 view = mat4(1); | |
uniform mat4 model = mat4(1); | |
// simple but expensive 1: vertices cover the entire screen | |
// projected screen quad - this is our hard-coded "vertex buffer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample custom iterator. | |
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558) | |
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468 | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <iterator> | |
#include <cassert> |