2018-02-11 20:23:07 +01:00
|
|
|
/** 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);
|
2018-02-11 20:23:07 +01:00
|
|
|
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)))();
|
2018-02-11 20:23:07 +01:00
|
|
|
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));
|
2018-02-11 20:23:07 +01:00
|
|
|
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());
|
2018-02-11 20:23:07 +01:00
|
|
|
|
|
|
|
render.run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|