Search
lxdream.org :: lxdream :: r648:ef9aa5cba86f
lxdream 0.9.1
released Jun 29
Download Now
changeset648:ef9aa5cba86f lxdream-render
parent647:d6fecb7750b9
child649:620c5c6496b5
authornkeynes
dateSat Mar 08 04:21:42 2008 +0000 (11 years ago)
branchlxdream-render
Put the 1/z back in for the moment
src/pvr2/glrender.c
src/pvr2/rendsort.c
src/pvr2/scene.c
1.1 --- a/src/pvr2/glrender.c Sat Mar 08 04:21:11 2008 +0000
1.2 +++ b/src/pvr2/glrender.c Sat Mar 08 04:21:42 2008 +0000
1.3 @@ -151,23 +151,7 @@
1.4 int width = POLY2_TEX_WIDTH(poly2);
1.5 int height = POLY2_TEX_HEIGHT(poly2);
1.6 glEnable(GL_TEXTURE_2D);
1.7 - switch( POLY2_TEX_BLEND(poly2) ) {
1.8 - case 0: /* Replace */
1.9 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
1.10 - break;
1.11 - case 2:/* Decal */
1.12 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
1.13 - break;
1.14 - case 1: /* Modulate RGB */
1.15 - /* This is not directly supported by opengl (other than by mucking
1.16 - * with the texture format), but we get the same effect by forcing
1.17 - * the fragment alpha to 1.0 and using GL_MODULATE.
1.18 - */
1.19 - case 3: /* Modulate RGBA */
1.20 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
1.21 - break;
1.22 - }
1.23 -
1.24 + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pvr2_poly_texblend[POLY2_TEX_BLEND(poly2)] );
1.25 if( POLY2_TEX_CLAMP_U(poly2) ) {
1.26 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
1.27 } else {
1.28 @@ -266,7 +250,7 @@
1.29 farz*= 2.0;
1.30 }
1.31 glOrtho( 0, pvr2_scene.buffer_width, pvr2_scene.buffer_height, 0,
1.32 - -nearz, -farz );
1.33 + -farz, -nearz );
1.34
1.35 /* Clear the buffer (FIXME: May not want always want to do this) */
1.36 glDisable( GL_SCISSOR_TEST );
1.37 @@ -304,7 +288,7 @@
1.38 (pvr2_scene.sort_mode == SORT_TILEFLAG && (segment->control&SEGMENT_SORT_TRANS))) {
1.39 gl_render_tilelist(segment->trans_ptr);
1.40 } else {
1.41 - render_autosort_tile(segment->trans_ptr, RENDER_NORMAL, !pvr2_scene.full_shadow);
1.42 + render_autosort_tile(segment->trans_ptr, RENDER_NORMAL );
1.43 }
1.44 }
1.45 if( IS_TILE_PTR(segment->punchout_ptr) ) {
2.1 --- a/src/pvr2/rendsort.c Sat Mar 08 04:21:11 2008 +0000
2.2 +++ b/src/pvr2/rendsort.c Sat Mar 08 04:21:42 2008 +0000
2.3 @@ -157,12 +157,12 @@
2.4 render_set_context( poly->context, RENDER_NORMAL );
2.5 glEnable(GL_DEPTH_TEST);
2.6 glDepthFunc(GL_GEQUAL);
2.7 + /* Fix cull direction */
2.8 if( triangles[i].triangle_num & 1 ) {
2.9 glCullFace(GL_FRONT);
2.10 } else {
2.11 glCullFace(GL_BACK);
2.12 }
2.13 - /* Fix cull direction */
2.14 glDrawArrays(GL_TRIANGLE_STRIP, poly->vertex_index + triangles[i].triangle_num, 3 );
2.15 }
2.16 }
2.17 @@ -171,7 +171,7 @@
2.18 {
2.19 const struct sort_triangle *tri1 = a;
2.20 const struct sort_triangle *tri2 = b;
2.21 - return tri1->minz - tri2->minz;
2.22 + return tri2->minz - tri1->minz;
2.23 }
2.24
2.25 void sort_triangles( struct sort_triangle *triangles, int num_triangles )
2.26 @@ -179,7 +179,7 @@
2.27 qsort( triangles, num_triangles, sizeof(struct sort_triangle), compare_triangles );
2.28 }
2.29
2.30 -void render_autosort_tile( pvraddr_t tile_entry, int render_mode, gboolean cheap_modifier_mode )
2.31 +void render_autosort_tile( pvraddr_t tile_entry, int render_mode )
2.32 {
2.33 int num_triangles = sort_count_triangles(tile_entry);
2.34 if( num_triangles == 0 ) {
3.1 --- a/src/pvr2/scene.c Sat Mar 08 04:21:11 2008 +0000
3.2 +++ b/src/pvr2/scene.c Sat Mar 08 04:21:42 2008 +0000
3.3 @@ -45,10 +45,6 @@
3.4 float f;
3.5 uint32_t i;
3.6 } temp;
3.7 - /* int e = ((half & 0x7C00) >> 10) - 15 + 127;
3.8 -
3.9 - temp.i = ((half & 0x8000) << 16) | (e << 23) |
3.10 - ((half & 0x03FF) << 13); */
3.11 temp.i = ((uint32_t)half)<<16;
3.12 return temp.f;
3.13 }
3.14 @@ -211,6 +207,8 @@
3.15 float z = *data.fval++;
3.16 if( !isfinite(z) ) {
3.17 z = 0;
3.18 + } else if( z != 0 ) {
3.19 + z = 1/z;
3.20 }
3.21 if( z > pvr2_scene.bounds[5] ) {
3.22 pvr2_scene.bounds[5] = z;
.