107 lines
2.6 KiB
C++
107 lines
2.6 KiB
C++
|
|
|
|
|
|
|
|
|
|
|
|
#include "xsunlightparseparams.h"
|
|
|
|
XSunLightParseParams::XSunLightParseParams()
|
|
: XAsset() {
|
|
}
|
|
|
|
void XSunLightParseParams::ParseData(QDataStream *aStream) {
|
|
if (GetPtr() == -1) {
|
|
aStream->read(mName, 64 * sizeof(char));
|
|
aStream->read((char*)&mAmbientScale, sizeof(float));
|
|
aStream->read((char*)mAmbientColor, 3 * sizeof(float));
|
|
aStream->read((char*)&mDiffuseFraction, sizeof(float));
|
|
aStream->read((char*)&mSunLight, sizeof(float));
|
|
aStream->read((char*)mSunColor, 3 * sizeof(float));
|
|
aStream->read((char*)mDiffuseColor, 3 * sizeof(float));
|
|
aStream->read((char*)&mDiffuseColorHasBeenSet, sizeof(bool));
|
|
aStream->read((char*)mAngles, 3 * sizeof(float));
|
|
}
|
|
}
|
|
|
|
const char* XSunLightParseParams::GetName() const {
|
|
return mName;
|
|
}
|
|
|
|
void XSunLightParseParams::SetName(const char* name) {
|
|
strncpy(mName, name, 64);
|
|
}
|
|
|
|
float XSunLightParseParams::GetAmbientScale() const {
|
|
return mAmbientScale;
|
|
}
|
|
|
|
void XSunLightParseParams::SetAmbientScale(float scale) {
|
|
mAmbientScale = scale;
|
|
}
|
|
|
|
const float* XSunLightParseParams::GetAmbientColor() const {
|
|
return mAmbientColor;
|
|
}
|
|
|
|
void XSunLightParseParams::SetAmbientColor(const float* color, size_t count) {
|
|
if (count <= 3) {
|
|
memcpy(mAmbientColor, color, count * sizeof(float));
|
|
}
|
|
}
|
|
|
|
float XSunLightParseParams::GetDiffuseFraction() const {
|
|
return mDiffuseFraction;
|
|
}
|
|
|
|
void XSunLightParseParams::SetDiffuseFraction(float fraction) {
|
|
mDiffuseFraction = fraction;
|
|
}
|
|
|
|
float XSunLightParseParams::GetSunLight() const {
|
|
return mSunLight;
|
|
}
|
|
|
|
void XSunLightParseParams::SetSunLight(float light) {
|
|
mSunLight = light;
|
|
}
|
|
|
|
const float* XSunLightParseParams::GetSunColor() const {
|
|
return mSunColor;
|
|
}
|
|
|
|
void XSunLightParseParams::SetSunColor(const float* color, size_t count) {
|
|
if (count <= 3) {
|
|
memcpy(mSunColor, color, count * sizeof(float));
|
|
}
|
|
}
|
|
|
|
const float* XSunLightParseParams::GetDiffuseColor() const {
|
|
return mDiffuseColor;
|
|
}
|
|
|
|
void XSunLightParseParams::SetDiffuseColor(const float* color, size_t count) {
|
|
if (count <= 3) {
|
|
memcpy(mDiffuseColor, color, count * sizeof(float));
|
|
}
|
|
}
|
|
|
|
bool XSunLightParseParams::IsDiffuseColorSet() const {
|
|
return mDiffuseColorHasBeenSet;
|
|
}
|
|
|
|
void XSunLightParseParams::SetDiffuseColorSet(bool set) {
|
|
mDiffuseColorHasBeenSet = set;
|
|
}
|
|
|
|
const float* XSunLightParseParams::GetAngles() const {
|
|
return mAngles;
|
|
}
|
|
|
|
void XSunLightParseParams::SetAngles(const float* angles, size_t count) {
|
|
if (count <= 3) {
|
|
memcpy(mAngles, angles, count * sizeof(float));
|
|
}
|
|
}
|
|
|