#include "../../../common/world/world.h"

#include <sys/stat.h>
Camera3D* worldcam;
enginend::nodes::trid::billboard* itsame;
void world::boot() {
	
	itsame=new enginend::nodes::trid::billboard({0,0,0},{0,0,0},{1,1,1},{1,1,1},"player/kinfuyuki/player.png");
	players->boot();
	entities->boot();
	buildings->boot();
	terrain=new enginend::nodes::trid::object3d(AT("res/models/world.obj"));
	worldrender=LoadShader(
		AT("res/shaders/tile.vs"),
		AT("res/shaders/tile.fs")
	);
	players->children.push_back(itsame);
	worldcam=new Camera3D;
	itsame->watcher=worldcam;
}
void world::draw() {
	BeginMode3D(*worldcam);
	BeginShaderMode(worldrender);
	terrain->draw();
	EndShaderMode();
	players->draw();
	entities->draw();
	buildings->draw();
	EndMode3D();
}
void world::exit() {
	players->exit();
	entities->exit();
	buildings->exit();
}

