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.
62 lines
1.5 KiB
62 lines
1.5 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, 128 }; // 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)
|
|
{
|
|
time_init();
|
|
input_init();
|
|
display_init();
|
|
|
|
//asset_loadTexture(tim_e1m1, NULL);
|
|
|
|
world_load(bsp_test, &world);
|
|
}
|
|
|
|
// Main function, program entrypoint
|
|
int main(int argc, const char *argv[])
|
|
{
|
|
// Init stuff
|
|
init();
|
|
|
|
// Main loop
|
|
while(1)
|
|
{
|
|
input_process();
|
|
|
|
display_start();
|
|
|
|
// Draw stuff
|
|
world_draw(&world);
|
|
|
|
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);
|
|
FntFlush(-1);
|
|
|
|
display_finish();
|
|
|
|
time_tick();
|
|
}
|
|
|
|
return 0;
|
|
}
|