
Added Lighting Changes for Vertex Normal Calculation Added Method to Get a Polygons Vertices as a Vector array Added Methods to Add the Color to a Polygon and Vertex Object Added Normalization to the Polygon normal vector Added Vector Normal Calculation to the Model Class Added Light Calculation method to the Rasterizer Class Added Flag to Rasterizer to stop processing when the screen is minimised Added Flat and Gouraud Drawing Methods to the Resterizer Added Standard and INT triangle drawing Methods Added Function to mimic sgn function from Java Added Length to Vector3D class Added / operator to Vector3D class Added Get(x,y,z,w)Int methods to Vertex class Changed Color Variables on the Vertex/Polygon classes to use r, g and b values rather than COLORREF Changed Camera translation functions to use normal Translation Functions Cleaned up Code Removed Unused code from the Camera Class
46 lines
899 B
C++
46 lines
899 B
C++
#pragma once
|
|
#include "Vector3D.h"
|
|
#include "SharedTools.h"
|
|
#include "windows.h"
|
|
|
|
using namespace SharedTools;
|
|
|
|
class Polygon3D
|
|
{
|
|
public:
|
|
Polygon3D();
|
|
Polygon3D(int index0, int index1, int index2);
|
|
Polygon3D(const Polygon3D& other);
|
|
|
|
~Polygon3D();
|
|
|
|
size_t GetPolygonVertexCount() const;
|
|
|
|
int GetIndex(int index) const;
|
|
|
|
void SetNormal(const Vector3D& normal);
|
|
const Vector3D& GetNormal() const;
|
|
void NormalizeNormal();
|
|
|
|
void SetColor(int red, int green, int blue);
|
|
void SetColor(const COLORREF color);
|
|
COLORREF GetColor() const;
|
|
|
|
void SetDepth(float depth);
|
|
float GetDepth() const;
|
|
void SetCulled(bool culled);
|
|
bool GetCulled() const;
|
|
|
|
Polygon3D& operator= (const Polygon3D& rhs);
|
|
|
|
private:
|
|
int _indices[3];
|
|
Vector3D _normal;
|
|
float _depth;
|
|
bool _culled;
|
|
COLORREF _color;
|
|
|
|
void Copy(const Polygon3D& other);
|
|
};
|
|
|