Update XGfxWorldVertexData parsing logic
This commit is contained in:
parent
ab7d2bb3b8
commit
d525f9bee3
@ -1,51 +1,30 @@
|
|||||||
#include "xgfxworldvertexdata.h"
|
#include "xgfxworldvertexdata.h"
|
||||||
|
|
||||||
XGfxWorldVertexData::XGfxWorldVertexData()
|
XGfxWorldVertexData::XGfxWorldVertexData()
|
||||||
: XAsset() {
|
: XAsset()
|
||||||
|
, mVertices()
|
||||||
|
, mWorldVertexBuffer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XGfxWorldVertexData::~XGfxWorldVertexData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void XGfxWorldVertexData::Clear()
|
||||||
|
{
|
||||||
|
mVertices.clear();
|
||||||
|
mWorldVertexBuffer.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XGfxWorldVertexData::ParseData(QDataStream *aStream) {
|
void XGfxWorldVertexData::ParseData(QDataStream *aStream) {
|
||||||
if (GetPtr() == -1) {
|
if (GetPtr() == -1) {
|
||||||
// Parse vertex count
|
|
||||||
int vertexCount;
|
|
||||||
*aStream >> vertexCount;
|
|
||||||
|
|
||||||
// Clear existing data before parsing new data
|
qint32 worldVertexPtr;
|
||||||
mVertices.clear();
|
*aStream >> worldVertexPtr;
|
||||||
|
|
||||||
// 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
|
|
||||||
qint32 bufferPtr;
|
|
||||||
*aStream >> bufferPtr;
|
|
||||||
if (bufferPtr == -1)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
mWorldVertexBuffer.ParseData(aStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user