12 vec3 center_world_space;
18 vec3 C = FragmentIn.center_world_space;
19 float r = FragmentIn.radius;
21 if(glupIsEnabled(GLUP_CLIPPING)) {
23 glup_primitive == GLUP_POINTS ||
24 GLUP.clipping_mode == GLUP_CLIP_WHOLE_CELLS
26 if(
dot(
vec4(C,1.0),GLUP.world_clip_plane) < 0.0) {
29 }
else if(GLUP.clipping_mode == GLUP_CLIP_STRADDLING_CELLS) {
31 abs(
dot(
vec4(C,1.0),GLUP.world_clip_plane)) /
32 length(GLUP.world_clip_plane.xyz) ;
39 Ray R = glup_primary_ray();
43 glup_primitive != GLUP_POINTS &&
44 glupIsEnabled(GLUP_CLIPPING) &&
45 GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS
47 N = GLUP.world_clip_plane.xyz;
48 float w = GLUP.world_clip_plane.w;
49 float t = -(w +
dot(N,R.O)) /
dot(N,R.V);
51 if(
dot(M-C,M-C) > r*r) {
60 float a =
dot(R.V,R.V);
61 float b_prime = -
dot(D,R.V);
62 vec3 H = D + (b_prime/a) * R.V;
63 float delta = r*r -
dot(H,H);
69 float q = b_prime - sqrt(a*delta);
89 glup_primitive != GLUP_POINTS &&
90 glupIsEnabled(GLUP_CLIPPING) &&
91 GLUP.clipping_mode == GLUP_CLIP_STANDARD
93 if(
dot(
vec4(M,1.0),GLUP.world_clip_plane) < 0.0) {
100 if(glupIsEnabled(GLUP_PRIMITIVE_FILTERING)) {
101 glup_primitive_filter(gl_PrimitiveID);
104 if(glupIsEnabled(GLUP_PICKING)) {
105 glup_FragColor = glup_picking(gl_PrimitiveID);
110 if(glupIsEnabled(GLUP_VERTEX_COLORS)) {
111 result = FragmentIn.color;
113 result = GLUP.front_color;
115 if(glupIsEnabled(GLUP_TEXTURING)) {
116 result = glup_texturing(result, FragmentIn.tex_coord);
118 if(glupIsEnabled(GLUP_LIGHTING)) {
121 glup_primitive != GLUP_POINTS &&
122 glupIsEnabled(GLUP_CLIPPING) &&
123 GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS &&
128 result = glup_lighting(result, N);
130 glup_FragColor = result;
131 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.