mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-23 01:57:21 +03:00
Something idk
This commit is contained in:
parent
af57ea469e
commit
b0e18e4f68
1 changed files with 38 additions and 50 deletions
|
|
@ -93,24 +93,7 @@ static int clamp(int size, int targetSize)
|
|||
return size;
|
||||
}
|
||||
|
||||
void debugRaster(RwRaster *r){
|
||||
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
|
||||
static void halveTexture(RwTexture *texture){
|
||||
if(texture == nil)
|
||||
return;
|
||||
|
||||
|
|
@ -167,36 +150,37 @@ static void downscaleTexture(RwTexture *texture){
|
|||
RwImageDestroy(resized);
|
||||
RwTextureSetRaster(texture, newRaster);
|
||||
RwRasterDestroy(oldRaster);
|
||||
// #else
|
||||
// RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||
// if (oldRaster == nil)
|
||||
// return;
|
||||
//
|
||||
// extern bool moreVram;
|
||||
// int targetSize = moreVram ? 64 : 32;
|
||||
//
|
||||
// int oldWidth = RwRasterGetWidth(oldRaster);
|
||||
// int oldHeight = RwRasterGetHeight(oldRaster);
|
||||
// if (oldWidth <= targetSize && oldHeight <= targetSize) return;
|
||||
//
|
||||
// int newWidth = clamp(oldWidth, targetSize);
|
||||
// int newHeight = clamp(oldHeight, targetSize);
|
||||
// if (newWidth == oldWidth && newHeight == oldHeight) return;
|
||||
//
|
||||
// RwImage *image = oldRaster->toImage();
|
||||
// if (image == nil) return;
|
||||
//
|
||||
// RwImage *resized = resizeImage(image, newWidth, newHeight);
|
||||
// RwImageDestroy(image);
|
||||
// if (resized == nil) return;
|
||||
//
|
||||
// RwRaster *newRaster = rw::Raster::createFromImage(resized);
|
||||
// RwImageDestroy(resized);
|
||||
// if (newRaster == nil) return;
|
||||
//
|
||||
// RwTextureSetRaster(texture, newRaster);
|
||||
// RwRasterDestroy(oldRaster);
|
||||
// #endif
|
||||
}
|
||||
|
||||
static void downscaleTexture(RwTexture *texture) {
|
||||
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||
if (oldRaster == nil)
|
||||
return;
|
||||
|
||||
extern bool moreVram;
|
||||
int targetSize = moreVram ? 64 : 32;
|
||||
|
||||
int oldWidth = RwRasterGetWidth(oldRaster);
|
||||
int oldHeight = RwRasterGetHeight(oldRaster);
|
||||
if (oldWidth <= targetSize && oldHeight <= targetSize) return;
|
||||
|
||||
int newWidth = clamp(oldWidth, targetSize);
|
||||
int newHeight = clamp(oldHeight, targetSize);
|
||||
if (newWidth == oldWidth && newHeight == oldHeight) return;
|
||||
|
||||
RwImage *image = oldRaster->toImage();
|
||||
if (image == nil) return;
|
||||
|
||||
RwImage *resized = resizeImage(image, newWidth, newHeight);
|
||||
RwImageDestroy(image);
|
||||
if (resized == nil) return;
|
||||
|
||||
RwRaster *newRaster = rw::Raster::createFromImage(resized);
|
||||
RwImageDestroy(resized);
|
||||
if (newRaster == nil) return;
|
||||
|
||||
RwTextureSetRaster(texture, newRaster);
|
||||
RwRasterDestroy(oldRaster);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -224,9 +208,9 @@ RwTextureGtaStreamRead(RwStream *stream)
|
|||
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
|
||||
texNumLoaded++;
|
||||
} 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);
|
||||
downscaleTexture(tex);
|
||||
halveTexture(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +562,11 @@ CreateTxdImageForVideoCard()
|
|||
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
|
||||
FORLIST(lnk, texDict->textures){
|
||||
rw::Texture *texture = rw::Texture::fromDict(lnk);
|
||||
#ifdef RW_GL3
|
||||
downscaleTexture(texture);
|
||||
#else
|
||||
halveTexture(texture);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
int32 pos = STREAMTELL(img);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue