void world_cleanLandscape(World *W) { EON_ObjDelete(W->land); EON_ObjDelete(W->sky); EON_MatDelete(W->landMat); EON_MatDelete(W->skyMat); return; }
END_TEST START_TEST(test_material_info) { CX_LogContext *sink = CX_log_open_null(); EON_Mat *M = EON_MatCreate(); EON_MatInfo(M, sink); // FIXME EON_MatDelete(M); CX_log_close(sink); }
END_TEST START_TEST(test_material_init_flat) { EON_Mat *M = EON_MatCreate(); void *orig = M->_PutFace; M->ShadeType = EON_SHADE_GOURAUD; EON_MatInit(M); ck_assert_ptr_ne(M->_PutFace, orig); EON_MatDelete(M); }
int main(int argc, char *argv[]) { int frames = 0; EON_Mat *mat[3]; EON_Cam *cam; EON_Obj *land; EON_Obj *sky, *sky2; Landscape ls; EONx_Console *con; EON_Rend *rend; EON_Frame *frame; EON_Font *font; uint64_t ts = 0; CX_LogContext *Logger = CX_log_open_console(CX_LOG_MARK, stderr); srand(0); // initialize prng EONx_ConsoleStartup("Eon3D :: Fly v1.1", NULL); con = EONx_ConsoleCreate(800, // Screen width 600, // Screen height 90.0 // Field of view ); frame = EONx_ConsoleGetFrame(con); cam = EONx_ConsoleGetCamera(con); rend = EON_RendCreate(cam); cam->Pos.Y = 800; // move the camera up from the ground font = EON_TextDefaultFont(); setup_materials(con, mat, Logger); // intialize materials and palette memset(&ls, 0, sizeof(ls)); setup_landscape(&ls, mat[0],mat[1],mat[2]); // create landscape land = ls.land; sky = ls.sky; sky2 = ls.sky2; EON_ObjInfo(land, Logger); EON_ObjInfo(sky, Logger); EON_ObjInfo(sky2, Logger); frames = 0; // set up for framerate counter ts = eon_gettime_ms(); while (!EONx_ConsoleNextEvent(con)) { // save time when the frame began, to be used later. uint64_t elapsed = 0; frames++; cam->Pos.Z += 1; EONx_ConsoleClearFrame(con); if (cam->Pos.Y > 2000) { // if above the sky, only render the skies, with no far clip plane cam->ClipBack = 0.0; EON_RenderBegin(rend); EON_RenderObj(rend, sky); EON_RenderObj(rend, sky2); } else { // otherwise, render the sky (but not the second sky), // and the land, with a far clip plane cam->ClipBack = 10000.0; EON_RenderBegin(rend); EON_RenderObj(rend, sky); EON_RenderObj(rend, land); } EON_RenderEnd(rend, frame); elapsed = (eon_gettime_ms() - ts) / 1000000; EON_TextPrintf(font, cam, frame, cam->ClipLeft+5, cam->ClipTop, 0.0, "%.3f FPS", (frames/ (double) elapsed)); EONx_ConsoleShowFrame(con); // wraparound if (cam->Pos.X > LAND_SIZE/2) cam->Pos.X = -LAND_SIZE/2; if (cam->Pos.X < -LAND_SIZE/2) cam->Pos.X = LAND_SIZE/2; if (cam->Pos.Z > LAND_SIZE/2) cam->Pos.Z = -LAND_SIZE/2; if (cam->Pos.Z < -LAND_SIZE/2) cam->Pos.Z = LAND_SIZE/2; if (cam->Pos.Y < 0 ) cam->Pos.Y = 8999; if (cam->Pos.Y > 8999 ) cam->Pos.Y = 0; } EON_FontDelete(font); EON_ObjDelete(land); EON_ObjDelete(sky); EON_ObjDelete(sky2); EON_MatDelete(mat[0]); EON_MatDelete(mat[1]); EON_MatDelete(mat[2]); EONx_ConsoleShutdown(); return CX_log_close(Logger); }