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:
|
public:
|
||||||
// Accessors
|
// Accessors
|
||||||
ELightType Type() const { return mType; }
|
ELightType Type() const { return mType; }
|
||||||
uint32 LayerIndex() const { return mLayerIndex; }
|
uint32 LayerIndex() const { return mLayerIndex; }
|
||||||
CVector3f Position() const { return mPosition; }
|
const CVector3f& Position() const { return mPosition; }
|
||||||
CVector3f Direction() const { return mDirection; }
|
const CVector3f& Direction() const { return mDirection; }
|
||||||
CColor Color() const { return mColor; }
|
const CColor& Color() const { return mColor; }
|
||||||
CVector3f DistAttenuation() const { return mDistAttenCoefficients; }
|
const CVector3f& DistAttenuation() const { return mDistAttenCoefficients; }
|
||||||
CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; }
|
const CVector3f& AngleAttenuation() const { return mAngleAttenCoefficients; }
|
||||||
|
|
||||||
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
void SetLayer(uint32 Index) { mLayerIndex = Index; }
|
||||||
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; }
|
||||||
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; }
|
||||||
|
|
||||||
float GetRadius() const;
|
float GetRadius() const;
|
||||||
float GetIntensity() const;
|
float GetIntensity() const;
|
||||||
|
|||||||
@@ -126,14 +126,14 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
struct SLightEntry {
|
struct SLightEntry {
|
||||||
CLight *pLight;
|
CLight* pLight;
|
||||||
float Distance;
|
float Distance;
|
||||||
|
|
||||||
SLightEntry(CLight *_pLight, float _Distance)
|
SLightEntry(CLight* pLight_, float Distance_)
|
||||||
: pLight(_pLight), Distance(_Distance) {}
|
: pLight(pLight_), Distance(Distance_) {}
|
||||||
|
|
||||||
bool operator<(const SLightEntry& rkOther) const {
|
bool operator<(const SLightEntry& rkOther) const {
|
||||||
return (Distance < rkOther.Distance);
|
return Distance < rkOther.Distance;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::vector<SLightEntry> LightEntries;
|
std::vector<SLightEntry> LightEntries;
|
||||||
@@ -159,7 +159,7 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
|
|||||||
if (IsInRange)
|
if (IsInRange)
|
||||||
{
|
{
|
||||||
const float Dist = mPosition.Distance(pLight->Position());
|
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