mirror of https://github.com/AxioDL/metaforce.git
CGuiLight imps
This commit is contained in:
parent
22ca6d025b
commit
a81bc3c7a2
|
@ -173,6 +173,62 @@ size_t FRME::Widget::CAMRInfo::binarySize(size_t __isz) const
|
||||||
return __isz + 4;
|
return __isz + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FRME::Widget::LITEInfo::read(athena::io::IStreamReader& __dna_reader)
|
||||||
|
{
|
||||||
|
IWidgetInfo::read(__dna_reader);
|
||||||
|
/* type */
|
||||||
|
type = ELightType(__dna_reader.readUint32Big());
|
||||||
|
/* distC */
|
||||||
|
distC = __dna_reader.readFloatBig();
|
||||||
|
/* distL */
|
||||||
|
distL = __dna_reader.readFloatBig();
|
||||||
|
/* distQ */
|
||||||
|
distQ = __dna_reader.readFloatBig();
|
||||||
|
/* angC */
|
||||||
|
angC = __dna_reader.readFloatBig();
|
||||||
|
/* angL */
|
||||||
|
angL = __dna_reader.readFloatBig();
|
||||||
|
/* angQ */
|
||||||
|
angQ = __dna_reader.readFloatBig();
|
||||||
|
/* loadedIdx */
|
||||||
|
loadedIdx = __dna_reader.readUint32Big();
|
||||||
|
|
||||||
|
/* cutoff */
|
||||||
|
if (type == ELightType::Spot)
|
||||||
|
cutoff = __dna_reader.readFloatBig();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FRME::Widget::LITEInfo::write(athena::io::IStreamWriter& __dna_writer) const
|
||||||
|
{
|
||||||
|
IWidgetInfo::write(__dna_writer);
|
||||||
|
/* type */
|
||||||
|
__dna_writer.writeUint32Big(atUint32(type));
|
||||||
|
/* distC */
|
||||||
|
__dna_writer.writeFloatBig(distC);
|
||||||
|
/* distL */
|
||||||
|
__dna_writer.writeFloatBig(distL);
|
||||||
|
/* distQ */
|
||||||
|
__dna_writer.writeFloatBig(distQ);
|
||||||
|
/* angC */
|
||||||
|
__dna_writer.writeFloatBig(angC);
|
||||||
|
/* angL */
|
||||||
|
__dna_writer.writeFloatBig(angL);
|
||||||
|
/* angQ */
|
||||||
|
__dna_writer.writeFloatBig(angQ);
|
||||||
|
/* loadedIdx */
|
||||||
|
__dna_writer.writeUint32Big(loadedIdx);
|
||||||
|
|
||||||
|
/* cutoff */
|
||||||
|
if (type == ELightType::Spot)
|
||||||
|
__dna_writer.writeFloatBig(cutoff);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t FRME::Widget::LITEInfo::binarySize(size_t __isz) const
|
||||||
|
{
|
||||||
|
__isz = IWidgetInfo::binarySize(__isz);
|
||||||
|
return __isz + ((type == ELightType::Spot) ? 36 : 32);
|
||||||
|
}
|
||||||
|
|
||||||
void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader)
|
void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader)
|
||||||
{
|
{
|
||||||
IWidgetInfo::read(__dna_reader);
|
IWidgetInfo::read(__dna_reader);
|
||||||
|
|
|
@ -119,15 +119,25 @@ struct FRME : BigDNA
|
||||||
|
|
||||||
struct LITEInfo : IWidgetInfo
|
struct LITEInfo : IWidgetInfo
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_EXPLICIT_DNA
|
||||||
Value<atUint32> unk1;
|
enum class ELightType : atUint32
|
||||||
Value<float> unk2;
|
{
|
||||||
Value<float> unk3;
|
Spot = 0,
|
||||||
Value<float> unk4;
|
Point = 1,
|
||||||
Value<float> unk5;
|
Directional = 2,
|
||||||
Value<float> unk6;
|
LocalAmbient = 3,
|
||||||
Value<float> unk7;
|
Custom = 4,
|
||||||
Value<atUint32> unk8;
|
};
|
||||||
|
|
||||||
|
Value<ELightType> type;
|
||||||
|
Value<float> distC;
|
||||||
|
Value<float> distL;
|
||||||
|
Value<float> distQ;
|
||||||
|
Value<float> angC;
|
||||||
|
Value<float> angL;
|
||||||
|
Value<float> angQ;
|
||||||
|
Value<atUint32> loadedIdx;
|
||||||
|
Value<float> cutoff; /* Spot only */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ENRGInfo : IWidgetInfo
|
struct ENRGInfo : IWidgetInfo
|
||||||
|
|
|
@ -40,6 +40,7 @@ target_link_libraries(urde
|
||||||
RuntimeCommonCharacter
|
RuntimeCommonCharacter
|
||||||
RuntimeCommonInput
|
RuntimeCommonInput
|
||||||
RuntimeCommonParticle
|
RuntimeCommonParticle
|
||||||
|
RuntimeCommonGuiSys
|
||||||
RuntimeCommonGraphics
|
RuntimeCommonGraphics
|
||||||
RuntimeCommonAudio
|
RuntimeCommonAudio
|
||||||
RuntimeCommon
|
RuntimeCommon
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "Runtime/Particle/CGenDescription.hpp"
|
#include "Runtime/Particle/CGenDescription.hpp"
|
||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
||||||
#include "Runtime/Graphics/CModel.hpp"
|
#include "Runtime/Graphics/CModel.hpp"
|
||||||
#include "Runtime/Graphics/CTexture.hpp"
|
#include "Runtime/Graphics/CTexture.hpp"
|
||||||
|
|
||||||
|
@ -13,8 +14,9 @@ namespace urde
|
||||||
|
|
||||||
ProjectResourceFactory::ProjectResourceFactory()
|
ProjectResourceFactory::ProjectResourceFactory()
|
||||||
{
|
{
|
||||||
m_factoryMgr.AddFactory(hecl::FOURCC('TXTR'), urde::FTextureFactory);
|
m_factoryMgr.AddFactory(FOURCC('TXTR'), urde::FTextureFactory);
|
||||||
m_factoryMgr.AddFactory(hecl::FOURCC('PART'), urde::FParticleFactory);
|
m_factoryMgr.AddFactory(FOURCC('PART'), urde::FParticleFactory);
|
||||||
|
m_factoryMgr.AddFactory(FOURCC('FRME'), urde::RGuiFrameFactoryInGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)
|
void ProjectResourceFactory::BuildObjectMap(const hecl::Database::Project::ProjectDataSpec &spec)
|
||||||
|
|
|
@ -1,24 +1,71 @@
|
||||||
#include "CLight.hpp"
|
#include "CLight.hpp"
|
||||||
|
#include <cfloat>
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const zeus::CVector3f kDefaultPosition(0.f, 0.f, 0.f);
|
||||||
|
static const zeus::CVector3f kDefaultDirection(0.f, -1.f, 0.f);
|
||||||
|
|
||||||
|
float CLight::CalculateLightRadius() const
|
||||||
|
{
|
||||||
|
if (x28_distL < FLT_EPSILON && x2c_distQ < FLT_EPSILON)
|
||||||
|
return FLT_MAX;
|
||||||
|
|
||||||
|
float intens = GetIntensity();
|
||||||
|
|
||||||
|
if (x2c_distQ > FLT_EPSILON)
|
||||||
|
{
|
||||||
|
if (intens <= FLT_EPSILON)
|
||||||
|
return 0.f;
|
||||||
|
return std::sqrt(intens / 5.f * intens / 255.f * x2c_distQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
float nextIntens = 5.f * intens / 255.f;
|
||||||
|
return intens / std::min(0.2f, nextIntens) * x28_distL;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CLight::GetIntensity() const
|
||||||
|
{
|
||||||
|
if (x4c_24_intensityDirty)
|
||||||
|
{
|
||||||
|
((CLight*)this)->x4c_24_intensityDirty = false;
|
||||||
|
float coef = 1.f;
|
||||||
|
if (x1c_type == ELightType::Custom)
|
||||||
|
coef = x30_angleC;
|
||||||
|
((CLight*)this)->x48_cachedIntensity =
|
||||||
|
coef * std::max(x18_color.r, std::max(x18_color.g, x18_color.b));
|
||||||
|
}
|
||||||
|
return x48_cachedIntensity;
|
||||||
|
}
|
||||||
|
|
||||||
CLight CLight::BuildDirectional(const zeus::CVector3f& dir, const zeus::CColor& color)
|
CLight CLight::BuildDirectional(const zeus::CVector3f& dir, const zeus::CColor& color)
|
||||||
{
|
{
|
||||||
return {};
|
return CLight(ELightType::Directional, kDefaultPosition, dir, color, 180.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLight CLight::BuildSpot(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
CLight CLight::BuildSpot(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||||
const zeus::CColor& color, float angle)
|
const zeus::CColor& color, float angle)
|
||||||
{
|
{
|
||||||
return {};
|
return CLight(ELightType::Spot, pos, dir, color, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLight CLight::BuildPoint(const zeus::CVector3f& pos, const zeus::CColor& color)
|
||||||
|
{
|
||||||
|
return CLight(ELightType::Point, pos, kDefaultDirection, color, 180.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLight CLight::BuildCustom(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
CLight CLight::BuildCustom(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||||
const zeus::CColor& color, float constAtt, float linearAtt, float quadAtt,
|
const zeus::CColor& color,
|
||||||
float intensity, float, float)
|
float distC, float distL, float distQ,
|
||||||
|
float angleC, float angleL, float angleQ)
|
||||||
{
|
{
|
||||||
return {};
|
return CLight(pos, dir, color, distC, distL, distQ, angleC, angleL, angleQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLight CLight::BuildLocalAmbient(const zeus::CVector3f& pos, const zeus::CColor& color)
|
||||||
|
{
|
||||||
|
return CLight(ELightType::LocalAmbient, pos, kDefaultDirection, color, 180.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
|
|
||||||
#include "zeus/CVector3f.hpp"
|
#include "zeus/CVector3f.hpp"
|
||||||
#include "zeus/CColor.hpp"
|
#include "zeus/CColor.hpp"
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class ELightType
|
enum class ELightType
|
||||||
{
|
{
|
||||||
LocalAmbient,
|
Spot = 0,
|
||||||
Directional,
|
Point = 1,
|
||||||
Custom,
|
Directional = 2,
|
||||||
Spot,
|
LocalAmbient = 3,
|
||||||
Spot2,
|
Custom = 4,
|
||||||
LocalAmbient2
|
|
||||||
};
|
};
|
||||||
enum class EFalloffType
|
enum class EFalloffType
|
||||||
{
|
{
|
||||||
|
@ -25,13 +25,111 @@ enum class EFalloffType
|
||||||
|
|
||||||
class CLight
|
class CLight
|
||||||
{
|
{
|
||||||
|
friend class CGuiLight;
|
||||||
|
|
||||||
|
zeus::CVector3f x0_pos;
|
||||||
|
zeus::CVector3f xc_dir;
|
||||||
|
zeus::CColor x18_color;
|
||||||
|
ELightType x1c_type;
|
||||||
|
float x20_spotCutoff;
|
||||||
|
float x24_distC;
|
||||||
|
float x28_distL;
|
||||||
|
float x2c_distQ;
|
||||||
|
float x30_angleC;
|
||||||
|
float x34_angleL;
|
||||||
|
float x38_angleQ;
|
||||||
|
u32 x3c_ = 0;
|
||||||
|
u32 x40_loadedIdx = 0;
|
||||||
|
float x44_cachedRadius;
|
||||||
|
float x48_cachedIntensity;
|
||||||
|
bool x4c_24_intensityDirty : 1;
|
||||||
|
bool x4c_25_radiusDirty : 1;
|
||||||
|
|
||||||
|
float CalculateLightRadius() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CLight(const zeus::CVector3f& pos,
|
||||||
|
const zeus::CVector3f& dir,
|
||||||
|
const zeus::CColor& color,
|
||||||
|
float distC, float distL, float distQ,
|
||||||
|
float angleC, float angleL, float angleQ)
|
||||||
|
: x0_pos(pos), xc_dir(dir), x18_color(color),
|
||||||
|
x1c_type(ELightType::Custom), x20_spotCutoff(0.f),
|
||||||
|
x24_distC(distC), x28_distL(distL), x2c_distQ(distQ),
|
||||||
|
x30_angleC(angleC), x34_angleL(angleL), x38_angleQ(angleQ),
|
||||||
|
x44_cachedRadius(0.f), x48_cachedIntensity(0.f),
|
||||||
|
x4c_24_intensityDirty(true), x4c_25_radiusDirty(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
CLight(ELightType type,
|
||||||
|
const zeus::CVector3f& pos,
|
||||||
|
const zeus::CVector3f& dir,
|
||||||
|
const zeus::CColor& color,
|
||||||
|
float cutoff)
|
||||||
|
: x0_pos(pos), xc_dir(dir), x18_color(color),
|
||||||
|
x1c_type(type), x20_spotCutoff(cutoff),
|
||||||
|
x24_distC(0.f), x28_distL(1.f), x2c_distQ(0.f),
|
||||||
|
x30_angleC(0.f), x34_angleL(1.f), x38_angleQ(0.f),
|
||||||
|
x44_cachedRadius(0.f), x48_cachedIntensity(0.f),
|
||||||
|
x4c_24_intensityDirty(true), x4c_25_radiusDirty(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void SetPosition(const zeus::CVector3f& pos)
|
||||||
|
{
|
||||||
|
x0_pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDirection(const zeus::CVector3f& dir)
|
||||||
|
{
|
||||||
|
xc_dir = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetColor(const zeus::CColor& col)
|
||||||
|
{
|
||||||
|
x18_color = col;
|
||||||
|
x4c_24_intensityDirty = true;
|
||||||
|
x4c_25_radiusDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAttenuation(float constant, float linear, float quadratic)
|
||||||
|
{
|
||||||
|
x24_distC = constant;
|
||||||
|
x28_distL = linear;
|
||||||
|
x2c_distQ = quadratic;
|
||||||
|
x4c_24_intensityDirty = true;
|
||||||
|
x4c_25_radiusDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAngleAttenuation(float constant, float linear, float quadratic)
|
||||||
|
{
|
||||||
|
x30_angleC = constant;
|
||||||
|
x34_angleL = linear;
|
||||||
|
x38_angleQ = quadratic;
|
||||||
|
x4c_24_intensityDirty = true;
|
||||||
|
x4c_25_radiusDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetRadius() const
|
||||||
|
{
|
||||||
|
if (x4c_25_radiusDirty)
|
||||||
|
{
|
||||||
|
((CLight*)this)->x44_cachedRadius = CalculateLightRadius();
|
||||||
|
((CLight*)this)->x4c_25_radiusDirty = false;
|
||||||
|
}
|
||||||
|
return x44_cachedRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetIntensity() const;
|
||||||
|
|
||||||
static CLight BuildDirectional(const zeus::CVector3f& dir, const zeus::CColor& color);
|
static CLight BuildDirectional(const zeus::CVector3f& dir, const zeus::CColor& color);
|
||||||
static CLight BuildSpot(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
static CLight BuildSpot(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||||
const zeus::CColor& color, float angle);
|
const zeus::CColor& color, float angle);
|
||||||
|
static CLight BuildPoint(const zeus::CVector3f& pos, const zeus::CColor& color);
|
||||||
static CLight BuildCustom(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
static CLight BuildCustom(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||||
const zeus::CColor& color, float constAtt, float linearAtt, float quadAtt,
|
const zeus::CColor& color,
|
||||||
float intensity, float, float);
|
float distC, float distL, float distQ,
|
||||||
|
float angleC, float angleL, float angleQ);
|
||||||
|
static CLight BuildLocalAmbient(const zeus::CVector3f& pos, const zeus::CColor& color);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class CGuiCompoundWidget : public CGuiWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CGuiCompoundWidget(const CGuiWidgetParms& parms);
|
CGuiCompoundWidget(const CGuiWidgetParms& parms);
|
||||||
virtual FourCC GetWidgetTypeID() const {return FourCC(-1);}
|
FourCC GetWidgetTypeID() const {return FourCC(-1);}
|
||||||
|
|
||||||
void OnInvisible();
|
void OnInvisible();
|
||||||
void OnVisible();
|
void OnVisible();
|
||||||
|
|
|
@ -304,6 +304,11 @@ bool CGuiFrame::SendWidgetMessage(s16 id,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGuiFrame::ClearAllMessageMap()
|
||||||
|
{
|
||||||
|
x7c_messageMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void CGuiFrame::ClearMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id)
|
void CGuiFrame::ClearMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id)
|
||||||
{
|
{
|
||||||
CGuiFrame::LogicalEventList* list =
|
CGuiFrame::LogicalEventList* list =
|
||||||
|
@ -622,6 +627,14 @@ CGuiFrame* CGuiFrame::CreateFrame(TResId frmeId, CGuiSys& sys, CInputStream& in)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
|
||||||
|
const CVParamTransfer& vparms)
|
||||||
|
{
|
||||||
|
CGuiResFrameData& rfData = static_cast<TObjOwnerParam<CGuiResFrameData>*>(vparms.GetObj())->GetParam();
|
||||||
|
std::unique_ptr<CGuiFrame> frame(CGuiFrame::CreateFrame(tag.id, rfData.x0_guiSys, in));
|
||||||
|
return TToken<CGuiFrame>::GetIObjObjectFor(std::move(frame));
|
||||||
|
}
|
||||||
|
|
||||||
std::string CGuiFrame::CreateFrameName(TResId frmeId)
|
std::string CGuiFrame::CreateFrameName(TResId frmeId)
|
||||||
{
|
{
|
||||||
/* formatting token originally "frame_%x" for 32-bit ids */
|
/* formatting token originally "frame_%x" for 32-bit ids */
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "CGuiControllerInfo.hpp"
|
#include "CGuiControllerInfo.hpp"
|
||||||
#include "CGuiLogicalEventTrigger.hpp"
|
#include "CGuiLogicalEventTrigger.hpp"
|
||||||
#include "CGuiWidgetIdDB.hpp"
|
#include "CGuiWidgetIdDB.hpp"
|
||||||
|
#include "IObj.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -16,6 +17,7 @@ class CGuiCamera;
|
||||||
class CGuiHeadWidget;
|
class CGuiHeadWidget;
|
||||||
class CFinalInput;
|
class CFinalInput;
|
||||||
class CGuiLight;
|
class CGuiLight;
|
||||||
|
class CVParamTransfer;
|
||||||
|
|
||||||
enum class EFrameTransitionOptions
|
enum class EFrameTransitionOptions
|
||||||
{
|
{
|
||||||
|
@ -131,6 +133,9 @@ public:
|
||||||
static std::string CreateFrameName(TResId frmeId);
|
static std::string CreateFrameName(TResId frmeId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
|
||||||
|
const CVParamTransfer& vparms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __URDE_CGUIFRAME_HPP__
|
#endif // __URDE_CGUIFRAME_HPP__
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CGuiGroup : public CGuiCompoundWidget
|
||||||
bool x100_b;
|
bool x100_b;
|
||||||
public:
|
public:
|
||||||
CGuiGroup(const CGuiWidgetParms& parms, int defaultWorker, bool b);
|
CGuiGroup(const CGuiWidgetParms& parms, int defaultWorker, bool b);
|
||||||
virtual FourCC GetWidgetTypeID() const {return FOURCC('GRUP');}
|
FourCC GetWidgetTypeID() const {return FOURCC('GRUP');}
|
||||||
|
|
||||||
void SelectWorkerWidget(int workerId, bool setActive, bool setVisible);
|
void SelectWorkerWidget(int workerId, bool setActive, bool setVisible);
|
||||||
CGuiWidget* GetSelectedWidget();
|
CGuiWidget* GetSelectedWidget();
|
||||||
|
|
|
@ -1,25 +1,109 @@
|
||||||
#include "CGuiLight.hpp"
|
#include "CGuiLight.hpp"
|
||||||
#include "CGuiAnimController.hpp"
|
#include "CGuiAnimController.hpp"
|
||||||
#include "CGuiLogicalEventTrigger.hpp"
|
#include "CGuiLogicalEventTrigger.hpp"
|
||||||
|
#include "CGuiFrame.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CGuiLight::CGuiLight(const CGuiWidgetParms& parms, const CLight& light)
|
CGuiLight::CGuiLight(const CGuiWidgetParms& parms, const CLight& light)
|
||||||
: CGuiWidget(parms)
|
: CGuiWidget(parms),
|
||||||
|
xf8_type(light.x1c_type),
|
||||||
|
xfc_spotCutoff(light.x20_spotCutoff),
|
||||||
|
x100_distC(light.x24_distC),
|
||||||
|
x104_distL(light.x28_distL),
|
||||||
|
x108_distQ(light.x2c_distQ),
|
||||||
|
x10c_angleC(light.x30_angleC),
|
||||||
|
x110_angleL(light.x34_angleL),
|
||||||
|
x114_angleQ(light.x38_angleQ),
|
||||||
|
x118_loadedIdx(light.x40_loadedIdx)
|
||||||
|
{}
|
||||||
|
|
||||||
|
CGuiLight::~CGuiLight()
|
||||||
{
|
{
|
||||||
|
xc8_frame->RemoveLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLight CGuiLight::BuildLight() const
|
CLight CGuiLight::BuildLight() const
|
||||||
{
|
{
|
||||||
return {};
|
CLight ret = CLight::BuildLocalAmbient(zeus::CVector3f::skZero, zeus::CColor::skBlack);
|
||||||
|
|
||||||
|
switch (xf8_type)
|
||||||
|
{
|
||||||
|
case ELightType::Spot:
|
||||||
|
ret = CLight::BuildSpot(GetWorldPosition(), x34_worldXF.m_basis[1], xbc_color, xfc_spotCutoff);
|
||||||
|
break;
|
||||||
|
case ELightType::Point:
|
||||||
|
ret = CLight::BuildPoint(GetWorldPosition(), xbc_color);
|
||||||
|
break;
|
||||||
|
case ELightType::Directional:
|
||||||
|
ret = CLight::BuildDirectional(x34_worldXF.m_basis[1], xbc_color);
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.SetAttenuation(x100_distC, x104_distL, x108_distQ);
|
||||||
|
ret.SetAngleAttenuation(x10c_angleC, x110_angleL, x114_angleQ);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGuiLight::SetIsVisible(bool vis)
|
||||||
|
{
|
||||||
|
if (vis)
|
||||||
|
xc8_frame->AddLight(this);
|
||||||
|
else
|
||||||
|
xc8_frame->RemoveLight(this);
|
||||||
|
CGuiWidget::SetIsVisible(vis);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGuiLight* CGuiLight::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
CGuiLight* CGuiLight::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
||||||
{
|
{
|
||||||
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
||||||
|
|
||||||
|
ELightType tp = ELightType(in.readUint32Big());
|
||||||
|
float distC = in.readFloatBig();
|
||||||
|
float distL = in.readFloatBig();
|
||||||
|
float distQ = in.readFloatBig();
|
||||||
|
float angC = in.readFloatBig();
|
||||||
|
float angL = in.readFloatBig();
|
||||||
|
float angQ = in.readFloatBig();
|
||||||
|
u32 loadedIdx = in.readUint32Big();
|
||||||
|
|
||||||
|
CGuiLight* ret = nullptr;
|
||||||
|
switch (tp)
|
||||||
|
{
|
||||||
|
case ELightType::Spot:
|
||||||
|
{
|
||||||
|
float cutoff = in.readFloatBig();
|
||||||
|
CLight lt = CLight::BuildSpot(zeus::CVector3f::skZero, zeus::CVector3f::skZero,
|
||||||
|
parms.x10_color, cutoff);
|
||||||
|
lt.SetAttenuation(distC, distL, distQ);
|
||||||
|
lt.SetAngleAttenuation(angC, angL, angQ);
|
||||||
|
lt.x40_loadedIdx = loadedIdx;
|
||||||
|
ret = new CGuiLight(parms, lt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ELightType::Point:
|
||||||
|
{
|
||||||
|
CLight lt = CLight::BuildPoint(zeus::CVector3f::skZero, parms.x10_color);
|
||||||
|
lt.SetAttenuation(distC, distL, distQ);
|
||||||
|
lt.x40_loadedIdx = loadedIdx;
|
||||||
|
ret = new CGuiLight(parms, lt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ELightType::Directional:
|
||||||
|
{
|
||||||
|
CLight lt = CLight::BuildDirectional(zeus::CVector3f::skZero, parms.x10_color);
|
||||||
|
lt.x40_loadedIdx = loadedIdx;
|
||||||
|
ret = new CGuiLight(parms, lt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->ParseBaseInfo(frame, in, parms);
|
||||||
|
frame->AddLight(ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,23 @@ namespace urde
|
||||||
|
|
||||||
class CGuiLight : public CGuiWidget
|
class CGuiLight : public CGuiWidget
|
||||||
{
|
{
|
||||||
u32 x118_loadedIdx = 0;
|
ELightType xf8_type;
|
||||||
|
float xfc_spotCutoff;
|
||||||
|
float x100_distC;
|
||||||
|
float x104_distL;
|
||||||
|
float x108_distQ;
|
||||||
|
float x10c_angleC;
|
||||||
|
float x110_angleL;
|
||||||
|
float x114_angleQ;
|
||||||
|
u32 x118_loadedIdx;
|
||||||
|
zeus::CColor x11c_color = zeus::CColor::skBlack;
|
||||||
public:
|
public:
|
||||||
|
~CGuiLight();
|
||||||
CGuiLight(const CGuiWidgetParms& parms, const CLight& light);
|
CGuiLight(const CGuiWidgetParms& parms, const CLight& light);
|
||||||
|
FourCC GetWidgetTypeID() const {return FOURCC('LITE');}
|
||||||
|
|
||||||
CLight BuildLight() const;
|
CLight BuildLight() const;
|
||||||
|
void SetIsVisible(bool vis);
|
||||||
u32 GetLoadedIdx() const {return x118_loadedIdx;}
|
u32 GetLoadedIdx() const {return x118_loadedIdx;}
|
||||||
|
|
||||||
static CGuiLight* Create(CGuiFrame* frame, CInputStream& in, bool);
|
static CGuiLight* Create(CGuiFrame* frame, CInputStream& in, bool);
|
||||||
|
|
|
@ -11,6 +11,26 @@ CGuiPane::CGuiPane(const CGuiWidgetParms& parms, float a, float b, const zeus::C
|
||||||
InitializeBuffers();
|
InitializeBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGuiPane::ScaleDimensions(const zeus::CVector3f& scale)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGuiPane::SetDimensions(const zeus::CVector2f& dim, bool flag)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const zeus::CVector3f& CGuiPane::GetDimensions() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGuiPane::InitializeBuffers()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGuiPane::WriteData(COutputStream& out, bool flag) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CGuiPane* CGuiPane::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
CGuiPane* CGuiPane::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
||||||
{
|
{
|
||||||
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
||||||
|
|
|
@ -372,6 +372,11 @@ void CGuiWidget::AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool at
|
||||||
AddChildObject(widget, makeWorldLocal, atEnd);
|
AddChildObject(widget, makeWorldLocal, atEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CGuiWidget::AddWorkerWidget(CGuiWidget* worker)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CGuiWidget::AddAnim(EGuiAnimBehListID id, CGuiAnimBase* anim)
|
void CGuiWidget::AddAnim(EGuiAnimBehListID id, CGuiAnimBase* anim)
|
||||||
{
|
{
|
||||||
if (!xb0_animController)
|
if (!xb0_animController)
|
||||||
|
|
|
@ -1156,7 +1156,8 @@ void CParticleDataFactory::LoadGPSMTokens(CGenDescription* desc)
|
||||||
desc->xd4_xc0_SSWH.m_swoosh = desc->xd4_xc0_SSWH.m_token.GetObj();
|
desc->xd4_xc0_SSWH.m_swoosh = desc->xd4_xc0_SSWH.m_token.GetObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)
|
std::unique_ptr<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in,
|
||||||
|
const CVParamTransfer& vparms)
|
||||||
{
|
{
|
||||||
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());
|
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());
|
||||||
return TToken<CGenDescription>::GetIObjObjectFor(std::unique_ptr<CGenDescription>(CParticleDataFactory::GetGeneratorDesc(in, sp)));
|
return TToken<CGenDescription>::GetIObjObjectFor(std::unique_ptr<CGenDescription>(CParticleDataFactory::GetGeneratorDesc(in, sp)));
|
||||||
|
|
|
@ -209,7 +209,8 @@ bool CParticleElectric::SystemHasLight() const
|
||||||
|
|
||||||
CLight CParticleElectric::GetLight() const
|
CLight CParticleElectric::GetLight() const
|
||||||
{
|
{
|
||||||
return CLight();
|
return CLight(zeus::CVector3f::skZero, zeus::CVector3f::skZero,
|
||||||
|
zeus::CColor::skBlack, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CParticleElectric::GetParticleEmission() const
|
bool CParticleElectric::GetParticleEmission() const
|
||||||
|
|
|
@ -105,7 +105,8 @@ bool CParticleSwoosh::SystemHasLight() const
|
||||||
|
|
||||||
CLight CParticleSwoosh::GetLight() const
|
CLight CParticleSwoosh::GetLight() const
|
||||||
{
|
{
|
||||||
return CLight();
|
return CLight(zeus::CVector3f::skZero, zeus::CVector3f::skZero,
|
||||||
|
zeus::CColor::skBlack, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CParticleSwoosh::GetParticleEmission() const
|
bool CParticleSwoosh::GetParticleEmission() const
|
||||||
|
|
Loading…
Reference in New Issue