9glup_flat glup_in 
vec4 color;
 
   10glup_flat glup_in 
vec4 tex_coord;
 
   11glup_flat glup_in 
vec3 center_world_space;
 
   12glup_flat glup_in 
float radius;
 
   13glup_flat glup_in glup_id primitive_id;
 
   16    vec3 C = center_world_space;
 
   19    if(glupIsEnabled(GLUP_CLIPPING)) {
 
   20        if(GLUP.clipping_mode == GLUP_CLIP_WHOLE_CELLS) {
 
   21            if(
dot(
vec4(center_world_space,1.0),GLUP.world_clip_plane) < 0.0) {
 
   24        } 
else if(GLUP.clipping_mode == GLUP_CLIP_STRADDLING_CELLS) {
 
   26                abs(
dot(
vec4(center_world_space,1.0),GLUP.world_clip_plane)) /
 
   27                length(GLUP.world_clip_plane.xyz) ;
 
   34    Ray R = glup_primary_ray();
 
   38        glupIsEnabled(GLUP_CLIPPING) &&
 
   39        GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS
 
   41        N = GLUP.world_clip_plane.xyz;
 
   42        float w = GLUP.world_clip_plane.w;
 
   43        float t = -(w + 
dot(N,R.O)) / 
dot(N,R.V);
 
   45        if(
dot(M-C,M-C) > r*r) {
 
   50        float a = 
dot(R.V,R.V);
 
   51        float b = 2.0*
dot(R.V,D);
 
   52        float c = 
dot(D,D)-r*r;
 
   53        float delta = b*b-4.0*a*c;
 
   58        float t = (-b-sqrt(delta))/(2.0*a);
 
   64        glupIsEnabled(GLUP_CLIPPING) &&
 
   65        GLUP.clipping_mode == GLUP_CLIP_STANDARD
 
   67        if(
dot(
vec4(M,1.0),GLUP.world_clip_plane) < 0.0) {
 
   74    if(glupIsEnabled(GLUP_PICKING)) {
 
   75        glup_FragColor = glup_picking(
int(primitive_id));
 
   80    if(glupIsEnabled(GLUP_VERTEX_COLORS)) {
 
   83        result = GLUP.front_color;
 
   85    if(glupIsEnabled(GLUP_TEXTURING)) {
 
   86        result = glup_texturing(result, tex_coord);
 
   88    if(glupIsEnabled(GLUP_LIGHTING)) {
 
   91            glupIsEnabled(GLUP_CLIPPING) &&
 
   92            GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS &&
 
   97        result = glup_lighting(result, N);
 
   99    glup_FragColor = result;
 
  100    glup_alpha_discard();
 
double length(vec3 v)
Computes the length of a vector.
vec3 normalize(vec3 v)
Computes a normalized vector.
T dot(const vecng< 3, T > &v1, const vecng< 3, T > &v2)
Computes the dot product of 2 vectors.   vecng
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
vecng< 4, Numeric::float64 > vec4
Represents points and vectors in 4d.