Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: desmume/src/gfx3d.cpp
- ===================================================================
- --- desmume/src/gfx3d.cpp (revision 4477)
- +++ desmume/src/gfx3d.cpp (working copy)
- @@ -2138,6 +2138,16 @@
- std::sort(gfx3d.indexlist.list + opaqueCount, gfx3d.indexlist.list + polycount, gfx3d_ysort_compare);
- }
- + // apply user visibility settings
- + for(int i=0; i<polycount; i++)
- + {
- + POLY &poly = polylist->list[polycount-i-1];
- + int polyRange = polycount; //POLYLIST_SIZE;
- + int minPolyIndex = (int)((double)polyRange * gfx3d.visibilityRangeStart);
- + int maxPolyIndex = (int)((double)polyRange * gfx3d.visibilityRangeEnd);
- + poly.enabled = (i >= minPolyIndex) && (i <= maxPolyIndex);
- + }
- +
- //switch to the new lists
- twiddleLists();
- Index: desmume/src/gfx3d.h
- ===================================================================
- --- desmume/src/gfx3d.h (revision 4477)
- +++ desmume/src/gfx3d.h (working copy)
- @@ -141,6 +141,7 @@
- u32 polyAttr, texParam, texPalette; //the hardware rendering params
- u32 viewport;
- float miny, maxy;
- + bool enabled; // user settings
- void setVertIndexes(int a, int b, int c, int d=-1)
- {
- @@ -366,6 +367,8 @@
- GFX3D()
- : polylist(0)
- , vertlist(0)
- + , visibilityRangeStart(0.0)
- + , visibilityRangeEnd(1.0)
- , frameCtr(0)
- , frameCtrRaw(0) {
- }
- @@ -380,6 +383,9 @@
- VERTLIST* vertlist;
- INDEXLIST indexlist;
- + double visibilityRangeStart;
- + double visibilityRangeEnd;
- +
- //ticks every time flush() is called
- int frameCtr;
- Index: desmume/src/lua-engine.cpp
- ===================================================================
- --- desmume/src/lua-engine.cpp (revision 4477)
- +++ desmume/src/lua-engine.cpp (working copy)
- @@ -29,6 +29,7 @@
- #include "GPU_osd.h"
- #include "saves.h"
- #include "emufile.h"
- +#include "gfx3d.h"
- #if defined(WIN32) && !defined(WXPORT)
- #include <windows.h>
- #include "main.h"
- @@ -4421,6 +4422,22 @@
- return 0;
- }
- +// gui.setgfx3dvisibility(double bgStart, double bgEnd)
- +//
- +static int gui_setgfx3dvisibility(lua_State *L)
- +{
- + double gfx3dStart = luaL_checknumber(L,1);
- + double gfx3dEnd = luaL_checknumber(L,2);
- +
- + gfx3dStart = std::min(std::max(gfx3dStart, 0.0), 1.0);
- + gfx3dEnd = std::min(std::max(gfx3dEnd, 0.0), 1.0);
- +
- + gfx3d.visibilityRangeStart = gfx3dStart;
- + gfx3d.visibilityRangeEnd = gfx3dEnd;
- +
- + return 0;
- +}
- +
- DEFINE_LUA_FUNCTION(stylus_read, "")
- {
- @@ -4559,6 +4576,7 @@
- {"gdoverlay", gui_gdoverlay},
- {"redraw", emu_redraw}, // some people might think of this as more of a GUI function
- {"osdtext", gui_osdtext},
- + {"setgfx3dvisibility", gui_setgfx3dvisibility},
- // alternative names
- {"drawtext", gui_text},
- {"drawbox", gui_box},
- Index: desmume/src/OGLRender.cpp
- ===================================================================
- --- desmume/src/OGLRender.cpp (revision 4477)
- +++ desmume/src/OGLRender.cpp (working copy)
- @@ -1078,6 +1078,9 @@
- POLY *poly = &gfx3d.polylist->list[gfx3d.indexlist.list[i]];
- int type = poly->type;
- + if (!poly->enabled)
- + continue;
- +
- //a very macro-level state caching approach:
- //these are the only things which control the GPU rendering state.
- if(i==0 || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette || lastPolyAttr != poly->polyAttr)
- Index: desmume/src/rasterize.cpp
- ===================================================================
- --- desmume/src/rasterize.cpp (revision 4477)
- +++ desmume/src/rasterize.cpp (working copy)
- @@ -1060,7 +1060,8 @@
- polyAttr.backfacing = engine->polyBackfacing[i];
- - shape_engine<SLI>(type,!polyAttr.backfacing, (poly->vtxFormat & 4) && CommonSettings.GFX3D_LineHack);
- + if(poly->enabled)
- + shape_engine<SLI>(type,!polyAttr.backfacing, (poly->vtxFormat & 4) && CommonSettings.GFX3D_LineHack);
- }
- }
- Index: desmume/src/version.cpp
- ===================================================================
- --- desmume/src/version.cpp (revision 4477)
- +++ desmume/src/version.cpp (working copy)
- @@ -82,7 +82,7 @@
- #endif
- #define DESMUME_VERSION_NUMERIC 90800
- -#define DESMUME_VERSION_STRING " " "0.9.8" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER
- +#define DESMUME_VERSION_STRING " " "0.9.8-gfx3dHack" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER
- #define DESMUME_NAME_AND_VERSION DESMUME_NAME DESMUME_VERSION_STRING
- u32 EMU_DESMUME_VERSION_NUMERIC() { return DESMUME_VERSION_NUMERIC; }
Add Comment
Please, Sign In to add comment