main.cpp 1.04 KB
Newer Older
1
#include <core/state.h>
2
#include <core/res/res.h>
3
4
5
6
#include <core/objects/skybox.h>
#include <components/PlayerController.h>

#include <raytrace/tracer/pathtracer.h>
7
#include "util/files.h"
8
9
10
11
12
13

using namespace glare;

int main(int argc, char* argv[])
{
	// Initialize engine from settings xml
14
	core::Context::createAsCurrent(files::asset("/preferences/default.xml"));
15
16

	// Load a scene and attach it to the constant root
17
	core::Context::current().graph()->attach(core::global_resources::scenes.get(files::asset("meshes/scenery/cbox.dae"), 1.0f));
18
19

	// Create a skybox
20
	core::Context::current().skybox()->reset(files::asset("textures/ryfjallet/"));
21
22

	// Add a PlayerController to move around
23
	core::Context::current().camera()->owner()->makeComponent<component::PlayerController>();
24
25

	// Create a Pathtracer and all needed stuff for it from the graph
26
	const auto pathtracer = std::make_unique<raytrace::Pathtracer>(core::Context::current().graph());
27
28

	// Render the scene with the pathtracer
29
	core::Context::current().loop([&pathtracer]() { pathtracer->draw(); });
30
}