Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IDynamicMeshBuffer.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_DYNAMIC_MESH_BUFFER_HPP_INCLUDED
6#define NIRT_I_DYNAMIC_MESH_BUFFER_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IMeshBuffer.hpp>
9#include <nirtcpp/core/engine/IVertexBuffer.hpp>
10#include <nirtcpp/core/engine/IIndexBuffer.hpp>
11
12namespace nirt
13{
14namespace 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
27
28 // ------------------- Old interface ------------------- //
29 // That stuff could also be in CDynamicMeshBuffer
30 // I suppose it was put here to show that the information
31 // is now basically handled by the vertex/index buffers instead
32 // of the meshbuffer itself.
33
34
37 {
38 return getVertexBuffer().getHardwareMappingHint();
39 }
40
43 {
44 return getIndexBuffer().getHardwareMappingHint();
45 }
46
48 virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX ) override
49 {
50 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
51 getVertexBuffer().setHardwareMappingHint(NewMappingHint);
52 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
53 getIndexBuffer().setHardwareMappingHint(NewMappingHint);
54 }
55
57 virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override
58 {
59 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
60 getVertexBuffer().setDirty();
61 if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
62 getIndexBuffer().setDirty();
63 }
64
65 virtual u32 getChangedID_Vertex() const override
66 {
67 return getVertexBuffer().getChangedID();
68 }
69
70 virtual u32 getChangedID_Index() const override
71 {
72 return getIndexBuffer().getChangedID();
73 }
74
75
77
78 virtual video::E_VERTEX_TYPE getVertexType() const override
79 {
80 return getVertexBuffer().getType();
81 }
82
84
86 virtual const void* getVertices() const override
87 {
88 return getVertexBuffer().getData();
89 }
90
92
94 virtual void* getVertices() override
95 {
96 return getVertexBuffer().getData();
97 }
98
100
101 virtual u32 getVertexCount() const override
102 {
103 return getVertexBuffer().size();
104 }
105
107
108 virtual video::E_INDEX_TYPE getIndexType() const override
109 {
110 return getIndexBuffer().getType();
111 }
112
114
115 virtual const u16* getIndices() const override
116 {
117 return (u16*)getIndexBuffer().getData();
118 }
119
121
122 virtual u16* getIndices() override
123 {
124 return (u16*)getIndexBuffer().getData();
125 }
126
128
129 virtual u32 getIndexCount() const override
130 {
131 return getIndexBuffer().size();
132 }
133
135 virtual const core::vector3df& getPosition(u32 i) const override
136 {
137 return getVertexBuffer()[i].Pos;
138 }
139
141 virtual core::vector3df& getPosition(u32 i) override
142 {
143 return getVertexBuffer()[i].Pos;
144 }
145
147 virtual const core::vector2df& getTCoords(u32 i) const override
148 {
149 return getVertexBuffer()[i].TCoords;
150 }
151
153 virtual core::vector2df& getTCoords(u32 i) override
154 {
155 return getVertexBuffer()[i].TCoords;
156 }
157
159 virtual const core::vector3df& getNormal(u32 i) const override
160 {
161 return getVertexBuffer()[i].Normal;
162 }
163
165 virtual core::vector3df& getNormal(u32 i) override
166 {
167 return getVertexBuffer()[i].Normal;
168 }
169
171 virtual video::SColor& getColor(u32 i) override
172 {
173 return getVertexBuffer()[i].Color;
174 }
175
177 virtual const video::SColor& getColor(u32 i) const override
178 {
179 return getVertexBuffer()[i].Color;
180 }
181 };
182
183
184} // end namespace scene
185} // end namespace nirt
186
187#endif
Definition IDynamicMeshBuffer.hpp:19
virtual const core::vector2df & getTCoords(u32 i) const override
returns texture coords of vertex i
Definition IDynamicMeshBuffer.hpp:147
virtual core::vector2df & getTCoords(u32 i) override
returns texture coords of vertex i
Definition IDynamicMeshBuffer.hpp:153
virtual u16 * getIndices() override
Get access to indices.
Definition IDynamicMeshBuffer.hpp:122
virtual core::vector3df & getNormal(u32 i) override
returns normal of vertex i
Definition IDynamicMeshBuffer.hpp:165
virtual video::E_INDEX_TYPE getIndexType() const override
Get type of index data which is stored in this meshbuffer.
Definition IDynamicMeshBuffer.hpp:108
virtual u32 getVertexCount() const override
Get amount of vertices in meshbuffer.
Definition IDynamicMeshBuffer.hpp:101
virtual const void * getVertices() const override
Get access to vertex data. The data is an array of vertices.
Definition IDynamicMeshBuffer.hpp:86
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
get the current hardware mapping hint
Definition IDynamicMeshBuffer.hpp:36
virtual u32 getChangedID_Vertex() const override
Get the currently used ID for identification of changes.
Definition IDynamicMeshBuffer.hpp:65
virtual const core::vector3df & getNormal(u32 i) const override
returns normal of vertex i
Definition IDynamicMeshBuffer.hpp:159
virtual video::E_VERTEX_TYPE getVertexType() const override
Get type of vertex data which is stored in this meshbuffer.
Definition IDynamicMeshBuffer.hpp:78
virtual u32 getChangedID_Index() const override
Get the currently used ID for identification of changes.
Definition IDynamicMeshBuffer.hpp:70
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const override
get the current hardware mapping hint
Definition IDynamicMeshBuffer.hpp:42
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override
flags the mesh as changed, reloads hardware buffers
Definition IDynamicMeshBuffer.hpp:57
virtual video::SColor & getColor(u32 i) override
returns color of vertex i
Definition IDynamicMeshBuffer.hpp:171
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override
set the hardware mapping hint, for driver
Definition IDynamicMeshBuffer.hpp:48
virtual u32 getIndexCount() const override
Get amount of indices in this meshbuffer.
Definition IDynamicMeshBuffer.hpp:129
virtual const core::vector3df & getPosition(u32 i) const override
returns position of vertex i
Definition IDynamicMeshBuffer.hpp:135
virtual const u16 * getIndices() const override
Get access to indices.
Definition IDynamicMeshBuffer.hpp:115
virtual core::vector3df & getPosition(u32 i) override
returns position of vertex i
Definition IDynamicMeshBuffer.hpp:141
virtual void * getVertices() override
Get access to vertex data. The data is an array of vertices.
Definition IDynamicMeshBuffer.hpp:94
virtual const video::SColor & getColor(u32 i) const override
returns color of vertex i
Definition IDynamicMeshBuffer.hpp:177
Definition IIndexBuffer.hpp:20
virtual void * getData()=0
Pointer to first element.
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
virtual void setDirty()=0
flags the meshbuffer as changed, reloads hardware buffers
virtual u32 getChangedID() const =0
Get the currently used ID for identification of changes.
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
virtual u32 size() const =0
Number of elements.
Class for holding a mesh with a single material.
Definition IMeshBuffer.hpp:41
Definition IVertexBuffer.hpp:19
virtual void setDirty()=0
flags the meshbuffer as changed, reloads hardware buffers
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0
get the current hardware mapping hint
virtual u32 getChangedID() const =0
Get the currently used ID for identification of changes.
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint)=0
set the hardware mapping hint, for driver
virtual u32 size() const =0
Number of elements.
virtual void * getData()=0
Pointer to first element of vertex data.
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
E_BUFFER_TYPE
Definition EHardwareBufferFlags.hpp:29
@ EBT_VERTEX_AND_INDEX
Change both vertex and index mapping to the same value.
Definition EHardwareBufferFlags.hpp:37
@ EBT_INDEX
Change the index mapping.
Definition EHardwareBufferFlags.hpp:35
@ EBT_VERTEX
Change the vertex mapping.
Definition EHardwareBufferFlags.hpp:33
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.hpp:14
E_VERTEX_TYPE
Enumeration for all vertex types there are.
Definition S3DVertex.hpp:19
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.hpp:46
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print