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)) {
21 glup_primitive == GLUP_POINTS ||
22 GLUP.clipping_mode == GLUP_CLIP_WHOLE_CELLS
24 if(
dot(
vec4(center_world_space,1.0),GLUP.world_clip_plane) < 0.0) {
27 }
else if(GLUP.clipping_mode == GLUP_CLIP_STRADDLING_CELLS) {
29 abs(
dot(
vec4(center_world_space,1.0),GLUP.world_clip_plane)) /
30 length(GLUP.world_clip_plane.xyz) ;
37 Ray R = glup_primary_ray();
41 glup_primitive != GLUP_POINTS &&
42 glupIsEnabled(GLUP_CLIPPING) &&
43 GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS
45 N = GLUP.world_clip_plane.xyz;
46 float w = GLUP.world_clip_plane.w;
47 float t = -(w +
dot(N,R.O)) /
dot(N,R.V);
49 if(
dot(M-C,M-C) > r*r) {
58 float a =
dot(R.V,R.V);
60 float b_prime = -
dot(D,R.V);
61 vec3 H = D + (b_prime/a) * R.V;
62 float delta = r*r -
dot(H,H);
68 float q = b_prime - sqrt(a*delta);
87 glup_primitive != GLUP_POINTS &&
88 glupIsEnabled(GLUP_CLIPPING) &&
89 GLUP.clipping_mode == GLUP_CLIP_STANDARD
91 if(
dot(
vec4(M,1.0),GLUP.world_clip_plane) < 0.0) {
98 if(glupIsEnabled(GLUP_PICKING)) {
99 glup_FragColor = glup_picking(
int(primitive_id));
104 if(glupIsEnabled(GLUP_VERTEX_COLORS)) {
107 result = GLUP.front_color;
109 if(glupIsEnabled(GLUP_TEXTURING)) {
110 result = glup_texturing(result, tex_coord);
112 if(glupIsEnabled(GLUP_LIGHTING)) {
115 glup_primitive != GLUP_POINTS &&
116 glupIsEnabled(GLUP_CLIPPING) &&
117 GLUP.clipping_mode == GLUP_CLIP_SLICE_CELLS &&
122 result = glup_lighting(result, N);
124 glup_FragColor = result;
125 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.