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.
 
 

64 lines
1.6 KiB

#include "common.h"
#include "input.h"
#include "display.h"
#include "time.h"
#include "asset.h"
#include "world.h"
extern u_long tim_e1m1[];
extern u_long bsp_test[];
VECTOR cam_pos = { 2176, 1152, 272 }; // START
//VECTOR cam_pos = { 1920, -1408, 352 }; // E1M1
SVECTOR cam_rot = { 0, 0, 0 };
world_t world;
// 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)
{
input_init(); // Works
display_init(); // Works
time_init(); // Works
//asset_loadTexture(tim_e1m1, NULL);
world_load(bsp_test, &world); // Works
}
// Main function, program entrypoint
int main(int argc, const char *argv[])
{
// Init stuff
init();
// Main loop
while(1)
{
input_process(); // Works
display_start(); // Works
FntPrint(-1, "Time: %d, ticks = %d, delta time = %d, fps = %d\n", (time_getRealTime() * 1000) >> 12, time_getFrameNumber(), time_getDeltaTime(), time_getFrameRate() >> 8);
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);
// Draw stuff
world_draw(&world); // Doesn't work >:(
FntPrint(-1, "Polygon count: %d\n", polyCount);
FntFlush(-1);
display_finish(); // Works
time_tick();
}
return 0;
}