XPlor/libs/xassets/xsunlightparseparams.cpp

66 lines
1.5 KiB
C++
Raw Normal View History

2025-08-17 13:14:17 -04:00
#include "xsunlightparseparams.h"
2025-09-05 18:35:17 -04:00
#include "xstring.h"
2025-08-17 13:14:17 -04:00
XSunLightParseParams::XSunLightParseParams()
2025-09-05 18:35:17 -04:00
: XAsset()
, mName("")
, mAmbientScale(1.0f)
, mAmbientColor()
, mDiffuseFraction(0.0f)
, mSunLight(0.0f)
, mSunColor()
, mDiffuseColor()
, mDiffuseColorHasBeenSet(false)
, mAngles()
{
2025-09-10 21:58:26 -04:00
SetName("Sunlight Parse Parameters");
2025-08-17 13:14:17 -04:00
}
2025-09-05 18:35:17 -04:00
XSunLightParseParams::~XSunLightParseParams()
{
2025-08-17 13:14:17 -04:00
}
2025-09-10 21:58:26 -04:00
void XSunLightParseParams::ParseData(XDataStream *aStream) {
2025-09-05 18:35:17 -04:00
if (GetPtr() == -1) {
mName = XString::ParseCustom(aStream);
quint32 ambientR, ambientG, ambientB,
sunR, sunG, sunB,
diffuseR, diffuseG, diffuseB;
*aStream
>> mAmbientScale
>> ambientR
>> ambientG
>> ambientB
>> mDiffuseFraction
>> mSunLight
>> sunR
>> sunG
>> sunB
>> diffuseR
>> diffuseG
>> diffuseB
>> mDiffuseColorHasBeenSet
>> mAngles[0]
>> mAngles[1]
>> mAngles[2];
mAmbientColor = QColor(ambientR, ambientG, ambientB);
mSunColor = QColor(sunR, sunG, sunB);
mDiffuseColor = QColor(diffuseR, diffuseG, diffuseB);
2025-08-17 13:14:17 -04:00
}
}
2025-09-05 18:35:17 -04:00
void XSunLightParseParams::Clear()
{
mName.clear();
mAmbientScale = 1.0f;
mAmbientColor = QColor();
mDiffuseFraction = 0.0f;
mSunLight = 0.0f;
mSunColor = QColor();
mDiffuseColor = QColor();
mDiffuseColorHasBeenSet = false;
mAngles = QVector3D();
2025-08-17 13:14:17 -04:00
}