Files
Graphics-Rasterizer/Model.h
IDunnoDev f5fd5b6756 Week8 [16/11] - [19/11]
Added Light Base Class
Added AmbientLight, DirectionalLight and PointLight Classes
Added Constructor to the Camera Class
Added Light CoEff's to the Model Class
Added Color Variables to Polygon3D Class
Added Light Vector to hold the lights in the Rasteriser
Added Camera Vector to hold multiple Cameras and Methods to set which is the current
Added Lighting to the Rasterizer
Added DrawSolidFlat method to the Rastorizer
Added Bounds Check to the SharedTools for Int and Float values
Added Color Enum Class
Added Normalize Method to the Vector3D Class
Renamed the TransformTools to SharedTools since adding more non transform methods to it
2021-12-11 17:05:43 +00:00

64 lines
1.7 KiB
C++

#pragma once
#include "Vector3D.h"
#include "Vertex.h"
#include "Polygon3D.h"
#include "Matrix.h"
#include "Camera.h"
#include <vector>
#include <algorithm>
using namespace std;
class Model
{
public:
Model();
~Model();
vector<Polygon3D>& GetPolygons(void);
const vector<Vertex>& GetVertices(void);
const vector<Matrix>& GetPendingTransforms(void);
size_t GetPolygonCount(void);
size_t GetVerticesCount(void);
size_t GetPendingTransformCount(void);
void AddVertex(float x, float y, float z);
void AddPolygon(int index0, int index1, int index2);
void EnqueueTransform(Matrix transform);
void ClearPendingTransforms();
const Polygon3D& GetPolygon(int index) const;
const Vertex& GetVertex(int polygonIndex, int vertexPolygonIndex) const;
const Vertex& GetVertex(int index) const;
void SetReflectionCoefficient(float red, float green, float blue);
void SetReflectionCoefficient(ColRef color, float value);
void SetRedReflectionCoefficient(float value);
void SetGreenReflectionCoefficient(float value);
void SetBlueReflectionCoefficient(float value);
float GetReflectionCoefficient(ColRef color) const;
float GetRedReflectionCoefficient() const;
float GetGreenReflectionCoefficient() const;
float GetBlueReflectionCoefficient() const;
void ApplyTransformToLocalVertices(const Matrix& transform);
void ApplyTransformToTransformedVertices(const Matrix& transform);
void DehomogenizeAllVertices(void);
void CalculateBackfaces(Camera& currentCamera);
void Sort(void);
private:
vector<Polygon3D> _polygons;
vector<Vertex> _vertices;
vector<Vertex> _transformedVertices;
vector<Matrix> _pendingTransforms;
float _kdRed;
float _kdGreen;
float _kdBlue;
};