metaforce/Runtime/Character/CActorLights.hpp

96 lines
3.6 KiB
C++
Raw Normal View History

2016-04-14 21:42:47 +00:00
#ifndef __URDE_CACTORLIGHTS_HPP__
#define __URDE_CACTORLIGHTS_HPP__
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
2016-08-21 00:04:50 +00:00
#include "zeus/CColor.hpp"
#include "zeus/CAABox.hpp"
#include "Graphics/CLight.hpp"
2016-04-14 21:42:47 +00:00
namespace urde
{
2016-08-21 00:04:50 +00:00
class CBooModel;
class CStateManager;
class CGameArea;
2016-04-14 21:42:47 +00:00
class CActorLights
{
static s32 sFrameSchedulerCount;
2016-08-21 00:04:50 +00:00
std::vector<CLight> x0_areaLights;
std::vector<CLight> x144_dynamicLights;
zeus::CColor x288_ambientColor;
TAreaId x294_aid = kInvalidAreaId;
union
{
struct
{
bool x298_24_dirty : 1;
bool x298_25_castShadows : 1;
bool x298_26_hasAreaLights : 1;
bool x298_27_findShadowLight : 1;
2016-08-21 00:04:50 +00:00
bool x298_28_inArea : 1;
bool x298_29_ambientChannelOverflow : 1;
bool x298_30_layer2 : 1;
bool x298_31_disableWorldLights : 1;
bool x299_24_inBrightLight : 1;
2017-04-13 19:28:31 +00:00
bool x299_25_useBrightLightLag : 1;
2016-08-21 00:04:50 +00:00
bool x299_26_ : 1;
};
u16 _dummy = 0;
};
2017-08-10 07:05:27 +00:00
bool x29a_findNearestDynamicLights = false;
u32 x29c_shadowLightValIdx = -1;
u32 x2a0_shadowLightIdx = -1;
u32 x2a4_lastUpdateFrame = 0;
u32 x2a8_areaUpdateFramePeriod;
zeus::CVector3f x2ac_actorPosBias;
int x2b8_maxAreaLights;
int x2bc_maxDynamicLights;
zeus::CVector3f x2c0_lastActorPos;
float x2cc_actorPositionDeltaUpdateThreshold;
float x2d0_shadowDynamicRangeThreshold = 0.f;
float x2d4_worldLightingLevel = 1.f;
u32 x2d8_brightLightIdx = -1;
2017-04-13 19:28:31 +00:00
u32 x2dc_brightLightLag = 0;
2016-08-21 00:04:50 +00:00
static void MergeOverflowLight(CLight& out, zeus::CColor& color, const CLight& in, float colorMag);
void AddOverflowToLights(const CLight& light, const zeus::CColor& color, float mag);
void MoveAmbienceToLights(const zeus::CColor& color);
void MultiplyLightingLevels(float level);
2017-04-13 19:28:31 +00:00
void UpdateBrightLight();
2016-04-14 21:42:47 +00:00
public:
CActorLights(u32 areaUpdateFramePeriod, const zeus::CVector3f& actorPosBias,
int maxDynamicLights, int maxAreaLights, bool ambientChannelOverflow,
bool layer2, bool disableWorldLights, float positionUpdateThreshold);
2016-08-21 00:04:50 +00:00
void BuildConstantAmbientLighting();
void BuildConstantAmbientLighting(const zeus::CColor& color);
void BuildFakeLightList(const std::vector<CLight>& lights, const zeus::CColor& color);
2017-04-13 19:28:31 +00:00
void BuildFaceLightList(const CStateManager& mgr, const CGameArea& area, const zeus::CAABox& aabb);
bool BuildAreaLightList(const CStateManager& mgr, const CGameArea& area, const zeus::CAABox& aabb);
void BuildDynamicLightList(const CStateManager& mgr, const zeus::CAABox& aabb);
2017-08-08 06:03:57 +00:00
std::vector<CLight> BuildLightVector() const;
2016-08-21 00:04:50 +00:00
void ActivateLights(CBooModel& model) const;
void SetCastShadows(bool v) { x298_25_castShadows = v; }
void SetFindShadowLight(bool v) { x298_27_findShadowLight = v; }
2017-08-10 07:05:27 +00:00
void SetAmbientChannelOverflow(bool v) { x298_29_ambientChannelOverflow = v; }
void DisableAreaLights();
void SetMaxDynamicLights(int l) { x2bc_maxDynamicLights = l; }
void SetFindNearestDynamicLights(bool v) { x29a_findNearestDynamicLights = v; }
2016-08-21 00:04:50 +00:00
void SetAmbientColor(const zeus::CColor& color) { x288_ambientColor = color; }
2017-04-13 19:28:31 +00:00
const zeus::CColor& GetAmbientColor() const { return x288_ambientColor; }
2016-08-21 00:04:50 +00:00
const CLight& GetLight(u32 idx) const;
u32 GetActiveLightCount() const;
2017-08-13 07:56:35 +00:00
int GetMaxAreaLights() const { return x2b8_maxAreaLights; }
2017-04-13 19:28:31 +00:00
const std::vector<CLight>& GetAreaLights() const { return x0_areaLights; }
const std::vector<CLight>& GetDynamicLights() const { return x144_dynamicLights; }
2017-08-13 07:56:35 +00:00
bool GetIsDirty() const { return x298_24_dirty; }
2016-04-14 21:42:47 +00:00
};
}
#endif // __URDE_CACTORLIGHTS_HPP__