-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (41 loc) · 1.42 KB
/
main.cpp
File metadata and controls
57 lines (41 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <gccore.h>
#include <gctypes.h>
#include "velvet/Renderer.hpp"
#include "velvet/core/Core.hpp"
#include "velvet/core/Engine.hpp"
#include "velvet/core/loaders/ModelLoader.hpp"
#include "velvet/core/loaders/TextureLoader.hpp"
#include "velvet/dvd/DVD.hpp"
#include "velvet/input/Input.hpp"
#include "velvet/math/Quaternion.hpp"
[[noreturn]] s32 main() {
using namespace velvet;
core::Init();
auto texturesTpl = core::loaders::LoadTPL("textures.tpl");
auto skyboxTpl = core::loaders::LoadTPL("skybox.tpl");
auto monkeyFile = dvd::LoadFile("models/aiai.vobj").value();
const auto monkeyVobj = core::loaders::InitVOBJ(dvd::GetFileBuffer(monkeyFile));
for (;;) {
input::UpdateControllers();
core::gMainCamera.Update();
renderer::BeginDraw();
// Draw everything
core::loaders::LoadTexFromTPL(texturesTpl, 0, GX_TEXMAP0);
core::loaders::LoadTexFromTPL(texturesTpl, 1, GX_TEXMAP1);
core::loaders::LoadTexFromTPL(texturesTpl, 2, GX_TEXMAP2);
renderer::SetLight({0.f, 0.5f, 1.f}, 100.f, {255, 255, 255, 255});
renderer::SetMaterial({255, 255, 255, 255}, {16, 16, 16, 255});
renderer::SetTexture(GX_TEXMAP2, true);
// static f32 rot = 0;
renderer::DrawTexturedVObj(
*monkeyVobj.value(),
{.translation = {0, 0, 0}, .scale = {2, 2, 2}});
// Draw skybox
core::loaders::LoadCubemapTexture(skyboxTpl);
renderer::DrawSkybox();
/*rot++;
if (rot > 360.f)
rot = 0.f;*/
renderer::EndDraw();
}
}