-/* $Id: feedback.c,v 1.6 1999/11/11 01:22:26 brianp Exp $ */
+/* $Id: feedback.c,v 1.7 2000/01/17 15:40:43 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
win[2] = VB->Win.data[v][2] / DEPTH_SCALE;
win[3] = 1.0 / VB->Win.data[v][3];
- if (ctx->Light.ShadeModel==GL_SMOOTH) pv = v;
+ if (ctx->Light.ShadeModel == GL_SMOOTH)
+ pv = v;
UBYTE_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
if (VB->TexCoordPtr[texUnit]->size == 4 &&
- VB->TexCoordPtr[texUnit]->data[v][3]!=0.0)
- {
+ VB->TexCoordPtr[texUnit]->data[v][3] != 0.0) {
GLfloat invq = 1.0F / VB->TexCoordPtr[texUnit]->data[v][3];
tc[0] = VB->TexCoordPtr[texUnit]->data[v][0] * invq;
tc[1] = VB->TexCoordPtr[texUnit]->data[v][1] * invq;
tc[2] = VB->TexCoordPtr[texUnit]->data[v][2] * invq;
tc[3] = VB->TexCoordPtr[texUnit]->data[v][3];
- } else {
+ }
+ else {
ASSIGN_4V(tc, 0,0,0,1);
COPY_SZ_4V(tc,
VB->TexCoordPtr[texUnit]->size,
struct vertex_buffer *VB = ctx->VB;
GLuint i;
- for (i=first;i<=last;i++)
+ for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
gl_do_feedback_vertex( ctx, i, i );
}
+ }
}
struct vertex_buffer *VB = ctx->VB;
if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) {
- gl_update_hitflag( ctx, VB->Win.data[v0][3] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v1][3] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v2][3] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v2][2] / DEPTH_SCALE );
}
}
{
struct vertex_buffer *VB = ctx->VB;
- gl_update_hitflag( ctx, VB->Win.data[v0][3] / DEPTH_SCALE );
- gl_update_hitflag( ctx, VB->Win.data[v1][3] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE );
}
+
void gl_select_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
GLuint i;
- for (i=first;i<=last;i++)
- if (VB->ClipMask[i]==0)
- gl_update_hitflag( ctx, VB->Win.data[i][3] / DEPTH_SCALE);
+ for (i=first;i<=last;i++) {
+ if (VB->ClipMask[i]==0) {
+ gl_update_hitflag( ctx, VB->Win.data[i][2] / DEPTH_SCALE);
+ }
+ }
}
WRITE_RECORD( ctx, ctx->Select.NameStackDepth );
WRITE_RECORD( ctx, zmin );
WRITE_RECORD( ctx, zmax );
- for (i=0;i<ctx->Select.NameStackDepth;i++) {
+ for (i = 0; i < ctx->Select.NameStackDepth; i++) {
WRITE_RECORD( ctx, ctx->Select.NameStack[i] );
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames");
/* Record the hit before the HitFlag is wiped out again. */
- if (ctx->RenderMode==GL_SELECT) {
+ if (ctx->RenderMode == GL_SELECT) {
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName");
- if (ctx->RenderMode!=GL_SELECT) {
+ if (ctx->RenderMode != GL_SELECT) {
return;
}
- if (ctx->Select.NameStackDepth==0) {
+ if (ctx->Select.NameStackDepth == 0) {
gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
return;
}
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
- if (ctx->Select.NameStackDepth<MAX_NAME_STACK_DEPTH) {
+ if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) {
ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name;
}
else {
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName");
- if (ctx->RenderMode!=GL_SELECT) {
+ if (ctx->RenderMode != GL_SELECT) {
return;
}
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
- if (ctx->Select.NameStackDepth<MAX_NAME_STACK_DEPTH) {
+ if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) {
ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
}
else {
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName");
- if (ctx->RenderMode!=GL_SELECT) {
+ if (ctx->RenderMode != GL_SELECT) {
return;
}
if (ctx->Select.HitFlag) {
write_hit_record( ctx );
}
- if (ctx->Select.NameStackDepth>0) {
+ if (ctx->Select.NameStackDepth > 0) {
ctx->Select.NameStackDepth--;
}
else {
return 0;
}
-
ctx->RenderMode = mode;
ctx->NewState |= NEW_ALL;