mpri-graphics-project/main_test_sphere.cpp

34 lines
954 B
C++
Raw Normal View History

/** An entry-point file using render/GlutRender as a renderer, displaying a
* simple sphere.
**/
#include "render/GlutRender.hpp"
#include "util/ObjParser.hpp"
#include "tests/TestImplicitSphere.hpp"
#include "Mesh.hpp"
#include "MarchingCubes.hpp"
int main(int argc, char** argv) {
GlutRender& render = GlutRender::get_instance();
render.init(&argc, argv, 640, 480, "Bouncing stuff");
TestImplicitSphere sph1(Point(2.5, -1, 0), 1);
TestImplicitSphere sph2(Point(-4, 0.5, 0), 1.4);
Mesh m_sph1 = MarchingCubes(sph1,
Cuboid(Point(1, -2, -2), Point(3, 0, 2)))();
Mesh m_sph2 = MarchingCubes(sph2,
Cuboid(Point(-6, -2, -2), Point(2, 3, 2)))();
render.add_mesh(&m_sph1);
render.add_mesh(&m_sph2);
puts("=== All set! ===");
printf("Sph1 has %ld vertices, %ld faces.\n",
m_sph1.get_vertices().size(),
m_sph1.get_faces().size());
render.run();
return 0;
}