diff options
| -rw-r--r-- | gfx/include/gfx/util/skyquad.h | 14 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | /// A skyquad is like a skybox but with a single quad. | 1 | /// A skyquad is like a skybox but with a single quad. |
| 2 | #pragma once | 2 | #pragma once |
| 3 | 3 | ||
| 4 | typedef struct Gfx Gfx; | 4 | typedef struct RenderBackend RenderBackend; |
| 5 | typedef struct Scene Scene; | 5 | typedef struct Scene Scene; |
| 6 | typedef struct SceneNode SceneNode; | 6 | typedef struct SceneNode SceneNode; |
| 7 | typedef struct SceneObject SceneObject; | 7 | typedef struct SceneObject SceneObject; |
| 8 | typedef struct Texture Texture; | 8 | typedef struct Texture Texture; |
| 9 | 9 | ||
| 10 | /// Create a skyquad. | 10 | /// Create a skyquad. |
| 11 | SceneObject* gfx_make_skyquad(Gfx*, const Texture*); | 11 | SceneObject* gfx_make_skyquad(RenderBackend*, const Texture*); |
| 12 | 12 | ||
| 13 | /// Set up a skyquad in the scene. | 13 | /// Set up a skyquad in the scene. |
| 14 | /// | 14 | /// |
| @@ -19,4 +19,4 @@ SceneObject* gfx_make_skyquad(Gfx*, const Texture*); | |||
| 19 | /// Return the light node under which objects affected by the light can be | 19 | /// Return the light node under which objects affected by the light can be |
| 20 | /// rooted. | 20 | /// rooted. |
| 21 | SceneNode* gfx_setup_skyquad( | 21 | SceneNode* gfx_setup_skyquad( |
| 22 | Gfx*, SceneNode* root, const Texture* environment_map); | 22 | 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 @@ | |||
| 15 | 15 | ||
| 16 | #include <assert.h> | 16 | #include <assert.h> |
| 17 | 17 | ||
| 18 | SceneObject* gfx_make_skyquad(Gfx* gfx, const Texture* texture) { | 18 | SceneObject* gfx_make_skyquad( |
| 19 | assert(gfx); | 19 | RenderBackend* render_backend, const Texture* texture) { |
| 20 | assert(texture); | ||
| 21 | |||
| 22 | // TODO: pass RenderBackend directly? | ||
| 23 | RenderBackend* render_backend = gfx_get_render_backend(gfx); | ||
| 24 | assert(render_backend); | 20 | assert(render_backend); |
| 21 | assert(texture); | ||
| 25 | 22 | ||
| 26 | ShaderProgram* shader = 0; | 23 | ShaderProgram* shader = 0; |
| 27 | Geometry* geometry = 0; | 24 | Geometry* geometry = 0; |
| @@ -96,7 +93,7 @@ static SceneNode* make_environment_light( | |||
| 96 | 93 | ||
| 97 | light = gfx_make_light(&(LightDesc){ | 94 | light = gfx_make_light(&(LightDesc){ |
| 98 | .type = EnvironmentLightType, | 95 | .type = EnvironmentLightType, |
| 99 | .light = (EnvironmentLightDesc){.environment_map = environment_light}}); | 96 | .light = {(EnvironmentLightDesc){.environment_map = environment_light}}}); |
| 100 | if (!light) { | 97 | if (!light) { |
| 101 | goto cleanup; | 98 | goto cleanup; |
| 102 | } | 99 | } |
| @@ -120,8 +117,9 @@ cleanup: | |||
| 120 | } | 117 | } |
| 121 | 118 | ||
| 122 | SceneNode* gfx_setup_skyquad( | 119 | SceneNode* gfx_setup_skyquad( |
| 123 | Gfx* gfx, SceneNode* root, const Texture* environment_map) { | 120 | RenderBackend* render_backend, SceneNode* root, |
| 124 | assert(gfx); | 121 | const Texture* environment_map) { |
| 122 | assert(render_backend); | ||
| 125 | assert(root); | 123 | assert(root); |
| 126 | assert(environment_map); | 124 | assert(environment_map); |
| 127 | 125 | ||
| @@ -130,7 +128,7 @@ SceneNode* gfx_setup_skyquad( | |||
| 130 | SceneNode* light_node = 0; | 128 | SceneNode* light_node = 0; |
| 131 | 129 | ||
| 132 | // Create the skyquad object. | 130 | // Create the skyquad object. |
| 133 | skyquad_object = gfx_make_skyquad(gfx, environment_map); | 131 | skyquad_object = gfx_make_skyquad(render_backend, environment_map); |
| 134 | if (!skyquad_object) { | 132 | if (!skyquad_object) { |
| 135 | goto cleanup; | 133 | goto cleanup; |
| 136 | } | 134 | } |
