This commit is contained in:
Dante Leoncini 2026-05-06 23:23:00 -03:00
commit 2390c67fa1
6 changed files with 73 additions and 64 deletions

View file

@ -2,16 +2,16 @@ Common:
- [x] Make it compile - [x] Make it compile
- [x] Window implementation - [x] Window implementation
- [x] Fix shader compilation - [x] Fix shader compilation
- [x] Basic touch controls
- [x] Downscale textures - [x] Downscale textures
- [ ] Simplify geometry - [ ] Simplify geometry
- [ ] Touch controls - [x] Touch controls
- [x] Keyboard controls - [x] Keyboard controls
- [ ] Audio? - [ ] Audio?
- [x] Menu - [x] Menu
- [x] Config - [x] Config
- [x] Merge S60v3 and ^3 branches - [x] Merge S60v3 and ^3 branches
- [ ] Move map to top left corner - [ ] Move map to top left corner
- [ ] Do something with sprites, they're still taking too much frame time
GLES 2.0 specific: GLES 2.0 specific:
- [x] Optimize to always run 10+ fps - [x] Optimize to always run 10+ fps

View file

@ -1403,14 +1403,10 @@ RenderScene(void)
} }
#endif #endif
PUSH_RENDERGROUP("RenderScene"); PUSH_RENDERGROUP("RenderScene");
#ifdef RW_GL3 // CClouds::Render();
CClouds::Render();
#endif
DoRWRenderHorizon(); DoRWRenderHorizon();
CRenderer::RenderRoads(); CRenderer::RenderRoads();
#ifdef RW_GL3 // CCoronas::RenderReflections();
CCoronas::RenderReflections();
#endif
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
CRenderer::RenderEverythingBarRoads(); CRenderer::RenderEverythingBarRoads();
CRenderer::RenderBoats(); CRenderer::RenderBoats();
@ -1457,10 +1453,8 @@ RenderEffects(void)
// CSkidmarks::Render(); // CSkidmarks::Render();
// CAntennas::Render(); // CAntennas::Render();
// CRubbish::Render(); // CRubbish::Render();
#ifdef RW_GL3 // CCoronas::Render();
CCoronas::Render(); CParticle::Render();
#endif
// CParticle::Render();
CPacManPickups::Render(); CPacManPickups::Render();
// CWeaponEffects::Render(); // CWeaponEffects::Render();
// CPointLights::RenderFogEffect(); // CPointLights::RenderFogEffect();

View file

