ICT290 / src / engine / skybox.h
skybox.h
Raw
#pragma once
#include "modelManager.h"

/**
 * @class Skybox
 * @brief A small class to wrap the opengl calls and model management in a
 * single object.
 *
 * @author Chase Percy
 *
 */
class Skybox {
   public:
    Skybox() = default;
    explicit Skybox(const std::shared_ptr<Model>& skyboxModel);
    ~Skybox() = default;

    /**
     * Draws a skybox around the camera, must be drawn before anything else.
     * Internally alters the z-near and z-far of the current projection matrix
     * so that 1x1 skybox's can be drawn, and will draw up to a max size of
     * 10x10. If the skyboxModel shared pointer is a nullptr then nothing will
     * be drawn.
     */
    void draw(const glm::vec3& direction, const glm::vec3& up) const;

    /**
     * Sets the model to be drawn as the skybox. For best results it should be a
     * cube, 1x1 is large enough.
     * @param skyboxModel the skybox model to set.
     */
    void setModel(const std::shared_ptr<Model>& skyboxModel);

   private:
    std::shared_ptr<Model> m_skyboxModel{nullptr};  /// The skybox model.
};