mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-20 18:29:13 +00:00
CLight: Return by reference where applicable
Prevents unnecessary copies.
This commit is contained in:
@@ -43,17 +43,17 @@ private:
|
||||
|
||||
public:
|
||||
// Accessors
|
||||
ELightType Type() const { return mType; }
|
||||
uint32 LayerIndex() const { return mLayerIndex; }
|
||||
CVector3f Position() const { return mPosition; }
|
||||
CVector3f Direction() const { return mDirection; }
|
||||
CColor Color() const { return mColor; }
|
||||
CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
||||
CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||
ELightType Type() const { return mType; }
|
||||
uint32 LayerIndex() const { return mLayerIndex; }
|
||||
const CVector3f& Position() const { return mPosition; }
|
||||
const CVector3f& Direction() const { return mDirection; }
|
||||
const CColor& Color() const { return mColor; }
|
||||
const CVector3f& DistAttenuation() const { return mDistAttenCoefficients; }
|
||||
const CVector3f& AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||
|
||||
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||
|
||||
float GetRadius() const;
|
||||
float GetIntensity() const;
|
||||
|
||||
@@ -126,14 +126,14 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
|
||||
Index = 0;
|
||||
|
||||
struct SLightEntry {
|
||||
CLight *pLight;
|
||||
CLight* pLight;
|
||||
float Distance;
|
||||
|
||||
SLightEntry(CLight *_pLight, float _Distance)
|
||||
: pLight(_pLight), Distance(_Distance) {}
|
||||
SLightEntry(CLight* pLight_, float Distance_)
|
||||
: pLight(pLight_), Distance(Distance_) {}
|
||||
|
||||
bool operator<(const SLightEntry& rkOther) const {
|
||||
return (Distance < rkOther.Distance);
|
||||
return Distance < rkOther.Distance;
|
||||
}
|
||||
};
|
||||
std::vector<SLightEntry> LightEntries;
|
||||
@@ -159,7 +159,7 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
|
||||
if (IsInRange)
|
||||
{
|
||||
const float Dist = mPosition.Distance(pLight->Position());
|
||||
LightEntries.push_back(SLightEntry(pLight, Dist));
|
||||
LightEntries.emplace_back(pLight, Dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user