Week8 [16/11] - [19/11]
Added Light Base Class Added AmbientLight, DirectionalLight and PointLight Classes Added Constructor to the Camera Class Added Light CoEff's to the Model Class Added Color Variables to Polygon3D Class Added Light Vector to hold the lights in the Rasteriser Added Camera Vector to hold multiple Cameras and Methods to set which is the current Added Lighting to the Rasterizer Added DrawSolidFlat method to the Rastorizer Added Bounds Check to the SharedTools for Int and Float values Added Color Enum Class Added Normalize Method to the Vector3D Class Renamed the TransformTools to SharedTools since adding more non transform methods to it
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
Polygon3D::Polygon3D() : _indices{ 0 }
|
||||
{
|
||||
_depth = 0.0f;
|
||||
_color = RGB(0, 0, 0);
|
||||
}
|
||||
|
||||
Polygon3D::Polygon3D(int index0, int index1, int index2)
|
||||
@ -10,6 +12,7 @@ Polygon3D::Polygon3D(int index0, int index1, int index2)
|
||||
_indices[1] = index1;
|
||||
_indices[2] = index2;
|
||||
_depth = 0.0f;
|
||||
_color = RGB(0, 0, 0);
|
||||
}
|
||||
|
||||
Polygon3D::Polygon3D(const Polygon3D& other)
|
||||
@ -41,6 +44,25 @@ Vector3D Polygon3D::GetNormal() const
|
||||
return _normal;
|
||||
}
|
||||
|
||||
void Polygon3D::SetColor(int red, int green, int blue)
|
||||
{
|
||||
int redChecked = BoundsCheck(0, 255, red);
|
||||
int greenChecked = BoundsCheck(0, 255, green);
|
||||
int blueChecked = BoundsCheck(0, 255, blue);
|
||||
|
||||
_color = RGB(redChecked, greenChecked, blueChecked);
|
||||
}
|
||||
|
||||
void Polygon3D::SetColor(const COLORREF color)
|
||||
{
|
||||
_color = color;
|
||||
}
|
||||
|
||||
COLORREF Polygon3D::GetColor() const
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
void Polygon3D::SetDepth(float depth)
|
||||
{
|
||||
_depth = depth;
|
||||
@ -78,5 +100,6 @@ void Polygon3D::Copy(const Polygon3D& other)
|
||||
_normal = other.GetNormal();
|
||||
_culled = other.GetCulled();
|
||||
_depth = other.GetDepth();
|
||||
_color = other.GetColor();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user