130 lines
2.8 KiB
C++
130 lines
2.8 KiB
C++
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#include "xgfxlight.h"
|
||
|
|
|
||
|
|
XGfxLight::XGfxLight()
|
||
|
|
: XAsset() {
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::ParseData(QDataStream *aStream) {
|
||
|
|
if (GetPtr() == -1) {
|
||
|
|
aStream->read((char*)&mType, sizeof(unsigned char));
|
||
|
|
aStream->read((char*)&mCanUseShadowMap, sizeof(unsigned char));
|
||
|
|
aStream->ignore(sizeof(unsigned char) * 2); // Skip unused bytes
|
||
|
|
aStream->read((char*)mColor, 3 * sizeof(float));
|
||
|
|
aStream->read((char*)mDir, 3 * sizeof(float));
|
||
|
|
aStream->read((char*)mOrigin, 3 * sizeof(float));
|
||
|
|
aStream->read((char*)&mRadius, sizeof(float));
|
||
|
|
aStream->read((char*)&mCosHalfFovOuter, sizeof(float));
|
||
|
|
aStream->read((char*)&mCosHalfFovInner, sizeof(float));
|
||
|
|
aStream->read((char*)&mExponent, sizeof(int));
|
||
|
|
|
||
|
|
// Skip spotShadowIndex - we'll handle this appropriately later
|
||
|
|
aStream->ignore(sizeof(unsigned int));
|
||
|
|
|
||
|
|
// Skip def pointer - we'll handle this appropriately later
|
||
|
|
aStream->ignore(sizeof(int));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
unsigned char XGfxLight::GetType() const {
|
||
|
|
return mType;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetType(unsigned char type) {
|
||
|
|
mType = type;
|
||
|
|
}
|
||
|
|
|
||
|
|
unsigned char XGfxLight::CanUseShadowMap() const {
|
||
|
|
return mCanUseShadowMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetCanUseShadowMap(bool canUse) {
|
||
|
|
mCanUseShadowMap = canUse ? 1 : 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
const float* XGfxLight::GetColor() const {
|
||
|
|
return mColor;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetColor(const float* color, size_t count) {
|
||
|
|
if (count <= 3) {
|
||
|
|
memcpy(mColor, color, count * sizeof(float));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const float* XGfxLight::GetDir() const {
|
||
|
|
return mDir;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetDir(const float* dir, size_t count) {
|
||
|
|
if (count <= 3) {
|
||
|
|
memcpy(mDir, dir, count * sizeof(float));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
const float* XGfxLight::GetOrigin() const {
|
||
|
|
return mOrigin;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetOrigin(const float* origin, size_t count) {
|
||
|
|
if (count <= 3) {
|
||
|
|
memcpy(mOrigin, origin, count * sizeof(float));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
float XGfxLight::GetRadius() const {
|
||
|
|
return mRadius;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetRadius(float radius) {
|
||
|
|
mRadius = radius;
|
||
|
|
}
|
||
|
|
|
||
|
|
float XGfxLight::GetCosHalfFovOuter() const {
|
||
|
|
return mCosHalfFovOuter;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetCosHalfFovOuter(float cosHalfFov) {
|
||
|
|
mCosHalfFovOuter = cosHalfFov;
|
||
|
|
}
|
||
|
|
|
||
|
|
float XGfxLight::GetCosHalfFovInner() const {
|
||
|
|
return mCosHalfFovInner;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetCosHalfFovInner(float cosHalfFov) {
|
||
|
|
mCosHalfFovInner = cosHalfFov;
|
||
|
|
}
|
||
|
|
|
||
|
|
int XGfxLight::GetExponent() const {
|
||
|
|
return mExponent;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetExponent(int exponent) {
|
||
|
|
mExponent = exponent;
|
||
|
|
}
|
||
|
|
|
||
|
|
unsigned int XGfxLight::GetSpotShadowIndex() const {
|
||
|
|
return mSpotShadowIndex;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetSpotShadowIndex(unsigned int index) {
|
||
|
|
mSpotShadowIndex = index;
|
||
|
|
}
|
||
|
|
|
||
|
|
int XGfxLight::GetDefPtr() const {
|
||
|
|
return mDefPtr;
|
||
|
|
}
|
||
|
|
|
||
|
|
void XGfxLight::SetDefPtr(int ptr) {
|
||
|
|
mDefPtr = ptr;
|
||
|
|
}
|
||
|
|
|
||
|
|
|