mpri-graphics-project/main_test_sphere.cpp

39 lines
1.2 KiB
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");
2018-02-12 00:56:35 +01:00
TestImplicitSphere sph1(Point(0, 0, 0), 1);
TestImplicitSphere sph2(Point(0, 0, 0), 1.6);
Mesh m_sph1 = MarchingCubes(sph1,
2018-02-12 00:56:35 +01:00
Cuboid(Point(-2.2, -2.2, -2.2), Point(2.2, 2.2, 2.2)))();
Mesh m_sph2 = MarchingCubes(sph2,
2018-02-12 00:56:35 +01:00
Cuboid(Point(-2.2, -2.2, -2.2), Point(2.2, 2.2, 2.2)))();
m_sph1.translate(Point(-2, 0, 0));
m_sph2.translate(Point(2, 0, 1));
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());
2018-02-12 00:56:35 +01:00
printf("Sph2 has %ld vertices, %ld faces.\n",
m_sph2.get_vertices().size(),
m_sph2.get_faces().size());
render.run();
return 0;
}