mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 11:09:37 -06:00
Removing quadFrag, singlepassraycaster and twopassraycaster shaders
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform sampler2D quadTex;
|
||||
in vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
color = texture(quadTex, texCoord);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec2 texCoordinate;
|
||||
layout(location = 2) in vec3 vertPosition;
|
||||
|
||||
in vec4 position;
|
||||
out vec2 texCoord;
|
||||
|
||||
const vec2 screenScale = vec2(0.5, 0.5);
|
||||
|
||||
void main() {
|
||||
texCoord = vertPosition.xy*screenScale+screenScale; // scale vertex attribute to [0-1] range
|
||||
gl_Position = vec4(vertPosition.xy, 0.0, 1.0);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
in vec4 position;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = position;
|
||||
texCoord = position.xy/2.0 + 0.5;
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
uniform sampler3D texVolume;
|
||||
uniform mat4 modelView;
|
||||
uniform mat4 modelViewProjection;
|
||||
uniform float focalLength;
|
||||
uniform vec2 windowSize;
|
||||
uniform vec3 rayOrigin;
|
||||
uniform float stepSize;
|
||||
|
||||
const int maxNumSamples = 128;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
struct Ray {
|
||||
vec3 Origin;
|
||||
vec3 Dir;
|
||||
};
|
||||
|
||||
struct AABB {
|
||||
vec3 Min;
|
||||
vec3 Max;
|
||||
};
|
||||
|
||||
bool IntersectBox(Ray r, AABB box, out float t0, out float t1) {
|
||||
vec3 invR = 1.0 / r.Dir;
|
||||
vec3 tbot = invR * (box.Min-r.Origin);
|
||||
vec3 ttop = invR * (box.Max-r.Origin);
|
||||
vec3 tmin = min(ttop, tbot);
|
||||
vec3 tmax = max(ttop, tbot);
|
||||
vec2 t = max(tmin.xx, tmin.yz);
|
||||
t0 = max(t.x, t.y);
|
||||
t = min(tmax.xx, tmax.yz);
|
||||
t1 = min(t.x, t.y);
|
||||
return t0 <= t1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 rayDirection;
|
||||
rayDirection.x = 2.0 * gl_FragCoord.x / windowSize.x - 1.0;
|
||||
rayDirection.y = 2.0 * gl_FragCoord.y / windowSize.y - 1.0;
|
||||
rayDirection.z = -focalLength;
|
||||
rayDirection = (vec4(rayDirection, 0) * modelView).xyz;
|
||||
|
||||
Ray eye = Ray( rayOrigin, normalize(rayDirection) );
|
||||
AABB box = AABB(vec3(-1.0), vec3(1.0));
|
||||
|
||||
float tnear, tfar;
|
||||
IntersectBox(eye, box, tnear, tfar);
|
||||
tnear = max(tnear, 0.0);
|
||||
|
||||
vec3 front = eye.Origin + eye.Dir* tnear;
|
||||
vec3 back = eye.Origin + eye.Dir* tfar;
|
||||
front = 0.5 * (front + 1.0);
|
||||
back = 0.5 * (back + 1.0);
|
||||
|
||||
vec3 direction = back-front;
|
||||
float directionLength = length(direction);
|
||||
direction = normalize(direction);
|
||||
vec3 position = front;
|
||||
vec4 tmp, color = vec4(0);
|
||||
int i = 0;
|
||||
|
||||
while (length(position-front) < directionLength && color.r != 1.0 && i < maxNumSamples) {
|
||||
++i;
|
||||
tmp = texture(texVolume, position);
|
||||
color = max(color, tmp); // MIP
|
||||
position = position + direction * stepSize;
|
||||
}
|
||||
|
||||
fragColor = vec4(color.rrr,1.0);
|
||||
|
||||
// // DEBUG DEBUG DEBUG
|
||||
// fragColor = vec4(front, 1.0);
|
||||
// if (front.x < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.45 && front.x < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
|
||||
// if (front.y > 0.45 && front.y < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 24) out;
|
||||
uniform mat4 modelViewProjection;
|
||||
in vec4 vPosition[1];
|
||||
|
||||
vec4 objCube[8]; // Object space coordinate of cube corner
|
||||
vec4 ndcCube[8]; // Normalized device coordinate of cube corner
|
||||
ivec4 faces[6]; // Vertex indices of the cube faces
|
||||
|
||||
void emit_vert(int vert) {
|
||||
gl_Position = ndcCube[vert];
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
void emit_face(int face) {
|
||||
emit_vert(faces[face][1]); emit_vert(faces[face][0]);
|
||||
emit_vert(faces[face][3]); emit_vert(faces[face][2]);
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
void main() {
|
||||
faces[0] = ivec4(0,1,3,2); faces[1] = ivec4(5,4,6,7);
|
||||
faces[2] = ivec4(4,5,0,1); faces[3] = ivec4(3,2,7,6);
|
||||
faces[4] = ivec4(0,3,4,7); faces[5] = ivec4(2,1,6,5);
|
||||
|
||||
float size = 0.5;
|
||||
vec4 P = vPosition[0];
|
||||
vec4 I = vec4(size, 0, 0, 0);
|
||||
vec4 J = vec4(0, size, 0, 0);
|
||||
vec4 K = vec4(0, 0, size, 0);
|
||||
|
||||
objCube[0] = P+K+I+J; objCube[1] = P+K+I-J;
|
||||
objCube[2] = P+K-I-J; objCube[3] = P+K-I+J;
|
||||
objCube[4] = P-K+I+J; objCube[5] = P-K+I-J;
|
||||
objCube[6] = P-K-I-J; objCube[7] = P-K-I+J;
|
||||
|
||||
// Transform the corners of the box:
|
||||
for (int vert = 0; vert < 8; vert++)
|
||||
ndcCube[vert] = modelViewProjection * objCube[vert];
|
||||
|
||||
// Emit the six faces:
|
||||
for (int face = 0; face < 6; face++)
|
||||
emit_face(face);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
layout(location = 0) in vec4 Position;
|
||||
out vec4 vPosition;
|
||||
uniform mat4 modelViewProjection;
|
||||
|
||||
void main() {
|
||||
gl_Position = modelViewProjection * Position;
|
||||
vPosition = Position;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform sampler2D texBack, texFront;
|
||||
uniform sampler3D texVolume;
|
||||
uniform float stepSize;
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec2 texCoords;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec3 front = texture(texFront, texCoords).xyz;
|
||||
vec3 back = texture(texBack, texCoords).xyz;
|
||||
vec3 direction = back-front;
|
||||
float directionLength = length(direction);
|
||||
direction = normalize(direction);
|
||||
vec3 position = front;
|
||||
vec4 tmp, color = vec4(0);
|
||||
|
||||
while (length(position-front) < directionLength && color.r != 1.0) {
|
||||
tmp = texture(texVolume, position);
|
||||
color = max(color, tmp); // MIP
|
||||
position = position + direction * stepSize;
|
||||
}
|
||||
|
||||
fragColor = vec4(color.rrr, 1.0);
|
||||
|
||||
// // DEBUG DEBUG DEBUG
|
||||
// fragColor = vec4(front, 1.0);
|
||||
// if (front.x < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.45 && front.x < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
|
||||
// if (front.y > 0.45 && front.y < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec2 texCoordinate;
|
||||
layout(location = 2) in vec3 vertPosition;
|
||||
|
||||
out vec3 vPosition;
|
||||
out vec2 texCoords;
|
||||
|
||||
// Source: http://stackoverflow.com/questions/2588875/whats-the-best-way-to-draw-a-fullscreen-quad-in-opengl-3-2
|
||||
const vec2 screenScale = vec2(0.5, 0.5);
|
||||
|
||||
void main() {
|
||||
texCoords = vertPosition.xy*screenScale+screenScale; // scale vertex attribute to [0-1] range
|
||||
gl_Position = vec4(vertPosition.xy, 0.0, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user