arsa  2.7
IDynamicMeshBuffer.h
Go to the documentation of this file.
1 // Copyright (C) 2008-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
6 #define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
7 
8 #include "IMeshBuffer.h"
9 #include "IVertexBuffer.h"
10 #include "IIndexBuffer.h"
11 
12 namespace irr
13 {
14 namespace scene
15 {
16 
19  {
20  public:
21  virtual IVertexBuffer &getVertexBuffer() const =0;
22  virtual IIndexBuffer &getIndexBuffer() const =0;
23 
24  virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0;
25  virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0;
26 
28 
29  virtual video::SMaterial& getMaterial() =0;
30 
32 
33  virtual const video::SMaterial& getMaterial() const =0;
34 
36 
37  virtual const core::aabbox3df& getBoundingBox() const =0;
38 
40 
42  virtual void setBoundingBox(const core::aabbox3df& box) =0;
43 
45  virtual void recalculateBoundingBox() =0;
46 
48 
53  virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) _IRR_OVERRIDE_
54  {
55 
56  }
57 
59 
61  virtual void append(const IMeshBuffer* const other) _IRR_OVERRIDE_
62  {
63 
64  }
65 
66  // ------------------- To be removed? ------------------- //
67 
70  {
72  }
73 
76  {
78  }
79 
82  {
83  if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
84  getVertexBuffer().setHardwareMappingHint(NewMappingHint);
85  if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
86  getIndexBuffer().setHardwareMappingHint(NewMappingHint);
87  }
88 
91  {
92  if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
94  if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
96  }
97 
99  {
100  return getVertexBuffer().getChangedID();
101  }
102 
104  {
105  return getIndexBuffer().getChangedID();
106  }
107 
108  // ------------------- Old interface ------------------- //
109 
111 
113  {
114  return getVertexBuffer().getType();
115  }
116 
118 
120  virtual const void* getVertices() const _IRR_OVERRIDE_
121  {
122  return getVertexBuffer().getData();
123  }
124 
126 
128  virtual void* getVertices() _IRR_OVERRIDE_
129  {
130  return getVertexBuffer().getData();
131  }
132 
134 
136  {
137  return getVertexBuffer().size();
138  }
139 
141 
143  {
144  return getIndexBuffer().getType();
145  }
146 
148 
150  {
151  return (u16*)getIndexBuffer().getData();
152  }
153 
155 
157  {
158  return (u16*)getIndexBuffer().getData();
159  }
160 
162 
164  {
165  return getIndexBuffer().size();
166  }
167 
170  {
171  return getVertexBuffer()[i].Pos;
172  }
173 
176  {
177  return getVertexBuffer()[i].Pos;
178  }
179 
182  {
183  return getVertexBuffer()[i].TCoords;
184  }
185 
188  {
189  return getVertexBuffer()[i].TCoords;
190  }
191 
193  virtual const core::vector3df& getNormal(u32 i) const _IRR_OVERRIDE_
194  {
195  return getVertexBuffer()[i].Normal;
196  }
197 
200  {
201  return getVertexBuffer()[i].Normal;
202  }
203  };
204 
205 
206 } // end namespace scene
207 } // end namespace irr
208 
209 #endif
210 
211 
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const _IRR_OVERRIDE_
get the current hardware mapping hint
Change the vertex mapping.
virtual void append(const IMeshBuffer *const other) _IRR_OVERRIDE_
Append the meshbuffer to the current buffer.
virtual const core::vector3df & getPosition(u32 i) const _IRR_OVERRIDE_
returns position of vertex i
virtual IIndexBuffer & getIndexBuffer() const =0
virtual u32 size() const =0
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
virtual const core::aabbox3df & getBoundingBox() const =0
Get the axis aligned bounding box of this meshbuffer.
virtual u32 getChangedID() const =0
Get the currently used ID for identification of changes.
virtual void append(const void *const vertices, u32 numVertices, const u16 *const indices, u32 numIndices) _IRR_OVERRIDE_
Append the vertices and indices to the current buffer.
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
virtual void * getVertices() _IRR_OVERRIDE_
Get access to vertex data. The data is an array of vertices.
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: SDL_opengl.h:1571
virtual const u16 * getIndices() const _IRR_OVERRIDE_
Get access to indices.
virtual u32 getChangedID_Vertex() const _IRR_OVERRIDE_
Get the currently used ID for identification of changes.
virtual const core::vector2df & getTCoords(u32 i) const _IRR_OVERRIDE_
returns texture coords of vertex i
virtual video::E_VERTEX_TYPE getVertexType() const _IRR_OVERRIDE_
Get type of vertex data which is stored in this meshbuffer.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual core::vector3df & getNormal(u32 i) _IRR_OVERRIDE_
returns normal of vertex i
virtual u32 size() const =0
virtual void setIndexBuffer(IIndexBuffer *indexBuffer)=0
virtual core::vector2df & getTCoords(u32 i) _IRR_OVERRIDE_
returns texture coords of vertex i
unsigned short u16
16 bit unsigned variable.
Definition: irrTypes.h:44
virtual void setDirty()=0
flags the meshbuffer as changed, reloads hardware buffers
virtual const core::vector3df & getNormal(u32 i) const _IRR_OVERRIDE_
returns normal of vertex i
virtual u32 getChangedID() const =0
Get the currently used ID for identification of changes.
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
flags the mesh as changed, reloads hardware buffers
virtual video::E_INDEX_TYPE getType() const =0
virtual video::SMaterial & getMaterial()=0
Get the material of this meshbuffer.
virtual void * getData()=0
Struct for holding a mesh with a single material.
Definition: IMeshBuffer.h:39
virtual u32 getIndexCount() const _IRR_OVERRIDE_
Get amount of indices in this meshbuffer.
virtual void recalculateBoundingBox()=0
Recalculates the bounding box. Should be called if the mesh changed.
virtual u16 * getIndices() _IRR_OVERRIDE_
Get access to indices.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
virtual video::E_VERTEX_TYPE getType() const =0
Change both vertex and index mapping to the same value.
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
virtual core::vector3df & getPosition(u32 i) _IRR_OVERRIDE_
returns position of vertex i
Change the index mapping.
virtual void setBoundingBox(const core::aabbox3df &box)=0
Set axis aligned bounding box.
#define _IRR_OVERRIDE_
Defines an override macro, to protect virtual functions from typos and other mismatches.
Definition: irrTypes.h:216
virtual u32 getChangedID_Index() const _IRR_OVERRIDE_
Get the currently used ID for identification of changes.
virtual u32 getVertexCount() const _IRR_OVERRIDE_
Get amount of vertices in meshbuffer.
virtual void * getData()=0
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const _IRR_OVERRIDE_
get the current hardware mapping hint
virtual IVertexBuffer & getVertexBuffer() const =0
E_VERTEX_TYPE
Enumeration for all vertex types there are.
Definition: S3DVertex.h:18
virtual video::E_INDEX_TYPE getIndexType() const _IRR_OVERRIDE_
Get type of index data which is stored in this meshbuffer.
#define const
Definition: zconf.h:217
virtual const void * getVertices() const _IRR_OVERRIDE_
Get access to vertex data. The data is an array of vertices.
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
virtual void setDirty()=0
flags the meshbuffer as changed, reloads hardware buffers
Struct for holding parameters for a material renderer.
Definition: SMaterial.h:304
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
set the hardware mapping hint, for driver
virtual void setVertexBuffer(IVertexBuffer *vertexBuffer)=0