54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#include "xgfxworldvertexdata.h"
|
||
|
|
|
||
|
|
XGfxWorldVertexData::XGfxWorldVertexData()
|
||
|
|
: XAsset() {
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxWorldVertexData::ParseData(QDataStream *aStream) {
|
||
|
|
if (GetPtr() == -1) {
|
||
|
|
// Parse vertex count
|
||
|
|
int vertexCount;
|
||
|
|
aStream->read((char*)&vertexCount, sizeof(int));
|
||
|
|
|
||
|
|
// Clear existing data before parsing new data
|
||
|
|
mVertices.clear();
|
||
|
|
|
||
|
|
// Parse vertices
|
||
|
|
for (int i = 0; i < vertexCount; ++i) {
|
||
|
|
XGfxWorldVertex vertex;
|
||
|
|
vertex.ParseData(aStream);
|
||
|
|
mVertices.append(vertex);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Skip D3DVertexBuffer pointer - we'll handle this appropriately later
|
||
|
|
aStream->ignore(sizeof(int));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
QVector<XGfxWorldVertex>& XGfxWorldVertexData::GetVertices() {
|
||
|
|
return mVertices;
|
||
|
|
}
|
||
|
|
|
||
|
|
const QVector<XGfxWorldVertex>& XGfxWorldVertexData::GetVertices() const {
|
||
|
|
return mVertices;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxWorldVertexData::SetVertices(const QVector<XGfxWorldVertex>& vertices) {
|
||
|
|
mVertices = vertices;
|
||
|
|
}
|
||
|
|
|
||
|
|
int XGfxWorldVertexData::GetVertexBufferPtr() const {
|
||
|
|
return mVertexBufferPtr;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxWorldVertexData::SetVertexBufferPtr(int ptr) {
|
||
|
|
mVertexBufferPtr = ptr;
|
||
|
|
}
|
||
|
|
|