build/api-examples/Rasterizer3D.cpp¶
Complete program from the Rasterizer3D API reference. Save it at the path shown above and use the build command in the reference page.
Source files · Download Rasterizer3D.cpp
#include "raster3d.hpp"
int main()
{
gaspardos::Framebuffer image(320, 240);
gaspardos::graphics::Rasterizer3D renderer(image);
gaspardos::graphics::Pose pose;
pose.rotation = gaspardos::graphics::Vec3(.4f, .6f, .1f);
renderer.clear();
renderer.draw(gaspardos::graphics::Shapes3D::cube(), pose, false, true);
return image.pixel(160, 120) != 0x00201810 ? 0 : 1;
}