1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
matabstrix/src/scene.hpp

49 lines
813 B
C++

#ifndef _SCENE_HPP_
#define _SCENE_HPP_
#include "objects/object.hpp"
#include "lights/sun.hpp"
#include <vector>
#include <glm/glm.hpp>
struct Scene
{
inline Scene &operator<<(const Object *object);
inline Scene &operator<<(const Lights::Sun *sun);
inline const Lights::Sun *sun() const;
inline void draw(const glm::mat4 &mvp) const;
private:
std::vector<const Object*> _objects;
const Lights::Sun *_sun = nullptr;
};
Scene &Scene::operator<<(const Object *object)
{
_objects.push_back(object);
return *this;
}
Scene &Scene::operator<<(const Lights::Sun *sun)
{
_sun = sun;
return *this;
}
const Lights::Sun *Scene::sun() const
{
return _sun;
};
void Scene::draw(const glm::mat4 &mvp) const
{
for (auto object : _objects)
object->draw(*this, mvp);
}
#endif // _SCENE_HPP_