Fixed Light copy constructor/assignment operator

Former-commit-id: dadf40b2e3a58ed32d9f38b8fea8d60d2297b767
This commit is contained in:
Lynix 2013-09-23 09:44:43 +02:00
parent 05712da240
commit 96974a9d2b
1 changed files with 23 additions and 3 deletions

View File

@ -29,9 +29,18 @@ m_radius(5.f)
}
NzLight::NzLight(const NzLight& light) :
NzSceneNode(light)
NzSceneNode(light),
m_type(light.m_type),
m_boundingVolume(light.m_boundingVolume),
m_color(light.m_color),
m_boundingVolumeUpdated(light.m_boundingVolumeUpdated),
m_ambientFactor(light.m_ambientFactor),
m_attenuation(light.m_attenuation),
m_diffuseFactor(light.m_diffuseFactor),
m_innerAngle(light.m_innerAngle),
m_outerAngle(light.m_outerAngle),
m_radius(light.m_radius)
{
std::memcpy(this, &light, sizeof(NzLight)); // Aussi simple que ça
}
void NzLight::AddToRenderQueue(NzAbstractRenderQueue* renderQueue) const
@ -215,7 +224,18 @@ void NzLight::SetRadius(float radius)
NzLight& NzLight::operator=(const NzLight& light)
{
std::memcpy(this, &light, sizeof(NzLight));
NzSceneNode::operator=(light);
m_ambientFactor = light.m_ambientFactor;
m_attenuation = light.m_attenuation;
m_boundingVolume = light.m_boundingVolume;
m_boundingVolumeUpdated = light.m_boundingVolumeUpdated;
m_color = light.m_color;
m_diffuseFactor = light.m_diffuseFactor;
m_innerAngle = light.m_innerAngle;
m_outerAngle = light.m_outerAngle;
m_radius = light.m_radius;
m_type = light.m_type;
return *this;
}