Files
Graphics-Rasterizer/Polygon3D.cpp
IDunnoDev 19639d70d1 Week6 [02/11] - [04/11]
Added Camera Class
Added *= operator to the matrix class
Added Transformation Queue vector to the Model Class
Added Get Vertex, Polygon and Polygon Vertex methods to the Model Class
Added DehomogenizeAllVerticies method to the Model Class
Added GetPolygonVertexCount method to Polygon Class
Added Ability to have multiple models in a "scene" in the Rasterizer
Added DrawWireFrame method to the Rasterizer Class
Added Aspect Ratio and View Matrix to the Rasterizer Class
Added TransformTools namespace to hold shared transformation functions
Added Dehomogenize method to the Vector Class
Moved Transformation methods to a new shared name space
2021-12-11 14:15:02 +00:00

48 lines
730 B
C++

#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()
{
}
size_t Polygon3D::GetPolygonVertexCount()
{
return sizeof(_indices) / sizeof(_indices[0]);
}
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);
}
}