added namespace
This commit is contained in:
parent
8c789f57cb
commit
de7cbdabbd
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
struct Rect
|
||||
{
|
||||
float x, y;
|
||||
|
@ -13,3 +16,5 @@ struct BoundingBox
|
|||
};
|
||||
|
||||
typedef BoundingBox BBox;
|
||||
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
#include "Transformable.hpp"
|
||||
#include "Drawable.hpp"
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
// TODO: Find better name
|
||||
class CameraBase : public Transformable
|
||||
{
|
||||
|
@ -65,3 +68,5 @@ public:
|
|||
projection = glm::ortho(left, right, bottom, top, zNear, zFar);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -4,6 +4,9 @@
|
|||
#include "VertexArrayObject.hpp"
|
||||
#include "Shader.hpp"
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
class CameraBase;
|
||||
|
||||
enum class PrimitiveType
|
||||
|
@ -36,3 +39,5 @@ protected:
|
|||
|
||||
PrimitiveType type = PrimitiveType::Triangles;
|
||||
};
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
/**
|
||||
* Some objects should only exist once but be available to multiple objects (e.g. multiple
|
||||
* models sharing the same VAO and shaders. Any object can register objects here and other
|
||||
|
@ -69,3 +72,5 @@ class AbstractVertexArrayObject;
|
|||
|
||||
typedef ObjectManager<AbstractVertexArrayObject> VAOManager;
|
||||
typedef ObjectManager<AbstractShader> ShaderManager;
|
||||
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
class AbstractShader
|
||||
{
|
||||
friend class ShaderFactory;
|
||||
|
@ -37,3 +40,5 @@ public:
|
|||
return std::make_shared<AbstractShader>(vertexShader, fragmentShader);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
class Transformable
|
||||
{
|
||||
public:
|
||||
|
@ -31,3 +34,5 @@ protected:
|
|||
glm::vec3 position, scale;
|
||||
glm::quat orientation;
|
||||
};
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
// struct representing an OpenGL attribute pointer
|
||||
struct VertexAttribute
|
||||
{
|
||||
|
@ -56,3 +59,5 @@ public:
|
|||
return std::make_shared<AbstractVertexArrayObject>(vertices, indices, layout, usage);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
#include <lol/Drawable.hpp>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
void Drawable::Draw(const CameraBase& camera) const
|
||||
{
|
||||
shader->Use();
|
||||
|
@ -11,3 +14,5 @@ void Drawable::SetPrimitiveType(PrimitiveType type)
|
|||
{
|
||||
this->type = type;
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,9 @@
|
|||
#define IMPLEMENT_UNIFORM_FUNCTION(type, func) \
|
||||
inline
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
AbstractShader::AbstractShader(const std::string& vertexShader, const std::string& fragmentShader) :
|
||||
id(0)
|
||||
{
|
||||
|
@ -95,3 +98,5 @@ void AbstractShader::SetUniform(const std::string& name, const glm::vec4& value)
|
|||
|
||||
glUniform4fv(location, 1, glm::value_ptr(value));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
#include <lol/Transformable.hpp>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
Transformable::Transformable() :
|
||||
position(0.0f), scale(1.0f), orientation(glm::vec3(0.0, 0.0, 0.0))
|
||||
{
|
||||
|
@ -80,3 +83,5 @@ void Transformable::CalculateTransformationMatrix()
|
|||
transformation *= glm::mat4(orientation);
|
||||
transformation = glm::scale(transformation, scale);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <assert.h>
|
||||
#include <glad/glad.h>
|
||||
|
||||
namespace lol
|
||||
{
|
||||
|
||||
AbstractVertexArrayObject::~AbstractVertexArrayObject()
|
||||
{
|
||||
glDeleteBuffers(1, &ebo);
|
||||
|
@ -58,3 +61,5 @@ AbstractVertexArrayObject::AbstractVertexArrayObject(const VertexArray& vertices
|
|||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue