revision 308:10a5b5475fb0
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 308:10a5b5475fb0 |
parent | 307:a357a469f5ff |
child | 309:e2750808d02c |
author | nkeynes |
date | Sun Jan 21 11:28:43 2007 +0000 (17 years ago) |
Enable blend by default - remove toggle on tex-alpha bit as its just plain
wrong
Implement UV clamping
wrong
Implement UV clamping
src/pvr2/pvr2.h | view | annotate | diff | log | ||
src/pvr2/rendcore.c | view | annotate | diff | log | ||
src/pvr2/render.c | view | annotate | diff | log |
1.1 --- a/src/pvr2/pvr2.h Sun Jan 21 05:24:27 2007 +00001.2 +++ b/src/pvr2/pvr2.h Sun Jan 21 11:28:43 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: pvr2.h,v 1.22 2007-01-16 10:34:46 nkeynes Exp $1.6 + * $Id: pvr2.h,v 1.23 2007-01-21 11:28:43 nkeynes Exp $1.7 *1.8 * PVR2 (video chip) functions and macros.1.9 *1.10 @@ -259,6 +259,8 @@1.11 #define POLY2_COLOUR_CLAMP_ENABLE(poly2) ((poly2)&0x00200000)1.12 #define POLY2_ALPHA_ENABLE(poly2) ((poly2)&0x001000000)1.13 #define POLY2_TEX_ALPHA_ENABLE(poly2) (((poly2)&0x00080000) == 0 )1.14 +#define POLY2_TEX_CLAMP_U(poly2) ((poly2)&0x00010000)1.15 +#define POLY2_TEX_CLAMP_V(poly2) ((poly2)&0x00008000)1.16 #define POLY2_TEX_WIDTH(poly2) ( 1<< ((((poly2) >> 3) & 0x07 ) + 3) )1.17 #define POLY2_TEX_HEIGHT(poly2) ( 1<< (((poly2) & 0x07 ) + 3) )1.18 #define POLY2_TEX_BLEND(poly2) ( pvr2_poly_texblend[((poly2) >> 6)&0x03] )
2.1 --- a/src/pvr2/rendcore.c Sun Jan 21 05:24:27 2007 +00002.2 +++ b/src/pvr2/rendcore.c Sun Jan 21 11:28:43 2007 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: rendcore.c,v 1.9 2007-01-17 09:21:09 nkeynes Exp $2.6 + * $Id: rendcore.c,v 1.10 2007-01-21 11:28:43 nkeynes Exp $2.7 *2.8 * PVR2 renderer core.2.9 *2.10 @@ -72,10 +72,11 @@2.11 float f;2.12 uint32_t i;2.13 } temp;2.14 - int e = ((half & 0x7C00) >> 10) - 15 + 127;2.15 + /* int e = ((half & 0x7C00) >> 10) - 15 + 127;2.17 temp.i = ((half & 0x8000) << 16) | (e << 23) |2.18 - ((half & 0x03FF) << 13);2.19 + ((half & 0x03FF) << 13); */2.20 + temp.i = ((uint32_t)half)<<16;2.21 return temp.f;2.22 }2.24 @@ -125,6 +126,16 @@2.25 glEnable(GL_TEXTURE_2D);2.26 texcache_get_texture( (texture&0x000FFFFF)<<3, width, height, texture );2.27 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, POLY2_TEX_BLEND(poly2) );2.28 + if( POLY2_TEX_CLAMP_U(poly2) ) {2.29 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );2.30 + } else {2.31 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );2.32 + }2.33 + if( POLY2_TEX_CLAMP_V(poly2) ) {2.34 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );2.35 + } else {2.36 + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );2.37 + }2.38 } else {2.39 glDisable( GL_TEXTURE_2D );2.40 }2.41 @@ -134,11 +145,6 @@2.42 int srcblend = POLY2_SRC_BLEND(poly2);2.43 int destblend = POLY2_DEST_BLEND(poly2);2.44 glBlendFunc( srcblend, destblend );2.45 - if( POLY2_TEX_ALPHA_ENABLE(poly2) ) {2.46 - glEnable(GL_BLEND);2.47 - } else {2.48 - glDisable(GL_BLEND);2.49 - }2.50 }2.52 void render_vertexes( uint32_t poly1, uint32_t *vertexes, int num_vertexes, int vertex_size,2.53 @@ -199,7 +205,7 @@2.54 vertex_length *= 2 ;2.55 }2.56 vertex_length += 3;2.57 -2.58 +2.59 if( (entry & 0xE0000000) == 0x80000000 ) {2.60 /* Triangle(s) */2.61 int strip_count = ((entry >> 25) & 0x0F)+1;
3.1 --- a/src/pvr2/render.c Sun Jan 21 05:24:27 2007 +00003.2 +++ b/src/pvr2/render.c Sun Jan 21 11:28:43 2007 +00003.3 @@ -1,5 +1,5 @@3.4 /**3.5 - * $Id: render.c,v 1.16 2007-01-17 09:21:27 nkeynes Exp $3.6 + * $Id: render.c,v 1.17 2007-01-21 11:28:43 nkeynes Exp $3.7 *3.8 * PVR2 Renderer support. This part is primarily3.9 *3.10 @@ -205,12 +205,14 @@3.11 glMatrixMode(GL_MODELVIEW);3.12 glLoadIdentity();3.13 glCullFace( GL_BACK );3.14 + glEnable( GL_BLEND );3.16 /* Clear out the buffers */3.17 glDisable( GL_SCISSOR_TEST );3.18 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);3.19 glClearDepth(0);3.20 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );3.21 +3.22 }3.24 /**
.