2025-08-17 13:14:17 -04:00
|
|
|
#include "xgfxlight.h"
|
|
|
|
|
|
2025-09-03 13:02:23 -04:00
|
|
|
#include "qcolor.h"
|
|
|
|
|
#include "xgfxlightdef.h"
|
|
|
|
|
|
2025-08-17 13:14:17 -04:00
|
|
|
XGfxLight::XGfxLight()
|
2025-09-03 13:02:23 -04:00
|
|
|
: XAsset()
|
|
|
|
|
, mType(0)
|
|
|
|
|
, mCanUseShadowMap(0)
|
2025-09-05 18:35:17 -04:00
|
|
|
, mColor()
|
|
|
|
|
, mDir()
|
|
|
|
|
, mOrigin()
|
2025-09-03 13:02:23 -04:00
|
|
|
, mRadius(0.0f)
|
|
|
|
|
, mCosHalfFovOuter(0.0f)
|
|
|
|
|
, mCosHalfFovInner(0.0f)
|
|
|
|
|
, mExponent(0)
|
|
|
|
|
, mSpotShadowIndex(0)
|
|
|
|
|
, mDefPtr(0)
|
|
|
|
|
, mDef(new XGfxLightDef())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XGfxLight::~XGfxLight()
|
|
|
|
|
{
|
|
|
|
|
delete mDef;
|
2025-08-17 13:14:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XGfxLight::ParseData(QDataStream *aStream) {
|
|
|
|
|
if (GetPtr() == -1) {
|
2025-09-03 13:02:23 -04:00
|
|
|
*aStream
|
|
|
|
|
>> mType
|
|
|
|
|
>> mCanUseShadowMap;
|
|
|
|
|
|
|
|
|
|
aStream->skipRawData(2);
|
|
|
|
|
|
|
|
|
|
float r, g, b;
|
|
|
|
|
|
|
|
|
|
*aStream
|
|
|
|
|
>> r
|
|
|
|
|
>> g
|
|
|
|
|
>> b
|
|
|
|
|
>> mDir[0]
|
|
|
|
|
>> mDir[1]
|
|
|
|
|
>> mDir[2]
|
|
|
|
|
>> mOrigin[0]
|
|
|
|
|
>> mOrigin[1]
|
|
|
|
|
>> mOrigin[2]
|
|
|
|
|
>> mRadius
|
|
|
|
|
>> mCosHalfFovOuter
|
|
|
|
|
>> mCosHalfFovInner
|
|
|
|
|
>> mExponent
|
|
|
|
|
>> mSpotShadowIndex
|
|
|
|
|
>> mDefPtr;
|
|
|
|
|
|
|
|
|
|
mColor = QColor(r, g, b);
|
|
|
|
|
|
|
|
|
|
if (mDefPtr == -1)
|
|
|
|
|
{
|
|
|
|
|
mDef->ParseData(aStream);
|
|
|
|
|
}
|
2025-08-17 13:14:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XGfxLight::Clear()
|
|
|
|
|
{
|
2025-08-17 13:14:17 -04:00
|
|
|
|
|
|
|
|
}
|