class hiro::draw::PrimitiveDatabase
Overview
Database of common mesh primitives. Automatically manages OpenGL resources. More…
#include <PrimitiveDatabase.h> class PrimitiveDatabase { public: // construction PrimitiveDatabase(const hiro::draw::PrimitiveDatabase&); // methods void Draw(const hiro::draw::PrimitiveName primitive) const; void Draw(const hiro::draw::GeometryName geom) const; void DrawInstanced(uint32_t count, const hiro::draw::PrimitiveName primitive) const; void DrawInstanced(uint32_t count, const hiro::draw::GeometryName geom) const; const glw::PArrayObject& Get(const hiro::draw::PrimitiveName primitive) const; const hiro::draw::Geometry& GetGeometry(const hiro::draw::GeometryName geom) const; void Free(); static hiro::draw::PrimitiveDatabase& GetSingleton(); static glw::PArrayObject GenerateUvSphere(float radius, uint32_t smoothness = 8); static glw::PArrayObject GeneratePlane(const glm::vec3& position, float sizing, geom::Axis perpandicular_to); private: // construction ~PrimitiveDatabase(); };
Detailed Documentation
Database of common mesh primitives. Automatically manages OpenGL resources.
Methods
void Draw(const hiro::draw::PrimitiveName primitive) const
Request single draw call of a specified primitive.
void Draw(const hiro::draw::GeometryName geom) const
Request single draw call of a specified geometry.
void DrawInstanced(uint32_t count, const hiro::draw::PrimitiveName primitive) const
Request instanced draw call of a specified primitive.
void DrawInstanced(uint32_t count, const hiro::draw::GeometryName geom) const
Request instanced draw call of a specified geometry.
const glw::PArrayObject& Get(const hiro::draw::PrimitiveName primitive) const
Request pointer to buffer object of primitive with specified name.
const hiro::draw::Geometry& GetGeometry(const hiro::draw::GeometryName geom) const
Request pointer to geometry object with specified name.
void Free()
Releases all allocated resources from video memory.
static glw::PArrayObject GenerateUvSphere(float radius, uint32_t smoothness = 8)
Generates sphere with defined radius. Smoothness parameter influences number of sphere segments.
static glw::PArrayObject GeneratePlane(const glm::vec3& position, float sizing, geom::Axis perpandicular_to)
Generates plane at position, with specified size, perpendicular to specified axis.