Added matrix

This commit is contained in:
2021-07-12 10:22:33 -07:00
parent df2ee3bf1b
commit e990d28a1f
11 changed files with 250 additions and 64 deletions

View File

@ -14,6 +14,7 @@
#include "display/camera.h"
#include "display/framebuffer.h"
#include "display/matrix.h"
#include "display/primitive.h"
#include "display/render.h"
#include "display/shader.h"

View File

@ -7,12 +7,13 @@
#pragma once
#include "../libs.h"
#include "matrix.h"
/** The math for the camera is stored here. */
typedef struct {
/** View Matrix (Where the camera looks) */
mat4 view;
matrix_t view;
/** Projection Matrix (How the camera looks) */
mat4 projection;
matrix_t projection;
} camera_t;

View File

@ -0,0 +1,18 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
/**
* Representation for a matrix. Used as a highlevel wrapper for the math
* functions that sit underneath this API.
*/
typedef struct {
/** Internal Matrix API */
mat4 internalMatrix;
} matrix_t;

View File

@ -13,29 +13,32 @@
#define SHADER_UNI_TEXT "u_Text"
#define SHADER_UNI_MODL "u_Modl"
/** Representation of a shader uniform */
typedef GLuint shaderuniform_t;
/**
* Structure containing information about an OpenGL Shader. For simplicity sake
* we demand certain uninforms to be present on the shader target.
*/
typedef struct {
/** Pointer to an uploaded vertex shader program */
GLuint shaderVertex;
shaderuniform_t shaderVertex;
/** Pointer to an uploaded fragment shader program */
GLuint shaderFrag;
shaderuniform_t shaderFrag;
/** Pointer to an uploaded shader program linked */
GLuint shaderProgram;
shaderuniform_t shaderProgram;
/** Matrix for the view matrix */
GLint uniView;
shaderuniform_t uniView;
/** Matrix for the projection matrix */
GLint uniProj;
shaderuniform_t uniProj;
/** Uniform for the current texture */
GLint uniText;
shaderuniform_t uniText;
/** Uniform for the current model world position */
GLint uniModl;
shaderuniform_t uniModl;
} shader_t;