OBD:TXMP: Difference between revisions

m
link fix; grammar tweaks
m (changed family)
m (link fix; grammar tweaks)
 
Line 36: Line 36:
{{OBDtr| 0x8E | int16    |C8FFC8| 80 00      | 128      | height of the image in pixels }}
{{OBDtr| 0x8E | int16    |C8FFC8| 80 00      | 128      | height of the image in pixels }}
{{OBDtr| 0x90 | int32    |C8FFFF| 01 00 00 00 | 1        | texture format #1 (RGB555); see below for list of available formats.
{{OBDtr| 0x90 | int32    |C8FFFF| 01 00 00 00 | 1        | texture format #1 (RGB555); see below for list of available formats.
:0 - ARGB4444, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:0 - ARGB4444, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Four 4-bit channels, with bitmasks 0x000F (Blue), 0x00F0 (Green), 0x0F00 (Red) and 0xF000 (Alpha).
::Four 4-bit channels, with bitmasks 0x000F (Blue), 0x00F0 (Green), 0x0F00 (Red) and 0xF000 (Alpha).
:1 - RGB555, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:1 - RGB555, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Three 5-bit channels, with bitmasks 0x001F (Blue), 0x03E0 (Green) and 0x7C00 (Red).
::Three 5-bit channels, with bitmasks 0x001F (Blue), 0x03E0 (Green) and 0x7C00 (Red).
:::N.B. The high bit (0x8000) is unused, but the convention is to always set it to 1.
:::N.B. The high bit (0x8000) is unused, but the convention is to always set it to 1.
:2 - ARGB1555, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:2 - ARGB1555, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Three 5-bit channels with bitmasks 0x001F (Blue), 0x03E0 (Green) and 0x7C00 (Red), 1-bit alpha (0x8000).
::Three 5-bit channels with bitmasks 0x001F (Blue), 0x03E0 (Green) and 0x7C00 (Red), 1-bit alpha (0x8000).
:3 (never used in Vanilla TXMPs) - I8, 8 bits/pixel, stored as a single byte. Monochrome "intensity" (256 levels of gray).
:3 (never used in vanilla TXMPs) - I8, 8 bits/pixel, stored as a single byte. Monochrome "intensity" (256 levels of gray).
:4 (never used in Vanilla TXMPs) - I1, 8 pixels/byte. Pixel rows, bottom to top. Monochrome "intensity" (black-or-white).
:4 (never used in vanilla TXMPs) - I1, 8 pixels/byte. Pixel rows, bottom to top. Monochrome "intensity" (black-or-white).
:5 (never used in Vanilla TXMPs) - A8, 8 bits/pixel, stored as a single byte. Standalone alpha (256 levels of opacity).
:5 (never used in vanilla TXMPs) - A8, 8 bits/pixel, stored as a single byte. Standalone alpha (256 levels of opacity).
:6 (never used in Vanilla TXMPs) - A4I4, 8 bits/pixel, stored as a single byte. Intensity (bit mask 0x0F), alpha (0xF0).
:6 (never used in vanilla TXMPs) - A4I4, 8 bits/pixel, stored as a single byte. Intensity (bit mask 0x0F), alpha (0xF0).
:7 (never used in Vanilla TXMPs<ref>Storage format 7 was jointly used by OniSplit, Daodan DLL and the Intel Mac build to allow for 32-bit textures with transparency - most importantly experimental lightmaps, see [[Lightmapping_levels|HERE]]. However, the actual storage format used in this case was RGBA_Bytes (type 11), and type 7 was used by mistake.</ref>) - ARGB8888, 32 bits/pixel (stored as a little-Endian int32, swaps to big Endian at runtime on a PowerPC Mac)
:7 (never used in vanilla TXMPs<ref>Storage format 7 was jointly used by OniSplit, Daodan DLL and the Intel Mac build to allow for 32-bit textures with transparency - most importantly experimental lightmaps, see [[Lightmapping_levels|HERE]]. However, the actual storage format used in this case was RGBA_Bytes (type 11), and type 7 was used by mistake.</ref>) - ARGB8888, 32 bits/pixel (stored as a little-endian int32, swaps to big-endian at runtime on a PowerPC Mac)
::Four 8-bit channels, with bitmasks 0x000000FF (Blue), 0x0000FF00 (Green), 0x00FF0000 (Red) and 0xFF000000 (Alpha).
::Four 8-bit channels, with bitmasks 0x000000FF (Blue), 0x0000FF00 (Green), 0x00FF0000 (Red) and 0xFF000000 (Alpha).
:8 - RGB888, 32 bits/pixel (stored as a little-Endian int32, swaps to big Endian at runtime on Mac)
:8 - RGB888, 32 bits/pixel (stored as a little-endian int32, swaps to big-endian at runtime on Mac)
::Three 8-bit channels, with bitmasks 0x000000FF (Blue), 0x0000FF00 (Green) and 0x00FF0000 (Red).
::Three 8-bit channels, with bitmasks 0x000000FF (Blue), 0x0000FF00 (Green) and 0x00FF0000 (Red).
:::N.B. The high byte (0xFF000000) is unused, but the convention is to always set it to 0x00.
:::N.B. The high byte (0xFF000000) is unused, but the convention is to always set it to 0x00.
:9 - S3TC/DXT1, RGB565 compressed 4 times ([https://www.khronos.org/opengl/wiki/S3_Texture_Compression GL_COMPRESSED_RGB_S3TC_DXT1_EXT] OpenGL texture format)
:9 - S3TC/DXT1, RGB565 compressed 4 times ([https://wikis.khronos.org/opengl/S3_Texture_Compression GL_COMPRESSED_RGB_S3TC_DXT1_EXT] OpenGL texture format)
:10 (never used in Vanilla TXMPs) - RGB_Bytes, 24 bits/pixel, stored as 3 consecutive bytes: first Red, then Green, then Blue.
:10 (never used in vanilla TXMPs) - RGB_Bytes, 24 bits/pixel, stored as 3 consecutive bytes: first Red, then Green, then Blue.
::N.B. Unlike for RGB888 (type 8), the storage is compact, with no unused alpha bit.
::N.B. Unlike for RGB888 (type 8), the storage is compact, with no unused alpha bit.
:11 (never used in Vanilla TXMPs<ref>Storage format 11 (RGBA_Bytes) was effectively implemented by OniSplit to allow for 32-bit textures with transparency - most importantly experimental lightmaps, see [[Lightmapping_levels|HERE]]. However, it was mislabeled as type 7 (ARGB8888) by OniSplit, Daodan DLL and the Intel Mac build, which resulted in byte swapping and the requirement of authoring PC and Mac versions of TXMPs.</ref>) - RGBA_Bytes, 32 bits/pixel, stored as 4 consecutive bytes: first Red, then Green, then Blue, then Alpha.
:11 (never used in vanilla TXMPs<ref>Storage format 11 (RGBA_Bytes) was effectively implemented by OniSplit to allow for 32-bit textures with transparency - most importantly experimental lightmaps, see [[Lightmapping levels|HERE]]. However, it was mislabeled as type 7 (ARGB8888) by OniSplit, Daodan DLL and the Intel Mac build, which resulted in byte swapping and the requirement of authoring Windows and Mac versions of TXMPs.</ref>) - RGBA_Bytes, 32 bits/pixel, stored as 4 consecutive bytes: first Red, then Green, then Blue, then Alpha.
:12 (never used in Vanilla TXMPs) - RGBA5551, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:12 (never used in vanilla TXMPs) - RGBA5551, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Three 5-bit channels with bitmasks 0x003E (Blue), 0x07C0 (Green) and 0xF800 (Red), 1-bit alpha (0x0001).
::Three 5-bit channels with bitmasks 0x003E (Blue), 0x07C0 (Green) and 0xF800 (Red), 1-bit alpha (0x0001).
:13 (never used in Vanilla TXMPs) - RGBA4444, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:13 (never used in vanilla TXMPs) - RGBA4444, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Four 4-bit channels, with bitmasks 0x00F0 (Blue), 0x0F00 (Green), 0xF000 (Red) and 0x000F (Alpha).
::Four 4-bit channels, with bitmasks 0x00F0 (Blue), 0x0F00 (Green), 0xF000 (Red) and 0x000F (Alpha).
:14 (never used in Vanilla TXMPs) - RGB565, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:14 (never used in vanilla TXMPs) - RGB565, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Two 5-bit channels with bitmasks 0x001F (Blue) and 0xF800 (Red), 6-bit Green channel (0x07E0).
::Two 5-bit channels with bitmasks 0x001F (Blue) and 0xF800 (Red), 6-bit Green channel (0x07E0).
:15 (never used in Vanilla TXMPs) - ABGR1555, 16 bits/pixel (stored as a little-Endian int16, swaps to big Endian at runtime on Mac)
:15 (never used in vanilla TXMPs) - ABGR1555, 16 bits/pixel (stored as a little-endian int16, swaps to big-endian at runtime on Mac)
::Three 5-bit channels with bitmasks 0x001F (Red), 0x03E0 (Green) and 0x7C00 (Blue), 1-bit alpha (0x8000).
::Three 5-bit channels with bitmasks 0x001F (Red), 0x03E0 (Green) and 0x7C00 (Blue), 1-bit alpha (0x8000).
}}
}}
Line 134: Line 134:
;Oni's internal storage types
;Oni's internal storage types
There are 16 types of image storage in Oni:
There are 16 types of image storage in Oni:
*The first 9 types are stored as integers (little Endian in PC memory and in TXMP, big Endian in Mac memory)
*The first 9 types are stored as integers (little-endian in PC memory and in TXMP, big-endian in Mac memory)
The
The
{|border=1 cellspacing=0 cellpadding=3
{|border=1 cellspacing=0 cellpadding=3
Line 159: Line 159:
*A 16-bit field is used to store 4 color channels (4 bits each, values from 0 to 15).
*A 16-bit field is used to store 4 color channels (4 bits each, values from 0 to 15).
*Bit masks are 0x000F for Blue, 0x00F0 for Green, 0x0F00 for Red, 0xF000 for Alpha.
*Bit masks are 0x000F for Blue, 0x00F0 for Green, 0x0F00 for Red, 0xF000 for Alpha.
*In Mac RAM the two bytes appear in big Endian order (high byte first).
*In Mac RAM the two bytes appear in big-endian order (high byte first).
*In PC RAM and in TXMP files the two bytes appear in little Endian order.
*In PC RAM and in TXMP files the two bytes appear in little-endian order.
{|border=1 cellpadding=3 cellspacing=0
{|border=1 cellpadding=3 cellspacing=0
!<br/>Bits
!<br/>Bits
Line 201: Line 201:
*Bit masks are 0x001F for Blue, 0x03E0 for Green, 0x7C00 for Red.
*Bit masks are 0x001F for Blue, 0x03E0 for Green, 0x7C00 for Red.
*The high bit (0x8000) is unused, but is always set to 1 by convention.   
*The high bit (0x8000) is unused, but is always set to 1 by convention.   
*In Mac RAM the two bytes appear in big Endian order (high byte first).
*In Mac RAM the two bytes appear in big-endian order (high byte first).
*In PC RAM and in TXMP files the two bytes appear in little Endian order.
*In PC RAM and in TXMP files the two bytes appear in little-endian order.
{|border=1 cellpadding=3 cellspacing=0
{|border=1 cellpadding=3 cellspacing=0
!<br/>Bits
!<br/>Bits
Line 242: Line 242:
*A 16-bit field is used to store 3 color channels (5 bits each, values from 0 to 31) and one 1-bit channel.
*A 16-bit field is used to store 3 color channels (5 bits each, values from 0 to 31) and one 1-bit channel.
*Bit masks are 0x001F for Blue, 0x03E0 for Green, 0x7C00 for Red, and 0x8000 for Alpha.
*Bit masks are 0x001F for Blue, 0x03E0 for Green, 0x7C00 for Red, and 0x8000 for Alpha.
*In Mac RAM the two bytes appear in big Endian order (high byte first).
*In Mac RAM the two bytes appear in big-endian order (high byte first).
*In PC RAM and in TXMP files the two bytes appear in little Endian order.
*In PC RAM and in TXMP files the two bytes appear in little-endian order.
{|border=1 cellpadding=3 cellspacing=0
{|border=1 cellpadding=3 cellspacing=0
!<br/>Bits
!<br/>Bits
Line 310: Line 310:
*A 32-bit field is used to store 4 color channels (8 bits each, values from 0 to 255).
*A 32-bit field is used to store 4 color channels (8 bits each, values from 0 to 255).
*Bit masks are 0x000000FF for Blue, 0x0000FF00 for Green, 0x00FF0000 for Red, 0xFF000000 for Alpha.
*Bit masks are 0x000000FF for Blue, 0x0000FF00 for Green, 0x00FF0000 for Red, 0xFF000000 for Alpha.
*In Mac RAM the four bytes appear in big Endian order (high byte first).
*In Mac RAM the four bytes appear in big-endian order (high byte first).
*In PC RAM and in TXMP files the four bytes appear in little Endian order.
*In PC RAM and in TXMP files the four bytes appear in little-endian order.
{|border=1 cellpadding=3 cellspacing=0
{|border=1 cellpadding=3 cellspacing=0
!<br/>Bits
!<br/>Bits
Line 354: Line 354:
*Bit masks are 0x000000FF for Blue, 0x0000FF00 for Green, 0x00FF0000 for Red.
*Bit masks are 0x000000FF for Blue, 0x0000FF00 for Green, 0x00FF0000 for Red.
*The high byte (0xFF000000) is unused, but is always set to 00 by convention.
*The high byte (0xFF000000) is unused, but is always set to 00 by convention.
*In Mac RAM the four bytes appear in big Endian order (high byte first).
*In Mac RAM the four bytes appear in big-endian order (high byte first).
*In PC RAM and in TXMP files the four bytes appear in little Endian order.
*In PC RAM and in TXMP files the four bytes appear in little-endian order.
{|border=1 cellpadding=3 cellspacing=0
{|border=1 cellpadding=3 cellspacing=0
!<br/>Bits
!<br/>Bits