
Added active Variable to the Lights Classes Added updated MD2Loader Class Added Model Filename and Texture File Name to the Model Class Added Active Flag to the Model Class Added DrawMode to the Model Class Added Texture and UV Variables to the Model Class Added UV Coordinates to the Polygon3D Class Added DrawString method to the Rasterizer to write text to the screen space Added Interpolate and Lerp Methods to the Rasterizer Added Select statement for drawing a current models draw mode Added DrawTextured Method to the Rasterizer Class Added UVCoord Class Added Texture Class Added = operator to the Vector3D Class Added UVCoord to the Vertex Class Moved Models and Texture Files into a subfolder Fixed issue with textures not loading properly because of the vector address problem
130 lines
2.0 KiB
C++
130 lines
2.0 KiB
C++
#include "Light.h"
|
|
|
|
Light::Light()
|
|
{
|
|
SetLightIntensity(255, 255, 255);
|
|
_active = true;
|
|
}
|
|
|
|
Light::Light(int red, int green, int blue)
|
|
{
|
|
SetLightIntensity(red, green, blue);
|
|
_active = true;
|
|
}
|
|
|
|
Light::Light(const Light& other)
|
|
{
|
|
Copy(other);
|
|
}
|
|
|
|
Light::~Light()
|
|
{
|
|
}
|
|
|
|
void Light::SetLightIntensity(int red, int green, int blue)
|
|
{
|
|
_liRed = BoundsCheck(0, 255, red);
|
|
_liGreen = BoundsCheck(0, 255, green);
|
|
_liBlue = BoundsCheck(0, 255, blue);
|
|
}
|
|
|
|
void Light::SetLightIntensity(ColRef color, int value)
|
|
{
|
|
int valueChecked = BoundsCheck(0, 255, value);
|
|
|
|
switch (color)
|
|
{
|
|
default:
|
|
case ColRef::Red:
|
|
_liRed = valueChecked;
|
|
break;
|
|
case ColRef::Green:
|
|
_liGreen = valueChecked;
|
|
break;
|
|
case ColRef::Blue:
|
|
_liBlue = valueChecked;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void Light::SetRedLightIntensity(int value)
|
|
{
|
|
SetLightIntensity(ColRef::Red, value);
|
|
}
|
|
|
|
void Light::SetGreenLightIntensity(int value)
|
|
{
|
|
SetLightIntensity(ColRef::Green, value);
|
|
}
|
|
|
|
void Light::SetBlueLightIntensity(int value)
|
|
{
|
|
SetLightIntensity(ColRef::Blue, value);
|
|
}
|
|
|
|
int Light::GetLightIntensity(ColRef color) const
|
|
{
|
|
int result;
|
|
switch (color)
|
|
{
|
|
default:
|
|
case ColRef::Red:
|
|
result = _liRed;
|
|
break;
|
|
case ColRef::Green:
|
|
result = _liGreen;
|
|
break;
|
|
case ColRef::Blue:
|
|
result = _liBlue;
|
|
break;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
int Light::GetRedLightIntensity() const
|
|
{
|
|
return GetLightIntensity(ColRef::Red);
|
|
}
|
|
|
|
int Light::GetGreenLightIntensity() const
|
|
{
|
|
return GetLightIntensity(ColRef::Green);
|
|
}
|
|
|
|
int Light::GetBlueLightIntensity() const
|
|
{
|
|
return GetLightIntensity(ColRef::Blue);
|
|
}
|
|
|
|
bool Light::GetLightActive() const
|
|
{
|
|
return _active;
|
|
}
|
|
|
|
void Light::SetLightActive(bool active)
|
|
{
|
|
_active = active;
|
|
}
|
|
|
|
void Light::ToggleLightActive()
|
|
{
|
|
_active = !_active;
|
|
}
|
|
|
|
Light& Light::operator= (const Light& rhs)
|
|
{
|
|
if (this != &rhs)
|
|
{
|
|
Copy(rhs);
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
void Light::Copy(const Light& other)
|
|
{
|
|
_liRed = other.GetRedLightIntensity();
|
|
_liGreen = other.GetGreenLightIntensity();
|
|
_liBlue = other.GetBlueLightIntensity();
|
|
_active = other.GetLightActive();
|
|
} |