118 lines
2.5 KiB
C++
118 lines
2.5 KiB
C++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "xgfxworld.h"
|
|
|
|
XGfxWorld::XGfxWorld()
|
|
: XAsset() {
|
|
}
|
|
|
|
void XGfxWorld::ParseData(QDataStream *aStream) {
|
|
if (GetPtr() == -1) {
|
|
aStream->read(mName, 64 * sizeof(char));
|
|
|
|
// Parse streaming info
|
|
mStreamingInfo.ParseData(aStream);
|
|
|
|
// Parse vertex data
|
|
mVertexData.ParseData(aStream);
|
|
|
|
// Parse sun light params
|
|
mSunLightParams.ParseData(aStream);
|
|
|
|
// Parse lights count and array
|
|
int lightCount;
|
|
aStream->read((char*)&lightCount, sizeof(int));
|
|
for (int i = 0; i < lightCount; ++i) {
|
|
XGfxLight light;
|
|
light.ParseData(aStream);
|
|
mLights.append(light);
|
|
}
|
|
|
|
// Parse reflection probes count and array
|
|
int probeCount;
|
|
aStream->read((char*)&probeCount, sizeof(int));
|
|
for (int i = 0; i < probeCount; ++i) {
|
|
XGfxReflectionProbe probe;
|
|
probe.ParseData(aStream);
|
|
mReflectionProbes.append(probe);
|
|
}
|
|
}
|
|
}
|
|
|
|
const char* XGfxWorld::GetName() const {
|
|
return mName;
|
|
}
|
|
|
|
void XGfxWorld::SetName(const char* name) {
|
|
strncpy(mName, name, 64);
|
|
}
|
|
|
|
XGfxWorldStreamInfo& XGfxWorld::GetStreamingInfo() {
|
|
return mStreamingInfo;
|
|
}
|
|
|
|
const XGfxWorldStreamInfo& XGfxWorld::GetStreamingInfo() const {
|
|
return mStreamingInfo;
|
|
}
|
|
|
|
void XGfxWorld::SetStreamingInfo(const XGfxWorldStreamInfo& info) {
|
|
mStreamingInfo = info;
|
|
}
|
|
|
|
XGfxWorldVertexData& XGfxWorld::GetVertexData() {
|
|
return mVertexData;
|
|
}
|
|
|
|
const XGfxWorldVertexData& XGfxWorld::GetVertexData() const {
|
|
return mVertexData;
|
|
}
|
|
|
|
void XGfxWorld::SetVertexData(const XGfxWorldVertexData& data) {
|
|
mVertexData = data;
|
|
}
|
|
|
|
XSunLightParseParams& XGfxWorld::GetSunLightParams() {
|
|
return mSunLightParams;
|
|
}
|
|
|
|
const XSunLightParseParams& XGfxWorld::GetSunLightParams() const {
|
|
return mSunLightParams;
|
|
}
|
|
|
|
void XGfxWorld::SetSunLightParams(const XSunLightParseParams& params) {
|
|
mSunLightParams = params;
|
|
}
|
|
|
|
QVector<XGfxLight>& XGfxWorld::GetLights() {
|
|
return mLights;
|
|
}
|
|
|
|
const QVector<XGfxLight>& XGfxWorld::GetLights() const {
|
|
return mLights;
|
|
}
|
|
|
|
void XGfxWorld::SetLights(const QVector<XGfxLight>& lights) {
|
|
mLights = lights;
|
|
}
|
|
|
|
QVector<XGfxReflectionProbe>& XGfxWorld::GetReflectionProbes() {
|
|
return mReflectionProbes;
|
|
}
|
|
|
|
const QVector<XGfxReflectionProbe>& XGfxWorld::GetReflectionProbes() const {
|
|
return mReflectionProbes;
|
|
}
|
|
|
|
void XGfxWorld::SetReflectionProbes(const QVector<XGfxReflectionProbe>& probes) {
|
|
mReflectionProbes = probes;
|
|
}
|
|
|
|
|
|
|
|
|