Week5 [26/10]
Added the Z Access to the Matrix class Added the Identity Matrix Method to the Matrix Class Added MD2Loader Class Added Model Class Added Polygon Class Added Clear Viewport Method to Rasterizer Added Z Axis to the Vertex Class Updated Transformation Matrices to pass a matrix back so that we can do the multiplication at once
This commit is contained in:
43
Polygon3D.cpp
Normal file
43
Polygon3D.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "Polygon3D.h"
|
||||
|
||||
Polygon3D::Polygon3D() : _indices{ 0 }
|
||||
{
|
||||
}
|
||||
|
||||
Polygon3D::Polygon3D(int index0, int index1, int index2)
|
||||
{
|
||||
_indices[0] = index0;
|
||||
_indices[1] = index1;
|
||||
_indices[2] = index2;
|
||||
}
|
||||
|
||||
Polygon3D::Polygon3D(const Polygon3D& other)
|
||||
{
|
||||
Copy(other);
|
||||
}
|
||||
|
||||
Polygon3D::~Polygon3D()
|
||||
{
|
||||
}
|
||||
|
||||
int Polygon3D::GetIndex(const int index) const
|
||||
{
|
||||
return _indices[index];
|
||||
}
|
||||
|
||||
Polygon3D& Polygon3D::operator= (const Polygon3D& rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
Copy(rhs);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Polygon3D::Copy(const Polygon3D& other)
|
||||
{
|
||||
for (int i = 0; i < sizeof(_indices)/sizeof(_indices[0]); i++)
|
||||
{
|
||||
_indices[i] = other.GetIndex(i);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user