summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/texture_view.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/texture_view.c b/src/plugins/texture_view.c
index a8b2a94..98ff603 100644
--- a/src/plugins/texture_view.c
+++ b/src/plugins/texture_view.c
@@ -13,8 +13,10 @@
13#include <stdlib.h> 13#include <stdlib.h>
14 14
15// Default texture to load if no texture is provided. 15// Default texture to load if no texture is provided.
16static const char* DEFAULT_TEXTURE = "/assets/skybox/clouds1/clouds1_west.bmp"; 16static const char* DEFAULT_TEXTURE =
17// static const char* DEFAULT_TEXTURE = "/assets/checkerboard.jpg"; 17 "/home/jeanne/Nextcloud/assets/textures/skybox/clouds1/clouds1_west.bmp";
18// static const char* DEFAULT_TEXTURE =
19// "/home/jeanne/Nextcloud/assets/textures/checkerboard.jpg";
18 20
19struct State { 21struct State {
20 Scene* scene; 22 Scene* scene;
@@ -36,12 +38,12 @@ bool init(Game* game, State** pp_state) {
36 GfxCore* gfxcore = gfx_get_core(game->gfx); 38 GfxCore* gfxcore = gfx_get_core(game->gfx);
37 39
38 const Texture* texture = gfx_load_texture( 40 const Texture* texture = gfx_load_texture(
39 game->gfx, &(LoadTextureCmd){ 41 game->gfx,
40 .origin = AssetFromFile, 42 &(LoadTextureCmd){.origin = AssetFromFile,
41 .type = LoadTexture, 43 .type = LoadTexture,
42 .filtering = LinearFiltering, 44 .filtering = LinearFiltering,
43 .mipmaps = false, 45 .mipmaps = false,
44 .data.texture.filepath = mstring_make(texture_file)}); 46 .data.texture.filepath = mstring_make(texture_file)});
45 if (!texture) { 47 if (!texture) {
46 goto cleanup; 48 goto cleanup;
47 } 49 }
@@ -57,11 +59,10 @@ bool init(Game* game, State** pp_state) {
57 } 59 }
58 60
59 MaterialDesc material_desc = (MaterialDesc){.num_uniforms = 1}; 61 MaterialDesc material_desc = (MaterialDesc){.num_uniforms = 1};
60 material_desc.uniforms[0] = (ShaderUniform){ 62 material_desc.uniforms[0] = (ShaderUniform){.type = UniformTexture,
61 .type = UniformTexture, 63 .value.texture = texture,
62 .value.texture = texture, 64 .name = sstring_make("Texture")};
63 .name = sstring_make("Texture")}; 65 Material* material = gfx_make_material(&material_desc);
64 Material* material = gfx_make_material(&material_desc);
65 if (!material) { 66 if (!material) {
66 goto cleanup; 67 goto cleanup;
67 } 68 }
@@ -123,10 +124,9 @@ void render(const Game* game, const State* state) {
123 124
124 Renderer* renderer = gfx_get_renderer(game->gfx); 125 Renderer* renderer = gfx_get_renderer(game->gfx);
125 gfx_render_scene( 126 gfx_render_scene(
126 renderer, &(RenderSceneParams){ 127 renderer, &(RenderSceneParams){.mode = RenderDefault,
127 .mode = RenderDefault, 128 .scene = state->scene,
128 .scene = state->scene, 129 .camera = state->camera});
129 .camera = state->camera});
130} 130}
131 131
132void resize(Game* game, State* state, int width, int height) { 132void resize(Game* game, State* state, int width, int height) {