Week7 [09/11] - [11/11]
Added Backface Culling Methods to the Model Class Added Depth, Normal and Culled Flag Variables to the Polygon3D Class Added Vector3D Class Added - operator to the Vertex Class Cleaned up Code, Adding Void to Params etc
This commit is contained in:
@ -9,6 +9,7 @@ Polygon3D::Polygon3D(int index0, int index1, int index2)
|
||||
_indices[0] = index0;
|
||||
_indices[1] = index1;
|
||||
_indices[2] = index2;
|
||||
_depth = 0.0f;
|
||||
}
|
||||
|
||||
Polygon3D::Polygon3D(const Polygon3D& other)
|
||||
@ -20,7 +21,7 @@ Polygon3D::~Polygon3D()
|
||||
{
|
||||
}
|
||||
|
||||
size_t Polygon3D::GetPolygonVertexCount()
|
||||
size_t Polygon3D::GetPolygonVertexCount() const
|
||||
{
|
||||
return sizeof(_indices) / sizeof(_indices[0]);
|
||||
}
|
||||
@ -30,6 +31,36 @@ int Polygon3D::GetIndex(const int index) const
|
||||
return _indices[index];
|
||||
}
|
||||
|
||||
void Polygon3D::SetNormal(const Vector3D& normal)
|
||||
{
|
||||
_normal = normal;
|
||||
}
|
||||
|
||||
Vector3D Polygon3D::GetNormal() const
|
||||
{
|
||||
return _normal;
|
||||
}
|
||||
|
||||
void Polygon3D::SetDepth(float depth)
|
||||
{
|
||||
_depth = depth;
|
||||
}
|
||||
|
||||
float Polygon3D::GetDepth() const
|
||||
{
|
||||
return _depth;
|
||||
}
|
||||
|
||||
void Polygon3D::SetCulled(bool culled)
|
||||
{
|
||||
_culled = culled;
|
||||
}
|
||||
|
||||
bool Polygon3D::GetCulled() const
|
||||
{
|
||||
return _culled;
|
||||
}
|
||||
|
||||
Polygon3D& Polygon3D::operator= (const Polygon3D& rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
@ -44,5 +75,8 @@ void Polygon3D::Copy(const Polygon3D& other)
|
||||
for (int i = 0; i < sizeof(_indices)/sizeof(_indices[0]); i++)
|
||||
{
|
||||
_indices[i] = other.GetIndex(i);
|
||||
_normal = other.GetNormal();
|
||||
_culled = other.GetCulled();
|
||||
_depth = other.GetDepth();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user