From 96974a9d2bdcb9ecac091b75a4ec98055f506059 Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 23 Sep 2013 09:44:43 +0200 Subject: [PATCH] Fixed Light copy constructor/assignment operator Former-commit-id: dadf40b2e3a58ed32d9f38b8fea8d60d2297b767 --- src/Nazara/Graphics/Light.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Nazara/Graphics/Light.cpp b/src/Nazara/Graphics/Light.cpp index 8123e5990..14e4560b6 100644 --- a/src/Nazara/Graphics/Light.cpp +++ b/src/Nazara/Graphics/Light.cpp @@ -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; }