the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 51 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "BoatModel.h" 3 4BoatModel::BoatModel() : Model() 5{ 6 cubes[0] = new ModelPart(this, 0, 8); 7 cubes[1] = new ModelPart(this, 0, 0); 8 cubes[2] = new ModelPart(this, 0, 0); 9 cubes[3] = new ModelPart(this, 0, 0); 10 cubes[4] = new ModelPart(this, 0, 0); 11 12 int w = 24; 13 int d = 6; 14 int h = 20; 15 int yOff = 4; 16 17 cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0); 18 cubes[0]->setPos(0, (float)(0 + yOff), 0); 19 20 cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); 21 cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0); 22 23 cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); 24 cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0); 25 26 cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); 27 cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1)); 28 29 cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0); 30 cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1)); 31 32 cubes[0]->xRot = PI / 2; 33 cubes[1]->yRot = PI / 2 * 3; 34 cubes[2]->yRot = PI / 2 * 1; 35 cubes[3]->yRot = PI / 2 * 2; 36 37 // 4J added - compile now to avoid random performance hit first time cubes are rendered 38 cubes[0]->compile(1.0f/16.0f); 39 cubes[1]->compile(1.0f/16.0f); 40 cubes[2]->compile(1.0f/16.0f); 41 cubes[3]->compile(1.0f/16.0f); 42 cubes[4]->compile(1.0f/16.0f); 43} 44 45void BoatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) 46{ 47 for (int i = 0; i < 5; i++) 48 { 49 cubes[i]->render(scale, usecompiled); 50 } 51}