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
This commit is contained in:
37
Model.h
37
Model.h
@ -4,33 +4,56 @@
|
||||
#include "Polygon3D.h"
|
||||
#include "Matrix.h"
|
||||
#include "Camera.h"
|
||||
#include "Texture.h"
|
||||
#include "UVCoord.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
enum class DrawMethod { Wireframe, Flat, FlatRaster, Smooth, Textured };
|
||||
|
||||
class Model
|
||||
{
|
||||
public:
|
||||
Model();
|
||||
Model(string MD2Filename, string textureFilename);
|
||||
~Model();
|
||||
|
||||
string GetModelFilename() const;
|
||||
const char* CGetModelFilename() const;
|
||||
string GetTextureFilename() const;
|
||||
const char* CGetTextureFilename() const;
|
||||
|
||||
void SetActive(bool value);
|
||||
void ToggleActive();
|
||||
bool GetActive() const;
|
||||
|
||||
void SetDrawMethod(DrawMethod method);
|
||||
DrawMethod GetDrawMethod() const;
|
||||
|
||||
vector<Polygon3D>& GetPolygons(void);
|
||||
vector<Vertex>& GetVertices(void);
|
||||
vector<UVCoord>& GetUVCoords(void);
|
||||
const vector<Matrix>& GetPendingTransforms(void);
|
||||
|
||||
size_t GetPolygonCount(void);
|
||||
size_t GetVerticesCount(void);
|
||||
size_t GetUVCoordCount(void);
|
||||
size_t GetPendingTransformCount(void);
|
||||
|
||||
void AddVertex(float x, float y, float z);
|
||||
void AddPolygon(int index0, int index1, int index2);
|
||||
void AddPolygon(int index0, int index1, int index2, int uvIndex0, int uvIndex1, int uvIndex2);
|
||||
void AddTextureUV(float u, float v);
|
||||
void EnqueueTransform(Matrix transform);
|
||||
void ClearPendingTransforms();
|
||||
|
||||
Texture& GetTexture();
|
||||
const Polygon3D& GetPolygon(int index) const;
|
||||
const Vertex& GetVertex(int polygonIndex, int vertexPolygonIndex) const;
|
||||
const Vertex& GetVertex(int index) const;
|
||||
const Vertex& GetVertex(int index) const;
|
||||
const UVCoord& GetUVCoord(int index) const;
|
||||
|
||||
vector<Vertex> GetPolygonVertexArray(int index) const;
|
||||
void SetPolygonColor(int index, COLORREF color);
|
||||
@ -60,9 +83,19 @@ private:
|
||||
vector<Vertex> _vertices;
|
||||
vector<Vertex> _transformedVertices;
|
||||
vector<Matrix> _pendingTransforms;
|
||||
|
||||
vector<UVCoord> _uvCoords;
|
||||
|
||||
Texture _texture;
|
||||
|
||||
float _kdRed;
|
||||
float _kdGreen;
|
||||
float _kdBlue;
|
||||
|
||||
bool _active;
|
||||
DrawMethod _drawMethod;
|
||||
|
||||
string _modelMD2Filename;
|
||||
string _modelTextureFilename;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user