From 1b96b0211ed98afba515f0ac9880116f79ead2e5 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Tue, 28 Nov 2023 13:58:18 -0700 Subject: render the front face of a cube --- src/main.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 0c91536..c08b584 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,13 +5,6 @@ #include "vector.hpp" #include -class Box : public Renderable { -public: - virtual void render(std::shared_ptr scene) { - scene->draw_line({0, 0}, {2 << FIX_SHIFT, 3 << FIX_SHIFT}, 1); - } -}; - int main() { // interrupt & mode 4 foo irq_init(NULL); @@ -20,14 +13,19 @@ int main() { palette::put_palette((std::uint16_t *)MEM_PAL); auto scene = std::make_shared(); - // auto cube = std::shared_ptr((Renderable *)new Cube()); - // scene->renderables.add(cube); - auto box = std::shared_ptr((Renderable *)new Box()); - scene->renderables.add(box); + auto cube = std::shared_ptr((Mesh *)new Cube); + + ModelInstance modelInstance(cube, int2fx(2), {0x0C7F, 0x0000, 0}, + {int2fx(0), 0, int2fx(0)}); + + auto modelInstancePtr = std::shared_ptr(&modelInstance); + scene->renderables.add(modelInstancePtr); while (1) { + Scene::render(scene); + vid_flip(); VBlankIntrWait(); } -- cgit v1.2.3-70-g09d2