Draw FPS
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
#include "display/framebuffer/framebuffer.h"
|
||||
|
||||
void cameraInit(camera_t *camera) {
|
||||
cameraInitPerspective(camera);
|
||||
}
|
||||
|
||||
void cameraInitPerspective(camera_t *camera) {
|
||||
assertNotNull(camera, "Not a camera component");
|
||||
|
||||
camera->projType = CAMERA_PROJECTION_TYPE_PERSPECTIVE;
|
||||
@@ -24,6 +28,22 @@ void cameraInit(camera_t *camera) {
|
||||
glm_vec3_copy((vec3){ 0.0f, 0.0f, 0.0f }, camera->lookat.target);
|
||||
}
|
||||
|
||||
void cameraInitOrthographic(camera_t *camera) {
|
||||
assertNotNull(camera, "Not a camera component");
|
||||
|
||||
camera->projType = CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC;
|
||||
camera->orthographic.left = 0.0f;
|
||||
camera->orthographic.right = (float_t)frameBufferGetWidth(FRAMEBUFFER_BOUND);
|
||||
camera->orthographic.bottom = 0.0f;
|
||||
camera->orthographic.top = (float_t)frameBufferGetHeight(FRAMEBUFFER_BOUND);
|
||||
camera->nearClip = -1.0f;
|
||||
camera->farClip = 1.0f;
|
||||
|
||||
camera->viewType = CAMERA_VIEW_TYPE_2D;
|
||||
glm_vec3_copy((vec3){ 0.0f, 0.0f, 0.0f }, camera->_2d.position);
|
||||
camera->_2d.zoom = 1.0f;
|
||||
}
|
||||
|
||||
void cameraPushMatrix(camera_t *camera) {
|
||||
assertNotNull(camera, "Not a camera component");
|
||||
|
||||
|
@@ -59,10 +59,20 @@ typedef struct {
|
||||
} camera_t;
|
||||
|
||||
/**
|
||||
* Initializes a camera to default values.
|
||||
* Initializes a camera to default values. This calls cameraInitPerspective.
|
||||
*/
|
||||
void cameraInit(camera_t *camera);
|
||||
|
||||
/**
|
||||
* Initializes a camera for perspective projection.
|
||||
*/
|
||||
void cameraInitPerspective(camera_t *camera);
|
||||
|
||||
/**
|
||||
* Initializes a camera for orthographic projection.
|
||||
*/
|
||||
void cameraInitOrthographic(camera_t *camera);
|
||||
|
||||
/**
|
||||
* Pushes the camera's view matrix onto the matrix stack.
|
||||
*
|
||||
|
@@ -63,6 +63,11 @@ errorret_t displayInit(void) {
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
#endif
|
||||
|
||||
// Commands
|
||||
|
||||
// Variables
|
||||
consoleRegVar("fps", "0", NULL);
|
||||
|
||||
quadInit();
|
||||
frameBufferInitBackbuffer();
|
||||
spriteBatchInit();
|
||||
|
Reference in New Issue
Block a user