diff --git a/src/Graphics_NDS.c b/src/Graphics_NDS.c index 002e3d4c2..16790b632 100644 --- a/src/Graphics_NDS.c +++ b/src/Graphics_NDS.c @@ -25,14 +25,14 @@ void Gfx_Create(void) { glAlphaFunc(7); glClearDepth(GL_MAX_DEPTH); - glViewport(0, 0, 255, 191); + Gfx_SetViewport(0, 0, 256, 192); vramSetBankA(VRAM_A_TEXTURE); vramSetBankB(VRAM_B_TEXTURE); vramSetBankC(VRAM_C_TEXTURE); vramSetBankD(VRAM_D_TEXTURE); - glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); + Gfx_SetFaceCulling(false); } cc_bool Gfx_TryRestoreContext(void) { @@ -67,7 +67,11 @@ void Gfx_SetVSync(cc_bool vsync) { void Gfx_OnWindowResize(void) { } -void Gfx_SetViewport(int x, int y, int w, int h) { } +void Gfx_SetViewport(int x, int y, int w, int h) { + int x2 = x + w - 1, y2 = y + h - 1; + GFX_VIEWPORT = x | (y << 8) | (x2 << 16) | (y2 << 24); +} + void Gfx_SetScissor (int x, int y, int w, int h) { } void Gfx_BeginFrame(void) { diff --git a/src/Picking.h b/src/Picking.h index 6aa544a58..280a29fb0 100644 --- a/src/Picking.h +++ b/src/Picking.h @@ -18,7 +18,7 @@ http://www.devmaster.net/articles/raytracing_series/A%20faster%20voxel%20travers */ struct RayTracer { IVec3 pos; /* Coordinates of block within world */ - Vec3 origin, dir, invDir; + Vec3 origin, dir; Vec3 Min, Max; /* Min/max coords of block's bounding box. */ BlockID block; IVec3 step; @@ -28,6 +28,7 @@ struct RayTracer { IVec3 translatedPos; /* Coords of the neighbouring block that is closest to the player */ cc_bool valid; /* Whether the ray tracer actually intersected with a block */ Face closest; /* Face of the intersected block that is closet to the player */ + Vec3 invDir; }; /* Marks the given ray tracer as having no result. */