ReactOS 0.4.16-dev-297-gc569aee
normal.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void __gl_projectPolygon (GLUtesselator *tess)
 

Function Documentation

◆ __gl_projectPolygon()

void __gl_projectPolygon ( GLUtesselator tess)

Definition at line 198 of file normal.c.

199{
200 GLUvertex *v, *vHead = &tess->mesh->vHead;
201 GLdouble norm[3];
202 GLdouble *sUnit, *tUnit;
203 int i, computedNormal = FALSE;
204
205 norm[0] = tess->normal[0];
206 norm[1] = tess->normal[1];
207 norm[2] = tess->normal[2];
208 if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) {
209 ComputeNormal( tess, norm );
210 computedNormal = TRUE;
211 }
212 sUnit = tess->sUnit;
213 tUnit = tess->tUnit;
214 i = LongAxis( norm );
215
216#if defined(FOR_TRITE_TEST_PROGRAM) || defined(TRUE_PROJECT)
217 /* Choose the initial sUnit vector to be approximately perpendicular
218 * to the normal.
219 */
220 Normalize( norm );
221
222 sUnit[i] = 0;
223 sUnit[(i+1)%3] = S_UNIT_X;
224 sUnit[(i+2)%3] = S_UNIT_Y;
225
226 /* Now make it exactly perpendicular */
227 w = Dot( sUnit, norm );
228 sUnit[0] -= w * norm[0];
229 sUnit[1] -= w * norm[1];
230 sUnit[2] -= w * norm[2];
231 Normalize( sUnit );
232
233 /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */
234 tUnit[0] = norm[1]*sUnit[2] - norm[2]*sUnit[1];
235 tUnit[1] = norm[2]*sUnit[0] - norm[0]*sUnit[2];
236 tUnit[2] = norm[0]*sUnit[1] - norm[1]*sUnit[0];
237 Normalize( tUnit );
238#else
239 /* Project perpendicular to a coordinate axis -- better numerically */
240 sUnit[i] = 0;
241 sUnit[(i+1)%3] = S_UNIT_X;
242 sUnit[(i+2)%3] = S_UNIT_Y;
243
244 tUnit[i] = 0;
245 tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y;
246 tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X;
247#endif
248
249 /* Project the vertices onto the sweep plane */
250 for( v = vHead->next; v != vHead; v = v->next ) {
251 v->s = Dot( v->coords, sUnit );
252 v->t = Dot( v->coords, tUnit );
253 }
254 if( computedNormal ) {
255 CheckOrientation( tess );
256 }
257}
_Tp _STLP_CALL norm(const complex< _Tp > &__z)
Definition: _complex.h:741
static BOOL Normalize(PFILE_TYPE_ENTRY Entry)
Definition: filetypes.cpp:341
const GLdouble * v
Definition: gl.h:2040
double GLdouble
Definition: gl.h:163
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void ComputeNormal(GLUtesselator *tess, GLdouble norm[3])
Definition: normal.c:76
#define S_UNIT_X
Definition: normal.c:190
static int LongAxis(GLdouble v[3])
Definition: normal.c:67
#define TRUE
Definition: normal.c:43
#define FALSE
Definition: normal.c:46
static void CheckOrientation(GLUtesselator *tess)
Definition: normal.c:141
#define Dot(u, v)
Definition: normal.c:49
#define S_UNIT_Y
Definition: normal.c:191
GLUvertex vHead
Definition: mesh.h:164
GLdouble tUnit[3]
Definition: tess.h:75
GLdouble sUnit[3]
Definition: tess.h:74
GLdouble normal[3]
Definition: tess.h:73
GLUmesh * mesh
Definition: tess.h:66
GLUvertex * next
Definition: mesh.h:115

Referenced by gluTessEndPolygon().