Fixed texture generation for 3 channel textures

This commit is contained in:
2021-11-14 23:25:26 -08:00
parent 9b4acae63c
commit 20428597b6
3 changed files with 24 additions and 33 deletions

View File

@ -88,18 +88,18 @@ elseif(TARGET_TYPE STREQUAL game)
tool_vn_character(vn_penny tool_vn_character(vn_penny
${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite ${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite
) )
# tool_vn_character(vn_lucy tool_vn_character(vn_lucy
# ${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite ${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite
# ) )
# tool_vn_character(vn_julie tool_vn_character(vn_julie
# ${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite ${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite
# ) )
# tool_vn_character(vn_sammy tool_vn_character(vn_sammy
# ${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite ${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite
# ) )
# tool_vn_character(vn_jenny tool_vn_character(vn_jenny
# ${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite ${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite
# ) )
# World # World
tool_copy(texture_pub tool_copy(texture_pub
@ -118,10 +118,10 @@ elseif(TARGET_TYPE STREQUAL game)
texture_test texture_test
vn_penny vn_penny
# vn_lucy vn_lucy
# vn_julie vn_julie
# vn_sammy vn_sammy
# vn_jenny vn_jenny
locale_en locale_en
) )
@ -136,16 +136,7 @@ elseif(TARGET_TYPE STREQUAL game)
GAME_VERSION=1.0 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( tool_assets(
vn_penny
vn_sammy
shader_textured shader_textured
font_opensans font_opensans
texture_test texture_test

View File

@ -81,10 +81,6 @@ void pokerGameSceneInit(pokergamescene_t *gameScene, engine_t *engine) {
&engine->assetManager, gameScene->scene.assetOwner, &engine->assetManager, gameScene->scene.assetOwner,
"textures", "test_texture", 0 "textures", "test_texture", 0
); );
// gameScene->textureTest = assetManagerLoadTexture(
// &engine->assetManager, gameScene->scene.assetOwner, "textures/test_texture.png"
// );
// Cube // Cube
cubeInit(&gameScene->cube, 1, 1, 1); cubeInit(&gameScene->cube, 1, 1, 1);

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
xml[0] = '\0'; xml[0] = '\0';
sprintf(xml, sprintf(xml,
"<texture channels=\"%i\" width=\"%i\" height=\"%i\">", "<texture channels=\"%i\" width=\"%i\" height=\"%i\">",
channels, w, h STBI_rgb_alpha, w, h
); );
// For each scale. // For each scale.
@ -70,8 +70,12 @@ int main(int argc, char *argv[]) {
scale = RESIZE_SCALES[i]; scale = RESIZE_SCALES[i];
rw = w / scale; rw = w / scale;
rh = h / scale; rh = h / scale;
dataResized = malloc(sizeof(stbi_uc) * rw * rh * channels); dataResized = malloc(sizeof(stbi_uc) * rw * rh * STBI_rgb_alpha);
stbir_resize_uint8(dataOriginal, w, h, 0, dataResized, rw, rh, 0, channels); stbir_resize_uint8(
dataOriginal, w, h, 0,
dataResized, rw, rh, 0,
STBI_rgb_alpha
);
// Determine output path // Determine output path
sprintf(path, "%s_%i.texture", out, scale); sprintf(path, "%s_%i.texture", out, scale);
@ -87,7 +91,7 @@ int main(int argc, char *argv[]) {
} }
// Write texture // Write texture
fwrite(dataResized, sizeof(unsigned char), rw * rh * channels, file); fwrite(dataResized, sizeof(unsigned char), rw * rh * STBI_rgb_alpha, file);
// Cleanup // Cleanup
fclose(file); fclose(file);