Files
Graphics-Rasterizer/SharedTools.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

40 lines
1.2 KiB
C++

#pragma once
#include "Vertex.h"
#include "Matrix.h"
#include <cmath>
enum class Axis { X, Y, Z };
enum class ColRef { Red, Green, Blue };
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
namespace SharedTools
{
const float PI = (float)acos(-1);
int BoundsCheck(int min, int max, int value);
float BoundsCheck(float min, float max, float value);
Matrix GetTranslateMatrix(const float x, const float y, const float z);
Matrix GetTranslateMatrix(const Vertex& position);
Matrix GetScaleMatrix(const float x, const float y, const float z);
Matrix GetRotationMatrix(const Axis rotAxis, const float rotDegrees);
Matrix GetRotationMatrixFromPoint(const Axis rotAxis, const float rotDegrees, const float x, const float y, const float z);
Matrix GetOrthegraphicProjectionMatrix(float d);
Matrix GetPerspectiveProjectionMatrix(float d, float aspectRatio);
Matrix GetViewMatrix(float d, int width, int height);
Matrix GetCameraRotationMatrix(const Axis rotAxis, const float rotDegrees);
Matrix GetCameraTranslateMatrix(const float x, const float y, const float z);
Matrix GetCameraTranslateMatrix(const Vertex& position);
float DegreesToRadians(const float degrees);
};