12    vec3 center_world_space;
 
   18    vec3 C = FragmentIn.center_world_space;
 
   19    float r = FragmentIn.radius;
 
   21    if(glupIsEnabled(GLUP_CLIPPING)) {
 
   22        if(GLUP.clipping_mode == GLUP_CLIP_WHOLE_CELLS) {
 
   23            if(
dot(
vec4(C,1.0),GLUP.world_clip_plane) < 0.0) {
 
   26        } 
else if(GLUP.clipping_mode == GLUP_CLIP_STRADDLING_CELLS) {
 
   28                abs(
dot(
vec4(C,1.0),GLUP.world_clip_plane)) /
 
   29                length(GLUP.world_clip_plane.xyz) ;
 
   36    Ray R = glup_primary_ray();
 
   40        glupIsEnabled(GLUP_CLIPPING) &&
 
   41        GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS
 
   43        N = GLUP.world_clip_plane.xyz;
 
   44        float w = GLUP.world_clip_plane.w;
 
   45        float t = -(w + 
dot(N,R.O)) / 
dot(N,R.V);
 
   47        if(
dot(M-C,M-C) > r*r) {
 
   52        float a = 
dot(R.V,R.V);
 
   53        float b = 2.0*
dot(R.V,D);
 
   54        float c = 
dot(D,D)-r*r;
 
   55        float delta = b*b-4.0*a*c;
 
   60        float t = (-b-sqrt(delta))/(2.0*a);
 
   66        glupIsEnabled(GLUP_CLIPPING) &&
 
   67        GLUP.clipping_mode == GLUP_CLIP_STANDARD
 
   69        if(
dot(
vec4(M,1.0),GLUP.world_clip_plane) < 0.0) {
 
   76    if(glupIsEnabled(GLUP_PRIMITIVE_FILTERING)) {
 
   77        glup_primitive_filter(gl_PrimitiveID);
 
   80    if(glupIsEnabled(GLUP_PICKING)) {
 
   81        glup_FragColor = glup_picking(gl_PrimitiveID);
 
   86    if(glupIsEnabled(GLUP_VERTEX_COLORS)) {
 
   87        result = FragmentIn.color;
 
   89        result = GLUP.front_color;
 
   91    if(glupIsEnabled(GLUP_TEXTURING)) {
 
   92        result = glup_texturing(result, FragmentIn.tex_coord);
 
   94    if(glupIsEnabled(GLUP_LIGHTING)) {
 
   97            glupIsEnabled(GLUP_CLIPPING) &&
 
   98            GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS &&
 
  103        result = glup_lighting(result, N);
 
  105    glup_FragColor = result;
 
  106    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.