First render.

This commit is contained in:
2023-11-17 00:02:04 -06:00
parent 55f629c7b5
commit 490da9d0c1
43 changed files with 1039 additions and 67 deletions

View File

@ -7,14 +7,15 @@
#include "assert/assertgl.hpp"
#include "assert/assert.hpp"
#include "game/Game.hpp"
#include "display/RenderPipeline.hpp"
using namespace Dawn;
RenderHost::RenderHost() {
RenderHost::RenderHost() : IRenderHost() {
}
void RenderHost::init(std::shared_ptr<Game> game) {
void RenderHost::init(const std::shared_ptr<Game> game) {
// Init GLFW
if(!glfwInit()) {
assertUnreachable("Failed to initialize GLFW!");
@ -80,10 +81,30 @@ void RenderHost::init(std::shared_ptr<Game> game) {
// });
}
void RenderHost::update() {
void RenderHost::update(const std::shared_ptr<Game> game) {
// Prepare the initial values
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
assertNoGLError();
glBlendFuncSeparate(
GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA,
GL_ONE,
GL_ONE_MINUS_SRC_ALPHA
);
assertNoGLError();
glDepthMask(GL_TRUE);
assertNoGLError();
glDepthFunc(GL_LESS);
assertNoGLError();
// Pipeline
renderPipeline.render(game);
// Tick the engine.
glfwSwapBuffers(window);
// Update events
glfwPollEvents();
}

View File

@ -25,8 +25,8 @@ namespace Dawn {
*/
RenderHost();
void init(std::shared_ptr<Game> game) override;
void update() override;
void init(const std::shared_ptr<Game> game) override;
void update(const std::shared_ptr<Game> game) override;
bool_t isCloseRequested() override;
std::shared_ptr<RenderTarget> getBackBufferRenderTarget() override;