Dawn/temp/frame.c

45 lines
1.3 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "frame.h"
void pokerFrameInit(poker_t *poker, render_t *render) {
frameBufferInit(&poker->frameWorld, render->width, render->height);
frameBufferInit(&poker->frameGui, render->width, render->height);
}
void pokerFrameWorld(poker_t *poker, render_t *render) {
// Update the frame buffer
frameBufferResize(&poker->frameWorld, render->width, render->height);
// Correct the aspect on the perspective camera for the world
cameraPerspective(&poker->cameraWorld, 20,
render->width / render->height,
0.001, 1000
);
shaderUseCamera(&poker->shader, &poker->cameraWorld);
}
void pokerFrameGui(poker_t *poker, render_t *render) {
// Update FB
frameBufferResize(&poker->frameGui, render->width, render->height);
poker->guiWidth = ((float)POKER_GUI_HEIGHT/render->height) * render->width;
// frameBufferUse(&poker->frameGui, true);
// Correct aspect on the ortho camera
cameraOrtho(&poker->cameraGui,
0, poker->guiWidth,
POKER_GUI_HEIGHT, 0,
0.01, 100
);
cameraLookAt(&poker->cameraGui, 0, 0, 5, 0, 0, 0);
shaderUseCamera(&poker->shader, &poker->cameraGui);
}
void pokerFrameRender(poker_t *poker, render_t *render) {
}