2014-10-20 16:38:29 +00:00
|
|
|
#ifndef LEVEL_HH_INCLUDED
|
|
|
|
#define LEVEL_HH_INCLUDED
|
|
|
|
|
|
|
|
#include <string>
|
2014-10-30 22:54:19 +00:00
|
|
|
#include "object.hh"
|
|
|
|
#include "light.hh"
|
2014-10-20 16:38:29 +00:00
|
|
|
#include "entity.hh"
|
2014-10-20 17:07:45 +00:00
|
|
|
#include "terrain.hh"
|
2014-11-08 00:17:23 +00:00
|
|
|
#include "material.hh"
|
2014-11-13 16:19:56 +00:00
|
|
|
#include "camera.hh"
|
2014-11-17 11:57:16 +00:00
|
|
|
#include "physics.hh"
|
2014-12-15 13:59:03 +00:00
|
|
|
#include "trigger.hh"
|
2015-03-04 20:28:46 +00:00
|
|
|
#include "skydome.hh"
|
2015-03-12 18:14:14 +00:00
|
|
|
#include "keyboardState.hh"
|
2015-03-16 15:58:50 +00:00
|
|
|
#include "chunk.hh"
|
2014-10-20 16:38:29 +00:00
|
|
|
|
2015-02-04 16:16:06 +00:00
|
|
|
extern "C" {
|
2015-03-12 14:04:26 +00:00
|
|
|
#include "lua.h"
|
|
|
|
#include "lualib.h"
|
|
|
|
#include "lauxlib.h"
|
2015-02-04 16:16:06 +00:00
|
|
|
}
|
2015-03-12 14:04:26 +00:00
|
|
|
#include "LuaBridge.h"
|
2015-02-04 16:16:06 +00:00
|
|
|
|
2015-03-21 14:05:22 +00:00
|
|
|
// forward declaration
|
|
|
|
class Graphics;
|
|
|
|
|
2014-10-20 16:38:29 +00:00
|
|
|
class Level {
|
|
|
|
public:
|
2015-06-03 00:12:00 +00:00
|
|
|
Level(std::string xmlFilePath, float farPlane);
|
2014-10-30 22:54:19 +00:00
|
|
|
Level();
|
2014-10-20 16:38:29 +00:00
|
|
|
~Level();
|
2014-11-27 23:17:56 +00:00
|
|
|
void load();
|
2015-03-12 18:14:14 +00:00
|
|
|
void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,
|
|
|
|
KeyboardState* keyboardState);
|
2014-12-15 11:41:30 +00:00
|
|
|
void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
2015-05-31 22:57:36 +00:00
|
|
|
glm::vec3 center, int chunkRenderDistance, glm::mat4* viewProjectionMatrix,
|
2015-03-21 20:46:58 +00:00
|
|
|
std::vector<glm::mat4>* shadowVPs=0);
|
2014-10-30 22:59:03 +00:00
|
|
|
glm::vec3 getAmbientLight();
|
2014-11-17 16:51:15 +00:00
|
|
|
Light* getDirectionalLight();
|
2015-05-31 19:17:46 +00:00
|
|
|
std::vector<shared_ptr<Light>>* getLights();
|
2014-11-13 00:22:33 +00:00
|
|
|
Object* getCameraCenter();
|
2014-11-15 13:54:44 +00:00
|
|
|
Camera* getCamera();
|
2014-11-19 00:57:38 +00:00
|
|
|
glm::vec3 getCameraPosition();
|
2015-03-08 23:39:59 +00:00
|
|
|
glm::vec4 getFogColourDay();
|
|
|
|
glm::vec4 getFogColourRise();
|
|
|
|
glm::vec4 getFogColourNight();
|
2014-11-21 23:39:58 +00:00
|
|
|
void setSkydomeSize(float size);
|
2015-02-04 16:16:06 +00:00
|
|
|
float getSkydomeSize();
|
2015-03-09 13:28:09 +00:00
|
|
|
void setWaterPlane(Object* water);
|
2015-03-21 18:02:24 +00:00
|
|
|
Object* getWaterPlane();
|
2015-03-04 20:28:46 +00:00
|
|
|
Skydome* getSkydome();
|
2015-03-16 15:58:50 +00:00
|
|
|
std::vector<Object*>* getAllObjects();
|
2015-02-04 16:16:06 +00:00
|
|
|
std::vector<Object*>* getPhysicsObjects();
|
2015-01-17 12:30:33 +00:00
|
|
|
void moveObject(int objectIndex, float strength, float xPos, float yPos, float zPos);
|
2015-02-04 16:16:06 +00:00
|
|
|
void setStrength(float strength);
|
2015-03-04 20:28:46 +00:00
|
|
|
void setSkydomeObject(Skydome object);
|
2015-03-18 07:54:38 +00:00
|
|
|
void addObject(Object* object, bool crossesChunks);
|
2015-02-04 16:16:06 +00:00
|
|
|
void addPhysicsObject(Object* object);
|
|
|
|
void setAmbientLight(glm::vec3 colour);
|
2015-03-08 23:39:59 +00:00
|
|
|
void setFogColourDay(glm::vec4 colour);
|
|
|
|
void setFogColourRise(glm::vec4 colour);
|
|
|
|
void setFogColourNight(glm::vec4 colour);
|
2015-02-04 16:16:06 +00:00
|
|
|
void setDirectionalLight(Light light);
|
2015-03-06 12:22:04 +00:00
|
|
|
void setSunDirection(float x, float y, float z);
|
2015-02-04 16:16:06 +00:00
|
|
|
unsigned int getPhysicsObjectsVectorSize();
|
2015-03-16 15:58:50 +00:00
|
|
|
Physics* getPhysics();
|
2015-02-04 16:16:06 +00:00
|
|
|
void setCameraCenter(Object* object);
|
|
|
|
void addLight(Light light);
|
2015-03-07 12:41:35 +00:00
|
|
|
void preloadLightPosition(float xPos, float yPos, float zPos);
|
2015-05-31 22:57:36 +00:00
|
|
|
void addLightByParameters(float redColour, float greenColour,
|
|
|
|
float blueColour, float intensity, float flameYOffset,
|
|
|
|
float flameHeight, float flameWidth);
|
2015-03-07 12:41:35 +00:00
|
|
|
void deleteFourLights();
|
2015-02-04 16:16:06 +00:00
|
|
|
void addTrigger(Trigger trigger);
|
|
|
|
lua_State* getLuaState();
|
|
|
|
Terrain* getTerrain();
|
2015-02-13 16:14:29 +00:00
|
|
|
void resetPlayer();
|
2015-03-04 17:10:49 +00:00
|
|
|
void movePlayer(float xPosition, float yPosition, float zPosition);
|
2015-03-04 14:52:28 +00:00
|
|
|
void setPlayerIndex(int index);
|
2015-03-06 16:44:34 +00:00
|
|
|
void forceMove(float x, float y, float z, unsigned indice);
|
2015-03-06 15:19:57 +00:00
|
|
|
void activateEndgame();
|
2015-03-14 12:00:47 +00:00
|
|
|
void setTerrain(Terrain terrain);
|
2015-03-15 17:06:24 +00:00
|
|
|
void printPosition();
|
2015-03-16 15:58:50 +00:00
|
|
|
void generateChunks(int chunkSize);
|
2015-03-17 11:08:49 +00:00
|
|
|
std::vector<std::vector<Chunk>>* getChunks();
|
2015-03-17 13:54:18 +00:00
|
|
|
void addToSpecificChunk(Object* object, int xPosition, int zPosition);
|
2015-03-21 14:05:22 +00:00
|
|
|
void enqueueObjects(Graphics* graphics);
|
2015-03-21 17:44:08 +00:00
|
|
|
void sortObjects(int textureCount);
|
2015-06-02 19:37:58 +00:00
|
|
|
std::vector<shared_ptr<Light>>* getClosestLights(unsigned int maximumAmount);
|
2015-06-02 19:14:54 +00:00
|
|
|
int checkMaxSurroundingLights();
|
2014-10-20 16:38:29 +00:00
|
|
|
private:
|
2015-05-31 22:57:36 +00:00
|
|
|
std::vector<Chunk*> getSurroundingChunks(glm::vec3 center, int chunkRenderDistance);
|
2015-02-04 16:16:06 +00:00
|
|
|
lua_State* luaState=nullptr;
|
2015-03-16 15:58:50 +00:00
|
|
|
std::vector<Object*> crossChunkObjects;
|
2015-03-21 14:05:22 +00:00
|
|
|
std::vector<std::vector<Object*>> sortedCrossChunkObjects;
|
2015-03-16 15:58:50 +00:00
|
|
|
std::vector<Object*> allObjects;
|
2015-02-04 16:16:06 +00:00
|
|
|
std::vector<Object*> physicsObjects;
|
2015-03-17 08:39:42 +00:00
|
|
|
std::vector<std::vector<Chunk>> chunks;
|
2015-05-31 19:17:46 +00:00
|
|
|
std::vector<shared_ptr<Light>> lights;
|
|
|
|
std::vector<shared_ptr<Light>> closestLights;
|
2014-12-15 13:59:03 +00:00
|
|
|
std::vector<Trigger> triggers;
|
2015-03-24 18:09:39 +00:00
|
|
|
Object* waterPlane=nullptr;
|
2014-10-30 22:54:19 +00:00
|
|
|
glm::vec3 ambientLight;
|
2015-03-08 23:39:59 +00:00
|
|
|
glm::vec4 fogColourDay;
|
|
|
|
glm::vec4 fogColourRise;
|
|
|
|
glm::vec4 fogColourNight;
|
2014-11-17 16:51:15 +00:00
|
|
|
Light directionalLight;
|
2015-03-24 18:09:39 +00:00
|
|
|
Object* cameraCenter=nullptr;
|
2015-03-04 14:52:28 +00:00
|
|
|
int playerIndex;
|
2015-03-04 20:28:46 +00:00
|
|
|
Skydome skydome;
|
2014-11-17 11:57:16 +00:00
|
|
|
Physics physics;
|
2014-11-13 16:19:56 +00:00
|
|
|
Camera camera;
|
2014-10-20 17:07:45 +00:00
|
|
|
Terrain terrain;
|
2014-11-21 23:39:58 +00:00
|
|
|
float skydomeSize;
|
2015-01-06 12:14:30 +00:00
|
|
|
float strength;
|
2015-02-13 16:14:29 +00:00
|
|
|
std::string xmlFilePath;
|
2015-03-07 12:41:35 +00:00
|
|
|
glm::vec3 nextLightPosition;
|
2015-03-17 13:54:18 +00:00
|
|
|
int chunkSize;
|
|
|
|
float farPlane;
|
2015-05-31 19:17:46 +00:00
|
|
|
bool compareLightDistances(shared_ptr<Light> a, shared_ptr<Light> b);
|
2014-10-20 16:44:23 +00:00
|
|
|
};
|
2014-10-20 16:48:20 +00:00
|
|
|
|
|
|
|
#endif
|