LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
Main Page
Data Structures
Data Structures
Data Structure Index
Data Fields
All
Variables
Files
File List
Globals
All
b
c
d
f
i
j
l
m
s
t
v
w
Functions
b
c
d
f
i
j
l
m
s
t
v
w
•
All
Data Structures
Files
Functions
Variables
lg_dds_loader.h
1
/*
2
* LibGame - Copyright (C) Emmanuel Thomas-Maurin 2011-2025
3
* All rights reserved
4
*/
5
6
#ifndef LG_DDS_LOADER_H
7
#define LG_DDS_LOADER_H
8
9
#define DDS_MAGIC_SIZE ((size_t)4)
10
#define DDS_MAGIC_AND_HEADER_SIZE ((size_t)128)
11
12
/* (From dds.h) */
13
#define DDS_HEADER_FLAGS_TEXTURE 0x00001007
/* DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS */
14
#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000
/* DDSD_LINEARSIZE */
15
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000
/* DDSD_MIPMAPCOUNT */
16
17
/* (From DDSTextureLoader9.cpp) */
18
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
19
((uint32_t)(uint8_t)(ch0) | ((uint32_t)(uint8_t)(ch1) << 8) | \
20
((uint32_t)(uint8_t)(ch2) << 16) | ((uint32_t)(uint8_t)(ch3) << 24 ))
21
22
typedef
struct
__attribute__((packed)) {
23
uint32_t size;
24
uint32_t flags;
25
uint32_t sig_4cc;
/* "DXT1" or "DXT3" */
26
uint32_t rgb_bitcount;
27
uint32_t r_mask;
28
uint32_t g_mask;
29
uint32_t b_mask;
30
uint32_t a_mask;
31
}
DDS_PixelFormat
;
32
33
typedef
struct
__attribute__((packed)) {
34
uint32_t size;
/* 124 */
35
uint32_t flags;
/* Always include DDSD_CAPS, DDSD_PIXELFORMAT, DDSD_WIDTH, DDSD_HEIGHT and either DDSD_PITCH or DDSD_LINEARSIZE */
36
uint32_t h;
/* h first - duh! */
37
uint32_t w;
38
uint32_t pitch_or_linear_size;
39
uint32_t depth;
40
uint32_t mipmap_count;
41
uint32_t reserved1[11];
42
DDS_PixelFormat
pixel_format;
43
uint32_t caps;
44
uint32_t caps2;
45
uint32_t caps3;
46
uint32_t caps4;
47
uint32_t reserved2;
48
}
DDS_Header
;
49
50
void
*
lg_load_dds
(
const
char
*, lg_tc_format *,
size_t
*,
int
*,
int
*,
int
*);
51
52
#endif
/* LG_DDS_LOADER_H */
DDS_PixelFormat
Definition:
lg_dds_loader.h:22
DDS_Header
Definition:
lg_dds_loader.h:33
lg_load_dds
void * lg_load_dds(const char *path, lg_tc_format *tc_format, size_t *size, int *w, int *h, int *n_mipmaps)
Definition:
lg_dds_loader.c:59
src
libgame
lg_dds_loader.h
Generated by
1.8.17