Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vairdraw-src
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pirvi-public
vairdraw
vairdraw-src
Commits
e2552851
Commit
e2552851
authored
8 years ago
by
sdegrande
Browse files
Options
Downloads
Patches
Plain Diff
OpenVR distrotion program: use raw string litterals for prettier code.
parent
81a98675
No related branches found
Tags
v0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/HardwareSet/OpenVRSet/DistortionProgram.cpp
+51
-44
51 additions, 44 deletions
src/HardwareSet/OpenVRSet/DistortionProgram.cpp
with
51 additions
and
44 deletions
src/HardwareSet/OpenVRSet/DistortionProgram.cpp
+
51
−
44
View file @
e2552851
...
...
@@ -11,48 +11,55 @@ DistortionProgram::DistortionProgram()
:
Program
(
"OpenVRDistortion"
)
{
setShadersFromString
(
"OpenVR distortion vertex shader"
,
"#version 330 core "
" "
"layout(location = 0) in vec4 position; "
"layout(location = 1) in vec2 v2UVredIn; "
"layout(location = 2) in vec2 v2UVGreenIn; "
"layout(location = 3) in vec2 v2UVblueIn; "
"noperspective out vec2 v2UVred; "
"noperspective out vec2 v2UVgreen; "
"noperspective out vec2 v2UVblue; "
" "
"void main() "
"{ "
" v2UVred = v2UVredIn; "
" v2UVgreen = v2UVGreenIn; "
" v2UVblue = v2UVblueIn; "
" gl_Position = position; "
"} "
,
{},
{},
"OpenVR distrotion fragment shader"
,
"#version 330 core "
" "
"uniform sampler2D mytexture; "
" "
"noperspective in vec2 v2UVred; "
"noperspective in vec2 v2UVgreen; "
"noperspective in vec2 v2UVblue; "
" "
"out vec4 outputColor; "
" "
"void main() "
"{ "
" float fBoundsCheck = dot(vec2(lessThan(v2UVgreen.xy, vec2(0.05, 0.05))), vec2(1.0, 1.0)) + "
" dot(vec2(greaterThan(v2UVgreen.xy, vec2(0.95, 0.95))), vec2(1.0, 1.0)); "
" if (fBoundsCheck > 1.0) { "
" outputColor = vec4(0, 0, 0, 1.0); "
" } else { "
" float red = texture(mytexture, v2UVred).x; "
" float green = texture(mytexture, v2UVgreen).y; "
" float blue = texture(mytexture, v2UVblue).z; "
" outputColor = vec4(red, green, blue, 1.0); "
" } "
"} "
);
"OpenVR distortion vertex shader"
,
R"VS(
#version 330 core
layout(location = 0) in vec4 position;
layout(location = 1) in vec2 v2UVredIn;
layout(location = 2) in vec2 v2UVGreenIn;
layout(location = 3) in vec2 v2UVblueIn;
noperspective out vec2 v2UVred;
noperspective out vec2 v2UVgreen;
noperspective out vec2 v2UVblue;
void main()
{
v2UVred = v2UVredIn;
v2UVgreen = v2UVGreenIn;
v2UVblue = v2UVblueIn;
gl_Position = position;
}
)VS"
,
{},
{},
"OpenVR distortion fragment shader"
,
R"FS(
#version 330 core
uniform sampler2D mytexture;
noperspective in vec2 v2UVred;
noperspective in vec2 v2UVgreen;
noperspective in vec2 v2UVblue;
out vec4 outputColor;
void main()
{
float fBoundsCheck = dot(vec2(lessThan(v2UVgreen.xy, vec2(0.05, 0.05))), vec2(1.0, 1.0)) +
dot(vec2(greaterThan(v2UVgreen.xy, vec2(0.95, 0.95))), vec2(1.0, 1.0));
if (fBoundsCheck > 1.0) {
outputColor = vec4(0, 0, 0, 1.0);
} else {
float red = texture(mytexture, v2UVred).x;
float green = texture(mytexture, v2UVgreen).y;
float blue = texture(mytexture, v2UVblue).z;
outputColor = vec4(red, green, blue, 1.0);
}
} "
)FS"
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment