#include "AmbientLight.h" AmbientLight::AmbientLight(const AmbientLight& other) : Light(other) { Copy(other); } COLORREF AmbientLight::CalculateLightShared(const Model& currentModel, COLORREF colorIn) { float workingRed = (float)GetRedLightIntensity(); float workingGreen = (float)GetGreenLightIntensity(); float workingBlue = (float)GetBlueLightIntensity(); workingRed *= currentModel.GetRedReflectionCoefficient(); workingGreen *= currentModel.GetGreenReflectionCoefficient(); workingBlue *= currentModel.GetBlueReflectionCoefficient(); workingRed += (float)GetRValue(colorIn); workingGreen += (float)GetGValue(colorIn); workingBlue += (float)GetBValue(colorIn); int finalRed = BoundsCheck(0, 255, (int)workingRed); int finalGreen = BoundsCheck(0, 255, (int)workingGreen); int finalBlue = BoundsCheck(0, 255, (int)workingBlue); COLORREF outputColor = RGB(finalRed, finalGreen, finalBlue); return outputColor; } COLORREF AmbientLight::CalculateLight(const Model& currentModel, const Polygon3D& currentPolygon, COLORREF colorIn) { return CalculateLightShared(currentModel, colorIn); } COLORREF AmbientLight::CalculateLight(const Model& currentModel, const Vertex& currentVertex, COLORREF colorIn) { return CalculateLightShared(currentModel, colorIn); } AmbientLight& AmbientLight::operator= (const AmbientLight& rhs) { if (this != &rhs) { Copy(rhs); } return *this; } void AmbientLight::Copy(const AmbientLight& other) { Light::Copy(other); }