the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "ChestModel.h"
3#include "ModelPart.h"
4
5ChestModel::ChestModel()
6{
7 lid = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64);
8 lid->addBox(0.0f, -5.0f, -14.0f, 14, 5, 14, 0.0f);
9 lid->x = 1;
10 lid->y = 7;
11 lid->z = 15;
12
13 lock = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64);
14 lock->addBox(-1.0f, -2.0f, -15.0f, 2, 4, 1, 0.0f);
15 lock->x = 8;
16 lock->y = 7;
17 lock->z = 15;
18
19 bottom = ((new ModelPart(this, 0, 19)))->setTexSize(64, 64);
20 bottom->addBox(0.0f, 0.0f, 0.0f, 14, 10, 14, 0.0f);
21 bottom->x = 1;
22 bottom->y = 6;
23 bottom->z = 1;
24
25
26 // 4J added - compile now to avoid random performance hit first time cubes are rendered
27 lid->compile(1.0f/16.0f);
28 lock->compile(1.0f/16.0f);
29 bottom->compile(1.0f/16.0f);
30}
31
32void ChestModel::render(bool usecompiled)
33{
34 lock->xRot = lid->xRot;
35
36 lock->render(1 / 16.0f, usecompiled);
37 bottom->render(1 / 16.0f, usecompiled);
38
39 // 4J - moved lid to last and added z-bias to avoid glitching caused by z-fighting between the area of overlap between the lid & bottom of the chest
40 glPolygonOffset(-0.3f, -0.3f);
41 lid->render(1 / 16.0f, usecompiled);
42 glPolygonOffset(0.0f, 0.0f);
43}