Skip to content

Instantly share code, notes, and snippets.

@Shaptic
Created November 14, 2012 01:03
Show Gist options
  • Save Shaptic/4069531 to your computer and use it in GitHub Desktop.
Save Shaptic/4069531 to your computer and use it in GitHub Desktop.
CMeshInstance class in IronClad
// IronClad vertex buffer object wrapper.
#include "VertexBuffer.hpp"
// IronClad custom mesh loader.
#include "Mesh.hpp"
class CMeshInstance
{
public:
/**
* Loads the current instance into the GPU.
* Since this may not be the only instance of the mesh, if it has
* already been loaded into the GPU (e.g. CMesh::m_VertexBuffer
* is empty) then nothing is done.
*
* @param CVertexBuffer& The VBO to load into
*
* @return TRUE if the mesh was loaded in, FALSE if it's empty.
**/
bool LoadIntoVBO(gfx::CVertexBuffer& VBO);
/**
* Loads instance position data into an existing model-view matrix.
* @param math::matrix4x4_t& Model-view matrix to load into
**/
inline void LoadPositionMatrix(math::matrix4x4_t& MVMatrix)
{ MVMatrix[0][3] = m_Position.x; MVMatrix[1][3] = m_Position.y; }
private:
// Pointer to a loaded mesh.
CMesh* mp_ActiveMesh;
// Position of this mesh instance.
math::vector2_t m_Position;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment