World


This class holds all objects such as 3D models, lights, entities, etc. and manages their rendering.
It also contains an Skybox, Terrain and Waterplane object.



Members and Functions


Members:
int size: Holds the world size, also used by the Skybox, Waterplane and Terrain.
bool water: True if the World has a waterplane.
bool sky: True if the World has a skybox.
bool terr: True if the World has a terrain.
Waterplane* waterplane: Waterplane object, manages a dynamic waterplane.
Terrain* terrain: Terrain object, manages terrain.
Skybox* skybox: Skybox object, manages the skybox.
Buoyant::byWorld* physicsworld: Buoyant's world class, holds all physics bodies and manages them.
std::list<Light*> lights: Renderlist for all lights.
std::list<Light*>::iterator l_it: Iterator for lights renderlist.
std::list<Model*> models: Renderlist for all models.
std::list<Model*>::iterator m_it: Iterator for model renderlist.


Con-/Destructor:
World(): .

~World(): .

Functions:
void SetWater(bool set): Creates or destroys the World's waterplane.
void SetTerrain(bool set): Creates or destroys the World's terrain.
void SetSkybox(bool set): Creates or destroys the World's skybox.
bool AddLight(): Adds a light entity to the World.
Model* AddModel(char* f): Adds a model entity to the World. Returns a pointer to the new object.
bool DeleteLight(int ID): Deletes the light entity with this ID.
bool DeleteModel(int ID): Deletes the model entity with this ID.
void Update(): Updates objects in the World and the Buoyant physicsworld.
void Render(): Renders all objects, water and terrain of the World.
void RenderSky(): Renders the World's Skybox.




Example of Usage (C++)


Window* screen = new Window();
Context* context = new Context(screen);
Level* level = new Level();
Camera* camera = new Camera(screen, level->world);

level->world->SetWater(true);
level->world->waterplane->SetTexture("water.png");
level->world->SetSkybox(true);
level->world->skybox->SetTexture("skybox.png");

Model* myModel = level->world->AddModel("myModel.obj");
myModel->SetPosition(Buoyant::byVec3(20.0f,0.0f,0.0f));

while(!glfwWindowShouldClose(screen->window))
{
    camera->Render();
    context->Update();
    level->world->Update();
}



Copyright 2017 Evil Turtle Productions. All Rights Reserved.