Search
lxdream.org :: lxdream/src/pvr2/rendcore.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/rendcore.c
changeset 318:363935d31859
prev308:10a5b5475fb0
next319:5392aed6a982
author nkeynes
date Tue Jan 23 12:03:57 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Add initial offset color support
Honor the "enable fragment alpha" bit
file annotate diff log raw
1.1 --- a/src/pvr2/rendcore.c Sun Jan 21 11:28:43 2007 +0000
1.2 +++ b/src/pvr2/rendcore.c Tue Jan 23 12:03:57 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: rendcore.c,v 1.10 2007-01-21 11:28:43 nkeynes Exp $
1.6 + * $Id: rendcore.c,v 1.11 2007-01-23 12:03:57 nkeynes Exp $
1.7 *
1.8 * PVR2 renderer core.
1.9 *
1.10 @@ -52,6 +52,8 @@
1.11
1.12 extern char *video_base;
1.13
1.14 +gboolean pvr2_force_fragment_alpha;
1.15 +
1.16 struct tile_segment {
1.17 uint32_t control;
1.18 pvraddr_t opaque_ptr;
1.19 @@ -120,6 +122,12 @@
1.20 break;
1.21 }
1.22
1.23 + if( POLY1_SPECULAR(poly1) ) {
1.24 + glEnable(GL_COLOR_SUM);
1.25 + } else {
1.26 + glDisable(GL_COLOR_SUM);
1.27 + }
1.28 +
1.29 if( POLY1_TEXTURED(poly1) ) {
1.30 int width = POLY2_TEX_WIDTH(poly2);
1.31 int height = POLY2_TEX_HEIGHT(poly2);
1.32 @@ -145,6 +153,9 @@
1.33 int srcblend = POLY2_SRC_BLEND(poly2);
1.34 int destblend = POLY2_DEST_BLEND(poly2);
1.35 glBlendFunc( srcblend, destblend );
1.36 +
1.37 + pvr2_force_fragment_alpha = POLY2_ALPHA_ENABLE(poly2) ? FALSE : TRUE;
1.38 +
1.39 }
1.40
1.41 void render_vertexes( uint32_t poly1, uint32_t *vertexes, int num_vertexes, int vertex_size,
1.42 @@ -161,21 +172,32 @@
1.43 for( i=0; i<num_vertexes; i++ ) {
1.44 float *vertexf = (float *)vertexes;
1.45 uint32_t argb;
1.46 + int k = m + 3;
1.47 if( POLY1_TEXTURED(poly1) ) {
1.48 if( POLY1_UV16(poly1) ) {
1.49 - glTexCoord2f( halftofloat(vertexes[m+3]>>16),
1.50 - halftofloat(vertexes[m+3]) );
1.51 - argb = vertexes[m+4];
1.52 + glTexCoord2f( halftofloat(vertexes[k]>>16),
1.53 + halftofloat(vertexes[k]) );
1.54 + k++;
1.55 } else {
1.56 - glTexCoord2f( vertexf[m+3], vertexf[m+4] );
1.57 - argb = vertexes[m+5];
1.58 + glTexCoord2f( vertexf[k], vertexf[k+1] );
1.59 + k+=2;
1.60 }
1.61 - } else {
1.62 - argb = vertexes[m+3];
1.63 }
1.64
1.65 - glColor4ub( (GLubyte)(argb >> 16), (GLubyte)(argb >> 8),
1.66 - (GLubyte)argb, (GLubyte)(argb >> 24) );
1.67 + argb = vertexes[k++];
1.68 + if( pvr2_force_fragment_alpha ) {
1.69 + glColor4ub( (GLubyte)(argb >> 16), (GLubyte)(argb >> 8),
1.70 + (GLubyte)argb, 0xFF );
1.71 + } else {
1.72 + glColor4ub( (GLubyte)(argb >> 16), (GLubyte)(argb >> 8),
1.73 + (GLubyte)argb, (GLubyte)(argb >> 24) );
1.74 + }
1.75 +
1.76 + if( POLY1_SPECULAR(poly1) ) {
1.77 + uint32_t spec = vertexes[k++];
1.78 + glSecondaryColor3ubEXT( (GLubyte)(spec >> 16), (GLubyte)(spec >> 8),
1.79 + (GLubyte)spec );
1.80 + }
1.81 glVertex3f( vertexf[0], vertexf[1], vertexf[2] );
1.82 vertexes += vertex_size;
1.83 }
.