OpenGL-utility/include/object.hpp

79 lines
2 KiB
C++
Raw Permalink Normal View History

2021-01-22 00:53:05 +00:00
/*****************************************************************//**
* \file object.hpp
* \brief Representation of objects in 3D space
*
* \author Lauchmelder
* \date January 2021
*********************************************************************/
2021-01-22 00:29:50 +00:00
#ifndef OBJECT_HPP
#define OBJECT_HPP
#include <core.hpp>
2021-01-27 21:42:47 +00:00
#include <color.hpp>
2021-01-22 00:29:50 +00:00
#include <transformable.hpp>
#include <vertexArray.hpp>
namespace oglu
{
2021-01-29 16:28:48 +00:00
class Material;
2021-01-27 21:42:47 +00:00
typedef std::shared_ptr<Material> SharedMaterial;
2021-01-22 00:53:05 +00:00
/**
* @brief An object in 3D space.
*
* This class combines a 3D model with a Transformable. This class
* is designed to be imagined as a literal object in 3D space.
*/
2021-01-22 00:29:50 +00:00
class OGLU_API Object : public Transformable
{
public:
2021-01-22 00:53:05 +00:00
/**
* @brief Create a new object.
*
* No transformations are applied to this object.
*
* @param[in] vertices Array of vertex data
* @param[in] verticesSize Size of vertex array
* @param[in] indices Array of index data
* @param[in] indicesSize Size of index array
* @param[in] topology Array of VertexAttribute
* @param[in] topologySize Size of topology array
*/
2021-01-22 00:29:50 +00:00
Object(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize);
2021-01-22 00:53:05 +00:00
/**
* @brief Create a new object.
*
* No transformations are applied to this object.
*
* @param[in] vao The VAO to use for rendering
*/
Object(const VertexArray& vao);
/**
* @brief Copy another object.
*
* After copying these two objects will share the same VAO. However
* the transformation matrix is copied so that the two objects can be
* spatially independent.
*
* @param[in] other The object to copy from
*/
2021-01-22 00:29:50 +00:00
Object(const Object& other);
~Object();
2021-01-22 00:53:05 +00:00
/**
* @brief Render the object
*/
2021-01-22 00:29:50 +00:00
void Render();
2021-01-27 21:42:47 +00:00
void CopyMaterial(const Material& other);
SharedMaterial material;
2021-01-22 00:29:50 +00:00
private:
2021-01-22 00:53:05 +00:00
VertexArray VAO; ///< The VAO used for rendering
2021-01-22 00:29:50 +00:00
};
}
#endif