Not sure what I was doing here

This commit is contained in:
Carlos Sanchez 2024-09-12 02:59:28 -04:00
parent a38bcd51dd
commit 4bba0346dd

View File

@ -82,16 +82,11 @@ void sys_movement(ecs_placement *p, ecs_movement *m, tecs **ecs) {
// Perform the entire rendering of an object // Perform the entire rendering of an object
void sys_renderobject(ecs_placement *p, ecs_object *o, tecs **ecs) { void sys_renderobject(ecs_placement *p, ecs_object *o, tecs **ecs) {
struct vec3 lighting; // --**-- First, precalc all the vertices in the object --**--
struct vec4 precalc_verts[H3D_OBJ_MAXVERTICES];
// The compiler is complaining about lighting beined used unitialized, even
// though it's not. Just shut it up First, precalc all the vertices in the
vec3(lighting.v, 0, 0, 0);
// object
// ------------------------------------------------------------------
mfloat_t tmp[VEC4_SIZE]; mfloat_t tmp[VEC4_SIZE];
mfloat_t modelm[MAT4_SIZE]; mfloat_t modelm[MAT4_SIZE];
mfloat_t finalmatrix[MAT4_SIZE]; mfloat_t finalmatrix[MAT4_SIZE];
struct vec4 precalc_verts[H3D_OBJ_MAXVERTICES];
vec3_add(tmp, p->pos.v, p->lookvec.v); vec3_add(tmp, p->pos.v, p->lookvec.v);
haloo3d_my_lookat(modelm, p->pos.v, tmp, p->up.v); haloo3d_my_lookat(modelm, p->pos.v, tmp, p->up.v);
// Apply scale such that it looks like it was applied first (this prevents // Apply scale such that it looks like it was applied first (this prevents
@ -99,8 +94,11 @@ void sys_renderobject(ecs_placement *p, ecs_object *o, tecs **ecs) {
haloo3d_mat4_prescalev(modelm, o->scale.v); haloo3d_mat4_prescalev(modelm, o->scale.v);
mat4_multiply(finalmatrix, o->context->precalc_screen, modelm); mat4_multiply(finalmatrix, o->context->precalc_screen, modelm);
haloo3d_precalc_verts(o->model, finalmatrix, precalc_verts); haloo3d_precalc_verts(o->model, finalmatrix, precalc_verts);
// Next, setup some rendering invariants // --**-- Next, setup some rendering invariants --**--
// ------------------------------------------------------------------ struct vec3 lighting;
// The compiler is complaining about lighting being used unitialized, even
// though it's not. Just shut it up
vec3(lighting.v, 0, 0, 0);
o->context->rendersettings.texture = o->texture; o->context->rendersettings.texture = o->texture;
if (o->lighting) { if (o->lighting) {
if (o->lighting->autolightfix) { if (o->lighting->autolightfix) {
@ -129,8 +127,7 @@ void sys_renderobject(ecs_placement *p, ecs_object *o, tecs **ecs) {
vec3_assign(lighting.v, o->lighting->dir.v); vec3_assign(lighting.v, o->lighting->dir.v);
} }
} }
// Finally, actually render faces // --**-- Finally, actually render faces --**--
// ------------------------------------------------------------------
haloo3d_facef face, baseface; haloo3d_facef face, baseface;
haloo3d_facef outfaces[H3D_FACEF_MAXCLIP]; haloo3d_facef outfaces[H3D_FACEF_MAXCLIP];
for (int facei = 0; facei < o->model->numfaces; facei++) { for (int facei = 0; facei < o->model->numfaces; facei++) {
@ -166,7 +163,6 @@ void sys_renderobject(ecs_placement *p, ecs_object *o, tecs **ecs) {
o->context->rendersettings.flags = oflags; o->context->rendersettings.flags = oflags;
} }
} }
// return totaldrawn;
} }
void sys_playerinput(ecs_input *in) { void sys_playerinput(ecs_input *in) {
@ -191,6 +187,10 @@ void sys_playerinput(ecs_input *in) {
} while (event.type != unigi_enum_event_none); } while (event.type != unigi_enum_event_none);
} }
// ---------------------------------------------------
// MAIN FUNCTION
// ---------------------------------------------------
int main() { // int argc, char **argv) { int main() { // int argc, char **argv) {
srand(clock()); srand(clock());
@ -219,12 +219,10 @@ int main() { // int argc, char **argv) {
haloo3d_print_initdefault(&pt, printbuf, sizeof(printbuf)); haloo3d_print_initdefault(&pt, printbuf, sizeof(printbuf));
pt.fb = &screen; pt.fb = &screen;
haloo3d_easytimer frametimer, drawtimer, sdltimer; //, filltimer, logictimer; haloo3d_easytimer frametimer, drawtimer, sdltimer;
haloo3d_easytimer_init(&frametimer, AVGWEIGHT); haloo3d_easytimer_init(&frametimer, AVGWEIGHT);
haloo3d_easytimer_init(&drawtimer, AVGWEIGHT); haloo3d_easytimer_init(&drawtimer, AVGWEIGHT);
haloo3d_easytimer_init(&sdltimer, AVGWEIGHT); haloo3d_easytimer_init(&sdltimer, AVGWEIGHT);
// haloo3d_easytimer_init(&filltimer, AVGWEIGHT);
// haloo3d_easytimer_init(&logictimer, AVGWEIGHT);
render_context context; render_context context;
context.windowclear = 0xF000; context.windowclear = 0xF000;