Refactored.
This commit is contained in:
18
include/dawn/display/camera.h
Normal file
18
include/dawn/display/camera.h
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Msters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/** The math for the camera is stored here. */
|
||||
typedef struct {
|
||||
/** View Matrix (Where the camera looks) */
|
||||
mat4 view;
|
||||
|
||||
/** Projection Matrix (How the camera looks) */
|
||||
mat4 projection;
|
||||
} camera_t;
|
30
include/dawn/display/primitive.h
Normal file
30
include/dawn/display/primitive.h
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
#define PRIMITIVE_POSITIONS_PER_VERTICE 3
|
||||
#define PRIMITIVE_COORDINATES_PER_VERTICE 2
|
||||
|
||||
/** Structure containing information about a primitive */
|
||||
typedef struct {
|
||||
int32_t verticeCount;
|
||||
int32_t indiceCount;
|
||||
|
||||
GLuint vertexBuffer;
|
||||
GLuint indexBuffer;
|
||||
} primitive_t;
|
||||
|
||||
/** Structure containing vertice position information */
|
||||
typedef struct {
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
} vertice_t;
|
||||
|
||||
/** Indice that references a specific vertice */
|
||||
typedef unsigned int indice_t;
|
19
include/dawn/display/render.h
Normal file
19
include/dawn/display/render.h
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2021 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/**
|
||||
* Contains information about the current render state, can be used for querying
|
||||
* how the renderer is currently set up.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Resolution (in pixels) */
|
||||
int32_t width, height;
|
||||
} render_t;
|
||||
|
||||
/** Current render state */
|
||||
extern render_t RENDER_STATE;
|
41
include/dawn/display/shader.h
Normal file
41
include/dawn/display/shader.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Msters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
#define SHADER_UNI_VIEW "u_View"
|
||||
#define SHADER_UNI_PROJ "u_Proj"
|
||||
#define SHADER_UNI_TEXT "u_Text"
|
||||
#define SHADER_UNI_MODL "u_Modl"
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/** Pointer to an uploaded fragment shader program */
|
||||
GLuint shaderFrag;
|
||||
|
||||
/** Pointer to an uploaded shader program linked */
|
||||
GLuint shaderProgram;
|
||||
|
||||
/** Matrix for the view matrix */
|
||||
GLint uniView;
|
||||
|
||||
/** Matrix for the projection matrix */
|
||||
GLint uniProj;
|
||||
|
||||
/** Uniform for the current texture */
|
||||
GLint uniText;
|
||||
|
||||
/** Uniform for the current model world position */
|
||||
GLint uniModl;
|
||||
} shader_t;
|
21
include/dawn/display/spritebatch.h
Normal file
21
include/dawn/display/spritebatch.h
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/** Definition of a Sprite Batch. */
|
||||
typedef struct {
|
||||
/** Maximum sprites the batch can hold. */
|
||||
int32_t maxSprites;
|
||||
|
||||
/** The current/next sprite index. */
|
||||
int32_t currentSprite;
|
||||
|
||||
/** Internal primitive */
|
||||
primitive_t *primitive;
|
||||
} spritebatch_t;
|
23
include/dawn/display/texture.h
Normal file
23
include/dawn/display/texture.h
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2021 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/**
|
||||
* Structure detailing information about a texture.
|
||||
* Because we plan to upload the pixels of a texture into the GPU, we don't
|
||||
* store the pixels in memory because we don't need to!
|
||||
*/
|
||||
typedef struct {
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
GLuint id;
|
||||
} texture_t;
|
||||
|
||||
/** Information about a single pixel. */
|
||||
typedef struct {
|
||||
uint8_t r, g, b, a ;
|
||||
} pixel_t;
|
24
include/dawn/display/tileset.h
Normal file
24
include/dawn/display/tileset.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2021 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/** Division of a texture */
|
||||
typedef struct {
|
||||
float x0, y0, x1, y1;
|
||||
} tilesetdiv_t;
|
||||
|
||||
/** Definition of a Tileset */
|
||||
typedef struct {
|
||||
/** Count of X/Y divisions */
|
||||
int32_t columns, rows;
|
||||
|
||||
/** Count of divisions (unused) */
|
||||
int32_t count;
|
||||
|
||||
/** Division information */
|
||||
tilesetdiv_t *divisions;
|
||||
} tileset_t;
|
Reference in New Issue
Block a user