Generate TGA type 2 and type 10 test textures using loops
This commit is contained in:
parent
619e49d3b7
commit
64d20ccab8
|
@ -66,7 +66,7 @@ local pixels_grayscale_by_scanline_order = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local colormap_32bpp = {
|
local colormap_32bpp = {
|
||||||
{ 0, 0, 0, 128 },
|
{ 0, 0, 0, 127 },
|
||||||
{ 255, 0, 0, 255 },
|
{ 255, 0, 0, 255 },
|
||||||
{ 0, 255, 0, 255 },
|
{ 0, 255, 0, 255 },
|
||||||
{ 0, 0, 255, 255 },
|
{ 0, 0, 255, 255 },
|
||||||
|
@ -131,7 +131,7 @@ for _, color_format in ipairs(
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _ = { 0, 0, 0, 128 }
|
local _ = { 0, 0, 0, 127 }
|
||||||
local R = { 255, 0, 0, 255 }
|
local R = { 255, 0, 0, 255 }
|
||||||
local G = { 0, 255, 0, 255 }
|
local G = { 0, 255, 0, 255 }
|
||||||
local B = { 0, 0, 255, 255 }
|
local B = { 0, 0, 255, 255 }
|
||||||
|
@ -158,25 +158,10 @@ local pixels_rgba_tb = {
|
||||||
{ _, _, _, _, _, B, _, B, },
|
{ _, _, _, _, _, B, _, B, },
|
||||||
}
|
}
|
||||||
|
|
||||||
image_rgba_bt = tga_encoder.image(pixels_rgba_bt)
|
local pixels_rgba_by_scanline_order = {
|
||||||
image_rgba_tb = tga_encoder.image(pixels_rgba_tb)
|
["bottom-top"] = pixels_rgba_bt,
|
||||||
|
["top-bottom"] = pixels_rgba_tb,
|
||||||
image_rgba_bt:save(
|
}
|
||||||
"type2_32bpp_bt.tga",
|
|
||||||
{ color_format="B8G8R8A8", compression="RAW", scanline_order = "bottom-top" }
|
|
||||||
)
|
|
||||||
image_rgba_tb:save(
|
|
||||||
"type2_32bpp_tb.tga",
|
|
||||||
{ color_format="B8G8R8A8", compression="RAW", scanline_order = "top-bottom" }
|
|
||||||
)
|
|
||||||
image_rgba_bt:save(
|
|
||||||
"type10_32bpp_bt.tga",
|
|
||||||
{ color_format="B8G8R8A8", compression="RLE", scanline_order = "bottom-top" }
|
|
||||||
)
|
|
||||||
image_rgba_tb:save(
|
|
||||||
"type10_32bpp_tb.tga",
|
|
||||||
{ color_format="B8G8R8A8", compression="RLE", scanline_order = "top-bottom" }
|
|
||||||
)
|
|
||||||
|
|
||||||
local _ = { 0, 0, 0 }
|
local _ = { 0, 0, 0 }
|
||||||
local R = { 255, 0, 0 }
|
local R = { 255, 0, 0 }
|
||||||
|
@ -205,38 +190,53 @@ local pixels_rgb_tb = {
|
||||||
{ _, _, _, _, _, B, _, B, },
|
{ _, _, _, _, _, B, _, B, },
|
||||||
}
|
}
|
||||||
|
|
||||||
image_rgb_bt = tga_encoder.image(pixels_rgb_bt)
|
local pixels_rgb_by_scanline_order = {
|
||||||
image_rgb_tb = tga_encoder.image(pixels_rgb_tb)
|
["bottom-top"] = pixels_rgb_bt,
|
||||||
|
["top-bottom"] = pixels_rgb_tb,
|
||||||
|
}
|
||||||
|
|
||||||
image_rgb_bt:save(
|
local tga_type_by_compression = {
|
||||||
"type2_24bpp_bt.tga",
|
["RAW"] = "2",
|
||||||
{ color_format="B8G8R8", compression="RAW", scanline_order = "bottom-top" }
|
["RLE"] = "10",
|
||||||
)
|
}
|
||||||
image_rgb_tb:save(
|
|
||||||
"type2_24bpp_tb.tga",
|
local pixels_by_scanline_order_by_color_format = {
|
||||||
{ color_format="B8G8R8", compression="RAW", scanline_order = "top-bottom" }
|
["A1R5G5B5"] = pixels_rgba_by_scanline_order,
|
||||||
)
|
["B8G8R8"] = pixels_rgb_by_scanline_order,
|
||||||
image_rgb_bt:save(
|
["B8G8R8A8"] = pixels_rgba_by_scanline_order,
|
||||||
"type10_24bpp_bt.tga",
|
}
|
||||||
{ color_format="B8G8R8", compression="RLE", scanline_order = "bottom-top" }
|
|
||||||
)
|
for _, color_format in ipairs(
|
||||||
image_rgb_tb:save(
|
tga_encoder.features.color_format
|
||||||
"type10_24bpp_tb.tga",
|
) do
|
||||||
{ color_format="B8G8R8", compression="RLE", scanline_order = "top-bottom" }
|
for _, compression in ipairs(
|
||||||
)
|
tga_encoder.features.compression
|
||||||
image_rgb_bt:save(
|
) do
|
||||||
"type2_16bpp_bt.tga",
|
for _, scanline_order in ipairs(
|
||||||
{ color_format="A1R5G5B5", compression="RAW", scanline_order = "bottom-top" }
|
tga_encoder.features.scanline_order
|
||||||
)
|
) do
|
||||||
image_rgb_tb:save(
|
if ("Y8" ~= color_format) then
|
||||||
"type2_16bpp_tb.tga",
|
local tga_type = tga_type_by_compression[
|
||||||
{ color_format="A1R5G5B5", compression="RAW", scanline_order = "top-bottom" }
|
compression
|
||||||
)
|
]
|
||||||
image_rgb_bt:save(
|
local filename = "type" .. tga_type ..
|
||||||
"type10_16bpp_bt.tga",
|
'_' .. color_format ..
|
||||||
{ color_format="A1R5G5B5", compression="RLE", scanline_order = "bottom-top" }
|
'_' .. scanline_order ..
|
||||||
)
|
'.tga'
|
||||||
image_rgb_tb:save(
|
local pixels = pixels_by_scanline_order_by_color_format[
|
||||||
"type10_16bpp_tb.tga",
|
color_format
|
||||||
{ color_format="A1R5G5B5", compression="RLE", scanline_order = "top-bottom" }
|
][
|
||||||
)
|
scanline_order
|
||||||
|
]
|
||||||
|
local properties = {
|
||||||
|
color_format = color_format,
|
||||||
|
compression = compression,
|
||||||
|
scanline_order = scanline_order,
|
||||||
|
}
|
||||||
|
print(filename)
|
||||||
|
local image = tga_encoder.image(pixels)
|
||||||
|
image:save(filename, properties)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue