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

34 lines
1.1 KiB
C++

#pragma once
#include "Matrix.h"
#include <cmath>
enum class Axis { X, Y, Z };
enum class ColRef { Red, Green, Blue };
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);
};