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"
|
2014-10-20 16:38:29 +00:00
|
|
|
|
2015-02-04 16:16:06 +00:00
|
|
|
extern "C" {
|
|
|
|
#include "extern/lua/src/lua.h"
|
|
|
|
#include "extern/lua/src/lualib.h"
|
|
|
|
#include "extern/lua/src/lauxlib.h"
|
|
|
|
}
|
|
|
|
#include "extern/luabridge/LuaBridge.h"
|
|
|
|
|
2014-10-20 16:38:29 +00:00
|
|
|
class Level {
|
|
|
|
public:
|
2015-02-13 16:14:29 +00:00
|
|
|
Level(std::string heightmapFilePath, std::string xmlFilePath);
|
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-02 13:28:19 +00:00
|
|
|
void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed);
|
2014-12-15 11:41:30 +00:00
|
|
|
void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
|
|
|
glm::mat4* viewProjectionMatrix, 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();
|
2014-12-15 00:12:51 +00:00
|
|
|
std::vector<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-04 20:28:46 +00:00
|
|
|
Skydome* getSkydome();
|
2014-12-16 11:19:48 +00:00
|
|
|
std::vector<Object*>* getObjects();
|
2015-02-04 16:16:06 +00:00
|
|
|
std::vector<Object*>* getPhysicsObjects();
|
2015-01-13 12:52:22 +00:00
|
|
|
void deleteObject(int objectIndex);
|
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-02-04 16:16:06 +00:00
|
|
|
void addObject(Object* object);
|
|
|
|
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
|
|
|
Physics* getPhysics();
|
|
|
|
unsigned int getObjectsVectorSize();
|
|
|
|
unsigned int getPhysicsObjectsVectorSize();
|
|
|
|
void setCameraCenter(Object* object);
|
|
|
|
void addLight(Light light);
|
2015-03-07 12:41:35 +00:00
|
|
|
void preloadLightPosition(float xPos, float yPos, float zPos);
|
|
|
|
void addLightByParameters(float redColour, float greenColour, float blueColour, float intensity, float flameYOffset, float flameHeight, float flameWidth);
|
|
|
|
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();
|
2014-10-20 16:38:29 +00:00
|
|
|
private:
|
2015-02-04 16:16:06 +00:00
|
|
|
lua_State* luaState=nullptr;
|
2014-11-22 23:59:54 +00:00
|
|
|
std::vector<Object*> objects;
|
2015-02-04 16:16:06 +00:00
|
|
|
std::vector<Object*> physicsObjects;
|
2014-10-30 22:54:19 +00:00
|
|
|
std::vector<Light> lights;
|
2014-12-15 13:59:03 +00:00
|
|
|
std::vector<Trigger> triggers;
|
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;
|
2014-11-13 00:22:33 +00:00
|
|
|
Object* cameraCenter;
|
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;
|
2014-10-20 16:44:23 +00:00
|
|
|
};
|
2014-10-20 16:48:20 +00:00
|
|
|
|
|
|
|
#endif
|