From 1ba3351f6e7020805202c9dd1a28cb2de81ea71a Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 25 Jul 2009 19:59:40 +0000 Subject: [PATCH] oglrender: support wireframe --- desmume/src/OGLRender.cpp | 4 ++++ desmume/src/gfx3d.cpp | 3 --- desmume/src/gfx3d.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index 5c9e6ddef..a95580729 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -829,6 +829,7 @@ static void OGLRender() VERT *vert0 = &gfx3d.vertlist->list[poly->vertIndexes[0]]; u8 alpha = material_5bit_to_8bit[poly->getAlpha()]; + if(wireframe) alpha = 255; u8 color0[4] = { material_5bit_to_8bit[vert0->color[0]], material_5bit_to_8bit[vert0->color[1]], @@ -836,6 +837,9 @@ static void OGLRender() alpha }; + //this draws things as a fan to prepare for the day when the clipping is done in gfx3d + //and funny shaped polys find their way into here. + //of course it could really be drawn as a fan, i suppose.. i dont remember why we did it this way for(int j = 1; j < (type-1); j++) { VERT *vert1 = &gfx3d.vertlist->list[poly->vertIndexes[j]]; diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 53b90558e..7cb9dd25f 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -546,9 +546,6 @@ static void gfx3d_glPolygonAttrib_cache() // back face culling cullingMask = (polyAttr>>6)&3; - - // Alpha value, actually not well handled, 0 should be wireframe - colorRGB[3] = colorAlpha = ((polyAttr>>16)&0x1F); } static void gfx3d_glTexImage_cache() diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index b0711c745..b22aa1951 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -84,7 +84,8 @@ struct POLY { bool isTranslucent() { //alpha != 31 -> translucent - if((polyAttr&0x001F0000) != 0x001F0000) + //except for alpha 0 which is wireframe (unless it has a translucent tex) + if((polyAttr&0x001F0000) != 0x001F0000 && (polyAttr&0x001F0000) != 0) return true; int texFormat = (texParam>>26)&7;