mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-11 23:54:09 +02:00
Restored PSP build, added fog to it (#451)
Co-authored-by: Vicente Carrasco Álvarez <vicente.carrasco@usach.cl>
This commit is contained in:
@@ -33,11 +33,12 @@ namespace GAPI {
|
|||||||
// Texture
|
// Texture
|
||||||
struct Texture {
|
struct Texture {
|
||||||
uint8 *memory;
|
uint8 *memory;
|
||||||
int width, height, origWidth, origHeight;
|
int width, height, depth, origWidth, origHeight, origDepth;//todo: depth
|
||||||
TexFormat fmt;
|
TexFormat fmt;
|
||||||
uint32 opt;
|
uint32 opt;
|
||||||
|
|
||||||
Texture(int width, int height, uint32 opt) : memory(0), width(width), height(height), origWidth(width), origHeight(height), fmt(FMT_RGBA), opt(opt) {}
|
/*depth*/
|
||||||
|
Texture(int width, int height, int depth, uint32 opt) : memory(0), width(width), height(height), depth(depth), origWidth(width), origHeight(height), origDepth(depth), fmt(FMT_RGBA), opt(opt) {}
|
||||||
|
|
||||||
void init(void *data) {
|
void init(void *data) {
|
||||||
ASSERT((opt & OPT_PROXY) == 0);
|
ASSERT((opt & OPT_PROXY) == 0);
|
||||||
@@ -238,19 +239,22 @@ namespace GAPI {
|
|||||||
support.maxVectors = 0;
|
support.maxVectors = 0;
|
||||||
support.shaderBinary = false;
|
support.shaderBinary = false;
|
||||||
support.VAO = false;
|
support.VAO = false;
|
||||||
|
support.VBO = false;
|
||||||
support.depthTexture = false;
|
support.depthTexture = false;
|
||||||
support.shadowSampler = false;
|
support.shadowSampler = false;
|
||||||
support.discardFrame = false;
|
support.discardFrame = false;
|
||||||
support.texNPOT = false;
|
support.texNPOT = false;
|
||||||
|
support.tex3D = false;
|
||||||
support.texRG = false;
|
support.texRG = false;
|
||||||
support.texBorder = false;
|
support.texBorder = false;
|
||||||
|
support.texMaxLevel = false;
|
||||||
support.colorFloat = false;
|
support.colorFloat = false;
|
||||||
support.colorHalf = false;
|
support.colorHalf = false;
|
||||||
support.texFloatLinear = false;
|
support.texFloatLinear = false;
|
||||||
support.texFloat = false;
|
support.texFloat = false;
|
||||||
support.texHalfLinear = false;
|
support.texHalfLinear = false;
|
||||||
support.texHalf = false;
|
support.texHalf = false;
|
||||||
support.clipDist = false;
|
//support.clipDist = false;
|
||||||
|
|
||||||
Core::width = 480;
|
Core::width = 480;
|
||||||
Core::height = 272;
|
Core::height = 272;
|
||||||
@@ -351,9 +355,33 @@ namespace GAPI {
|
|||||||
sceGuClearColor(*((uint32*)&c));
|
sceGuClearColor(*((uint32*)&c));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setViewport(const Viewport &vp) {
|
// Previous: struct Viewport
|
||||||
sceGuOffset(2048 - vp.width / 2, 2048 - vp.height / 2);
|
void setViewport(const short4 &vp) {
|
||||||
sceGuViewport(2048 + vp.x, 2048 + vp.y, vp.width, vp.height);
|
sceGuOffset(2048 - vp.z / 2, 2048 - vp.w / 2);
|
||||||
|
sceGuViewport(2048 + vp.x, 2048 + vp.y, vp.z, vp.w);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*this was giving errors on menu rendering when method was empty, see RT_ flags too*/
|
||||||
|
void setFog(const vec4 ¶ms) {
|
||||||
|
uint32 color;
|
||||||
|
if(params.w > 0.0f){
|
||||||
|
sceGuEnable(GU_FOG);
|
||||||
|
// FFP TODO
|
||||||
|
color = 0xFF000000
|
||||||
|
| (uint32(clamp(params.x * 255.0f, 0.0f, 255.0f)) << 0)
|
||||||
|
| (uint32(clamp(params.y * 255.0f, 0.0f, 255.0f)) << 8)
|
||||||
|
| (uint32(clamp(params.z * 255.0f, 0.0f, 255.0f)) << 16);
|
||||||
|
// from 3DS
|
||||||
|
sceGuFog(24.0f, 32.0f * 1024.0f, color);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sceGuDisable(GU_FOG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// from other gapi, could be improved??
|
||||||
|
void setScissor(const short4 &s) {
|
||||||
|
sceGuScissor(s.x, Core::viewportDef.w - (s.y + s.w), s.x + s.z, Core::viewportDef.w - s.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDepthTest(bool enable) {
|
void setDepthTest(bool enable) {
|
||||||
@@ -458,8 +486,9 @@ namespace GAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec4 copyPixel(int x, int y) {
|
vec4 copyPixel(int x, int y) {
|
||||||
|
//pspgu.h, pspdisplay.h ??
|
||||||
return vec4(0.0f); // TODO: read from framebuffer
|
return vec4(0.0f); // TODO: read from framebuffer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -3489,8 +3489,11 @@ struct Level : IGame {
|
|||||||
short4 oldViewport = Core::viewportDef;
|
short4 oldViewport = Core::viewportDef;
|
||||||
|
|
||||||
setDefaultTarget(eye, view, false);
|
setDefaultTarget(eye, view, false);
|
||||||
|
#ifdef FFP //fixme: psp framebuffer error?
|
||||||
Core::setTarget(NULL, NULL, RT_CLEAR_DEPTH | RT_STORE_COLOR);
|
Core::setTarget(NULL, NULL, RT_CLEAR_DEPTH | RT_CLEAR_COLOR | RT_STORE_COLOR);
|
||||||
|
#else
|
||||||
|
Core::setTarget(NULL, NULL, RT_CLEAR_DEPTH | RT_STORE_COLOR);
|
||||||
|
#endif
|
||||||
|
|
||||||
float aspect = setViewport(view, eye);
|
float aspect = setViewport(view, eye);
|
||||||
|
|
||||||
|
@@ -653,7 +653,7 @@ namespace Sound {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual int decode(Frame *frames, int count) {
|
virtual int decode(Frame *frames, int count) {
|
||||||
#if _OS_PSV // TODO crash
|
#if defined(_OS_PSV) || defined(_OS_PSP) // TODO crash
|
||||||
memset(frames, 0, count * sizeof(Frame));
|
memset(frames, 0, count * sizeof(Frame));
|
||||||
return count;
|
return count;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -17,11 +17,11 @@ struct Texture : GAPI::Texture {
|
|||||||
#elif defined(_GAPI_GU)
|
#elif defined(_GAPI_GU)
|
||||||
Tile4 *tiles;
|
Tile4 *tiles;
|
||||||
CLUT *cluts;
|
CLUT *cluts;
|
||||||
|
// TODO: PSP depth ??
|
||||||
Texture(Tile4 *tiles, int tilesCount, CLUT *cluts, int clutsCount) : GAPI::Texture(256, 256, 1, OPT_PROXY) {
|
Texture(Tile4 *tiles, int tilesCount, CLUT *cluts, int clutsCount) : GAPI::Texture(256, 256, 1, OPT_PROXY) {
|
||||||
#ifdef EDRAM_TEX
|
#ifdef EDRAM_TEX
|
||||||
this->tiles = (TR::Tile4*)GAPI::allocEDRAM(tilesCount * sizeof(tiles[0]));
|
this->tiles = (Tile4*)GAPI::allocEDRAM(tilesCount * sizeof(tiles[0]));
|
||||||
this->cluts = (TR::CLUT*)GAPI::allocEDRAM(clutsCount * sizeof(cluts[0]));
|
this->cluts = (CLUT*)GAPI::allocEDRAM(clutsCount * sizeof(cluts[0]));
|
||||||
memcpy(this->cluts, cluts, clutsCount * sizeof(cluts[0]));
|
memcpy(this->cluts, cluts, clutsCount * sizeof(cluts[0]));
|
||||||
#ifdef TEX_SWIZZLE
|
#ifdef TEX_SWIZZLE
|
||||||
for (int i = 0; i < tilesCount; i++)
|
for (int i = 0; i < tilesCount; i++)
|
||||||
|
31
src/utils.h
31
src/utils.h
@@ -2047,6 +2047,37 @@ public:
|
|||||||
strcpy(path, contentDir);
|
strcpy(path, contentDir);
|
||||||
readDirectory(path);
|
readDirectory(path);
|
||||||
}
|
}
|
||||||
|
#elif _OS_PSP //vita isnt called "psp2" by coincidence
|
||||||
|
//dunno if this is used (?)
|
||||||
|
static void readDirectory(char* path) {
|
||||||
|
SceUID dd = sceIoDopen(path);
|
||||||
|
|
||||||
|
size_t len = strlen(path);
|
||||||
|
|
||||||
|
SceIoDirent entry;
|
||||||
|
while (sceIoDread(dd, &entry) > 0)
|
||||||
|
{
|
||||||
|
strcat(path, entry.d_name);
|
||||||
|
|
||||||
|
if (FIO_S_ISDIR(entry.d_stat.st_mode))
|
||||||
|
{
|
||||||
|
strcat(path, "/");
|
||||||
|
readDirectory(path);
|
||||||
|
} else {
|
||||||
|
fileList.push(StrUtils::copy(path + strlen(contentDir)));
|
||||||
|
}
|
||||||
|
|
||||||
|
path[len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sceIoClose(dd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void readFileList() {
|
||||||
|
char path[255];
|
||||||
|
strcpy(path, contentDir);
|
||||||
|
readDirectory(path);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static void readFileList() {};
|
static void readFileList() {};
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user