From 35558f3c8a835103fb0b8f07b1c6efdb9bd087e8 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 12 Jun 2023 09:13:29 -0700 Subject: Let skyquad take RenderBackend directly. --- gfx/include/gfx/util/skyquad.h | 14 +++++++------- gfx/src/util/skyquad.c | 18 ++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gfx/include/gfx/util/skyquad.h b/gfx/include/gfx/util/skyquad.h index f792a13..923c6e5 100644 --- a/gfx/include/gfx/util/skyquad.h +++ b/gfx/include/gfx/util/skyquad.h @@ -1,14 +1,14 @@ /// A skyquad is like a skybox but with a single quad. #pragma once -typedef struct Gfx Gfx; -typedef struct Scene Scene; -typedef struct SceneNode SceneNode; -typedef struct SceneObject SceneObject; -typedef struct Texture Texture; +typedef struct RenderBackend RenderBackend; +typedef struct Scene Scene; +typedef struct SceneNode SceneNode; +typedef struct SceneObject SceneObject; +typedef struct Texture Texture; /// Create a skyquad. -SceneObject* gfx_make_skyquad(Gfx*, const Texture*); +SceneObject* gfx_make_skyquad(RenderBackend*, const Texture*); /// Set up a skyquad in the scene. /// @@ -19,4 +19,4 @@ SceneObject* gfx_make_skyquad(Gfx*, const Texture*); /// Return the light node under which objects affected by the light can be /// rooted. SceneNode* gfx_setup_skyquad( - Gfx*, SceneNode* root, const Texture* environment_map); + RenderBackend*, SceneNode* root, const Texture* environment_map); diff --git a/gfx/src/util/skyquad.c b/gfx/src/util/skyquad.c index b59d7b9..d0f1cb0 100644 --- a/gfx/src/util/skyquad.c +++ b/gfx/src/util/skyquad.c @@ -15,13 +15,10 @@ #include -SceneObject* gfx_make_skyquad(Gfx* gfx, const Texture* texture) { - assert(gfx); - assert(texture); - - // TODO: pass RenderBackend directly? - RenderBackend* render_backend = gfx_get_render_backend(gfx); +SceneObject* gfx_make_skyquad( + RenderBackend* render_backend, const Texture* texture) { assert(render_backend); + assert(texture); ShaderProgram* shader = 0; Geometry* geometry = 0; @@ -96,7 +93,7 @@ static SceneNode* make_environment_light( light = gfx_make_light(&(LightDesc){ .type = EnvironmentLightType, - .light = (EnvironmentLightDesc){.environment_map = environment_light}}); + .light = {(EnvironmentLightDesc){.environment_map = environment_light}}}); if (!light) { goto cleanup; } @@ -120,8 +117,9 @@ cleanup: } SceneNode* gfx_setup_skyquad( - Gfx* gfx, SceneNode* root, const Texture* environment_map) { - assert(gfx); + RenderBackend* render_backend, SceneNode* root, + const Texture* environment_map) { + assert(render_backend); assert(root); assert(environment_map); @@ -130,7 +128,7 @@ SceneNode* gfx_setup_skyquad( SceneNode* light_node = 0; // Create the skyquad object. - skyquad_object = gfx_make_skyquad(gfx, environment_map); + skyquad_object = gfx_make_skyquad(render_backend, environment_map); if (!skyquad_object) { goto cleanup; } -- cgit v1.2.3