state_current.c revision fcded3b75bf930c68355adc3e3757e35e9cabde4
/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "cr_mem.h"
#include "state.h"
#include "state_internals.h"
/*
* Note: regardless of GL_NV_vertex_program, we store all per-vertex
* attributes in an array now, instead of specially named attributes
* like color, normal, texcoord, etc.
*/
{
unsigned int i;
/*
* initialize all vertex attributes to <0,0,0,1> for starters
*/
for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
}
/* now re-do the exceptions */
c->rasterIndex = 1.0f;
/* Set the "pre" values and raster position attributes */
for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
}
c->rasterValid = GL_TRUE;
c->inBeginEnd = GL_FALSE;
c->beginEndNum = 0;
/*c->beginEndMax = cfg->beginend_max;*/
c->flushOnEnd = 0;
c->current = 0; /* picked up by crStateSetCurrentPointers() */
/* init dirty bits */
for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
}
}
{
crStateColor4f(r, g, b, 1.0F);
}
{
}
{
CRContext *g = GetCurrentContext();
CRCurrentState *c = &(g->current);
FLUSH();
}
{
}
{
}
{
}
{
CRContext *g = GetCurrentContext();
CRCurrentState *c = &(g->current);
if (mode > GL_POLYGON)
{
return;
}
if (c->inBeginEnd)
{
return;
}
c->attribsUsedMask = 0;
c->inBeginEnd = GL_TRUE;
c->beginEndNum++;
}
void STATE_APIENTRY crStateEnd( void )
{
CRContext *g = GetCurrentContext();
CRCurrentState *c = &(g->current);
if (!c->inBeginEnd)
{
return;
}
c->inBeginEnd = GL_FALSE;
}
{
unsigned int i, j;
for (j=0;j<CR_MAX_BITARRAY;j++)
if (to->rasterValid) {
/* Use glWindowPos (which updates raster color) */
}
}
}
/* Vertex Current State Switch Code */
/* Its important that we don't do a value check here because
** current may not actually have the correct values, I think...
** We also need to restore the current state tracking pointer
** since the packing functions will set it.
*/
FILLDIRTY(c->colorIndex);
}
}
}
}
/* If using a vertex program, update the generic vertex attributes,
* which may or may not be aliased with conventional attributes.
*/
#if defined(CR_ARB_vertex_program) || defined(CR_NV_vertex_progra)
if ((attribsUsedMask & (1 << i))
FILLDIRTY(c->vertexAttrib[i]);
}
}
}
}
/* Fall-through so that attributes which don't have their bit set in the
* attribsUsedMask get handled via the conventional attribute functions.
*/
#endif
{
/* use conventional attribute functions */
/* NEED TO FIX THIS!!!!!! */
}
}
/* NEED TO FIX THIS, ALSO?!!!!! */
#ifdef CR_EXT_secondary_color
}
}
#endif
/* NEED TO FIX THIS, ALSO?!!!!! */
#ifdef CR_EXT_fog_coord
}
}
#endif
if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttrib[VERT_ATTRIB_NORMAL])) {
}
}
for (i = 0; i < maxTextureUnits; i++) {
if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) {
diff_api.MultiTexCoord4fvARB (i+GL_TEXTURE0_ARB, (GLfloat *) &(to->vertexAttrib[VERT_ATTRIB_TEX0+ i][0]));
}
}
}
}
}
void
{
unsigned int i, j;
for (j=0;j<CR_MAX_BITARRAY;j++)
if (to->rasterValid) {
/* Use glWindowPos (which updates raster color) */
}
}
}
/* Vertex Current State Sync Code */
/* Some things to note here:
** 1) Compare is done against the pre value since the
** current value includes the geometry info.
** 2) Update is done with the current value since
** the server will be getting the geometry block
** 3) Copy is done outside of the compare to ensure
** that it happens.
*/
/* edge flag */
}
}
/* color index */
}
}
/* If using a vertex program, update the generic vertex attributes,
* which may or may not be aliased with conventional attributes.
*/
#if defined(CR_ARB_vertex_program) || defined(CR_NV_vertex_progra)
int i;
if ((attribsUsedMask & (1 << i))
}
}
}
}
/* Fall-through so that attributes which don't have their bit set in the
* attribsUsedMask get handled via the conventional attribute functions.
*/
#endif
{
/* use conventional attribute functions */
if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR0],to->vertexAttribPre[VERT_ATTRIB_COLOR0])) {
}
}
#ifdef CR_EXT_secondary_color
if (COMPARE_COLOR(from->vertexAttrib[VERT_ATTRIB_COLOR1],to->vertexAttribPre[VERT_ATTRIB_COLOR1])) {
}
}
#endif
#ifdef CR_EXT_fog_coord
}
}
#endif
if (COMPARE_VECTOR (from->vertexAttrib[VERT_ATTRIB_NORMAL], to->vertexAttribPre[VERT_ATTRIB_NORMAL])) {
}
}
{
if (COMPARE_TEXCOORD (from->vertexAttrib[VERT_ATTRIB_TEX0 + i], to->vertexAttribPre[VERT_ATTRIB_TEX0 + i])) {
diff_api.MultiTexCoord4fvARB (GL_TEXTURE0_ARB + i, (GLfloat *) &(to->vertexAttribPre[VERT_ATTRIB_TEX0 + i]));
}
}
}
}
}