API Documentation
Mesh.h
1 // Mesh.h
3 //
5 
6 namespace nkGraphics
7 {
13  class Mesh : public Resource, public nkExport::Exportable
14  {
15  public :
16 
20  virtual ~Mesh () ;
21 
22  // Getters
26  const BoundingBox& getBounds () const ;
43  unsigned int getVertexBufferStride (unsigned int index) const ;
47  unsigned int getVertexBufferCount () const ;
62  const MeshInputLayout& getInputLayout () const ;
66  unsigned int getId () const ;
70  unsigned int getVertexCount () const ;
74  unsigned int getIndexCount () const ;
86  bool getAutoComputeBounds () const ;
87 
88  // Setters
94  void setBounds (const BoundingBox& value) ;
105  void addVertexBuffer (nkMemory::BufferView<unsigned char> view, unsigned int stride = 0) ;
116  void addVertexBufferCopy (nkMemory::BufferView<unsigned char> view, unsigned int stride = 0) ;
127  void addVertexBufferForward (nkMemory::Buffer&& buffer, unsigned int stride = 0) ;
133  void removeVertexBuffer(unsigned int index) ;
169  void setInputLayout (const MeshInputLayout& layout) ;
175  void setId (unsigned int value) ;
181  void setVertexCount (int value) ;
187  void setIndexCount (int value) ;
205  void setAutoComputeBounds (bool value) ;
206 
207  // Init
213  void computeBounds (nkMemory::StringView positionAttributeName) ;
214 
215  // Loading
216  virtual bool load () override ;
217 
218  // Memory freeing
223  virtual void freeShadowBuffers () ;
224 
225  // Import / Export
226  virtual void exportClassToTree (nkExport::Node* rootNode) override ;
227  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
228 
229  public :
230 
231  // Statics
239  static nkMemory::UniquePtr<Mesh> create (System* system = nullptr) ;
240  } ;
241 }
nkGraphics::Mesh::addVertexBufferCopy
void addVertexBufferCopy(nkMemory::BufferView< unsigned char > view, unsigned int stride=0)
nkGraphics::Mesh::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkGraphics::Mesh::~Mesh
virtual ~Mesh()
nkGraphics::Mesh::setInputLayout
void setInputLayout(const MeshInputLayout &layout)
nkGraphics::Mesh::setBounds
void setBounds(const BoundingBox &value)
nkGraphics::Mesh::getBounds
const BoundingBox & getBounds() const
nkGraphics::Mesh::addVertexBuffer
void addVertexBuffer(nkMemory::BufferView< unsigned char > view, unsigned int stride=0)
nkGraphics::INDEX_FORMAT
INDEX_FORMAT
Enumerates all formats supported for indices in a mesh.
Definition: IndexFormat.h:12
nkGraphics::Mesh::getVertexBufferStride
unsigned int getVertexBufferStride(unsigned int index) const
nkExport::Exportable
An interface to define objects that can be exported using this component.
Definition: Exportable.h:15
nkGraphics::Mesh::setId
void setId(unsigned int value)
nkGraphics::Mesh::setIndexBufferCopy
void setIndexBufferCopy(nkMemory::BufferView< unsigned char > view)
nkMemory::BufferView< unsigned char >
nkGraphics::Mesh::load
virtual bool load() override
nkGraphics::BoundingBox
A bounding box. Often used to encompass object's bounds in the world.
Definition: BoundingBox.h:14
nkGraphics::Mesh::setAutoComputeBounds
void setAutoComputeBounds(bool value)
nkGraphics::MeshInputLayout
Describes the layout of data inside a mesh.
Definition: MeshInputLayout.h:12
nkGraphics::Mesh::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkGraphics::Mesh::setIndexBufferForward
void setIndexBufferForward(nkMemory::Buffer &&buffer)
nkGraphics::Mesh::setIndexFormat
void setIndexFormat(INDEX_FORMAT value)
nkGraphics::Mesh::getIndexBuffer
nkMemory::BufferView< unsigned char > getIndexBuffer() const
nkGraphics::Mesh::getVertexBuffer
nkMemory::BufferView< unsigned char > getVertexBuffer(unsigned int index) const
nkGraphics::Mesh::getInputLayout
const MeshInputLayout & getInputLayout() const
nkGraphics::Mesh::getIndexCount
unsigned int getIndexCount() const
nkGraphics::Mesh::setIndexBuffer
void setIndexBuffer(nkMemory::BufferView< unsigned char > view)
nkGraphics::PRIMITIVE_TOPOLOGY
PRIMITIVE_TOPOLOGY
Enumerates all primitive topologies supported for meshes.
Definition: PrimitiveTopology.h:14
nkGraphics::Mesh::getId
unsigned int getId() const
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkGraphics::Mesh::setTopology
void setTopology(PRIMITIVE_TOPOLOGY value)
nkGraphics::Mesh::removeVertexBuffer
void removeVertexBuffer(unsigned int index)
nkGraphics::Mesh::getVertexCount
unsigned int getVertexCount() const
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Mesh::getVertexBufferCount
unsigned int getVertexBufferCount() const
nkGraphics::Mesh::getTopology
PRIMITIVE_TOPOLOGY getTopology() const
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkGraphics::Mesh::create
static nkMemory::UniquePtr< Mesh > create(System *system=nullptr)
nkGraphics::Mesh::setVertexCount
void setVertexCount(int value)
nkGraphics::Resource
Base class for a resource in the component.
Definition: Resource.h:12
nkGraphics::Mesh::setIndexCount
void setIndexCount(int value)
nkGraphics::Mesh::computeBounds
void computeBounds(nkMemory::StringView positionAttributeName)
nkGraphics::Mesh::getAutoComputeBounds
bool getAutoComputeBounds() const
nkGraphics::Mesh::addVertexBufferForward
void addVertexBufferForward(nkMemory::Buffer &&buffer, unsigned int stride=0)
nkGraphics::Mesh::getIndexFormat
INDEX_FORMAT getIndexFormat() const
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::Mesh
Holds information about a mesh. Used as a basis to render 3d models.
Definition: Mesh.h:14
nkGraphics::Mesh::freeShadowBuffers
virtual void freeShadowBuffers()