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