Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::Shapes Namespace Reference

Classes

class  Arrow
 A rounded arrow shape defined by a arrow and a cone. More...
 
class  Box
 A simple box with bounded limits. More...
 
class  CameraRep
 Camera visual representation. More...
 
class  Cone
 A simple cone shape. More...
 
class  CoordinateAxes
 Visual representation of a 3D coordinate axes. More...
 
class  Cylinder
 A simple cylinder shape. More...
 
class  Plane
 A simple plane with bounded limits. More...
 
class  Quad
 A simple unitary quad. More...
 
class  Sphere
 A simple sphere shape. More...
 

Variables

const string arrow_fragment_code
 Default fragment shader for rendering arrow. More...
 
const string arrow_vertex_code
 Default vertex shader for rendering arrow. More...
 
const string box_fragment_code
 Default fragment shader for rendering box. More...
 
const string box_vertex_code
 Default vertex shader for rendering box. More...
 
const string camerarep_fragment_code
 Default fragment shader for rendering camera representation. More...
 
const string camerarep_vertex_code
 Default vertex shader for rendering trackball representation. More...
 
const string cone_fragment_code
 Default fragment shader for rendering cone. More...
 
const string cone_vertex_code
 Default vertex shader for rendering cone. More...
 
const string cylinder_fragment_code
 Default fragment shader for rendering cylinder. More...
 
const string cylinder_vertex_code
 Default vertex shader for rendering cylinder. More...
 
const string plane_fragment_code
 Default fragment shader for rendering plane. More...
 
const string plane_vertex_code
 Default vertex shader for rendering plane. More...
 
const string quad_fragment_code
 Default fragment shader for rendering quad. More...
 
const string quad_vertex_code
 Default vertex shader for rendering quad. More...
 
const string sphere_fragment_code
 Default fragment shader for rendering sphere. More...
 
const string sphere_vertex_code
 Default vertex shader for rendering sphere. More...
 

Variable Documentation

const string Tucano::Shapes::arrow_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"void main(void)\n"
"{\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering arrow.

const string Tucano::Shapes::arrow_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"in vec4 in_Normal;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Normal.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering arrow.

const string Tucano::Shapes::box_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"void main(void)\n"
"{\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" if (dot(normal, eyeDirection) < 0.0) discard;\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering box.

const string Tucano::Shapes::box_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"in vec4 in_Normal;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Normal.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering box.

const string Tucano::Shapes::camerarep_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 ex_Color;\n"
"out vec4 out_Color;\n"
"in float depth;\n"
"void main(void)\n"
"{\n"
" out_Color = ex_Color;\n"
" gl_FragDepth = depth;\n"
"}\n"

Default fragment shader for rendering camera representation.

const string Tucano::Shapes::camerarep_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"out vec4 ex_Color;\n"
"out float depth;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"uniform float nearPlane;\n"
"uniform float farPlane;\n"
"void main(void)\n"
"{\n"
" gl_Position = (viewMatrix * modelMatrix) * in_Position;\n"
" depth = (farPlane+nearPlane)/(farPlane-nearPlane) + ( (2*nearPlane*farPlane)/(farPlane-nearPlane) ) * (1/gl_Position[2]);\n"
" depth = (depth+1.0)/2.0;\n"
" gl_Position = projectionMatrix * gl_Position;\n"
" ex_Color = in_Color;\n"
"}\n"

Default vertex shader for rendering trackball representation.

const string Tucano::Shapes::cone_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"void main(void)\n"
"{\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering cone.

const string Tucano::Shapes::cone_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"in vec4 in_Normal;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Normal.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering cone.

const string Tucano::Shapes::cylinder_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"uniform int with_cap;\n"
"void main(void)\n"
"{\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" if (with_cap == 1 && dot(normal, eyeDirection) < 0.0) discard;\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering cylinder.

const string Tucano::Shapes::cylinder_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"in vec4 in_Normal;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Normal.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering cylinder.

const string Tucano::Shapes::plane_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"void main(void)\n"
"{\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" //if (dot(normal, eyeDirection) < 0.0) discard;\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering plane.

const string Tucano::Shapes::plane_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"in vec4 in_Normal;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Normal.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering plane.

const string Tucano::Shapes::quad_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"out vec4 out_Color;\n"
"void main(void)\n"
"{\n"
" out_Color = color;\n"
"}\n"

Default fragment shader for rendering quad.

const string Tucano::Shapes::quad_vertex_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 in_Position;\n"
"out vec4 color;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering quad.

const string Tucano::Shapes::sphere_fragment_code
Initial value:
= "\n"
"#version 430\n"
"in vec4 color;\n"
"in vec3 normal;\n"
"in vec4 vert;\n"
"out vec4 out_Color;\n"
"uniform mat4 lightViewMatrix;\n"
"void main(void)\n"
"{\n"
" vec3 eyeDirection = -normalize(vert.xyz);\n"
" if (dot(normal, eyeDirection) < 0.0) discard;\n"
" vec3 lightDirection = (lightViewMatrix * vec4(0.0, 0.0, 1.0, 0.0)).xyz;\n"
" lightDirection = normalize(lightDirection);\n"
" vec3 lightReflection = reflect(-lightDirection, normal);\n"
" float shininess = 100.0;\n"
" vec4 ambientLight = color * 0.4;\n"
" vec4 diffuseLight = color * 0.6 * max(dot(lightDirection, normal),0.0);\n"
" vec4 specularLight = vec4(1.0) * max(pow(dot(lightReflection, eyeDirection), shininess),0.0);\n"
" out_Color = vec4(ambientLight.xyz + diffuseLight.xyz + specularLight.xyz, color.w);\n"
"}\n"

Default fragment shader for rendering sphere.

const string Tucano::Shapes::sphere_vertex_code
Initial value:
= "\n"
"#version 430\n"
"layout(location=0) in vec4 in_Position;\n"
"out vec4 color;\n"
"out vec3 normal;\n"
"out vec4 vert;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 viewMatrix;\n"
"uniform mat4 projectionMatrix;\n"
"uniform vec4 in_Color;\n"
"void main(void)\n"
"{\n"
" mat4 modelViewMatrix = viewMatrix * modelMatrix;\n"
" mat4 normalMatrix = transpose(inverse(modelViewMatrix));\n"
" normal = normalize(vec3(normalMatrix * vec4(in_Position.xyz,0.0)).xyz);\n"
" vert = modelViewMatrix * in_Position;\n"
" gl_Position = projectionMatrix * modelViewMatrix * in_Position;\n"
" color = in_Color;\n"
"}\n"

Default vertex shader for rendering sphere.