void drawShadowCaster( Geometry* geom ) { sceGuSetMatrix(GU_MODEL,&geom->world); sceGuColor(0x00000000); sceGuDrawArray(GU_TRIANGLES,GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D,geom->count,geom->indices,geom->vertices); }
void psp_init(void) { SceUID thid; char buff[128], *r; /* fw 1.5 sometimes returns 8002032c, although getcwd works */ r = getcwd(buff, sizeof(buff)); if (r) sceIoChdir(buff); main_thread_id = sceKernelGetThreadId(); lprintf("running on %08x kernel\n", sceKernelDevkitVersion()), lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id, sceKernelGetThreadCurrentPriority()); thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL); if (thid >= 0) { sceKernelStartThread(thid, 0, 0); } /* video */ sceDisplaySetMode(0, 480, 272); sceDisplaySetFrameBuf(VRAM_FB1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME); current_screen = 1; psp_screen = VRAM_FB0; /* gu */ sceGuInit(); sceGuStart(GU_DIRECT, guCmdList); sceGuDrawBuffer(GU_PSM_5650, (void *)VRAMOFFS_FB0, 512); sceGuDispBuffer(480, 272, (void *)VRAMOFFS_FB1, 512); // don't care sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT); sceGuDepthBuffer((void *)VRAMOFFS_DEPTH, 512); sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2)); sceGuViewport(2048, 2048, 480, 272); sceGuDepthRange(0xc350, 0x2710); sceGuScissor(0, 0, 480, 272); sceGuEnable(GU_SCISSOR_TEST); sceGuDepthMask(0xffff); sceGuDisable(GU_DEPTH_TEST); sceGuFrontFace(GU_CW); sceGuEnable(GU_TEXTURE_2D); sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB); sceGuAmbientColor(0xffffffff); sceGuColor(0xffffffff); sceGuFinish(); sceGuSync(0, 0); sceDisplayWaitVblankStart(); sceGuDisplay(GU_TRUE); /* input */ sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); }
void pgeTextureActivate(pgeTexture *texture) { if(texture->format == PGE_PIXEL_FORMAT_T4) { sceGuClutMode(texture->palFormat, 0, 0xff, 0); sceGuClutLoad(2, texture->palette); } else if(texture->format == PGE_PIXEL_FORMAT_T8) { sceGuClutMode(texture->palFormat, 0, 0xff, 0); sceGuClutLoad(32, texture->palette); } sceGuEnable(GU_TEXTURE_2D); sceGuTexWrap(GU_REPEAT, GU_REPEAT); sceGuTexFilter(GU_NEAREST, GU_NEAREST); sceGuTexFunc(pgeTextureMode, GU_TCC_RGBA); sceGuTexEnvColor(0xFFFFFFFF); sceGuColor(0xFFFFFFFF); sceGuAmbientColor(0xFFFFFFFF); sceGuTexOffset(0.0f, 0.0f); sceGuTexScale(1.0f/(float)texture->textureWidth, 1.0f/(float)texture->textureHeight); sceGuTexMode(texture->format, 0, 0, texture->swizzled); sceGuTexImage(0, texture->textureWidth, texture->textureHeight, texture->textureWidth, texture->data); }
// These are GU commands that should always stay the same inline void MasterGuRenderer::guPreRender() { DEBUG_ENTER_FUNC(); #ifdef USE_DISPLAY_CALLBACK _renderSema.take(); // Take the semaphore to prevent writes // to the palette/screen before we're done _renderFinished = false; // set to synchronize with callback thread #endif #ifdef ENABLE_RENDER_MEASURE _lastRenderTime = g_system->getMillis(); #endif /* ENABLE_RENDER_MEASURE */ sceGuStart(0, _displayList); sceGuClearColor(0xFF000000); sceGuClear(GU_COLOR_BUFFER_BIT); sceGuAmbientColor(0xFFFFFFFF); sceGuColor(0xFFFFFFFF); sceGuTexOffset(0, 0); sceGuTexFilter(GU_LINEAR, GU_LINEAR); sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); // Also good enough for all purposes sceGuAlphaFunc(GU_GREATER, 0, 0xFF); // Also good enough for all purposes }
void gEnd() { if (!obj_begin || obj_list_size <= 0) { obj_begin = G_FALSE; return; } // Manage pspgu extensions if (obj_use_z) sceGuEnable(GU_DEPTH_TEST); else sceGuDisable(GU_DEPTH_TEST); if (obj_use_blend) sceGuEnable(GU_BLEND); else sceGuDisable(GU_BLEND); if (obj_use_vert_color) sceGuColor(WHITE); else sceGuColor(obj_list[0].color); if (!obj_use_tex) sceGuDisable(GU_TEXTURE_2D); else { sceGuEnable(GU_TEXTURE_2D); if (obj_use_tex_linear) sceGuTexFilter(GU_LINEAR,GU_LINEAR); else sceGuTexFilter(GU_NEAREST,GU_NEAREST); if (obj_use_tex_repeat) sceGuTexWrap(GU_REPEAT,GU_REPEAT); else sceGuTexWrap(GU_CLAMP,GU_CLAMP); // Load texture sceGuTexMode(GU_PSM_8888,0,0,obj_tex->swizzled); sceGuTexImage(0,obj_tex->tw,obj_tex->th,obj_tex->tw,obj_tex->data); } switch (obj_type) { case RECTS: _gEndRects(); break; case LINES: _gEndLines(); break; case QUADS: _gEndQuads(); break; } sceGuColor(WHITE); sceGuEnable(GU_BLEND); obj_begin = G_FALSE; if (obj_use_z) zclear = G_TRUE; }
void drawShadowReceiver( Geometry* geom, ScePspFMatrix4 shadowProjMatrix ) { sceGuSetMatrix(GU_MODEL,&geom->world); // multiply shadowmap projection texture by geometry world matrix // since geometry coords are in object space gumMultMatrix(&shadowProjMatrix, &shadowProjMatrix, &geom->world ); sceGuSetMatrix(GU_TEXTURE,&shadowProjMatrix); sceGuColor(geom->color); sceGuDrawArray(GU_TRIANGLES,GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D,geom->count,geom->indices,geom->vertices); }
void drawTorus( int val ) { // setup a light ScePspFVector3 dir = { 0, 0, 1 }; sceGuLight(0,GU_DIRECTIONAL,GU_DIFFUSE,&dir); sceGuLightColor(0,GU_DIFFUSE,0x00ff4040 ); sceGuLightAtt(0,1.0f,0.0f,0.0f); sceGuAmbient(0x00202020); // setup texture sceGuDisable(GU_TEXTURE_2D); sceGuEnable(GU_LIGHTING); sceGuEnable(GU_LIGHT0); // setup matrices for torus sceGumMatrixMode(GU_PROJECTION); sceGumLoadIdentity(); sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f); sceGumMatrixMode(GU_VIEW); { ScePspFVector3 pos = {0.0f,0.0f,-2.5f}; sceGumLoadIdentity(); sceGumTranslate(&pos); } sceGumMatrixMode(GU_MODEL); { ScePspFVector3 rot = {val * 0.79f * (GU_PI/180.0f), val * 0.98f * (GU_PI/180.0f), val * 1.32f * (GU_PI/180.0f)}; sceGumLoadIdentity(); sceGumRotateXYZ(&rot); } // draw torus sceGuColor(0xffffff); sceGumDrawArray(GU_TRIANGLES,GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D,sizeof(torus_indices)/sizeof(unsigned short),torus_indices,torus_vertices); // restore state sceGuDisable(GU_LIGHTING); sceGuDisable(GU_LIGHT0); sceGuEnable(GU_TEXTURE_2D); }
void StateOptions::Draw(StateManager* sManager) { //start rendering mRender->StartFrame(1,1,1); switch(menuState) { case 0: { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0; x < 8; x++) { for(int y = 0; y < 5; y++) { backSprite->SetPosition(x*64,y*64); backSprite->Draw(); } } //Controls buttonSprite->SetPosition(240,120); buttonSprite->Draw(); //sensity - analog stick buttonSprite->SetPosition(240,160); buttonSprite->Draw(); //back buttonSprite->SetPosition(240,200); buttonSprite->Draw(); //selected button sbuttonSprite->SetPosition(240,(selectPos * 40) + 120); sbuttonSprite->Draw(); sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); //draw subtitles on buttons selectPos == 0 ? DrawText(240,129,GU_COLOR(1,1,0,1) ,default_size,"Controls") : DrawText(240,129,GU_COLOR(1,1,1,1) ,default_size,"Controls"); selectPos == 1 ? DrawText(240,169,GU_COLOR(1,1,0,1) ,default_size,"Analog stick") : DrawText(240,169,GU_COLOR(1,1,1,1) ,default_size,"Analog stick"); selectPos == 2 ? DrawText(240,209,GU_COLOR(1,1,0,1) ,default_size,"Back") : DrawText(240,209,GU_COLOR(1,1,1,1) ,default_size,"Back"); DrawText(240,29,GU_COLOR(1,1,1,1) ,default_size,"Options"); } break; case 1://controls { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0; x < 8; x++) { for(int y = 0; y < 5; y++) { backSprite->SetPosition(x*64,y*64); backSprite->Draw(); } } int starty = 60; //something for(int i = controlStart; i < controlEnd; i++) { if(controlPos == i) { halfsbuttonSprite->SetPosition(160,starty + (i * 30) - (controlStart * 30)); halfsbuttonSprite->Draw(); } else { halfbuttonSprite->SetPosition(160,starty + (i * 30) - (controlStart * 30)); halfbuttonSprite->Draw(); } } //back if(controlPos == 16) { sbuttonSprite->SetPosition(240,260); sbuttonSprite->Draw(); } else { buttonSprite->SetPosition(240,260); buttonSprite->Draw(); } sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); //write action names starty = 67; mRender->SetFontStyle(default_size,0xFFFFFFFF,0,0x00000000); for(int i = controlStart; i < controlEnd; i++) { //action mRender->DebugPrint(250,starty + (i * 30) - (controlStart * 30)+4,InputHelper::Instance()->getActionName(i).c_str()); } mRender->SetFontStyle(default_big_size,0xFFFFFFFF,0,0x00000200); starty = 65; for(int i = controlStart; i < controlEnd; i++) { //button assigned to this action if(controlPos == i && chooseKeyState == true) mRender->DebugPrint(160,starty + (i * 30) - (controlStart * 30)+4,"..."); else mRender->DebugPrint(160,starty + (i * 30) - (controlStart * 30)+4,InputHelper::Instance()->getButtonName(InputHelper::Instance()->getConnection(i).button).c_str()); } DrawText(240,269,GU_COLOR(1,1,0,1) ,default_size,"Back"); DrawText(240,29,GU_COLOR(1,1,1,1) ,default_size,"Controls"); } break; case 2://analog stick { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0; x < 8; x++) { for(int y = 0; y < 5; y++) { backSprite->SetPosition(x*64,y*64); backSprite->Draw(); } } //something nbuttonSprite->SetPosition(240,100); nbuttonSprite->Draw(); nbuttonSprite->SetPosition(240,130); nbuttonSprite->Draw(); nbuttonSprite->SetPosition(240,160); nbuttonSprite->Draw(); nbuttonSprite->SetPosition(240,190); nbuttonSprite->Draw(); //back buttonSprite->SetPosition(240,260); buttonSprite->Draw(); if(currentAnalogPos < 4) { sbuttonSprite->SetPosition(240,100 + (currentAnalogPos * 30)); sbuttonSprite->Draw(); } else { sbuttonSprite->SetPosition(240,260); sbuttonSprite->Draw(); } moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogYup) * 10) * 20),100); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogYdown) * 10) * 20),130); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogXleft) * 10) * 20),160); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogXright) * 10) * 20),190); moverSprite->Draw(); sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); mRender->SetFontStyle(default_size,0xFFFFFFFF,0,0x00000200); mRender->DebugPrint(240,109,"Analog up : %d%%",(int)(fabs(InputHelper::Instance()->analogYup) * 100.0f)); mRender->DebugPrint(240,139,"Analog down : %d%%",(int)(fabs(InputHelper::Instance()->analogYdown) * 100.0f)); mRender->DebugPrint(240,169,"Analog left : %d%%",(int)(fabs(InputHelper::Instance()->analogXleft) * 100.0f)); mRender->DebugPrint(240,199,"Analog right : %d%%",(int)(fabs(InputHelper::Instance()->analogXright) * 100.0f)); mRender->DebugPrint(240,269,"Back"); DrawText(240,29,GU_COLOR(1,1,1,1) ,default_size,"Analog stick"); } break; } //end frame mRender->EndFrame(); }
int dxpGraphicsSetup2DTex(DXPTEXTURE3 *texptr,int flag) { if(!texptr)return -1; //設定が同じなら変更処理をしない if(dxpGraphicsData.drawstate == DXP_DRAWSTATE_TEX2D && flag == dxpGraphicsData.flag && texptr == dxpGraphicsData.texture && !texptr->reloadflag && !dxpGraphicsData.forceupdate )return 0; GUSTART; if(dxpGraphicsData.drawstate != DXP_DRAWSTATE_TEX2D) {//2Dテクスチャ用の描画設定を行う。 dxpGraphicsData.drawstate = DXP_DRAWSTATE_TEX2D; dxpGraphicsData.forceupdate = 1; GUENABLE(GU_TEXTURE_2D); if(dxpGraphicsData.bilinear_enable) sceGuTexFilter(GU_LINEAR,GU_LINEAR); else sceGuTexFilter(GU_NEAREST,GU_NEAREST); if(dxpGraphicsData.usedepth) { GUENABLE(GU_DEPTH_TEST); sceGuDepthFunc(dxpGraphicsData.depthfunc); sceGuDepthBuffer(dxpGraphicsData.depthbuffer.texvram,512); //深度バッファを有効にするときでいい if(dxpGraphicsData.writedepth)sceGuDepthMask(0); else sceGuDepthMask(1); } else GUDISABLE(GU_DEPTH_TEST); } //テクスチャの設定開始 if(texptr != dxpGraphicsData.texture || texptr->reloadflag) {//GUにテクスチャの指定をする if(texptr->ppalette && (texptr->psm == GU_PSM_T8 || texptr->psm == GU_PSM_T4)) {//パレットの設定 sceGuClutMode(GU_PSM_8888,0,0xff,0); sceGuClutLoad(texptr->psm == GU_PSM_T4 ? 2 : 32,texptr->ppalette); } sceGuTexMode(texptr->psm,0,0,texptr->swizzledflag); sceGuTexImage(0,texptr->width,texptr->height,texptr->pitch,texptr->texvram ? texptr->texvram : texptr->texdata); dxpGraphicsData.texture = texptr; if(texptr != &dxpGraphicsData.displaybuffer[0] && texptr != &dxpGraphicsData.displaybuffer[1])texptr->reloadflag = 0; } u8 colorKey = 0,alphaEnable = 0; if(flag) { if(texptr->alphabit) alphaEnable = 1; else colorKey = 1; } if(colorKey) { GUENABLE(GU_COLOR_TEST); sceGuColorFunc(GU_NOTEQUAL,texptr->colorkey,0x00fefefe); } else { GUDISABLE(GU_COLOR_TEST); } int op; int src,dest; unsigned int srcfix; unsigned int destfix; switch(dxpGraphicsData.blendmode) { case DX_BLENDMODE_NOBLEND: op = GU_ADD; src = GU_FIX; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0; if(!alphaEnable)break; case DX_BLENDMODE_ALPHA: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_ONE_MINUS_SRC_ALPHA; srcfix = 0; destfix = 0; break; case DX_BLENDMODE_ADD: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0xffffffff; break; case DX_BLENDMODE_SUB: op = GU_REVERSE_SUBTRACT; src = GU_SRC_ALPHA; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0xffffffff; break; case DX_BLENDMODE_MUL: op = GU_ADD; src = GU_DST_COLOR; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0; break; case DX_BLENDMODE_DESTCOLOR: op = GU_ADD; src = GU_FIX; dest = GU_FIX; srcfix = 0; destfix = 0xffffffff; break; case DX_BLENDMODE_INVDESTCOLOR: op = GU_ADD; src = GU_ONE_MINUS_DST_COLOR; dest = GU_FIX; srcfix = 0; destfix = 0; break; case DX_BLENDMODE_INVSRC: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_ONE_MINUS_SRC_ALPHA; srcfix = 0; destfix = 0; break; default: return -1; } if(dxpGraphicsData.blendmode == DX_BLENDMODE_NOBLEND && !alphaEnable) { GUDISABLE(GU_BLEND); } else { GUENABLE(GU_BLEND); if(dxpGraphicsData.forceupdate || dxpGraphicsData.op != op || dxpGraphicsData.src != src || dxpGraphicsData.dest != dest || dxpGraphicsData.srcfix != srcfix || dxpGraphicsData.destfix != destfix ){ sceGuBlendFunc(op,src,dest,srcfix,destfix); dxpGraphicsData.op = op; dxpGraphicsData.src = src; dxpGraphicsData.dest = dest; dxpGraphicsData.srcfix = srcfix; dxpGraphicsData.destfix = destfix; } } if(dxpGraphicsData.forceupdate || dxpGraphicsData.color != dxpGraphicsData.gucolor) {//色を設定 sceGuColor(dxpGraphicsData.color); dxpGraphicsData.gucolor = dxpGraphicsData.color; } int tfx,tcc; switch(dxpGraphicsData.blendmode) { case DX_BLENDMODE_NOBLEND: case DX_BLENDMODE_MUL: case DX_BLENDMODE_DESTCOLOR: tcc = GU_TCC_RGB; tfx = GU_TFX_MODULATE; if(!alphaEnable) { GUDISABLE(GU_ALPHA_TEST); break; } case DX_BLENDMODE_ALPHA: case DX_BLENDMODE_ADD: case DX_BLENDMODE_SUB: case DX_BLENDMODE_INVDESTCOLOR: tcc = GU_TCC_RGBA; tfx = GU_TFX_MODULATE; GUENABLE(GU_ALPHA_TEST); sceGuAlphaFunc(GU_NOTEQUAL,0x00,0xff); break; case DX_BLENDMODE_INVSRC: sceGuTexEnvColor(0x00000000); tcc = GU_TCC_RGBA; tfx = GU_TFX_BLEND; GUDISABLE(GU_ALPHA_TEST); break; default: return -1; } if(dxpGraphicsData.forceupdate || dxpGraphicsData.tfx != tfx || dxpGraphicsData.tcc != tcc) { sceGuTexFunc(tfx,tcc); dxpGraphicsData.tfx = tfx; dxpGraphicsData.tcc = tcc; } dxpGraphicsData.forceupdate = 0; dxpGraphicsData.flag = flag; return 0; }
int main(int argc, char* argv[]) { setupCallbacks(); int i, j; // Load emd mesh from file EMD_MESH* mesh = EMD_LoadMeshFromFile("scene.emd"); int vert_count = EMD_GetVertexCount(mesh); int idx_count = 0; int elem_count = EMD_GetElementCount(mesh); for (i=0; i<elem_count; i++) { idx_count += EMD_GetIndexCount(mesh, i); } VERTEX* vert_buf = (VERTEX*)memalign(16, sizeof(VERTEX) * vert_count); GW_UINT16* idx_buf = (GW_UINT16*)memalign(16, sizeof(GW_UINT16) * idx_count); for (i=0; i<vert_count; i++) { EMD_GetVertexByIndex(mesh, i, &vert_buf[i].x, &vert_buf[i].y, &vert_buf[i].z); EMD_GetTexcoordByIndex(mesh, i, &vert_buf[i].u, &vert_buf[i].v); EMD_GetNormalByIndex(mesh, i, &vert_buf[i].nx, &vert_buf[i].ny, &vert_buf[i].nz); //vert_buf[i].color = 0xffffffff; } GW_UINT32 idx_head = 0; GW_UINT32* data; GW_UINT32 count; // Pack 32-bit index into 16-bit buffer for (i=0; i<elem_count; i++) { count = EMD_GetIndexCount(mesh, i); data = EMD_GetIndexArray(mesh, i); for (j=0; j<count; j++) { idx_buf[j + idx_head] = (GW_UINT16)data[j]; } idx_head += count; } EMD_FreeMesh(mesh); // flush cache so that no stray data remains sceKernelDcacheWritebackAll(); // setup GU void* fbp0 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888); void* fbp1 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888); void* zbp = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_4444); pspDebugScreenInit(); sceGuInit(); sceGuStart(GU_DIRECT,list); sceGuDrawBuffer(GU_PSM_8888,fbp0,BUF_WIDTH); sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,fbp1,BUF_WIDTH); sceGuDepthBuffer(zbp,BUF_WIDTH); sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2)); sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT); sceGuDepthRange(65535,0); sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT); sceGuEnable(GU_SCISSOR_TEST); sceGuDepthFunc(GU_GEQUAL); sceGuEnable(GU_DEPTH_TEST); sceGuFrontFace(GU_CCW); sceGuShadeModel(GU_SMOOTH); sceGuEnable(GU_CULL_FACE); //sceGuDisable(GU_TEXTURE_2D); sceGuEnable(GU_CLIP_PLANES); sceGuEnable(GU_LIGHTING); sceGuEnable(GU_LIGHT0); sceGuEnable(GU_LIGHT1); sceGuFinish(); sceGuSync(0,0); sceDisplayWaitVblankStart(); sceGuDisplay(GU_TRUE); // run sample int val = 0; while(running()) { sceGuStart(GU_DIRECT,list); // clear screen sceGuClearColor(0xff554433); sceGuClearDepth(0); sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); // setup lights ScePspFVector3 light_dir = { 1.0f, 1.0f, 1.0f }; // GU_DIRECTIONAL // GU_POINTLIGHT sceGuLight(0, GU_POINTLIGHT, GU_DIFFUSE, &light_dir); sceGuLightColor(0, GU_DIFFUSE, 0xffffffff); sceGuAmbient(0x00202020); light_dir.x = -light_dir.x; light_dir.y = -light_dir.y; light_dir.z = -light_dir.z; sceGuLight(1, GU_DIRECTIONAL, GU_DIFFUSE_AND_SPECULAR, &light_dir); sceGuLightColor(1, GU_DIFFUSE, 0xff7f7f7f); // setup matrices for cube sceGumMatrixMode(GU_PROJECTION); sceGumLoadIdentity(); sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f); sceGumMatrixMode(GU_VIEW); sceGumLoadIdentity(); sceGumMatrixMode(GU_MODEL); sceGumLoadIdentity(); { ScePspFVector3 pos = { 0, 0, -5.0f }; ScePspFVector3 rot = { val * 0.79f * (GU_PI/180.0f), val * 0.98f * (GU_PI/180.0f), val * 1.32f * (GU_PI/180.0f) }; sceGumTranslate(&pos); sceGumRotateXYZ(&rot); } // setup texture //sceGuTexMode(GU_PSM_4444,0,0,0); // sceGuTexImage(0,64,64,64,logo_start); //sceGuTexFunc(GU_TFX_ADD,GU_TCC_RGB); //sceGuTexEnvColor(0xffff00); //sceGuTexFilter(GU_LINEAR,GU_LINEAR); //sceGuTexScale(1.0f,1.0f); //sceGuTexOffset(0.0f,0.0f); //sceGuAmbientColor(0xff7f7f7f); // draw cube sceGuColor(0xffffff); sceGumDrawArray(GU_TRIANGLES, GU_TEXTURE_32BITF|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_INDEX_16BIT|GU_TRANSFORM_3D, idx_count, idx_buf, vert_buf); pspDebugScreenSetXY(0, 0); pspDebugScreenPrintf("v: %d", vert_count); pspDebugScreenSetXY(0, 1); pspDebugScreenPrintf("i: %d", idx_count); sceGuFinish(); sceGuSync(0,0); sceDisplayWaitVblankStart(); sceGuSwapBuffers(); val++; } sceGuTerm(); // Release buffers free(vert_buf); free(idx_buf); sceKernelExitGame(); return 0; }
void StartUpDisplay() { //ScePspFVector3 vec; _rotationSpeed = 1.0f; _rotation.x = 0.0f; _rotation.y = 0.0f; _rotation.z = 0.0f; _bgColour = 0; _frame = 0; _viewMode = 0; sceGuInit(); sceGuStart(SCEGU_IMMEDIATE, (void *)disp_list, sizeof(disp_list)); sceGuDrawBuffer(SCEGU_PF5551, SCEGU_VRAM_BP_0, SCEGU_VRAM_WIDTH); sceGuDispBuffer(SCEGU_SCR_WIDTH, SCEGU_SCR_HEIGHT, SCEGU_VRAM_BP_1, SCEGU_VRAM_WIDTH); sceGuDepthBuffer(SCEGU_VRAM_BP_2, SCEGU_VRAM_WIDTH); sceGuOffset(SCEGU_SCR_OFFSETX, SCEGU_SCR_OFFSETY); sceGuViewport(2048, 2048, SCEGU_SCR_WIDTH, SCEGU_SCR_HEIGHT); sceGuDepthRange(50000, 10000); sceGuDisable(SCEGU_BLEND); sceGuScissor(0, 0, SCEGU_SCR_WIDTH, SCEGU_SCR_HEIGHT); sceGuEnable(SCEGU_SCISSOR_TEST); sceGuDepthFunc(SCEGU_GEQUAL); sceGuEnable(SCEGU_DEPTH_TEST); sceGuFrontFace(SCEGU_CW); sceGuDisable(SCEGU_TEXTURE); sceGuShadeModel(SCEGU_SMOOTH); sceGuEnable(SCEGU_DITHER); //vec.x = 0.0f; //vec.y = 0.0f; //vec.z = 1.0f; //sceGuLightColor(0, SCEGU_DIFFUSE, 0xffffffff); //sceGuLight(0, SCEGU_LIGHT_DIRECTION, SCEGU_DIFFUSE, &vec); //vec.x = 1.0f; //vec.y = 0.0f; //vec.z = 0.0f; //sceGuLightColor(1, SCEGU_DIFFUSE, 0xff00ffff); //sceGuLight(1, SCEGU_LIGHT_DIRECTION, SCEGU_DIFFUSE, &vec); //vec.x = -1.0f; //vec.y = 0.0f; //vec.z = 0.0f; //sceGuLightColor(2, SCEGU_DIFFUSE, 0xffff00ff); //sceGuLight(2, SCEGU_LIGHT_DIRECTION, SCEGU_DIFFUSE, &vec); //sceGuEnable(SCEGU_LIGHT0); //sceGuEnable(SCEGU_LIGHT1); //sceGuEnable(SCEGU_LIGHT2); //sceGuEnable(SCEGU_LIGHTING); //sceGuFog(14.50, 25.0, 0x007f00ff); //sceGuAmbient(0xcc004cb2); sceGuAmbient(0xffffffff); sceGuColor(0xff0000ff); //sceGuTexMode(SCEGU_PF5551, 1, SCEGU_SINGLE_CLUT, SCEGU_TEXBUF_NORMAL); //sceGuTexFilter(SCEGU_LINEAR_MIPMAP_NEAREST, SCEGU_LINEAR); //sceGuTexFunc(SCEGU_TEX_MODULATE, SCEGU_RGB); //sceGuTexWrap(SCEGU_REPEAT, SCEGU_REPEAT); sceGumSetMatrixStack(matrix_stack, 1, 1, 2, 0); sceGumMatrixMode(SCEGU_MATRIX_PROJECTION); sceGumLoadIdentity(); sceGumPerspective(SCEGU_RAD(45.0f), SCEGU_SCR_ASPECT, 1.000000f, 100.000000f); sceGumMatrixMode(SCEGU_MATRIX_WORLD); sceGuClearDepth(0); sceGuClearStencil(0); sceGuFinish(); sceGuSync(SCEGU_SYNC_FINISH, SCEGU_SYNC_WAIT); sceGuDisplay(SCEGU_DISPLAY_ON); }
void StateOptions::Draw(StateManager* sManager) { //start rendering mRender->StartFrame(); switch(menuState) { case 0: { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0;x < 16;x++) { for(int y = 0;y < 9;y++) { backSprite->SetPosition(x*32,y*32); backSprite->Draw(); } } logoSprite->Draw(); //Controls buttonSprite->SetPosition(240,120); buttonSprite->Draw(); //sensity - analog stick buttonSprite->SetPosition(240,150); buttonSprite->Draw(); //texture pack buttonSprite->SetPosition(240,180); buttonSprite->Draw(); //back buttonSprite->SetPosition(240,210); buttonSprite->Draw(); //selected button sbuttonSprite->SetPosition(240,(selectPos * 30) + 120); sbuttonSprite->Draw(); sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); //draw subtitles on buttons mRender->DebugPrint(240,125,"Controls"); mRender->DebugPrint(240,155,"Analog stick"); mRender->DebugPrint(240,185,"Texture pack"); mRender->DebugPrint(240,215,"Back"); } break; case 1://controls { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0;x < 16;x++) { for(int y = 0;y < 9;y++) { backSprite->SetPosition(x*32,y*32); backSprite->Draw(); } } int starty = 60; //something for(int i = controlStart;i < controlEnd;i++) { if(controlPos == i) { halfsbuttonSprite->SetPosition(160,starty + (i * 30) - (controlStart * 30)); halfsbuttonSprite->Draw(); }else { halfbuttonSprite->SetPosition(160,starty + (i * 30) - (controlStart * 30)); halfbuttonSprite->Draw(); } } //back if(controlPos == 16) { sbuttonSprite->SetPosition(240,260); sbuttonSprite->Draw(); }else { buttonSprite->SetPosition(240,260); buttonSprite->Draw(); } sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); //write action names starty = 67; mRender->SetFontStyle(0.7f,0xFFFFFFFF,0xFF000000,0x00000000); for(int i = controlStart;i < controlEnd;i++) { //action mRender->DebugPrint(250,starty + (i * 30) - (controlStart * 30),InputHelper::Instance()->getActionName(i).c_str()); } mRender->SetFontStyle(0.6f,0xFFFFFFFF,0xFF000000,0x00000200); starty = 65; for(int i = controlStart;i < controlEnd;i++) { //button assigned to this action if(controlPos == i && chooseKeyState == true) mRender->DebugPrint(160,starty + (i * 30) - (controlStart * 30),"..."); else mRender->DebugPrint(160,starty + (i * 30) - (controlStart * 30),InputHelper::Instance()->getButtonName(InputHelper::Instance()->getConnection(i).button).c_str()); } mRender->SetFontStyle(0.5f,0xFFFFFFFF,0xFF000000,0x00000200); mRender->DebugPrint(240,265,"Back"); mRender->DebugPrint(240,20,"CONTROLS"); } break; case 2://analog stick { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0;x < 16;x++) { for(int y = 0;y < 9;y++) { backSprite->SetPosition(x*32,y*32); backSprite->Draw(); } } logoSprite->Draw(); //something buttonSprite->SetPosition(240,100); buttonSprite->Draw(); buttonSprite->SetPosition(240,130); buttonSprite->Draw(); buttonSprite->SetPosition(240,160); buttonSprite->Draw(); buttonSprite->SetPosition(240,190); buttonSprite->Draw(); //back buttonSprite->SetPosition(240,260); buttonSprite->Draw(); if(currentAnalogPos < 4) { sbuttonSprite->SetPosition(240,100 + (currentAnalogPos * 30)); sbuttonSprite->Draw(); }else { sbuttonSprite->SetPosition(240,260); sbuttonSprite->Draw(); } moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogYup) * 10) * 20),100); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogYdown) * 10) * 20),130); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogXleft) * 10) * 20),160); moverSprite->Draw(); moverSprite->SetPosition(144 +((fabs(InputHelper::Instance()->analogXright) * 10) * 20),190); moverSprite->Draw(); sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); mRender->DebugPrint(240,105,"Analog up : %d%%",(int)(fabs(InputHelper::Instance()->analogYup) * 100.0f)); mRender->DebugPrint(240,135,"Analog down : %d%%",(int)(fabs(InputHelper::Instance()->analogYdown) * 100.0f)); mRender->DebugPrint(240,165,"Analog left : %d%%",(int)(fabs(InputHelper::Instance()->analogXleft) * 100.0f)); mRender->DebugPrint(240,195,"Analog right : %d%%",(int)(fabs(InputHelper::Instance()->analogXright) * 100.0f)); mRender->DebugPrint(240,265,"Back"); } break; case 3: { sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuColor(GU_COLOR(1,1,1,1.0f)); for(int x = 0;x < 16;x++) { for(int y = 0;y < 9;y++) { backSprite->SetPosition(x*32,y*32); backSprite->Draw(); } } //select sprite if(TextureHelper::Instance()->packFiles.size() > 0) { selectSaveSprite->SetPosition(240,50 + (loadSavePos * 40) - (loadSaveStart * 40)); selectSaveSprite->Draw(); } //tp files for(int i = loadSaveStart;i <loadSaveMax;i++) { if(loadSavePos == i) { mRender->SetFontStyle(1.0f,0xFF000000,0xFFFFFFFF,0x00000000); mRender->DebugPrint(30,50 + (i * 40) - (loadSaveStart * 40),"%s",TextureHelper::Instance()->packFiles[i].c_str()); }else { mRender->SetFontStyle(0.8f,0xFFFFFFFF,0xFF000000,0x00000000); mRender->DebugPrint(30,50 + (i * 40) - (loadSaveStart * 40),"%s",TextureHelper::Instance()->packFiles[i].c_str()); } } //load buttonSprite->SetPosition(240,235); buttonSprite->Draw(); //back buttonSprite->SetPosition(240,260); buttonSprite->Draw(); //selected button sbuttonSprite->SetPosition(240,(loadSelectPos * 25) + 235); sbuttonSprite->Draw(); sceGuDisable(GU_BLEND); sceGuEnable(GU_DEPTH_TEST); mRender->SetFontStyle(0.5f,0xFFFFFFFF,0xFF000000,0x00000200); mRender->DebugPrint(240,20,"Load Texture Pack"); mRender->DebugPrint(240,240,"Load"); mRender->DebugPrint(240,265,"Back"); } break; } //end frame mRender->EndFrame(); }
//------------------------------------------------------------------------------------------------- // render a single frame of a MD2 model void JMD2Model::Render(int frameNum) { Vector3D *pointList; int i; // create a pointer to the frame we want to show pointList = &mModel->pointList[mModel->numPoints * frameNum]; // set the texture mRenderer->BindTexture(mModel->modelTex); #if !defined (PSP) // display the textured model with proper lighting normals #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); #else glBegin(GL_TRIANGLES); #endif //(defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) for(i = 0; i < mModel->numTriangles; i++) { CalculateNormal(pointList[mModel->triIndex[i].meshIndex[0]].v, pointList[mModel->triIndex[i].meshIndex[2]].v, pointList[mModel->triIndex[i].meshIndex[1]].v); #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1)|| (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) float vertex_data[]={ pointList[mModel->triIndex[i].meshIndex[0]].x, pointList[mModel->triIndex[i].meshIndex[0]].y, pointList[mModel->triIndex[i].meshIndex[0]].z, pointList[mModel->triIndex[i].meshIndex[2]].x, pointList[mModel->triIndex[i].meshIndex[2]].y, pointList[mModel->triIndex[i].meshIndex[2]].z, pointList[mModel->triIndex[i].meshIndex[1]].x, pointList[mModel->triIndex[i].meshIndex[1]].y, pointList[mModel->triIndex[i].meshIndex[1]].z, }; float texcoord_data[] = { mModel->st[mModel->triIndex[i].stIndex[0]].s, mModel->st[mModel->triIndex[i].stIndex[0]].t, mModel->st[mModel->triIndex[i].stIndex[2]].s, mModel->st[mModel->triIndex[i].stIndex[2]].t, mModel->st[mModel->triIndex[i].stIndex[1]].s, mModel->st[mModel->triIndex[i].stIndex[1]].t, }; glVertexPointer(3,GL_FLOAT,0,vertex_data); glTexCoordPointer(2,GL_FLOAT,0,texcoord_data); #else glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[0]].s, mModel->st[mModel->triIndex[i].stIndex[0]].t); glVertex3fv(pointList[mModel->triIndex[i].meshIndex[0]].v); glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[2]].s , mModel->st[mModel->triIndex[i].stIndex[2]].t); glVertex3fv(pointList[mModel->triIndex[i].meshIndex[2]].v); glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[1]].s, mModel->st[mModel->triIndex[i].stIndex[1]].t); glVertex3fv(pointList[mModel->triIndex[i].meshIndex[1]].v); #endif //#if (!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0) } #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) glDrawArrays(GL_TRIANGLES,0,3); // seems suspicious to put that here, should probably be in the loop #else glEnd(); #endif //(defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #else PSPVertex3D* vertices = (PSPVertex3D*) sceGuGetMemory(mModel->numTriangles * 3 * sizeof(PSPVertex3D)); int n = 0; for(i = 0; i < mModel->numTriangles; i++) { //CalculateNormal(&vertices[n].normal, // pointList[mModel->triIndex[i].meshIndex[0]].v, // pointList[mModel->triIndex[i].meshIndex[2]].v, // pointList[mModel->triIndex[i].meshIndex[1]].v); vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[0]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[0]].t; vertices[n].pos.x = pointList[mModel->triIndex[i].meshIndex[0]].x; vertices[n].pos.y = pointList[mModel->triIndex[i].meshIndex[0]].y; vertices[n].pos.z = pointList[mModel->triIndex[i].meshIndex[0]].z; n++; //vertices[n].normal.x = vertices[n-1].normal.x; //vertices[n].normal.y = vertices[n-1].normal.y; //vertices[n].normal.z = vertices[n-1].normal.z; vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[2]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[2]].t; vertices[n].pos.x = pointList[mModel->triIndex[i].meshIndex[2]].x; vertices[n].pos.y = pointList[mModel->triIndex[i].meshIndex[2]].y; vertices[n].pos.z = pointList[mModel->triIndex[i].meshIndex[2]].z; n++; //vertices[n].normal.x = vertices[n-1].normal.x; //vertices[n].normal.y = vertices[n-1].normal.y; //vertices[n].normal.z = vertices[n-1].normal.z; vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[1]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[1]].t; vertices[n].pos.x = pointList[mModel->triIndex[i].meshIndex[1]].x; vertices[n].pos.y = pointList[mModel->triIndex[i].meshIndex[1]].y; vertices[n].pos.z = pointList[mModel->triIndex[i].meshIndex[1]].z; n++; } sceGuColor(0xff000000); sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,mModel->numTriangles*3,0,vertices); #endif }
//-------------------------------------------------------------------- // Función: CFade::Update // Creador: Nacho (AMD) // Fecha: Thursday 14/06/2007 11:56:53 //-------------------------------------------------------------------- void CFade::Update(float dt) { if (m_fFadeTime > 0.0f) { m_fFadeState += dt; if (m_fFadeState >= m_fFadeTime) { m_bFadeActive = false; } float alpha = 0.0f; ///--- fade in if (m_bFadeIn) { alpha = 255.0f - ((m_fFadeState * 255.0f) / m_fFadeTime); } ///--- fade out else { alpha = ((m_fFadeState * 255.0f) / m_fFadeTime); } alpha = MAT_Clampf(alpha, 0.0f, m_fTarget); if (alpha > 0.0f) { VERT* v = (VERT*)sceGuGetMemory(sizeof(VERT) * 2); VERT* v0 = &v[0]; VERT* v1 = &v[1]; int alpha_integer = (((int)alpha) & 0xFF) << 24; v0->x = -1.0f; v0->y = -1.0f; v0->z = 0.0f; v1->x = 481.0f; v1->y = 273.0f; v1->z = 0.0f; sceGuColor((m_iColor & 0x00ffffff) | alpha_integer); sceGuDisable(GU_TEXTURE_2D); sceGuDisable(GU_DEPTH_TEST); sceGuEnable(GU_BLEND); sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); sceGumDrawArray(GU_SPRITES, GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, v); sceGuEnable(GU_DEPTH_TEST); sceGuDisable(GU_BLEND); sceGuEnable(GU_TEXTURE_2D); sceGuColor(0xffffffff); } } }
int main(int argc, char* argv[]) { /* Setup Homebutton Callbacks */ setupCallbacks(); sceKernelDcacheWritebackAll(); // setup GU SceCtrlData pad; sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL); sceGuInit(); sceGuStart(GU_DIRECT,list); sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH); sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH); sceGuDepthBuffer((void*)0x110000,BUF_WIDTH); sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2)); sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT); sceGuDepthRange(0xc350,0x2710); sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT); sceGuEnable(GU_SCISSOR_TEST); sceGuDepthFunc(GU_GEQUAL); sceGuEnable(GU_DEPTH_TEST); sceGuFrontFace(GU_CCW); sceGuColor(0xffffffff); sceGuShadeModel(GU_SMOOTH); // sceGuEnable(GU_CULL_FACE); sceGuEnable(GU_CLIP_PLANES); sceGuEnable(GU_TEXTURE_2D); sceGuTexMode(GU_PSM_8888, 0, 0, 0); sceGuTexImage(0, 16, 16, 16, texture); sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB); sceGuTexEnvColor(0xffffff); sceGuTexFilter(GU_LINEAR, GU_LINEAR); sceGuTexWrap(GU_REPEAT, GU_REPEAT); sceGuTexScale(1.0f, 1.0f); sceGuTexOffset(0.0f, 0.0f); sceGuAmbientColor(0xffffffff); sceGuFinish(); sceGuSync(0,0); sceDisplayWaitVblankStart(); sceGuDisplay(GU_TRUE); void* buffer = 0; pspDebugScreenInit(); unsigned int old = 0; unsigned int flags = PSP_CTRL_CIRCLE | PSP_CTRL_CROSS; int tex = 1; while(running()) { sceGuStart(GU_DIRECT,list); sceGuClearColor(0); sceGuClearDepth(0); sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT); sceGumMatrixMode(GU_PROJECTION); sceGumLoadIdentity(); sceGumPerspective(90.0f, 480.0/272.0f, 0.1f, 10.0f); sceGumMatrixMode(GU_VIEW); sceGumLoadIdentity(); ScePspFVector3 trans = { 0.0f, 0.0f, -1.8f }; sceGumTranslate(&trans); sceGumMatrixMode(GU_MODEL); sceGumLoadIdentity(); sceGumDrawArray(objects[o].prim, objects[o].flags, objects[o].count, 0, objects[o].data); sceCtrlReadBufferPositive(&pad, 1); if(old != pad.Buttons) { if(pad.Buttons & PSP_CTRL_CROSS) { o++; if(o >= sizeof(objects) / sizeof(Object)) { o = 0; } } if(pad.Buttons & PSP_CTRL_CIRCLE) { tex = !tex; if(tex) { sceGuEnable(GU_TEXTURE_2D); } else { sceGuDisable(GU_TEXTURE_2D); } } } old = pad.Buttons; sceGuFinish(); sceGuSync(0,0); pspDebugScreenSetOffset((int)buffer); pspDebugScreenSetXY(0, 0); pspDebugScreenPrintf("Mode: %s (X to change) Texture: %s (O to change)", objects[o].text, tex ? "on " : "off"); sceDisplayWaitVblankStart(); buffer = sceGuSwapBuffers(); } sceGuTerm(); sceKernelExitGame(); return 0; }
int dxpGraphicsSetup2D(u32 color) { GUSTART; if(dxpGraphicsData.drawstate != DXP_DRAWSTATE_NONTEX2D) { GUDISABLE(GU_TEXTURE_2D); dxpGraphicsData.texture = NULL; dxpGraphicsData.drawstate = DXP_DRAWSTATE_NONTEX2D; if(dxpGraphicsData.usedepth) { GUENABLE(GU_DEPTH_TEST); sceGuDepthFunc(dxpGraphicsData.depthfunc); sceGuDepthBuffer(dxpGraphicsData.depthbuffer.texvram,512); //深度バッファを有効にするときでいい if(dxpGraphicsData.writedepth)sceGuDepthMask(0); else sceGuDepthMask(1); } else GUDISABLE(GU_DEPTH_TEST); dxpGraphicsData.forceupdate = 1; } register u32 r,g,b,a,t; r = color & 0x000000ff; t = dxpGraphicsData.color & 0x000000ff; r *= t; r /= 255; g = (color & 0x0000ff00) >> 8; t = (dxpGraphicsData.color & 0x0000ff00) >> 8; g *= t; g /= 255; b = (color & 0x00ff0000) >> 16; t = (dxpGraphicsData.color & 0x00ff0000) >> 16; b *= t; b /= 255; //a = (color & 0xff000000) >> 24; //t = (dxpGraphicsData.color & 0xff000000) >> 24; //a *= t; //a /= 255; a = (dxpGraphicsData.color & 0xff000000) >> 24; color = (a << 24) | (b << 16) | (g << 8) | r; int op; int src,dest; unsigned int srcfix; unsigned int destfix; switch(dxpGraphicsData.blendmode) { case DX_BLENDMODE_NOBLEND: GUDISABLE(GU_BLEND); sceGuColor(dxpGraphicsData.gucolor = color); dxpGraphicsData.forceupdate = 0; return 0; case DX_BLENDMODE_INVSRC: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_ONE_MINUS_SRC_ALPHA; srcfix = 0; destfix = 0; color = (color & 0xff000000) | ~(color & 0x00ffffff); break; case DX_BLENDMODE_ALPHA: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_ONE_MINUS_SRC_ALPHA; srcfix = 0; destfix = 0; break; case DX_BLENDMODE_ADD: op = GU_ADD; src = GU_SRC_ALPHA; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0xffffffff; break; case DX_BLENDMODE_SUB: op = GU_REVERSE_SUBTRACT; src = GU_SRC_ALPHA; dest = GU_FIX; srcfix = 0xffffffff; destfix = 0xffffffff; break; case DX_BLENDMODE_MUL: op = GU_ADD; src = GU_DST_COLOR; dest = GU_FIX; srcfix = 0; destfix = 0; break; case DX_BLENDMODE_DESTCOLOR: op = GU_ADD; src = GU_FIX; dest = GU_FIX; srcfix = 0; destfix = 0xffffffff; break; case DX_BLENDMODE_INVDESTCOLOR: op = GU_ADD; src = GU_ONE_MINUS_DST_COLOR; dest = GU_FIX; srcfix = 0; destfix = 0; break; default: return -1; } sceGuColor(dxpGraphicsData.gucolor = color); GUENABLE(GU_BLEND); if(dxpGraphicsData.forceupdate || dxpGraphicsData.op != op || dxpGraphicsData.src != src || dxpGraphicsData.dest != dest || dxpGraphicsData.srcfix != srcfix || dxpGraphicsData.destfix != destfix ){ sceGuBlendFunc(op,src,dest,srcfix,destfix); dxpGraphicsData.op = op; dxpGraphicsData.src = src; dxpGraphicsData.dest = dest; dxpGraphicsData.srcfix = srcfix; dxpGraphicsData.destfix = destfix; } dxpGraphicsData.forceupdate = 0; return 0; }
//------------------------------------------------------------------------------------------------- // displays a frame of the model between startFrame and endFrame with an interpolation percent void JMD2Model::Render() { CheckNextState(); Vector3D *pointList; // current frame vertices Vector3D *nextPointList; // next frame vertices int i; float x1, y1, z1; // current frame point values float x2, y2, z2; // next frame point values Vector3D vertex[3]; if (mModel == NULL) return; pointList = &mModel->pointList[mModel->numPoints*mModel->currentFrame]; nextPointList = &mModel->pointList[mModel->numPoints*mModel->nextFrame]; mRenderer->BindTexture(mModel->modelTex); #if !defined (PSP) #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) // FIXME #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); #else glBegin(GL_TRIANGLES); #endif //(defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) for (i = 0; i < mModel->numTriangles; i++) { // get first points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[0]].x; y1 = pointList[mModel->triIndex[i].meshIndex[0]].y; z1 = pointList[mModel->triIndex[i].meshIndex[0]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[0]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[0]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[0]].z; // store first interpolated vertex of triangle vertex[0].x = x1 + mModel->interpol * (x2 - x1); vertex[0].y = y1 + mModel->interpol * (y2 - y1); vertex[0].z = z1 + mModel->interpol * (z2 - z1); // get second points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[2]].x; y1 = pointList[mModel->triIndex[i].meshIndex[2]].y; z1 = pointList[mModel->triIndex[i].meshIndex[2]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[2]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[2]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[2]].z; // store second interpolated vertex of triangle vertex[2].x = x1 + mModel->interpol * (x2 - x1); vertex[2].y = y1 + mModel->interpol * (y2 - y1); vertex[2].z = z1 + mModel->interpol * (z2 - z1); // get third points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[1]].x; y1 = pointList[mModel->triIndex[i].meshIndex[1]].y; z1 = pointList[mModel->triIndex[i].meshIndex[1]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[1]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[1]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[1]].z; // store third interpolated vertex of triangle vertex[1].x = x1 + mModel->interpol * (x2 - x1); vertex[1].y = y1 + mModel->interpol * (y2 - y1); vertex[1].z = z1 + mModel->interpol * (z2 - z1); // calculate the normal of the triangle //CalculateNormal(vertex[0].v, vertex[2].v, vertex[1].v); // render properly textured triangle #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) // FIXME #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) float vertex_data[]={ vertex[0].x, vertex[0].y, vertex[0].z, vertex[2].x, vertex[2].y, vertex[2].z, vertex[1].x, vertex[1].y, vertex[1].z, }; float texcoord_data[] = { mModel->st[mModel->triIndex[i].stIndex[0]].s, mModel->st[mModel->triIndex[i].stIndex[0]].t, mModel->st[mModel->triIndex[i].stIndex[2]].s, mModel->st[mModel->triIndex[i].stIndex[2]].t, mModel->st[mModel->triIndex[i].stIndex[1]].s, mModel->st[mModel->triIndex[i].stIndex[1]].t, }; glVertexPointer(3,GL_FLOAT,0,vertex_data); glTexCoordPointer(2,GL_FLOAT,0,texcoord_data); #else glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[0]].s, mModel->st[mModel->triIndex[i].stIndex[0]].t); glVertex3fv(vertex[0].v); glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[2]].s , mModel->st[mModel->triIndex[i].stIndex[2]].t); glVertex3fv(vertex[2].v); glTexCoord2f(mModel->st[mModel->triIndex[i].stIndex[1]].s, mModel->st[mModel->triIndex[i].stIndex[1]].t); glVertex3fv(vertex[1].v); #endif //(defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) } #if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) // FIXME #elif (defined GL_ES_VERSION_1_1) || (defined GL_VERSION_1_1) || (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1) glDrawArrays(GL_TRIANGLES,0,3); // seems suspicious to put that here, should probably be in the loop #else glEnd(); #endif //(defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) #else PSPVertex3D* vertices = (PSPVertex3D*) sceGuGetMemory(mModel->numTriangles * 3 * sizeof(PSPVertex3D)); int n = 0; for (i = 0; i < mModel->numTriangles; i++) { // get first points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[0]].x; y1 = pointList[mModel->triIndex[i].meshIndex[0]].y; z1 = pointList[mModel->triIndex[i].meshIndex[0]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[0]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[0]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[0]].z; // store first interpolated vertex of triangle vertex[0].x = x1 + mModel->interpol * (x2 - x1); vertex[0].y = y1 + mModel->interpol * (y2 - y1); vertex[0].z = z1 + mModel->interpol * (z2 - z1); // get second points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[2]].x; y1 = pointList[mModel->triIndex[i].meshIndex[2]].y; z1 = pointList[mModel->triIndex[i].meshIndex[2]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[2]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[2]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[2]].z; // store second interpolated vertex of triangle vertex[2].x = x1 + mModel->interpol * (x2 - x1); vertex[2].y = y1 + mModel->interpol * (y2 - y1); vertex[2].z = z1 + mModel->interpol * (z2 - z1); // get third points of each frame x1 = pointList[mModel->triIndex[i].meshIndex[1]].x; y1 = pointList[mModel->triIndex[i].meshIndex[1]].y; z1 = pointList[mModel->triIndex[i].meshIndex[1]].z; x2 = nextPointList[mModel->triIndex[i].meshIndex[1]].x; y2 = nextPointList[mModel->triIndex[i].meshIndex[1]].y; z2 = nextPointList[mModel->triIndex[i].meshIndex[1]].z; // store third interpolated vertex of triangle vertex[1].x = x1 + mModel->interpol * (x2 - x1); vertex[1].y = y1 + mModel->interpol * (y2 - y1); vertex[1].z = z1 + mModel->interpol * (z2 - z1); //CalculateNormal(&vertices[n].normal, // vertex[0].v, // vertex[2].v, // vertex[1].v); vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[0]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[0]].t; vertices[n].pos.x = vertex[0].x; vertices[n].pos.y = vertex[0].y; vertices[n].pos.z = vertex[0].z; n++; //vertices[n].normal.x = vertices[n-1].normal.x; //vertices[n].normal.y = vertices[n-1].normal.y; //vertices[n].normal.z = vertices[n-1].normal.z; vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[2]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[2]].t; vertices[n].pos.x = vertex[2].x; vertices[n].pos.y = vertex[2].y; vertices[n].pos.z = vertex[2].z; n++; //vertices[n].normal.x = vertices[n-1].normal.x; //vertices[n].normal.y = vertices[n-1].normal.y; //vertices[n].normal.z = vertices[n-1].normal.z; vertices[n].texture.x = mModel->st[mModel->triIndex[i].stIndex[1]].s; vertices[n].texture.y = mModel->st[mModel->triIndex[i].stIndex[1]].t; vertices[n].pos.x = vertex[1].x; vertices[n].pos.y = vertex[1].y; vertices[n].pos.z = vertex[1].z; n++; } sceGuColor(0xff000000); sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,mModel->numTriangles*3,0,vertices); #endif // mModel->interpol += percent; // increase percentage of interpolation between frames }
/** * Created: 01/03/2011 * Renders a cube to the demo space according to it's game location */ void FrontEnd::RenderCube(float x, float y, float z) { #ifdef PC /* Set the colour */ _pd3dDevice->SetRenderState( D3DRS_AMBIENT, IntToD3DColor( _fgColour ) ); D3DXMATRIXA16 rotation; D3DXMATRIXA16 world; D3DXMATRIXA16 temp; D3DXMatrixIdentity( &rotation ); D3DXMatrixIdentity( &world ); /* Create the rotation matrix */ D3DXMatrixIdentity( &temp ); D3DXMatrixRotationX( &temp, _rotation.y ); rotation *= temp; D3DXMatrixRotationY( &temp, _rotation.z ); rotation *= temp; D3DXMatrixRotationZ( &temp, _rotation.x ); rotation *= temp; /* Translate the cube */ D3DXMatrixIdentity( &temp ); D3DXMatrixTranslation( &temp, -x, -y, z ); world *= temp; /* Rotate the cube */ D3DXMatrixIdentity( &temp ); D3DXMatrixTranslation( &temp, _view.x, _view.y, -_view.z ); world *= temp; world *= rotation; D3DXMatrixIdentity( &temp ); D3DXMatrixTranslation( &temp, -_view.x, -_view.y, _view.z ); world *= temp; /* Set the world matrix */ _pd3dDevice->SetTransform( D3DTS_WORLD, &world ); /* Render the cube */ _pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 36 ); #else ScePspFVector3 vec; /* Create the rotation matrix */ ScePspFMatrix4 rotation; ScePspFVector3 rotator; rotator.x = _rotation.x; rotator.y = _rotation.y; rotator.z = _rotation.z; sceGumPushMatrix(); sceGumRotateXYZ( &rotator ); sceGumStoreMatrix( &rotation); sceGumPopMatrix(); /* Push a new matrix */ sceGumPushMatrix(); //printf("FrontEnd::RenderCube() started\n"); /* Rotate the cube's translation */ ScePspFVector3 view; view.x = -_view.x; view.y = -_view.y; view.z = -_view.z; sceGumTranslate( &view ); sceGumRotateXYZ( &rotator ); view.x = -view.x; view.y = -view.y; view.z = -view.z; sceGumTranslate( &view ); vec.x = (float)-x; vec.y = (float)-y; vec.z = (float)-z; sceGumTranslate( &vec ); /* Set the colour */ sceGuColor( _fgColour ); /* Render the cube */ sceGumDrawArray(SCEGU_PRIM_TRIANGLES, SCEGU_VERTEX_FLOAT, 36, 0, Cube); /* Pop the matrix */ sceGumPopMatrix(); #endif }
int main(int argc, char* argv[]) { pspDebugScreenInit(); setupCallbacks(); // setup GU void* fbp0 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888); void* fbp1 = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888); void* zbp = getStaticVramBuffer(BUF_WIDTH,SCR_HEIGHT,GU_PSM_4444); sceGuInit(); sceGuStart(GU_DIRECT,list); sceGuDrawBuffer(GU_PSM_8888,fbp0,BUF_WIDTH); sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,fbp1,BUF_WIDTH); sceGuDepthBuffer(zbp,BUF_WIDTH); sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2)); sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT); sceGuDepthRange(65535,0); sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT); sceGuEnable(GU_SCISSOR_TEST); sceGuFinish(); sceGuSync(0,0); sceDisplayWaitVblankStart(); sceGuDisplay(GU_TRUE); int val = 0; gettimeofday(&base_time,0); while(running()) { struct Vertex* vertices; struct timeval tv; sceGuStart(GU_DIRECT,list); // clear screen sceGuClearColor(0); sceGuClearDepth(0); sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); // draw triangle 1 (normal) sceGuColor(0xffffffff); vertices = (struct Vertex*)sceGuGetMemory(3*sizeof(struct Vertex)); vertices[0].x = (SCR_WIDTH/2) + cosf(val * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[0].y = (SCR_HEIGHT/2) + sinf(val * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[0].z = 0; vertices[1].x = (SCR_WIDTH/2) + cosf((val+120) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[1].y = (SCR_HEIGHT/2) + sinf((val+120) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[1].z = 0; vertices[2].x = (SCR_WIDTH/2) + cosf((val+240) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[2].y = (SCR_HEIGHT/2) + sinf((val+240) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[2].z = 0; sceGuDrawArray(GU_TRIANGLES,GU_VERTEX_32BITF|GU_TRANSFORM_2D,3,0,vertices); // draw triangle 2 (affected by logic op) sceGuEnable(GU_COLOR_LOGIC_OP); sceGuLogicalOp(curr_state); sceGuColor(0xffff00ff); vertices = (struct Vertex*)sceGuGetMemory(3*sizeof(struct Vertex)); vertices[0].x = (SCR_WIDTH/2) + cosf((val*1.1f) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[0].y = (SCR_HEIGHT/2) + sinf((val*1.1f) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[0].z = 0; vertices[1].x = (SCR_WIDTH/2) + cosf((val*1.1f+120) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[1].y = (SCR_HEIGHT/2) + sinf((val*1.1f+120) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[1].z = 0; vertices[2].x = (SCR_WIDTH/2) + cosf((val*1.1f+240) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[2].y = (SCR_HEIGHT/2) + sinf((val*1.1f+240) * (GU_PI/180)) * (SCR_HEIGHT/2); vertices[2].z = 0; sceGuDrawArray(GU_TRIANGLES,GU_VERTEX_32BITF|GU_TRANSFORM_2D,3,0,vertices); sceGuDisable(GU_COLOR_LOGIC_OP); sceGuFinish(); sceGuSync(0,0); gettimeofday(&tv,0); if ((tv.tv_sec-base_time.tv_sec) > TIME_SLICE) { curr_state = (curr_state + 1) & 15; base_time = tv; } sceDisplayWaitVblankStart(); sceGuSwapBuffers(); pspDebugScreenSetXY(0,0); pspDebugScreenPrintf("%s",names[curr_state]); val++; } sceGuTerm(); sceKernelExitGame(); return 0; }
void Drop::Render(Vector3 playerPos, float camAngle) { if(abs(position.x-playerPos.x) < 8.0f && abs(position.y-playerPos.y) < 5.0f && abs(position.z-playerPos.z) < 8.0f) { active = true; } else { active = false; } if(toDestroy == false && getMe == false && active == true) { if(abs(position.x-playerPos.x) < 0.8f && abs(position.y-playerPos.y) < 1.8f && abs(position.z-playerPos.z) < 0.8f && existingTime >= 0.5f && myCrft->InventoryIsFull(id,amount,stackable) == false && myCrft->HP > 0.0f) { getMe = true; return; } float angle = atan2f(position.x-(playerPos.x+(cosf(camAngle+PI)*4)),position.z-(playerPos.z+(sinf(camAngle+PI)*4)))-PI*0.5f; sceGuColor(GU_COLOR(myCrft->BlockFinalLight(position.x,position.y,position.z),myCrft->BlockFinalLight(position.x,position.y,position.z),myCrft->BlockFinalLight(position.x,position.y,position.z),1.0f)); sceGuEnable(GU_DEPTH_TEST); sceGuEnable(GU_ALPHA_TEST); sceGuEnable(GU_BLEND); if(id < 250) { sceGumPushMatrix(); ScePspFVector3 loc = {position.x,position.y+sinf(levit)*0.09f,position.z}; sceGumTranslate(&loc); ScePspFVector3 sca = {0.25f,0.25f,0.25f}; sceGumScale(&sca); sceGumRotateX(0.0f); sceGumRotateY(angleBlock); sceGumRotateZ(0.0f); myCrft->drawCubes(id,myCrft->BlockFinalLight(position.x,position.y,position.z)); sceGumPopMatrix(); if(amount >= 3 && stackable == true) { sceGumPushMatrix(); ScePspFVector3 loc = {position.x+0.09f,position.y+sinf(levit)*0.09f+0.09f,position.z}; sceGumTranslate(&loc); ScePspFVector3 sca = {0.25f,0.25f,0.25f}; sceGumScale(&sca); sceGumRotateX(0.0f); sceGumRotateY(angleBlock); sceGumRotateZ(0.0f); myCrft->drawCubes(id,myCrft->BlockFinalLight(position.x,position.y,position.z)); sceGumPopMatrix(); } } else { sceGumPushMatrix(); ScePspFVector3 loc = {position.x,position.y+sinf(levit)*0.09f,position.z}; sceGumTranslate(&loc); sceGumRotateX(0.0f); sceGumRotateY(angle); sceGumRotateZ(0.0f); myCrft->drawDropItems(id); sceGumPopMatrix(); } sceGuDisable(GU_BLEND); sceGuDisable(GU_ALPHA_TEST); sceGuDisable(GU_DEPTH_TEST); } }