Documentation
¶
Overview ¶
Package texture provides parsers and converters for Echo VR texture assets.
Echo VR uses three types of texture files: 1. Standard DDS files with full headers (type 0xbeac1969cb7b8861) 2. Raw BC compressed texture data without headers (type 0x7f5bc1cf8ce51ffd) 3. 256-byte texture metadata files (type 0x2f6e61706a2c8f35)
The metadata files describe texture properties and are used to reconstruct proper DDS headers for the raw BC texture data.
Index ¶
Constants ¶
const ( DXGI_FORMAT_UNKNOWN = 0 DXGI_FORMAT_BC1_UNORM = 71 DXGI_FORMAT_BC1_UNORM_SRGB = 72 DXGI_FORMAT_BC2_UNORM = 74 DXGI_FORMAT_BC2_UNORM_SRGB = 75 DXGI_FORMAT_BC3_UNORM = 77 DXGI_FORMAT_BC3_UNORM_SRGB = 78 DXGI_FORMAT_BC4_UNORM = 80 DXGI_FORMAT_BC4_SNORM = 81 DXGI_FORMAT_BC5_UNORM = 83 DXGI_FORMAT_BC5_SNORM = 84 DXGI_FORMAT_BC6H_UF16 = 95 DXGI_FORMAT_BC6H_SF16 = 96 DXGI_FORMAT_BC7_UNORM = 98 DXGI_FORMAT_BC7_UNORM_SRGB = 99 DXGI_FORMAT_R8G8B8A8_UNORM = 28 DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29 )
DXGI_FORMAT constants for common texture formats
const ( DDS_MAGIC = 0x20534444 // "DDS " DDS_HEADER_SIZE = 124 DDS_HEADER_FLAGS_CAPS = 0x1 DDS_HEADER_FLAGS_HEIGHT = 0x2 DDS_HEADER_FLAGS_WIDTH = 0x4 DDS_HEADER_FLAGS_PITCH = 0x8 DDS_HEADER_FLAGS_PIXELFORMAT = 0x1000 DDS_HEADER_FLAGS_MIPMAPCOUNT = 0x20000 DDS_HEADER_FLAGS_LINEARSIZE = 0x80000 DDS_HEADER_FLAGS_DEPTH = 0x800000 DDS_SURFACE_FLAGS_TEXTURE = 0x1000 DDS_SURFACE_FLAGS_MIPMAP = 0x400000 DDS_SURFACE_FLAGS_CUBEMAP = 0x200 DDS_PIXELFORMAT_SIZE = 32 DDS_FOURCC = 0x4 DX10_FOURCC = 0x30315844 // "DX10" )
DDS header constants
const MetadataSize = 256
MetadataSize is the fixed size of texture metadata files.
Variables ¶
This section is empty.
Functions ¶
func ConvertRawBCToDDS ¶
func ConvertRawBCToDDS(rawData []byte, meta *TextureMetadata) ([]byte, error)
ConvertRawBCToDDS converts headerless BC texture to DDS with proper header.
func FormatName ¶
FormatName returns a human-readable name for a DXGI_FORMAT value.
Types ¶
type TextureMetadata ¶
type TextureMetadata struct {
Width uint32 // +0x00: Texture width in pixels
Height uint32 // +0x04: Texture height in pixels
MipLevels uint32 // +0x08: Number of mipmap levels
DXGIFormat uint32 // +0x0C: DXGI_FORMAT enum value
DDSFileSize uint32 // +0x10: Size of DDS file with header
RawFileSize uint32 // +0x14: Size of raw BC data without header
Flags uint32 // +0x18: Texture flags
ArraySize uint32 // +0x1C: Array size (1 for normal textures)
Reserved [224]byte // +0x20: Reserved/padding to 256 bytes
}
TextureMetadata represents the 256-byte texture descriptor. Based on analysis of 12,275 metadata files, all exactly 256 bytes.
func ParseMetadata ¶
func ParseMetadata(r io.Reader) (*TextureMetadata, error)
ParseMetadata reads texture metadata from binary data.
func (*TextureMetadata) String ¶
func (m *TextureMetadata) String() string
String returns a human-readable representation.
func (*TextureMetadata) ToBytes ¶
func (m *TextureMetadata) ToBytes() []byte
ToBytes serializes metadata to 256 bytes.