summaryrefslogtreecommitdiff
path: root/scene.h
blob: a029d91afd71d211789ea9712e75353f5a85b90a (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef SCENE_H
#define SCENE_H

#include "vector.h"
#include "terrain.h"
#include "gl.h"
#include "shader.h"
#include "gui.h"
#include "tool.h"
#include "scripting.h"
#include "player.h"
#include "model.h"

#include <FTGL/ftgl.h>
#include <assimp/assimp.hpp>
#include <assimp/aiScene.h>

using models::Model;

class Scene {
	public:
		float pitch, yaw;
		Vector3 pos;
		float yvel;
		Terrain *terrain;
		FTFont *font;
		GUI *gui;
		Tool *tool;
		ConsoleWindow *console;
		ChatWindow *chat;
		Lua *lua;
		PlayerList players;

		bool running;
		bool grid;
		bool normals;
		bool render_terrain;
		bool gravity;
		bool dialog;
		bool flying;
		bool underwater;

		Terrain::Node *last_node;

		unsigned int last_time;
		unsigned int last_sort;
		Vector3 selected;

		bool do_select, show_selection;
		int sx, sy;

		GLShaderProgram terrain_program;
		GLShaderProgram water_program;
		GLShaderProgram tree_program;

		GLuint grass_texture, rock_texture, soil_texture, water_texture, marker_texture, placeholder_texture;
		std::map<std::string, GLuint> scene_textures;

		Scene();
		~Scene();

		void lookat();
		void move(float forward, float right, int steps);
		bool select(int x, int y, float& px, float& py, float& pz);
		void update();
		void events();
		void render();
		GLuint load_texture(const char *filename);
		GLuint load_texture(aiTexture *texture);

		void sort_players();
};

#endif