@ -1327,24 +1327,48 @@ void CHud::DrawAfterFade()
int w = 640; int w = 640;
int y = 0; int y = 0;
{ {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetScale(0.75f, 0.75f);
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_BANK);
#define CRECT(X, Y, W, H) CRect(X, (Y) * 480.f / 360.f, (W) + (X), ((H) + (Y)) * 480.f / 360.f) #define CRECT(X, Y, W, H) CRect(X, (Y) * 480.f / 360.f, (W) + (X), ((H) + (Y)) * 480.f / 360.f)
#define PRINT(S, X, Y, W) CFont::SetCentreSize(W); \
CFont::PrintString((X) + ((W) / 2), (Y) * (480.f / 360.f), (wchar*) L ## S);
// l // l
CSprite2d::DrawRect(CRECT(40, 6 + y, 90, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(40, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
PRINT("L1", 40, 12 + y, 90);
CSprite2d::DrawRect(CRECT(180, 6 + y, 90, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(180, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
PRINT("L2", 180, 12 + y, 90);
// r // r
CSprite2d::DrawRect(CRECT(w - 40 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(w - 40 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
PRINT("R1", w - 40 - 90, 12 + y, 90);
CSprite2d::DrawRect(CRECT(w - 180 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(w - 180 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
PRINT("R2", w - 180 - 90, 12 + y, 90);
// select, start // select, start
CSprite2d::DrawRect(CRECT(320 - 80, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(320 - 80, 286 + y, 60, 20), CRGBA(0, 0, 0, 128));
PRINT("select", 320 - 80, 290 + y, 60);
CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128));
PRINT("start", 320 + 20, 290 + y, 60);
// dpad // dpad
CSprite2d::DrawRect(CRECT(0, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(0, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128));
PRINT("/\\", w / 8 - 15, 90 + y, 30);
PRINT("v", w / 8 - 15, 160 + y, 30);
PRINT("<", w / 8 - 60, 125 + y, 30);
PRINT(">", w / 8 + 30, 125 + y, 30);
// abxy // abxy
CSprite2d::DrawRect(CRECT(w - w / 4, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); CSprite2d::DrawRect(CRECT(w - w / 4, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128));
PRINT("/\\", w - w / 8 - 15, 90 + y, 30);
PRINT("X", w - w / 8 - 15, 160 + y, 30);
PRINT("[]", w - w / 8 - 60, 125 + y, 30);
PRINT("O", w - w / 8 + 30, 125 + y, 30);
#undef PRINT
#undef CRECT #undef CRECT
} }
} }

View file

@ -93,24 +93,7 @@ static int clamp(int size, int targetSize)
return size; return size;
} }
void debugRaster(RwRaster *r){ static void halveTexture(RwTexture *texture){
if(!r){
debug("Raster NULL");
return;
}
debug("Raster: %dx%d | depth: %d | format: 0x%X | stride: %d | platform: %d | pixels: %p",
r->width,
r->height,
r->depth,
r->format,
r->stride,
r->platform,
r->pixels);
}
static void downscaleTexture(RwTexture *texture){
// #ifdef RW_GLES1
if(texture == nil) if(texture == nil)
return; return;
@ -167,36 +150,37 @@ static void downscaleTexture(RwTexture *texture){
RwImageDestroy(resized); RwImageDestroy(resized);
RwTextureSetRaster(texture, newRaster); RwTextureSetRaster(texture, newRaster);
RwRasterDestroy(oldRaster); RwRasterDestroy(oldRaster);
// #else }
// RwRaster *oldRaster = RwTextureGetRaster(texture);
// if (oldRaster == nil) static void downscaleTexture(RwTexture *texture) {
// return; RwRaster *oldRaster = RwTextureGetRaster(texture);
// if (oldRaster == nil)
// extern bool moreVram; return;
// int targetSize = moreVram ? 64 : 32;
// extern bool moreVram;
// int oldWidth = RwRasterGetWidth(oldRaster); int targetSize = moreVram ? 64 : 32;
// int oldHeight = RwRasterGetHeight(oldRaster);
// if (oldWidth <= targetSize && oldHeight <= targetSize) return; int oldWidth = RwRasterGetWidth(oldRaster);
// int oldHeight = RwRasterGetHeight(oldRaster);
// int newWidth = clamp(oldWidth, targetSize); if (oldWidth <= targetSize && oldHeight <= targetSize) return;
// int newHeight = clamp(oldHeight, targetSize);
// if (newWidth == oldWidth && newHeight == oldHeight) return; int newWidth = clamp(oldWidth, targetSize);
// int newHeight = clamp(oldHeight, targetSize);
// RwImage *image = oldRaster->toImage(); if (newWidth == oldWidth && newHeight == oldHeight) return;
// if (image == nil) return;
// RwImage *image = oldRaster->toImage();
// RwImage *resized = resizeImage(image, newWidth, newHeight); if (image == nil) return;
// RwImageDestroy(image);
// if (resized == nil) return; RwImage *resized = resizeImage(image, newWidth, newHeight);
// RwImageDestroy(image);
// RwRaster *newRaster = rw::Raster::createFromImage(resized); if (resized == nil) return;
// RwImageDestroy(resized);
// if (newRaster == nil) return; RwRaster *newRaster = rw::Raster::createFromImage(resized);
// RwImageDestroy(resized);
// RwTextureSetRaster(texture, newRaster); if (newRaster == nil) return;
// RwRasterDestroy(oldRaster);
// #endif RwTextureSetRaster(texture, newRaster);
RwRasterDestroy(oldRaster);
} }
#endif #endif
@ -224,9 +208,9 @@ RwTextureGtaStreamRead(RwStream *stream)
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
texNumLoaded++; texNumLoaded++;
} else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) { } else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) {
if (tex != nil && tex->raster != nil && RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128) { if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) {
// debug("downscaling %s", tex->name); // debug("downscaling %s", tex->name);
downscaleTexture(tex); halveTexture(tex);
} }
} }
@ -578,7 +562,11 @@ CreateTxdImageForVideoCard()
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict; RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
FORLIST(lnk, texDict->textures){ FORLIST(lnk, texDict->textures){
rw::Texture *texture = rw::Texture::fromDict(lnk); rw::Texture *texture = rw::Texture::fromDict(lnk);
#ifdef RW_GL3
downscaleTexture(texture); downscaleTexture(texture);
#else
halveTexture(texture);
#endif
} }
#endif #endif
int32 pos = STREAMTELL(img); int32 pos = STREAMTELL(img);

View file

@ -707,11 +707,11 @@ public:
if (y < 125) { if (y < 125) {
b = JOY_Y; b = JOY_Y;
} else if (y > 155) { } else if (y > 155) {
b = JOY_A; b = JOY_B;
} else if (x < w - w / 8) { } else if (x < w - w / 8) {
b = JOY_X; b = JOY_X;
} else { } else {
b = JOY_B; b = JOY_A;
} }
activeZone[i] = b + 1; activeZone[i] = b + 1;
virtualButtons[b] = 1; virtualButtons[b] = 1;

View file

@ -19,6 +19,8 @@
#include "rwgl3impl.h" #include "rwgl3impl.h"
extern bool moreVram;
namespace rw { namespace rw {
namespace gl3 { namespace gl3 {
@ -340,6 +342,7 @@ skinClose(void *o, int32, int32)
void void
initSkin(void) initSkin(void)
{ {
if (moreVram) return; // TODO
u_boneMatrices = registerUniform("u_boneMatrices", UNIFORM_MAT4, MAX_BONES); u_boneMatrices = registerUniform("u_boneMatrices", UNIFORM_MAT4, MAX_BONES);
Driver::registerPlugin(PLATFORM_GL3, 0, ID_SKIN, Driver::registerPlugin(PLATFORM_GL3, 0, ID_SKIN,