Quake BSP renderer for PS1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

54 lines
1.2 KiB

#include "common.h"
#include "input.h"
#include "display.h"
#include "time.h"
#include "asset.h"
extern u_long tim_e1m1[];
extern u_long tim_e2m2[];
VECTOR cam_pos = { 0, -400, 100 };
SVECTOR cam_rot = { 0 };
// BSP face rendering:
// - Gather vertex data from face start index + length
// - Store vertex data in scratchpad memory (should be plenty of space for one face)
// - Perform camera offset and re-scaling operations to fit vertex data in signed 16-bit fixed point vectors
// - Note: may be possible to (ab)use 32-bit GTE registers & ops to do this calculation and downcast
// - Store rescaled vertex data in scratchpad memory
// Init function
void init(void)
{
time_init();
input_init();
display_init();
asset_loadTexture(tim_e1m1, NULL);
asset_loadTexture(tim_e2m2, NULL);
}
// Main function, program entrypoint
int main(int argc, const char *argv[])
{
// Init stuff
init();
// Main loop
while(1)
{
input_process();
display_start();
// Draw stuff
FntPrint(-1, "Camera pos = (%d, %d, %d) rot = (%d, %d, %d)\n", cam_pos.vx, cam_pos.vy, cam_pos.vz, cam_rot.vx, cam_rot.vy, cam_rot.vz);
FntFlush(-1);
display_finish();
time_tick();
}
return 0;
}