Skip to content
Snippets Groups Projects
Commit 711f74d3 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added toggle-able section line highlighting

parent 5a94a6e8
No related branches found
No related tags found
No related merge requests found
...@@ -3,9 +3,15 @@ out vec4 FragColor; ...@@ -3,9 +3,15 @@ out vec4 FragColor;
in vec4 vertexColor; in vec4 vertexColor;
in float colorCoord; in float colorCoord;
in int colorOverridden;
uniform sampler1D colorscheme; uniform sampler1D colorscheme;
void main(){ void main(){
FragColor = texture(colorscheme, colorCoord); if(colorOverridden == 1){
} FragColor = vertexColor;
\ No newline at end of file }
else{
FragColor = texture(colorscheme, colorCoord);
}
}
...@@ -3,6 +3,7 @@ layout (location = 0) in vec3 aPos; ...@@ -3,6 +3,7 @@ layout (location = 0) in vec3 aPos;
out vec4 vertexColor; out vec4 vertexColor;
out float colorCoord; out float colorCoord;
out int colorOverridden;
//perspective related uniforms //perspective related uniforms
uniform mat4 model; uniform mat4 model;
...@@ -15,6 +16,14 @@ uniform float minZ; ...@@ -15,6 +16,14 @@ uniform float minZ;
uniform float maxZ; uniform float maxZ;
uniform float bad_z_value; uniform float bad_z_value;
//Cross section plots lines related uniforms
uniform int plotLinesEnabled;
uniform vec3 plotLineAlongX_color;
uniform vec3 plotLineAlongY_color;
uniform float plotLineAlongX_y;
uniform float plotLineAlongY_x;
uniform float plotLineHalfThickness;
void main(){ void main(){
vec3 position = aPos; vec3 position = aPos;
if(aPos.z != bad_z_value){ if(aPos.z != bad_z_value){
...@@ -26,6 +35,19 @@ void main(){ ...@@ -26,6 +35,19 @@ void main(){
position.z = minZ - 0.5 * scale * (maxZ - minZ); position.z = minZ - 0.5 * scale * (maxZ - minZ);
} }
gl_Position = projection * view * model * vec4(position, 1.0); gl_Position = projection * view * model * vec4(position, 1.0);
vertexColor = vec4(position.z, 0.0, 0.0, 1.);
colorCoord = (aPos.z - minZ)/(maxZ-minZ); colorCoord = (aPos.z - minZ)/(maxZ-minZ);
} vertexColor = vec4(position.z, 0.0, 0.0, 1.);
\ No newline at end of file colorOverridden = 0;
//Check if on cross section line
if(plotLinesEnabled == 1){
if(abs(position.x - plotLineAlongY_x) < plotLineHalfThickness){
colorOverridden = 1;
vertexColor = vec4(plotLineAlongY_color, 1.);
}
else if(abs(position.y - plotLineAlongX_y) < plotLineHalfThickness){
colorOverridden = 1;
vertexColor = vec4(plotLineAlongX_color, 1.);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment