20 #ifndef _STELQGLINDEXBUFFER_HPP_
21 #define _STELQGLINDEXBUFFER_HPP_
26 #include "StelIndexBuffer.hpp"
51 Q_ASSERT_X(
locked(), Q_FUNC_INFO,
52 "Trying to access raw data of an unlocked index buffer");
53 if(
indexType_ == IndexType_U16) {
return indices16.constData();}
54 else if(
indexType_ == IndexType_U32) {
return indices32.constData();}
55 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");
70 const int previousIndexCount =
length();
71 maxIndex_ = std::max(index, maxIndex_);
72 if(previousIndexCount < indexCapacity())
79 if(
indexType_ == IndexType_U16) {indices16[previousIndexCount] = index;}
80 else if(
indexType_ == IndexType_U32) {indices32[previousIndexCount] = index;}
81 else{Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");}
84 if(
indexType_ == IndexType_U16) {indices16.append(index);}
85 else if(
indexType_ == IndexType_U32) {indices32.append(index);}
86 else{Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");}
91 if(
indexType_ == IndexType_U16) {
return indices16[which];}
92 else if(
indexType_ == IndexType_U32) {
return indices32[which];}
93 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");
98 virtual void setIndex_(
const int which,
const uint index)
100 if(
indexType_ == IndexType_U16) {indices16[which] = index;}
101 else if(
indexType_ == IndexType_U32) {indices32[which] = index;}
102 else{Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");}
117 QVector<uint> indices32;
120 QVector<ushort> indices16;
132 int indexCapacity()
const
134 if(
indexType_ == IndexType_U16) {
return indices16.size();}
135 else if(
indexType_ == IndexType_U32) {
return indices32.size();}
136 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Unknown index type");
142 #endif // _STELQGLINDEXBUFFER_HPP_