mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 17:17:09 -04:00
PSP: Less broken rendering
This commit is contained in:
parent
c07d34a5fc
commit
d96aba237b
@ -60,6 +60,8 @@ static void guInit(void) {
|
|||||||
sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
sceGuScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
sceGuDisable(GU_SCISSOR_TEST);
|
sceGuDisable(GU_SCISSOR_TEST);
|
||||||
|
|
||||||
|
|
||||||
|
//sceGuEnable(GU_CLIP_PLANES);
|
||||||
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
|
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
|
||||||
|
|
||||||
sceGuFinish();
|
sceGuFinish();
|
||||||
@ -137,13 +139,18 @@ void Gfx_ClearCol(PackedCol color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetColWriteMask(cc_bool r, cc_bool g, cc_bool b, cc_bool a) {
|
void Gfx_SetColWriteMask(cc_bool r, cc_bool g, cc_bool b, cc_bool a) {
|
||||||
//glColorMask(r, g, b, a);
|
unsigned int mask = 0xffffffff;
|
||||||
/* TODO implemenet */
|
if (r) mask &= 0xffffff00;
|
||||||
|
if (g) mask &= 0xffff00ff;
|
||||||
|
if (b) mask &= 0xff00ffff;
|
||||||
|
if (a) mask &= 0x00ffffff;
|
||||||
|
|
||||||
|
//sceGuPixelMask(mask); TODO implement
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetDepthWrite(cc_bool enabled) { sceGuDepthMask(enabled); }
|
void Gfx_SetDepthWrite(cc_bool enabled) { sceGuDepthMask(enabled); }
|
||||||
void Gfx_SetDepthTest(cc_bool enabled) { GU_Toggle(GU_DEPTH_TEST); }
|
void Gfx_SetDepthTest(cc_bool enabled) { GU_Toggle(GU_DEPTH_TEST); }
|
||||||
|
//void Gfx_SetDepthTest(cc_bool enabled) { sceGuDisable(GU_DEPTH_TEST); }
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------------Matrices--------------------------------------------------------*
|
*---------------------------------------------------------Matrices--------------------------------------------------------*
|
||||||
@ -305,11 +312,11 @@ void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
|||||||
*---------------------------------------------------------Matrices--------------------------------------------------------*
|
*---------------------------------------------------------Matrices--------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static int matrix_modes[] = { GU_PROJECTION, GU_VIEW };
|
static int matrix_modes[] = { GU_PROJECTION, GU_VIEW };
|
||||||
|
static ScePspFMatrix4 tmp_matrix;
|
||||||
|
|
||||||
void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
|
void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
|
||||||
ScePspFMatrix4 m;
|
gumLoadMatrix(&tmp_matrix, matrix);
|
||||||
gumLoadMatrix(&m, matrix);
|
sceGuSetMatrix(matrix_modes[type], &tmp_matrix);
|
||||||
sceGuSetMatrix(matrix_modes[type], &m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_LoadIdentityMatrix(MatrixType type) {
|
void Gfx_LoadIdentityMatrix(MatrixType type) {
|
||||||
@ -349,14 +356,17 @@ void Gfx_DrawVb_Lines(int verticesCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
void Gfx_DrawVb_IndexedTris_Range(int verticesCount, int startVertex) {
|
||||||
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, verticesCount, gfx_indices, gfx_vertices + startVertex * gfx_stride);
|
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, ICOUNT(verticesCount),
|
||||||
|
gfx_indices, gfx_vertices + startVertex * gfx_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
void Gfx_DrawVb_IndexedTris(int verticesCount) {
|
||||||
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, verticesCount, gfx_indices, gfx_vertices);
|
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, ICOUNT(verticesCount),
|
||||||
|
gfx_indices, gfx_vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
void Gfx_DrawIndexedTris_T2fC4b(int verticesCount, int startVertex) {
|
||||||
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, verticesCount, gfx_indices, gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED);
|
sceGuDrawArray(GU_TRIANGLES, gfx_fields | GU_INDEX_16BIT, ICOUNT(verticesCount),
|
||||||
|
gfx_indices, gfx_vertices + startVertex * SIZEOF_VERTEX_TEXTURED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -9,7 +9,6 @@
|
|||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -19,14 +18,13 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <pspkernel.h>
|
#include <pspkernel.h>
|
||||||
#include <pspnet_inet.h>
|
#include <pspnet_inet.h>
|
||||||
#include <pspnet_resolver.h>
|
#include <pspnet_resolver.h>
|
||||||
|
#include <psprtc.h>
|
||||||
|
|
||||||
#define NS_PER_SEC 1000000000ULL
|
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
|
||||||
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
|
||||||
const cc_result ReturnCode_FileNotFound = ENOENT;
|
const cc_result ReturnCode_FileNotFound = ENOENT;
|
||||||
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
||||||
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
||||||
@ -64,13 +62,16 @@ void Mem_Free(void* mem) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*------------------------------------------------------Logging/Time-------------------------------------------------------*
|
*------------------------------------------------------Logging/Time-------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
/* TODO: check this is actually accurate */
|
|
||||||
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
|
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
|
||||||
if (end < beg) return 0;
|
if (end < beg) return 0;
|
||||||
return (end - beg) / 1000;
|
return end - beg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Log(const char* msg, int len) {
|
void Platform_Log(const char* msg, int len) {
|
||||||
|
int fd = sceKernelStdout();
|
||||||
|
sceIoWrite(fd, msg, len);
|
||||||
|
sceIoWrite(fd, "\n", 1);
|
||||||
|
|
||||||
//pspDebugSioPutData(msg, len);
|
//pspDebugSioPutData(msg, len);
|
||||||
//pspDebugSioPutData("\n", 1);
|
//pspDebugSioPutData("\n", 1);
|
||||||
}
|
}
|
||||||
@ -83,25 +84,23 @@ TimeMS DateTime_CurrentUTC_MS(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DateTime_CurrentLocal(struct DateTime* t) {
|
void DateTime_CurrentLocal(struct DateTime* t) {
|
||||||
struct timeval cur;
|
pspTime curTime;
|
||||||
struct tm loc_time;
|
sceRtcGetCurrentClockLocalTime(&curTime);
|
||||||
gettimeofday(&cur, NULL);
|
|
||||||
localtime_r(&cur.tv_sec, &loc_time);
|
|
||||||
|
|
||||||
t->year = loc_time.tm_year + 1900;
|
t->year = curTime.year;
|
||||||
t->month = loc_time.tm_mon + 1;
|
t->month = curTime.month;
|
||||||
t->day = loc_time.tm_mday;
|
t->day = curTime.day;
|
||||||
t->hour = loc_time.tm_hour;
|
t->hour = curTime.hour;
|
||||||
t->minute = loc_time.tm_min;
|
t->minute = curTime.minutes;
|
||||||
t->second = loc_time.tm_sec;
|
t->second = curTime.seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define US_PER_SEC 1000000ULL
|
||||||
cc_uint64 Stopwatch_Measure(void) {
|
cc_uint64 Stopwatch_Measure(void) {
|
||||||
struct timespec t;
|
// TODO: sceKernelGetSystemTimeWide
|
||||||
// sceKernelGetSystemTimeWide
|
struct SceKernelTimeval cur;
|
||||||
/* TODO: CLOCK_MONOTONIC_RAW ?? */
|
sceKernelLibcGettimeofday(&cur, NULL);
|
||||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
return (cc_uint64)cur.tv_sec * US_PER_SEC + cur.tv_usec;
|
||||||
return (cc_uint64)t.tv_sec * NS_PER_SEC + t.tv_nsec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user