OLD | NEW |
1 /* | 1 /* |
2 * Mesa 3-D graphics library | 2 * Mesa 3-D graphics library |
3 * Version: 6.5.3 | 3 * Version: 6.5.3 |
4 * | 4 * |
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. | 5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. |
6 * | 6 * |
7 * Permission is hereby granted, free of charge, to any person obtaining a | 7 * Permission is hereby granted, free of charge, to any person obtaining a |
8 * copy of this software and associated documentation files (the "Software"), | 8 * copy of this software and associated documentation files (the "Software"), |
9 * to deal in the Software without restriction, including without limitation | 9 * to deal in the Software without restriction, including without limitation |
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ASSERT(plane[2] != 0.0F); | 105 ASSERT(plane[2] != 0.0F); |
106 return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; | 106 return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 #define SOLVE_PLANE(X, Y, PLANE) \ | 110 #define SOLVE_PLANE(X, Y, PLANE) \ |
111 ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) | 111 ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) |
112 | 112 |
113 | 113 |
114 /* | 114 /* |
115 * Return 1 / solve_plane(). | |
116 */ | |
117 static inline GLfloat | |
118 solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) | |
119 { | |
120 const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; | |
121 if (denom == 0.0F) | |
122 return 0.0F; | |
123 else | |
124 return -plane[2] / denom; | |
125 } | |
126 | |
127 | |
128 /* | |
129 * Solve plane and return clamped GLchan value. | 115 * Solve plane and return clamped GLchan value. |
130 */ | 116 */ |
131 static inline GLchan | 117 static inline GLchan |
132 solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) | 118 solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) |
133 { | 119 { |
134 const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; | 120 const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; |
135 #if CHAN_TYPE == GL_FLOAT | 121 #if CHAN_TYPE == GL_FLOAT |
136 return CLAMP(z, 0.0F, CHAN_MAXF); | 122 return CLAMP(z, 0.0F, CHAN_MAXF); |
137 #else | 123 #else |
138 if (z < 0) | 124 if (z < 0) |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 || swrast->_FogEnabled | 289 || swrast->_FogEnabled |
304 || _mesa_need_secondary_color(ctx)) { | 290 || _mesa_need_secondary_color(ctx)) { |
305 SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri; | 291 SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri; |
306 } | 292 } |
307 else { | 293 else { |
308 SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri; | 294 SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri; |
309 } | 295 } |
310 | 296 |
311 ASSERT(SWRAST_CONTEXT(ctx)->Triangle); | 297 ASSERT(SWRAST_CONTEXT(ctx)->Triangle); |
312 } | 298 } |
OLD | NEW |