ReactOS  0.4.15-dev-1197-g8081ba9
vbxform.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_transform_vb_part1 (GLcontext *ctx, GLboolean alldone)
 
void gl_transform_vb_part2 (GLcontext *ctx, GLboolean alldone)
 

Function Documentation

◆ gl_transform_vb_part1()

void gl_transform_vb_part1 ( GLcontext ctx,
GLboolean  alldone 
)

Definition at line 1120 of file vbxform.c.

1121 {
1122  struct vertex_buffer *VB = ctx->VB;
1123 #ifdef PROFILE
1124  GLdouble t0 = gl_time();
1125 #endif
1126 
1127  ASSERT( VB->Count>0 );
1128 
1129  /* Apply the modelview matrix to transform vertexes from Object
1130  * to Eye coords.
1131  */
1132  if (VB->VertexSizeMask==VERTEX4_BIT) {
1133  transform_points4( ctx, VB->Count - VB->Start,
1134  VB->Obj + VB->Start, VB->Eye + VB->Start );
1135  }
1136  else {
1137  transform_points3( ctx, VB->Count - VB->Start,
1138  VB->Obj + VB->Start, VB->Eye + VB->Start );
1139  }
1140 
1141  /* Now transform the normal vectors */
1142  if (ctx->NeedNormals) {
1143  gl_xform_normals_3fv( VB->Count - VB->Start,
1144  VB->Normal + VB->Start, ctx->ModelViewInv,
1145  VB->Normal + VB->Start, ctx->Transform.Normalize );
1146  }
1147 
1148 #ifdef PROFILE
1149  ctx->VertexTime += gl_time() - t0;
1150 #endif
1151 
1152  /* lighting, project, etc */
1153  gl_transform_vb_part2( ctx, allDone );
1154 }
double GLdouble
Definition: gl.h:163
static void transform_points3(GLcontext *ctx, GLuint n, GLfloat vObj[][4], GLfloat vEye[][4])
Definition: vbxform.c:232
void gl_transform_vb_part2(GLcontext *ctx, GLboolean allDone)
Definition: vbxform.c:1165
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct vertex_buffer * VB
Definition: tritemp.h:139
static void transform_points4(GLcontext *ctx, GLuint n, GLfloat vObj[][4], GLfloat vEye[][4])
Definition: vbxform.c:361
void gl_xform_normals_3fv(GLuint n, GLfloat v[][3], const GLfloat m[16], GLfloat u[][3], GLboolean normalize)
Definition: xform.c:195
#define VERTEX4_BIT
Definition: vb.h:95

Referenced by gl_ArrayElement(), gl_End(), gl_eval_vertex(), vertex2f_color(), vertex2f_color_tex2(), vertex2f_color_tex4(), vertex2f_index(), vertex2f_normal(), vertex2f_normal_color_tex2(), vertex2f_normal_color_tex4(), vertex3f_color(), vertex3f_color_tex2(), vertex3f_color_tex4(), vertex3f_index(), vertex3f_normal(), vertex3f_normal_color_tex2(), vertex3f_normal_color_tex4(), vertex3fv_color(), vertex3fv_color_tex2(), vertex3fv_color_tex4(), vertex3fv_index(), vertex3fv_normal(), vertex3fv_normal_color_tex2(), vertex3fv_normal_color_tex4(), vertex4(), and vertex4f_feedback().

◆ gl_transform_vb_part2()

void gl_transform_vb_part2 ( GLcontext ctx,
GLboolean  alldone 
)

Definition at line 1165 of file vbxform.c.

