Camera


This is the main camera class, it sets up a viewport with correct perspective and renders the world to the window. When initializing this class it needs an initialized Window and World class. This class inherits members and methods from the Object class.



Members and Functions


Members:
Window* window; pointer to an object of the Window class the camera needs to render to.
World* world; pointer to an object of the World class, which the camera needs to render.

Con-/Destructor:
Camera(Window* w, World* wld); This constructor takes a Window and World object for the internal pointers, sets the position to zero and initializes the viewport/perspective.

~Camera(); Empty.

Functions:
void SetWindow(Window* w): Sets the Window object to render to.
void SetWorld(World* wld): Sets the World object that needs rendering.
Window* GetWindow(): Get the current Window.
World* GetWorld(): Get the current World.
void Render(): Renders the World as viewed by this Camera to the Window.




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");

camera->SetPosition(Buoyant::byVec3(0.0f,-2.0f,-2.f));

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



Copyright 2017 Evil Turtle Productions. All Rights Reserved.