From 20428597b64a5de2f39cc01e1070a24eb9c24944 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sun, 14 Nov 2021 23:25:26 -0800 Subject: [PATCH] Fixed texture generation for 3 channel textures --- CMakeLists.txt | 41 ++++++++++++------------------ src/game/poker/scenes/gamescene.c | 4 --- tools/display/texture_generation.c | 12 ++++++--- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be8b71c4..fcd81207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,18 +88,18 @@ elseif(TARGET_TYPE STREQUAL game) tool_vn_character(vn_penny ${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite ) - # tool_vn_character(vn_lucy - # ${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite - # ) - # tool_vn_character(vn_julie - # ${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite - # ) - # tool_vn_character(vn_sammy - # ${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite - # ) - # tool_vn_character(vn_jenny - # ${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite - # ) + tool_vn_character(vn_lucy + ${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite + ) + tool_vn_character(vn_julie + ${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite + ) + tool_vn_character(vn_sammy + ${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite + ) + tool_vn_character(vn_jenny + ${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite + ) # World tool_copy(texture_pub @@ -118,10 +118,10 @@ elseif(TARGET_TYPE STREQUAL game) texture_test vn_penny - # vn_lucy - # vn_julie - # vn_sammy - # vn_jenny + vn_lucy + vn_julie + vn_sammy + vn_jenny locale_en ) @@ -136,16 +136,7 @@ elseif(TARGET_TYPE STREQUAL game) GAME_VERSION=1.0 ) - set(DIR_CHARS "${ASSETS_SOURCE_DIR}/poker/characters") - tool_vn_character(vn_penny - ${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite - ) - tool_vn_character(vn_sammy - ${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite - ) tool_assets( - vn_penny - vn_sammy shader_textured font_opensans texture_test diff --git a/src/game/poker/scenes/gamescene.c b/src/game/poker/scenes/gamescene.c index fe1f6243..556c68ca 100644 --- a/src/game/poker/scenes/gamescene.c +++ b/src/game/poker/scenes/gamescene.c @@ -81,10 +81,6 @@ void pokerGameSceneInit(pokergamescene_t *gameScene, engine_t *engine) { &engine->assetManager, gameScene->scene.assetOwner, "textures", "test_texture", 0 ); - // gameScene->textureTest = assetManagerLoadTexture( - // &engine->assetManager, gameScene->scene.assetOwner, "textures/test_texture.png" - // ); - // Cube cubeInit(&gameScene->cube, 1, 1, 1); diff --git a/tools/display/texture_generation.c b/tools/display/texture_generation.c index 0428f3b2..64fdc7bf 100644 --- a/tools/display/texture_generation.c +++ b/tools/display/texture_generation.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { xml[0] = '\0'; sprintf(xml, "", - channels, w, h + STBI_rgb_alpha, w, h ); // For each scale. @@ -70,8 +70,12 @@ int main(int argc, char *argv[]) { scale = RESIZE_SCALES[i]; rw = w / scale; rh = h / scale; - dataResized = malloc(sizeof(stbi_uc) * rw * rh * channels); - stbir_resize_uint8(dataOriginal, w, h, 0, dataResized, rw, rh, 0, channels); + dataResized = malloc(sizeof(stbi_uc) * rw * rh * STBI_rgb_alpha); + stbir_resize_uint8( + dataOriginal, w, h, 0, + dataResized, rw, rh, 0, + STBI_rgb_alpha + ); // Determine output path sprintf(path, "%s_%i.texture", out, scale); @@ -87,7 +91,7 @@ int main(int argc, char *argv[]) { } // Write texture - fwrite(dataResized, sizeof(unsigned char), rw * rh * channels, file); + fwrite(dataResized, sizeof(unsigned char), rw * rh * STBI_rgb_alpha, file); // Cleanup fclose(file);