From d5cf0cdc0505f2a918a134a3cacaaca55c71f7d7 Mon Sep 17 00:00:00 2001 From: slack Date: Thu, 2 Oct 2008 22:20:01 +0200 Subject: [PATCH] WIP: sketching gfx engine design --- Makefile | 2 +- game.cc | 1 + gfx.cc | 24 +++++++++++++++++++++++- gfx.h | 3 +++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c2b34f7..83c83f2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ TARGET = laz0r -OBJS = main.o game.o +OBJS = main.o game.o gfx.o PSP_FW_VERSION=401 BUILD_PRX=1 diff --git a/game.cc b/game.cc index d726e6b..a631946 100644 --- a/game.cc +++ b/game.cc @@ -2,6 +2,7 @@ int game_main(int argc, char **argv) { + while(1) { } diff --git a/gfx.cc b/gfx.cc index e5905cb..6d7cf1c 100644 --- a/gfx.cc +++ b/gfx.cc @@ -6,7 +6,7 @@ void GFX::init() { - dList = memalign(16, 640); + dList = memalign(16, 2048); fbp0 = 0; // Init GU @@ -32,6 +32,11 @@ void GFX::init() sceGuFrontFace( GU_CW ); sceGuEnable( GU_CULL_FACE ); sceGuEnable( GU_CLIP_PLANES ); + + // set clear color/depth + sceGuClearColor( GU_COLOR( 0.0f, 0.0f, 0.0f, 1.0f ) ); + sceGuClearDepth(0); + sceGuFinish(); sceGuSync(0,0); @@ -67,3 +72,20 @@ void update_fps( void ) pspDebugScreenPrintf( fps_display ); } + +void GFX::perspective(float fov, float aspect, float znear, float zfar) +{ + // setup projection matrix + sceGumMatrixMode(GU_PROJECTION); + sceGumLoadIdentity(); + sceGumPerspective(fov, aspect, znear, zfar); +} + +void GFX::look_at(ScePspFVector3 *eye, ScePspFVector3 *center, ScePspFVector3 *up) +{ + sceGumMatrixMode(GU_VIEW); + sceGumLoadIdentity(); + sceGumLookAt(eye, center, up); +} + + diff --git a/gfx.h b/gfx.h index 35ceb15..97081fc 100644 --- a/gfx.h +++ b/gfx.h @@ -21,6 +21,9 @@ class GFX: public Singleton void init(); void cleanup(); void update_fps(); + + void setup_perspective(float fov, float aspect, float znear, float zfar); + void look_at(ScePspFVector3 *eye, ScePspFVector3 *center, ScePspFVector3 *up); }; #endif -- 2.34.1