Ocular Engine
|
Combination of a VertexBuffer and IndexBuffer. More...
#include <Mesh.hpp>
Public Member Functions | |
virtual bool | bind () |
virtual void | unbind () |
virtual void | unload () override |
void | setVertexBuffer (VertexBuffer *buffer, uint32_t submesh=0) |
VertexBuffer * | getVertexBuffer (uint32_t submesh=0) |
void | setIndexBuffer (IndexBuffer *buffer, uint32_t submesh=0) |
IndexBuffer * | getIndexBuffer (uint32_t submesh=0) |
void | calculateMinMaxPoints () |
void | setMinMaxPoints (Math::Vector3f const &min, Math::Vector3f const &max) |
Math::Vector3f const & | getMinPoint () const |
Math::Vector3f const & | getMaxPoint () const |
SubMesh * | getSubMesh (uint32_t index) const |
uint32_t | addSubMesh (SubMesh *submesh=nullptr) |
bool | setSubMesh (SubMesh *submesh, uint32_t index) |
bool | removeSubMesh (uint32_t index) |
uint32_t | getNumSubMeshes () const |
Public Member Functions inherited from Ocular::Core::Resource | |
Resource (File const &source) | |
virtual void | forceLoad () |
File | getSourceFile () const |
void | setSourceFile (File const &file) |
void | setIsInMemory (bool inMemory) |
bool | isInMemory () const |
void | setSize (uint64_t size) |
uint64_t | getSize () const |
ResourceType | getResourceType () const |
void | setName (std::string const &name) |
std::string const & | getName () const |
std::string const & | getMappingName () const |
void | setMappingName (std::string const &name) |
ResourceMetadata * | getMetadata () const |
void | setMetadata (ResourceMetadata *metadata) |
Protected Attributes | |
Math::Vector3f | m_MinPoint |
Math::Vector3f | m_MaxPoint |
std::vector< SubMesh * > | m_SubMeshes |
Protected Attributes inherited from Ocular::Core::Resource | |
ResourceType | m_Type |
ResourceMetadata * | m_Metadata |
File | m_SourceFile |
bool | m_IsInMemory |
uint64_t | m_SizeInMemory |
std::string | m_Name |
std::string | m_MappingName |
Combination of a VertexBuffer and IndexBuffer.
uint32_t Ocular::Graphics::Mesh::addSubMesh | ( | SubMesh * | submesh = nullptr | ) |
|
virtual |
Does nothing.
See SubMesh::Bind to bind a vertex/index buffer pair.
Reimplemented in Ocular::Graphics::MeshEmpty, and Ocular::Graphics::MeshMissing.
void Ocular::Graphics::Mesh::calculateMinMaxPoints | ( | ) |
Calculates the minimum and maximum vertex spatial points within the mesh.
IndexBuffer * Ocular::Graphics::Mesh::getIndexBuffer | ( | uint32_t | submesh = 0 | ) |
[in] | submesh | The index of the submesh whose buffer should be retrieved. |
Math::Vector3f const & Ocular::Graphics::Mesh::getMaxPoint | ( | ) | const |
Returns the maximum vertex spatial point along all 3 axis. This point does not necessarily correspond with an actual vertex position.
Note that this point is cached, and is thus retrieved in constant time. It is also the local point prior to any transformations that may be performed on the parent renderer/model/etc. (translate, scale, rotate).
Math::Vector3f const & Ocular::Graphics::Mesh::getMinPoint | ( | ) | const |
Returns the minimum vertex spatial point along all 3 axis. This point does not necessarily correspond with an actual vertex position.
Note that this point is cached, and is thus retrieved in constant time. It is also the local point prior to any transformations that may be performed on the parent renderer/model/etc. (translate, scale, rotate).
uint32_t Ocular::Graphics::Mesh::getNumSubMeshes | ( | ) | const |
SubMesh * Ocular::Graphics::Mesh::getSubMesh | ( | uint32_t | index | ) | const |
VertexBuffer * Ocular::Graphics::Mesh::getVertexBuffer | ( | uint32_t | submesh = 0 | ) |
Returns a pointer to the current vertex buffer of this mesh, which can then be modified.
After modifying vertex data, one should call either calculateMinMaxPoints() or setMinMaxPoints() so that bounding volumes, etc. based off of this mesh will be accurate.
Any changes made to the buffer will not take affect until VertexBuffer::build is called and the Mesh is rebound.
[in] | submesh | The index of the submesh whose buffer should be retrieved. |
bool Ocular::Graphics::Mesh::removeSubMesh | ( | uint32_t | index | ) |
void Ocular::Graphics::Mesh::setIndexBuffer | ( | IndexBuffer * | buffer, |
uint32_t | submesh = 0 |
||
) |
Sets the IndexBuffer for this Mesh.
[in] | buffer | |
[in] | submesh | Index of the submesh that should receive the new buffer. |
void Ocular::Graphics::Mesh::setMinMaxPoints | ( | Math::Vector3f const & | min, |
Math::Vector3f const & | max | ||
) |
Sets the minimum and maximum vertex spatial points within the mesh data.
These should represent the extrema along each of the local axis, and do not necessarily correlate to an actual vertex within the mesh.
[in] | min | |
[in] | max |
bool Ocular::Graphics::Mesh::setSubMesh | ( | SubMesh * | submesh, |
uint32_t | index | ||
) |
void Ocular::Graphics::Mesh::setVertexBuffer | ( | VertexBuffer * | buffer, |
uint32_t | submesh = 0 |
||
) |
Sets the VertexBuffer for this Mesh.
After modifying vertex data, one should call either calculateMinMaxPoints() or setMinMaxPoints() so that bounding volumes, etc. based off of this mesh will be accurate.
The Mesh takes ownership of the buffer and will delete it when it is no longer in use.
[in] | buffer | |
[in] | submesh | Index of the submesh that should receive the new buffer. |
|
virtual |
Does nothing.
See SubMesh::Unind to unbind a vertex/index buffer pair.
Reimplemented in Ocular::Graphics::MeshEmpty, and Ocular::Graphics::MeshMissing.
|
overridevirtual |
Unloads this Mesh from CPU and GPU memory
Reimplemented from Ocular::Core::Resource.
Reimplemented in Ocular::Graphics::MeshEmpty, and Ocular::Graphics::MeshMissing.