
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
50 lines
1.1 KiB
C++
50 lines
1.1 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();
|
|
|
|
const 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 Vertex& GetVertex(int polygonIndex, int vertexPolygonIndex);
|
|
const Vertex& GetVertex(int index);
|
|
|
|
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;
|
|
|
|
};
|
|
|