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
${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

View File

@ -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);

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
xml[0] = '\0';
sprintf(xml,
"<texture channels=\"%i\" width=\"%i\" height=\"%i\">",
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);