aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IMeshBuffer.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-03-28 22:28:34 +1000
committerDavid Walter Seikel2016-03-28 22:28:34 +1000
commit7028cbe09c688437910a25623098762bf0fa592d (patch)
tree10b5af58277d9880380c2251f109325542c4e6eb /src/others/irrlicht-1.8.1/include/IMeshBuffer.h
parentMove lemon to the src/others directory. (diff)
downloadSledjHamr-7028cbe09c688437910a25623098762bf0fa592d.zip
SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.gz
SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.bz2
SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.xz
Move Irrlicht to src/others.
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IMeshBuffer.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IMeshBuffer.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IMeshBuffer.h b/src/others/irrlicht-1.8.1/include/IMeshBuffer.h
new file mode 100644
index 0000000..44b865b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IMeshBuffer.h
@@ -0,0 +1,154 @@
1// Copyright (C) 2002-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_MESH_BUFFER_H_INCLUDED__
6#define __I_MESH_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "SMaterial.h"
10#include "aabbox3d.h"
11#include "S3DVertex.h"
12#include "SVertexIndex.h"
13#include "EHardwareBufferFlags.h"
14#include "EPrimitiveTypes.h"
15
16namespace irr
17{
18namespace scene
19{
20 //! Struct for holding a mesh with a single material.
21 /** A part of an IMesh which has the same material on each face of that
22 group. Logical groups of an IMesh need not be put into separate mesh
23 buffers, but can be. Separately animated parts of the mesh must be put
24 into separate mesh buffers.
25 Some mesh buffer implementations have limitations on the number of
26 vertices the buffer can hold. In that case, logical grouping can help.
27 Moreover, the number of vertices should be optimized for the GPU upload,
28 which often depends on the type of gfx card. Typial figures are
29 1000-10000 vertices per buffer.
30 SMeshBuffer is a simple implementation of a MeshBuffer, which supports
31 up to 65535 vertices.
32
33 Since meshbuffers are used for drawing, and hence will be exposed
34 to the driver, chances are high that they are grab()'ed from somewhere.
35 It's therefore required to dynamically allocate meshbuffers which are
36 passed to a video driver and only drop the buffer once it's not used in
37 the current code block anymore.
38 */
39 class IMeshBuffer : public virtual IReferenceCounted
40 {
41 public:
42
43 //! Get the material of this meshbuffer
44 /** \return Material of this buffer. */
45 virtual video::SMaterial& getMaterial() = 0;
46
47 //! Get the material of this meshbuffer
48 /** \return Material of this buffer. */
49 virtual const video::SMaterial& getMaterial() const = 0;
50
51 //! Get type of vertex data which is stored in this meshbuffer.
52 /** \return Vertex type of this buffer. */
53 virtual video::E_VERTEX_TYPE getVertexType() const = 0;
54
55 //! Get access to vertex data. The data is an array of vertices.
56 /** Which vertex type is used can be determined by getVertexType().
57 \return Pointer to array of vertices. */
58 virtual const void* getVertices() const = 0;
59
60 //! Get access to vertex data. The data is an array of vertices.
61 /** Which vertex type is used can be determined by getVertexType().
62 \return Pointer to array of vertices. */
63 virtual void* getVertices() = 0;
64
65 //! Get amount of vertices in meshbuffer.
66 /** \return Number of vertices in this buffer. */
67 virtual u32 getVertexCount() const = 0;
68
69 //! Get type of index data which is stored in this meshbuffer.
70 /** \return Index type of this buffer. */
71 virtual video::E_INDEX_TYPE getIndexType() const =0;
72
73 //! Get access to Indices.
74 /** \return Pointer to indices array. */
75 virtual const u16* getIndices() const = 0;
76
77 //! Get access to Indices.
78 /** \return Pointer to indices array. */
79 virtual u16* getIndices() = 0;
80
81 //! Get amount of indices in this meshbuffer.
82 /** \return Number of indices in this buffer. */
83 virtual u32 getIndexCount() const = 0;
84
85 //! Get the axis aligned bounding box of this meshbuffer.
86 /** \return Axis aligned bounding box of this buffer. */
87 virtual const core::aabbox3df& getBoundingBox() const = 0;
88
89 //! Set axis aligned bounding box
90 /** \param box User defined axis aligned bounding box to use
91 for this buffer. */
92 virtual void setBoundingBox(const core::aabbox3df& box) = 0;
93
94 //! Recalculates the bounding box. Should be called if the mesh changed.
95 virtual void recalculateBoundingBox() = 0;
96
97 //! returns position of vertex i
98 virtual const core::vector3df& getPosition(u32 i) const = 0;
99
100 //! returns position of vertex i
101 virtual core::vector3df& getPosition(u32 i) = 0;
102
103 //! returns normal of vertex i
104 virtual const core::vector3df& getNormal(u32 i) const = 0;
105
106 //! returns normal of vertex i
107 virtual core::vector3df& getNormal(u32 i) = 0;
108
109 //! returns texture coord of vertex i
110 virtual const core::vector2df& getTCoords(u32 i) const = 0;
111
112 //! returns texture coord of vertex i
113 virtual core::vector2df& getTCoords(u32 i) = 0;
114
115 //! Append the vertices and indices to the current buffer
116 /** Only works for compatible vertex types.
117 \param vertices Pointer to a vertex array.
118 \param numVertices Number of vertices in the array.
119 \param indices Pointer to index array.
120 \param numIndices Number of indices in array. */
121 virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
122
123 //! Append the meshbuffer to the current buffer
124 /** Only works for compatible vertex types
125 \param other Buffer to append to this one. */
126 virtual void append(const IMeshBuffer* const other) = 0;
127
128 //! get the current hardware mapping hint
129 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const = 0;
130
131 //! get the current hardware mapping hint
132 virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const = 0;
133
134 //! set the hardware mapping hint, for driver
135 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) = 0;
136
137 //! flags the meshbuffer as changed, reloads hardware buffers
138 virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0;
139
140 //! Get the currently used ID for identification of changes.
141 /** This shouldn't be used for anything outside the VideoDriver. */
142 virtual u32 getChangedID_Vertex() const = 0;
143
144 //! Get the currently used ID for identification of changes.
145 /** This shouldn't be used for anything outside the VideoDriver. */
146 virtual u32 getChangedID_Index() const = 0;
147 };
148
149} // end namespace scene
150} // end namespace irr
151
152#endif
153
154