summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-03-16 19:49:14 +0100
committerFlorian Jung <flo@windfisch.org>2015-03-16 19:49:14 +0100
commit928302f76b243e50a032f18399813fa9a27b7b8c (patch)
tree1258f8b006d85940aa6c2ed3138ca1c5eeb31ae6
parent81d4cdb0de47a001e0498e8ad144cb25cabd09c4 (diff)
spherical projection III: vignette
-rw-r--r--client2.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/client2.cpp b/client2.cpp
index 0f1f1ac..5b04602 100644
--- a/client2.cpp
+++ b/client2.cpp
@@ -63,7 +63,7 @@ const char* drawOnCanvasFragmentSource =
"const float CAM_YRES=720;\n"
"const float CAM_XDEG=70/180.*3.141592654;\n"
"const float CAM_FX=CAM_XRES/2.0 / tan(CAM_XDEG/2.0);\n"
- //"const float CAM_FX=1;\n"
+ "const float margin_thickness=100;\n"
"const mat3 cam_cal = transpose(mat3(CAM_FX, 0, CAM_XRES/2, 0, CAM_FX, CAM_YRES/2, 0,0,1));\n"
"const mat3 math_to_opencv = transpose(mat3(0,1,0, 0,0,1, -1,0,0));\n"
"in vec2 Texcoord;\n"
@@ -82,7 +82,12 @@ const char* drawOnCanvasFragmentSource =
" if ( point_in_cam_pic_uniform.z < 0 && \n"
" (0 <= point_in_cam_pic.x && point_in_cam_pic.x < CAM_XRES) && \n"
" (0 <= point_in_cam_pic.y && point_in_cam_pic.y < CAM_YRES) ) \n"
+ " {\n"
" outColor = texture(texVideo, vec2(1.0,1.0)-point_in_cam_pic/vec2(CAM_XRES,CAM_YRES));\n"
+ " float xmarg = min( (min(point_in_cam_pic.x, CAM_XRES-point_in_cam_pic.x)/margin_thickness), 1.0);\n"
+ " float ymarg = min( (min(point_in_cam_pic.y, CAM_YRES-point_in_cam_pic.y)/margin_thickness), 1.0);\n"
+ " outColor.a=xmarg*ymarg;\n"
+ " }\n"
//" outColor = vec4(point_in_cam_pic/vec2(CAM_XRES,CAM_YRES),-point_in_cam_pic_uniform.z/1000,1);\n"
" else\n"
" outColor = vec4(0.0,0.0,0.0,0.00);"