Ejemplo n.º 1
0
/* All attributes are float[4], so this is easy:
 */
static void interp_attr( float dst[4],
			 float t,
			 const float in[4],
			 const float out[4] )
{  
   dst[0] = LINTERP( t, out[0], in[0] );
   dst[1] = LINTERP( t, out[1], in[1] );
   dst[2] = LINTERP( t, out[2], in[2] );
   dst[3] = LINTERP( t, out[3], in[3] );
}
Ejemplo n.º 2
0
/* All attributes are float[4], so this is easy:
 */
static void interp_attr( float *fdst,
			 float t,
			 const float *fin,
			 const float *fout )
{  
   fdst[0] = LINTERP( t, fout[0], fin[0] );
   fdst[1] = LINTERP( t, fout[1], fin[1] );
   fdst[2] = LINTERP( t, fout[2], fin[2] );
   fdst[3] = LINTERP( t, fout[3], fin[3] );
}
Ejemplo n.º 3
0
/* Helper functions for hardware which doesn't put back colors and/or
 * edgeflags into vertices.
 */
void _tnl_generic_interp_extras( struct gl_context *ctx,
				   GLfloat t,
				   GLuint dst, GLuint out, GLuint in,
				   GLboolean force_boundary )
{
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   /* If stride is zero, BackfaceColorPtr is constant across the VB, so
    * there is no point interpolating between two values as they will
    * be identical.  In all other cases, this value is generated by
    * t_vb_lighttmp.h and has a stride of 4 dwords.
    */
   if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
      assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));

      INTERP_4F( t,
		 VB->BackfaceColorPtr->data[dst],
		 VB->BackfaceColorPtr->data[out],
		 VB->BackfaceColorPtr->data[in] );
   }
   
   if (VB->BackfaceIndexPtr) {
      VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t,
					       VB->BackfaceIndexPtr->data[out][0],
					       VB->BackfaceIndexPtr->data[in][0] );
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   _tnl_generic_interp(ctx, t, dst, out, in, force_boundary);
}
Ejemplo n.º 4
0
static void interp_extras( GLcontext *ctx,
			   GLfloat t,
			   GLuint dst, GLuint out, GLuint in,
			   GLboolean force_boundary )
{
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   if (VB->ColorPtr[1]) {
      INTERP_4CHAN( t,
		 GET_COLOR(VB->ColorPtr[1], dst),
		 GET_COLOR(VB->ColorPtr[1], out),
		 GET_COLOR(VB->ColorPtr[1], in) );

      if (VB->SecondaryColorPtr[1]) {
	 INTERP_3CHAN( t,
		    GET_COLOR(VB->SecondaryColorPtr[1], dst),
		    GET_COLOR(VB->SecondaryColorPtr[1], out),
		    GET_COLOR(VB->SecondaryColorPtr[1], in) );
      }
   }
   else if (VB->IndexPtr[1]) {
      VB->IndexPtr[1]->data[dst] = (GLuint) (GLint)
	 LINTERP( t,
		  (GLfloat) VB->IndexPtr[1]->data[out],
		  (GLfloat) VB->IndexPtr[1]->data[in] );
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   interp_tab[SWSETUP_CONTEXT(ctx)->SetupIndex](ctx, t, dst, out, in,
						force_boundary);
}
Ejemplo n.º 5
0
/* Helper functions for hardware which doesn't put back colors and/or
 * edgeflags into vertices.
 */
static void generic_interp_extras( GLcontext *ctx,
				   GLfloat t,
				   GLuint dst, GLuint out, GLuint in,
				   GLboolean force_boundary )
{
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   if (VB->ColorPtr[1]) {
      assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));

      INTERP_4F( t,
		 VB->ColorPtr[1]->data[dst],
		 VB->ColorPtr[1]->data[out],
		 VB->ColorPtr[1]->data[in] );

      if (VB->SecondaryColorPtr[1]) {
	 INTERP_3F( t,
		    VB->SecondaryColorPtr[1]->data[dst],
		    VB->SecondaryColorPtr[1]->data[out],
		    VB->SecondaryColorPtr[1]->data[in] );
      }
   }
   else if (VB->IndexPtr[1]) {
      VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
					       VB->IndexPtr[1]->data[out][0],
					       VB->IndexPtr[1]->data[in][0] );
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   generic_interp(ctx, t, dst, out, in, force_boundary);
}