38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/** 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(0, 0, 0), 1);
|
|
TestImplicitSphere sph2(Point(0, 0, 0), 1.6);
|
|
Mesh m_sph1 = MarchingCubes(sph1,
|
|
Cuboid(Point(-2.2, -2.2, -2.2), Point(2.2, 2.2, 2.2)))();
|
|
Mesh m_sph2 = MarchingCubes(sph2,
|
|
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());
|
|
printf("Sph2 has %ld vertices, %ld faces.\n",
|
|
m_sph2.get_vertices().size(),
|
|
m_sph2.get_faces().size());
|
|
|
|
render.run();
|
|
|
|
return 0;
|
|
}
|