8#ifndef GLUP_NO_GL_CLIPPING 
    9in 
float gl_ClipDistance[];
 
   13    vec4 vertex_clip_space;
 
   16#if GLUP_PRIMITIVE_DIMENSION==2 
   23bool is_triangle(in vec4 mesh_tex_coord) {
 
   25        !glupIsEnabled(GLUP_CLIPPING) ||
 
   26        GLUP.clipping_mode != GLUP_CLIP_SLICE_CELLS
 
   28        switch(glup_primitive) {
 
   43         mesh_tex_coord.w) < 1.5
 
   47float edge_factor(in vec4 mesh_tex_coord) {
 
   48    if(is_triangle(mesh_tex_coord)) {
 
   49        return edge_factor3(mesh_tex_coord.xyz);
 
   51        return edge_factor4(mesh_tex_coord);
 
   55vec4 glup_draw_mesh(in vec4 color, in vec4 mesh_tex_coord) {
 
   57        GLUP.mesh_color, color, edge_factor(mesh_tex_coord)
 
   64#ifndef GLUP_NO_GL_CLIPPING 
   65    if(glupIsEnabled(GLUP_CLIPPING) && (gl_ClipDistance[0] < 0.0)) {
 
   71    if(glupIsEnabled(GLUP_PRIMITIVE_FILTERING)) {
 
   72        glup_primitive_filter(gl_PrimitiveID);
 
   75    if(glupIsEnabled(GLUP_PICKING)) {
 
   76        glup_FragColor = glup_picking(gl_PrimitiveID);
 
   81    if(glupIsEnabled(GLUP_VERTEX_COLORS)) {
 
   82        result = FragmentIn.color;
 
   84        result = gl_FrontFacing ? GLUP.front_color : GLUP.back_color;
 
   87    if(glupIsEnabled(GLUP_TEXTURING) && !glupIsEnabled(GLUP_NORMAL_MAPPING)) {
 
   88        result = glup_texturing(result, FragmentIn.tex_coord);
 
   90    if(glupIsEnabled(GLUP_LIGHTING)) {
 
   93            glupIsEnabled(GLUP_TEXTURING) &&
 
   94            glupIsEnabled(GLUP_NORMAL_MAPPING)
 
   96            N = glup_texturing(
vec4(1.0,1.0,1.0,1.0), FragmentIn.tex_coord).xyz;
 
   97            N = N-
vec3(0.5,0.5,0.5);
 
  103#if GLUP_PRIMITIVE_DIMENSION==2 
  104            if(glupIsEnabled(GLUP_VERTEX_NORMALS)) {
 
  106                if(!gl_FrontFacing) {
 
  112                vec3 U = dFdx(FragmentIn.vertex_clip_space.xyz);
 
  113                vec3 V = dFdy(FragmentIn.vertex_clip_space.xyz);
 
  117                        GLUP.projection_matrix[0].xyz,
 
  118                        GLUP.projection_matrix[1].xyz,
 
  119                        GLUP.projection_matrix[2].xyz
 
  125        result = glup_lighting(result, N);
 
  127    if(glupIsEnabled(GLUP_DRAW_MESH)) {
 
  128        result = glup_draw_mesh(result, FragmentIn.mesh_tex_coord);
 
  130    glup_FragColor = result;
 
  131    glup_alpha_discard();
 
vec3 cross(vec3 v1, vec3 v2)
Computes the cross product between two vectors.
vec3 normalize(vec3 v)
Computes a normalized vector.
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
vecng< 4, Numeric::float64 > vec4
Represents points and vectors in 4d.
Matrix< 3, Numeric::float64 > mat3
Represents a 3x3 matrix.