2000-11-05 18:20:18 +00:00
|
|
|
/*
|
|
|
|
* Mesa 3-D graphics library
|
|
|
|
* Version: 3.5
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 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"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Keith Whitwell <keithw@valinux.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
|
2000-11-05 18:20:18 +00:00
|
|
|
{
|
2000-11-16 21:05:34 +00:00
|
|
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
2000-12-26 05:09:27 +00:00
|
|
|
struct vertex_buffer *VB = &tnl->vb;
|
2000-11-05 18:20:18 +00:00
|
|
|
SWvertex *v;
|
2000-12-26 05:09:27 +00:00
|
|
|
GLfloat (*proj)[4]; /* projected clip coordinates */
|
2000-11-05 18:20:18 +00:00
|
|
|
GLfloat (*tc[MAX_TEXTURE_UNITS])[4];
|
2001-01-24 00:04:58 +00:00
|
|
|
GLchan (*color)[4];
|
|
|
|
GLchan (*spec)[4];
|
2000-11-05 18:20:18 +00:00
|
|
|
GLuint *index;
|
|
|
|
GLfloat *fog;
|
2000-12-08 00:18:39 +00:00
|
|
|
GLfloat *pointSize;
|
2000-12-26 05:09:27 +00:00
|
|
|
GLuint tsz[MAX_TEXTURE_UNITS];
|
2001-03-08 15:23:46 +00:00
|
|
|
GLuint i;
|
2000-12-26 05:09:27 +00:00
|
|
|
GLfloat *m = ctx->Viewport._WindowMap.m;
|
|
|
|
const GLfloat sx = m[0];
|
|
|
|
const GLfloat sy = m[5];
|
|
|
|
const GLfloat sz = m[10];
|
|
|
|
const GLfloat tx = m[12];
|
|
|
|
const GLfloat ty = m[13];
|
|
|
|
const GLfloat tz = m[14];
|
|
|
|
GLuint maxtex = 0;
|
2000-11-05 18:20:18 +00:00
|
|
|
|
2001-01-29 20:47:39 +00:00
|
|
|
if (!newinputs) {
|
|
|
|
fprintf(stderr, "no new inputs\n");
|
|
|
|
return;
|
|
|
|
}
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
/* TODO: Get import_client_data to pad vectors out to 4 cleanly.
|
|
|
|
*/
|
2000-12-26 05:09:27 +00:00
|
|
|
if (VB->importable_data)
|
|
|
|
VB->import_data( ctx, VB->importable_data & newinputs,
|
|
|
|
(VB->ClipOrMask
|
|
|
|
? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
|
|
|
|
: VEC_BAD_STRIDE));
|
|
|
|
|
2000-11-05 18:20:18 +00:00
|
|
|
if (IND & TEX0) {
|
|
|
|
tc[0] = VB->TexCoordPtr[0]->data;
|
2000-12-26 05:09:27 +00:00
|
|
|
tsz[0] = VB->TexCoordPtr[0]->size;
|
2000-11-05 18:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (IND & MULTITEX) {
|
2000-12-26 05:09:27 +00:00
|
|
|
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
|
|
|
|
if (VB->TexCoordPtr[i]) {
|
|
|
|
maxtex = i+1;
|
|
|
|
tc[i] = VB->TexCoordPtr[i]->data;
|
|
|
|
tsz[i] = VB->TexCoordPtr[i]->size;
|
|
|
|
}
|
|
|
|
else tc[i] = 0;
|
2000-11-05 18:20:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-16 18:14:41 +00:00
|
|
|
/* Tie up some dangling pointers for flat/twoside code in ss_tritmp.h
|
|
|
|
*/
|
|
|
|
if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0) {
|
|
|
|
VB->SecondaryColorPtr[0] = VB->ColorPtr[0];
|
|
|
|
VB->SecondaryColorPtr[1] = VB->ColorPtr[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
proj = VB->ProjectedClipPtr->data;
|
|
|
|
if (IND & FOG)
|
|
|
|
fog = VB->FogCoordPtr->data;
|
|
|
|
if (IND & COLOR)
|
|
|
|
color = VB->ColorPtr[0]->data;
|
|
|
|
if (IND & SPEC)
|
|
|
|
spec = VB->SecondaryColorPtr[0]->data;
|
|
|
|
if (IND & INDEX)
|
|
|
|
index = VB->IndexPtr[0]->data;
|
|
|
|
if (IND & POINT)
|
|
|
|
pointSize = VB->PointSizePtr->data;
|
2000-11-05 18:20:18 +00:00
|
|
|
|
2000-12-26 05:09:27 +00:00
|
|
|
v = &(SWSETUP_CONTEXT(ctx)->verts[start]);
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
for (i=start; i < end; i++, v++) {
|
|
|
|
if (VB->ClipMask[i] == 0) {
|
2000-12-26 05:09:27 +00:00
|
|
|
v->win[0] = sx * proj[i][0] + tx;
|
|
|
|
v->win[1] = sy * proj[i][1] + ty;
|
|
|
|
v->win[2] = sz * proj[i][2] + tz;
|
|
|
|
v->win[3] = proj[i][3];
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
if (IND & TEX0)
|
2000-12-26 05:09:27 +00:00
|
|
|
COPY_CLEAN_4V( v->texcoord[0], tsz[0], tc[0][i] );
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
if (IND & MULTITEX) {
|
|
|
|
GLuint u;
|
2000-12-26 05:09:27 +00:00
|
|
|
for (u = 0 ; u < maxtex ; u++)
|
2001-01-14 06:14:21 +00:00
|
|
|
if (tc[u])
|
2000-12-26 05:09:27 +00:00
|
|
|
COPY_CLEAN_4V( v->texcoord[u], tsz[u], tc[u][i] );
|
2000-11-05 18:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (IND & COLOR)
|
2001-03-08 15:23:46 +00:00
|
|
|
COPY_CHAN4(v->color, color[i]);
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
if (IND & SPEC)
|
2001-03-08 15:23:46 +00:00
|
|
|
COPY_CHAN4(v->specular, spec[i]);
|
2000-11-05 18:20:18 +00:00
|
|
|
|
|
|
|
if (IND & FOG)
|
|
|
|
v->fog = fog[i];
|
|
|
|
|
|
|
|
if (IND & INDEX)
|
|
|
|
v->index = index[i];
|
2000-12-08 00:18:39 +00:00
|
|
|
|
|
|
|
if (IND & POINT)
|
|
|
|
v->pointSize = pointSize[i];
|
2000-11-05 18:20:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef TAG
|
|
|
|
#undef IND
|
2000-12-26 05:09:27 +00:00
|
|
|
#undef SETUP_FLAGS
|