9 namespace visualization {
17 "uniform sampler2D image_texture;\n" 19 "out vec4 FragColor;\n" 23 " FragColor = texture(image_texture, UV);\n" 37 namespace visualization {
45 "uniform sampler2D image_texture;\n" 47 "uniform vec3 mask_color;\n" 48 "uniform float mask_alpha;\n" 50 "out vec4 FragColor;\n" 54 " FragColor = vec4(mask_color, texture(image_texture, UV).r * mask_alpha);\n" 68 namespace visualization {
75 "in vec3 vertex_position;\n" 76 "in vec2 vertex_UV;\n" 82 " gl_Position = vec4(vertex_position, 1);\n" 97 namespace visualization {
104 "in vec3 vertex_position;\n" 105 "in vec2 vertex_UV;\n" 109 "uniform vec3 vertex_scale;\n" 113 " gl_Position = vec4(vertex_position * vertex_scale, 1);\n" 128 namespace visualization {
135 "in vec3 vertex_normal_camera;\n" 136 "out vec4 FragColor;\n" 140 " FragColor = vec4(vertex_normal_camera * 0.5 + 0.5, 1);\n" 154 namespace visualization {
161 "in vec3 vertex_position;\n" 162 "in vec3 vertex_normal;\n" 164 "out vec3 vertex_normal_camera;\n" 166 "uniform mat4 MVP;\n" 172 " gl_Position = MVP * vec4(vertex_position, 1);\n" 173 " vertex_normal_camera = (V * M * vec4(vertex_normal, 0)).xyz;\n" 187 namespace visualization {
194 "in vec3 vertex_position_world;\n" 195 "in vec3 vertex_normal_camera;\n" 196 "in vec3 eye_dir_camera;\n" 197 "in mat4 light_dir_camera_4;\n" 198 "in vec3 fragment_color;\n" 200 "uniform mat4 light_color_4;\n" 201 "uniform vec4 light_diffuse_power_4;\n" 202 "uniform vec4 light_specular_power_4;\n" 203 "uniform vec4 light_specular_shininess_4;\n" 204 "uniform vec4 light_ambient;\n" 206 "out vec4 FragColor;\n" 210 " vec3 diffuse_color = fragment_color;\n" 211 " vec3 ambient_color = light_ambient.xyz * diffuse_color;\n" 212 " vec3 specular_color = vec3(1.0, 1.0, 1.0);\n" 215 " vec3 n, e, l, r;\n" 217 " n = normalize(vertex_normal_camera);\n" 218 " e = normalize(eye_dir_camera);\n" 219 " l = normalize(light_dir_camera_4[0].xyz);\n" 220 " r = reflect(-l, n);\n" 221 " cos_theta[0] = clamp(dot(n, l), 0, 1);\n" 222 " cos_alpha[0] = clamp(dot(e, r), 0, 1);\n" 224 " l= normalize(light_dir_camera_4[1].xyz);\n" 225 " r = reflect(-l, n);\n" 226 " cos_theta[1] = clamp(dot(n, l), 0, 1);\n" 227 " cos_alpha[1] = clamp(dot(e, r), 0, 1);\n" 229 " l= normalize(light_dir_camera_4[2].xyz);\n" 230 " r = reflect(-l, n);\n" 231 " cos_theta[2] = clamp(dot(n, l), 0, 1);\n" 232 " cos_alpha[2] = clamp(dot(e, r), 0, 1);\n" 234 " l= normalize(light_dir_camera_4[3].xyz);\n" 235 " r = reflect(-l, n);\n" 236 " cos_theta[3] = clamp(dot(n, l), 0, 1);\n" 237 " cos_alpha[3] = clamp(dot(e, r), 0, 1);\n" 239 " FragColor = vec4(ambient_color + \n" 240 " diffuse_color * light_color_4[0].xyz * light_diffuse_power_4[0] * cos_theta[0] +\n" 241 " specular_color * light_color_4[0].xyz * light_specular_power_4[0] * pow(cos_alpha[0], light_specular_shininess_4[0]) +\n" 242 " diffuse_color * light_color_4[1].xyz * light_diffuse_power_4[1] * cos_theta[1] +\n" 243 " specular_color * light_color_4[1].xyz * light_specular_power_4[1] * pow(cos_alpha[1], light_specular_shininess_4[1]) +\n" 244 " diffuse_color * light_color_4[2].xyz * light_diffuse_power_4[2] * cos_theta[2] +\n" 245 " specular_color * light_color_4[2].xyz * light_specular_power_4[2] * pow(cos_alpha[2], light_specular_shininess_4[2]) +\n" 246 " diffuse_color * light_color_4[3].xyz * light_diffuse_power_4[3] * cos_theta[3] +\n" 247 " specular_color * light_color_4[3].xyz * light_specular_power_4[3] * pow(cos_alpha[3], light_specular_shininess_4[3]), 1);\n" 261 namespace visualization {
268 "in vec3 vertex_position;\n" 269 "in vec3 vertex_normal;\n" 270 "in vec3 vertex_color;\n" 272 "out vec3 vertex_position_world;\n" 273 "out vec3 vertex_normal_camera;\n" 274 "out vec3 eye_dir_camera;\n" 275 "out mat4 light_dir_camera_4;\n" 276 "out vec3 fragment_color;\n" 278 "uniform mat4 MVP;\n" 281 "uniform mat4 light_position_world_4;\n" 285 " gl_Position = MVP * vec4(vertex_position, 1);\n" 286 " vertex_position_world = (M * vec4(vertex_position, 1)).xyz;\n" 288 " vec3 vertex_position_camera = (V * M * vec4(vertex_position, 1)).xyz;\n" 289 " eye_dir_camera = vec3(0, 0, 0) - vertex_position_camera;\n" 291 " vec4 v = vec4(vertex_position_camera, 1);\n" 292 " light_dir_camera_4 = V * light_position_world_4 - mat4(v, v, v, v);\n" 294 " vertex_normal_camera = (V * M * vec4(vertex_normal, 0)).xyz;\n" 295 " if (dot(eye_dir_camera, vertex_normal_camera) < 0.0)\n" 296 " vertex_normal_camera = vertex_normal_camera * -1.0;\n" 298 " fragment_color = vertex_color;\n" 312 namespace visualization {
319 "in vec4 fragment_color;\n" 320 "out vec4 FragColor;\n" 324 " FragColor = fragment_color;\n" 338 namespace visualization {
345 "in vec3 vertex_position;\n" 346 "in float vertex_index;\n" 347 "uniform mat4 MVP;\n" 349 "out vec4 fragment_color;\n" 353 " float r, g, b, a;\n" 354 " gl_Position = MVP * vec4(vertex_position, 1);\n" 355 " r = floor(vertex_index / 16777216.0) / 255.0;\n" 356 " g = mod(floor(vertex_index / 65536.0), 256.0) / 255.0;\n" 357 " b = mod(floor(vertex_index / 256.0), 256.0) / 255.0;\n" 358 " a = mod(vertex_index, 256.0) / 255.0;\n" 359 " fragment_color = vec4(r, g, b, a);\n" 373 namespace visualization {
381 "uniform sampler2D image_texture;\n" 384 "/* built-in option to ensure RGB and D are handled in the same shader,\n" 385 " which can be used in 2 passes */\n" 386 "#define DEPTH_TEXTURE_MODE 0\n" 387 "#define RGB_TEXTURE_MODE 1\n" 388 "#define GRAYSCALE_TEXTURE_MODE 2\n" 389 "uniform int texture_mode;\n" 391 "/* Decides the colormap of the depth image */\n" 392 "uniform float depth_max;\n" 393 "out vec4 FragColor;\n" 395 "float Interpolate(float value, float y0, float x0, float y1, float x1) {\n" 396 " if (value < x0) return y0;\n" 397 " if (value > x1) return y1;\n" 398 " return (value - x0) * (y1 - y0) / (x1 - x0) + y0;\n" 401 "float Jet(float value /* already clamped in [0, 1] */) {\n" 402 " if (value <= -0.75) {\n" 404 " } else if (value <= -0.25) {\n" 405 " return Interpolate(value, 0.0, -0.75, 1.0, -0.25);\n" 406 " } else if (value <= 0.25) {\n" 408 " } else if (value <= 0.75) {\n" 409 " return Interpolate(value, 1.0, 0.25, 0.0, 0.75);\n" 416 " if (texture_mode == DEPTH_TEXTURE_MODE) {\n" 417 " float depth = texture(image_texture, UV).r;\n" 418 " depth = clamp(depth, 0, depth_max);\n" 419 " depth = depth / depth_max;\n" 420 " depth = 2 * depth - 1;\n" 421 " FragColor = vec4(Jet(depth - 0.5), Jet(depth), Jet(depth + 0.5), 1);\n" 422 " } else if (texture_mode == RGB_TEXTURE_MODE) {\n" 423 " FragColor = texture(image_texture, UV);\n" 424 " } else if (texture_mode == GRAYSCALE_TEXTURE_MODE) {\n" 425 " float scalar = texture(image_texture, UV).r;\n" 426 " FragColor = vec4(vec3(scalar), 1);\n" 441 namespace visualization {
448 "in vec3 fragment_color;\n" 449 "out vec4 FragColor;\n" 453 " FragColor = vec4(fragment_color, 1);\n" 467 namespace visualization {
474 "in vec3 vertex_position;\n" 475 "in vec3 vertex_color;\n" 477 "out vec3 fragment_color;\n" 481 " gl_Position = vec4(vertex_position, 1);\n" 482 " fragment_color = vertex_color;\n" 496 namespace visualization {
503 "out vec4 FragColor;\n" 507 " FragColor = vec4(0.1, 0.1, 0.1, 1);\n" 521 namespace visualization {
528 "in vec3 vertex_position;\n" 529 "uniform mat4 MVP;\n" 533 " gl_Position = MVP * vec4(vertex_position, 1);\n" 547 namespace visualization {
554 "in vec3 fragment_color;\n" 555 "out vec4 FragColor;\n" 559 " FragColor = vec4(fragment_color, 1);\n" 573 namespace visualization {
580 "in vec3 vertex_position;\n" 581 "in vec3 vertex_color;\n" 582 "uniform mat4 MVP;\n" 584 "out vec3 fragment_color;\n" 588 " gl_Position = MVP * vec4(vertex_position, 1);\n" 589 " fragment_color = vertex_color;\n" 603 namespace visualization {
610 "in vec3 vertex_position_world;\n" 611 "in vec3 vertex_normal_camera;\n" 612 "in vec3 eye_dir_camera;\n" 613 "in mat4 light_dir_camera_4;\n" 614 "in vec2 fragment_uv;\n" 616 "uniform mat4 light_color_4;\n" 617 "uniform vec4 light_diffuse_power_4;\n" 618 "uniform vec4 light_specular_power_4;\n" 619 "uniform vec4 light_specular_shininess_4;\n" 620 "uniform vec4 light_ambient;\n" 621 "uniform sampler2D diffuse_texture;\n" 623 "out vec4 FragColor;\n" 627 " vec3 diffuse_color = texture(diffuse_texture, fragment_uv).rgb;\n" 628 " vec3 ambient_color = light_ambient.xyz * diffuse_color;\n" 629 " vec3 specular_color = vec3(1.0, 1.0, 1.0);\n" 632 " vec3 n, e, l, r;\n" 634 " n = normalize(vertex_normal_camera);\n" 635 " e = normalize(eye_dir_camera);\n" 636 " l = normalize(light_dir_camera_4[0].xyz);\n" 637 " r = reflect(-l, n);\n" 638 " cos_theta[0] = clamp(dot(n, l), 0, 1);\n" 639 " cos_alpha[0] = clamp(dot(e, r), 0, 1);\n" 641 " l= normalize(light_dir_camera_4[1].xyz);\n" 642 " r = reflect(-l, n);\n" 643 " cos_theta[1] = clamp(dot(n, l), 0, 1);\n" 644 " cos_alpha[1] = clamp(dot(e, r), 0, 1);\n" 646 " l= normalize(light_dir_camera_4[2].xyz);\n" 647 " r = reflect(-l, n);\n" 648 " cos_theta[2] = clamp(dot(n, l), 0, 1);\n" 649 " cos_alpha[2] = clamp(dot(e, r), 0, 1);\n" 651 " l= normalize(light_dir_camera_4[3].xyz);\n" 652 " r = reflect(-l, n);\n" 653 " cos_theta[3] = clamp(dot(n, l), 0, 1);\n" 654 " cos_alpha[3] = clamp(dot(e, r), 0, 1);\n" 656 " FragColor = vec4(ambient_color + \n" 657 " diffuse_color * light_color_4[0].xyz * light_diffuse_power_4[0] * cos_theta[0] +\n" 658 " specular_color * light_color_4[0].xyz * light_specular_power_4[0] * pow(cos_alpha[0], light_specular_shininess_4[0]) +\n" 659 " diffuse_color * light_color_4[1].xyz * light_diffuse_power_4[1] * cos_theta[1] +\n" 660 " specular_color * light_color_4[1].xyz * light_specular_power_4[1] * pow(cos_alpha[1], light_specular_shininess_4[1]) +\n" 661 " diffuse_color * light_color_4[2].xyz * light_diffuse_power_4[2] * cos_theta[2] +\n" 662 " specular_color * light_color_4[2].xyz * light_specular_power_4[2] * pow(cos_alpha[2], light_specular_shininess_4[2]) +\n" 663 " diffuse_color * light_color_4[3].xyz * light_diffuse_power_4[3] * cos_theta[3] +\n" 664 " specular_color * light_color_4[3].xyz * light_specular_power_4[3] * pow(cos_alpha[3], light_specular_shininess_4[3]), 1);\n" 678 namespace visualization {
685 "in vec3 vertex_position;\n" 686 "in vec3 vertex_normal;\n" 687 "in vec2 vertex_uv;\n" 689 "out vec3 vertex_position_world;\n" 690 "out vec3 vertex_normal_camera;\n" 691 "out vec3 eye_dir_camera;\n" 692 "out mat4 light_dir_camera_4;\n" 693 "out vec2 fragment_uv;\n" 695 "uniform mat4 MVP;\n" 698 "uniform mat4 light_position_world_4;\n" 702 " gl_Position = MVP * vec4(vertex_position, 1);\n" 703 " vertex_position_world = (M * vec4(vertex_position, 1)).xyz;\n" 705 " vec3 vertex_position_camera = (V * M * vec4(vertex_position, 1)).xyz;\n" 706 " eye_dir_camera = vec3(0, 0, 0) - vertex_position_camera;\n" 708 " vec4 v = vec4(vertex_position_camera, 1);\n" 709 " light_dir_camera_4 = V * light_position_world_4 - mat4(v, v, v, v);\n" 711 " vertex_normal_camera = (V * M * vec4(vertex_normal, 0)).xyz;\n" 712 " if (dot(eye_dir_camera, vertex_normal_camera) < 0.0)\n" 713 " vertex_normal_camera = vertex_normal_camera * -1.0;\n" 715 " fragment_uv = vertex_uv;\n" 730 namespace visualization {
737 "in vec2 fragment_uv;\n" 738 "out vec4 FragColor;\n" 740 "uniform sampler2D diffuse_texture;\n" 744 " FragColor = texture(diffuse_texture, fragment_uv);\n" 758 namespace visualization {
765 "in vec3 vertex_position;\n" 766 "in vec2 vertex_uv;\n" 767 "uniform mat4 MVP;\n" 769 "out vec2 fragment_uv;\n" 773 " gl_Position = MVP * vec4(vertex_position, 1);\n" 774 " fragment_uv = vertex_uv;\n" const char *const PhongFragmentShader
Definition: Shader.h:191
const char *const TextureSimpleVertexShader
Definition: Shader.h:762
const char *const PickingVertexShader
Definition: Shader.h:342
const char *const TexturePhongVertexShader
Definition: Shader.h:682
const char *const PickingFragmentShader
Definition: Shader.h:316
const char *const ImageFragmentShader
Definition: Shader.h:13
const char *const TextureSimpleFragmentShader
Definition: Shader.h:734
const char *const ImageMaskFragmentShader
Definition: Shader.h:41
const char *const Simple2DVertexShader
Definition: Shader.h:471
const char *const NormalFragmentShader
Definition: Shader.h:132
const char *const TexturePhongFragmentShader
Definition: Shader.h:607
const char *const RGBDImageFragmentShader
Definition: Shader.h:377
Definition: Open3DViewer.h:29
const char *const PhongVertexShader
Definition: Shader.h:265
const char *const ImageMaskVertexShader
Definition: Shader.h:72
const char *const SimpleBlackFragmentShader
Definition: Shader.h:500
const char *const ImageVertexShader
Definition: Shader.h:101
const char *const SimpleVertexShader
Definition: Shader.h:577
const char *const Simple2DFragmentShader
Definition: Shader.h:445
const char *const SimpleBlackVertexShader
Definition: Shader.h:525
const char *const SimpleFragmentShader
Definition: Shader.h:551
const char *const NormalVertexShader
Definition: Shader.h:158