1166 {
1167  struct vertex_buffer *VB = ctx->VB;
1168 #ifdef PROFILE
1169  GLdouble t0 = gl_time();
1170 #endif
1171 
1172  ASSERT( VB->Count>0 );
1173 
1174  /* Test vertices in eye coordinate space against user clipping planes */
1175  if (ctx->Transform.AnyClip) {
1176  GLuint result = userclip_vertices( ctx, VB->Count - VB->Start,
1177  VB->Eye + VB->Start,
1178  VB->ClipMask + VB->Start );
1179  if (result==CLIP_ALL) {
1180  /* All vertices were outside one of the clip planes! */
1181  VB->ClipOrMask = CLIP_ALL_BITS; /* force reset of clipping flags */
1182  gl_reset_vb( ctx, allDone );
1183  return;
1184  }
1185  else if (result==CLIP_SOME) {
1186  VB->ClipOrMask = CLIP_USER_BIT;
1187  }
1188  else {
1189  VB->ClipAndMask = 0;
1190  }
1191  }
1192 
1193  /* Apply the projection matrix to the Eye coordinates, resulting in
1194  * Clip coordinates. Also, compute the ClipMask for each vertex.
1195  */
1196  project_and_cliptest( ctx, VB->Count - VB->Start, VB->Eye + VB->Start,
1197  VB->Clip + VB->Start, VB->ClipMask + VB->Start,
1198  &VB->ClipOrMask, &VB->ClipAndMask );
1199 
1200  if (VB->ClipAndMask) {
1201  /* All vertices clipped by one plane, all done! */
1202  /*assert(VB->ClipOrMask);*/
1203  VB->ClipOrMask = CLIP_ALL_BITS; /* force reset of clipping flags */
1204  gl_reset_vb( ctx, allDone );
1205  return;
1206  }
1207 
1208  /* Lighting */
1209  if (ctx->Light.Enabled) {
1211  }
1212 
1213  /* Per-vertex fog */
1214  if (ctx->Fog.Enabled && ctx->Hint.Fog!=GL_NICEST) {
1215  fog_vertices(ctx);
1216  }
1217 
1218  /* Generate/transform texture coords */
1219  if (ctx->Texture.Enabled || ctx->RenderMode==GL_FEEDBACK) {
1220  if (ctx->Texture.TexGenEnabled) {
1221  gl_texgen( ctx, VB->Count - VB->Start,
1222  VB->Obj + VB->Start,
1223  VB->Eye + VB->Start,
1224  VB->Normal + VB->Start,
1225  VB->TexCoord + VB->Start );
1226  }
1227  if (ctx->NewTextureMatrix) {
1229  }
1230  if (ctx->TextureMatrixType!=MATRIX_IDENTITY) {
1231  transform_texcoords( ctx, VB->Count - VB->Start,
1232  VB->TexCoord + VB->Start );
1233  }
1234  }
1235 
1236  /* Use the viewport parameters to transform vertices from Clip
1237  * coordinates to Window coordinates.
1238  */
1239  viewport_map_vertices( ctx, VB->Count - VB->Start, VB->Clip + VB->Start,
1240  VB->ClipOrMask ? VB->ClipMask + VB->Start : NULL,
1241  VB->Win + VB->Start );
1242 
1243  /* Device driver rasterization setup. 3Dfx driver, for example. */
1244  if (ctx->Driver.RasterSetup) {
1245  (*ctx->Driver.RasterSetup)( ctx, 0, VB->Count );
1246  }
1247 
1248 
1249 #ifdef PROFILE
1250  ctx->VertexTime += gl_time() - t0;
1251  ctx->VertexCount += VB->Count - VB->Start;
1252 #endif
1253 
1254  /*
1255  * Now we're ready to rasterize the Vertex Buffer!!!
1256  *
1257  * If the device driver can't rasterize the vertex buffer then we'll
1258  * do it ourselves.
1259  */
1260  if (!ctx->Driver.RenderVB || !(*ctx->Driver.RenderVB)(ctx,allDone)) {
1261  gl_render_vb( ctx, allDone );
1262  }
1263 }
double GLdouble
Definition: gl.h:163
void gl_analyze_texture_matrix(GLcontext *ctx)
Definition: matrix.c:487
static void project_and_cliptest(GLcontext *ctx, GLuint n, GLfloat vEye[][4], GLfloat vClip[][4], GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask)
Definition: vbxform.c:581
void gl_texgen(GLcontext *ctx, GLint n, GLfloat obj[][4], GLfloat eye[][4], GLfloat normal[][3], GLfloat texcoord[][4])
Definition: texture.c:163
static void viewport_map_vertices(GLcontext *ctx, GLuint n, GLfloat vClip[][4], const GLubyte clipMask[], GLfloat vWin[][3])
Definition: vbxform.c:809
static void fog_vertices(GLcontext *ctx)
Definition: vbxform.c:1084
void gl_reset_vb(GLcontext *ctx, GLboolean allDone)
Definition: vbrender.c:1155
smooth NULL
Definition: ftsmooth.c:416
#define CLIP_ALL
Definition: vb.h:150
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static GLuint userclip_vertices(GLcontext *ctx, GLuint n, GLfloat vEye[][4], GLubyte clipMask[])
Definition: vbxform.c:759
struct vertex_buffer * VB
Definition: tritemp.h:139
static void transform_texcoords(GLcontext *ctx, GLuint n, GLfloat t[][4])
Definition: vbxform.c:481
#define GL_NICEST
Definition: gl.h:585
unsigned int GLuint
Definition: gl.h:159
static void shade_vertices(GLcontext *ctx)
Definition: vbxform.c:963
#define GL_FEEDBACK
Definition: gl.h:387
#define CLIP_ALL_BITS
Definition: vb.h:148
void gl_render_vb(GLcontext *ctx, GLboolean allDone)
Definition: vbrender.c:774
#define CLIP_USER_BIT
Definition: vb.h:147
#define CLIP_SOME
Definition: vb.h:152
GLuint64EXT * result
Definition: glext.h:11304
#define MATRIX_IDENTITY
Definition: types.h:1243

Referenced by gl_DrawArrays(), and gl_transform_vb_part1().