Files
Graphics-Rasterizer/Vertex.h
IDunnoDev cdb940f6aa Week10 [30/11] - [06/12]
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
2021-12-11 20:31:39 +00:00

85 lines
1.9 KiB
C++

#pragma once
#include "Vector3D.h"
#include "UVCoord.h"
#include "windows.h"
class Vertex
{
public:
Vertex();
Vertex(float x, float y, float z);
Vertex(float x, float y, float z, float w);
Vertex(const Vertex& other);
// Accessors
float GetX() const;
void SetX(const float x);
float GetY() const;
void SetY(const float y);
float GetZ() const;
void SetZ(const float z);
float GetW() const;
void SetW(const float w);
const int GetContributeCount() const;
void IncrementContributeCount();
void ResetContributeCount();
const Vector3D& GetNormal() const;
void SetNormal(float x, float y, float z);
void SetNormal(const Vector3D& normal);
void NormalizeNormal();
void ResetNormal(bool resetCount = false);
const COLORREF GetColor() const;
int GetR() const;
void SetR(const int r);
int GetG() const;
void SetG(const int g);
int GetB() const;
void SetB(const int b);
void SetColor(const int r, const int g, const int b);
void SetColor(const COLORREF colorIn);
int GetUVIndex() const;
void SetUVIndex(const int index);
// Accessors for returning the private x, y, z and w values as integeres instead of floats
// the ceil function to round the number up by defaults but using providing a false param will
// use the floor function instead to round the number down
int GetXInt(bool forceRoundUp = false) const;
int GetYInt(bool forceRoundUp = false) const;
int GetZInt(bool forceRoundUp = false) const;
int GetWInt(bool forceRoundUp = false) const;
void Dehomogenize();
// Assignment operator
Vertex& operator= (const Vertex& rhs);
bool operator== (const Vertex& rhs) const;
const Vertex operator+ (const Vertex& rhs) const;
const Vector3D operator- (const Vertex& rhs) const;
private:
float _x;
float _y;
float _z;
float _w;
float _zOriginal;
int _contributeCount;
Vector3D _normal;
int _r;
int _g;
int _b;
int _uvIndex;
void Copy(const Vertex& other);
};