Subversion Repositories eduke32

Rev

Rev 4889 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1173 terminx 1
#ifndef HIGHTILE_PRIV_H
2
#define HIGHTILE_PRIV_H
3
 
4766 hendricks2 4
#ifdef __cplusplus
5
extern "C" {
6
#endif
7
 
1173 terminx 8
struct hicskybox_t {
9
    char *face[6];
10
};
11
 
12
typedef struct hicreplc_t {
13
    struct hicreplc_t *next;
2282 helixhorne 14
    char *filename;
15
    struct hicskybox_t *skybox;
4680 terminx 16
    vec2f_t scale;
17
    float alphacut, specpower, specfactor;
4605 terminx 18
    char palnum, flags;
1173 terminx 19
} hicreplctyp;
20
 
21
extern palette_t hictinting[MAXPALOOKUPS];
22
extern hicreplctyp *hicreplc[MAXTILES];
4605 terminx 23
extern int32_t hicinitcounter;
1173 terminx 24
 
1218 terminx 25
typedef struct texcachehead_t
1173 terminx 26
{
27
    char magic[4];      // 'PMST', was 'Polymost'
28
    int xdim, ydim;     // of image, unpadded
29
    int flags;          // 1 = !2^x, 2 = has alpha, 4 = lzw compressed
30
    int quality;    // r_downsize at the time the cache was written
31
} texcacheheader;
32
 
1218 terminx 33
typedef struct texcachepic_t
1173 terminx 34
{
35
    int size;
36
    int format;
37
    int xdim, ydim;     // of mipmap (possibly padded)
38
    int border, depth;
39
} texcachepicture;
40
 
4605 terminx 41
hicreplctyp * hicfindsubst(int picnum, int palnum);
42
hicreplctyp * hicfindskybox(int picnum, int palnum);
1173 terminx 43
 
4487 helixhorne 44
static inline int have_basepal_tint(void)
45
{
46
    return (hictinting[MAXPALOOKUPS-1].r != 255 ||
47
            hictinting[MAXPALOOKUPS-1].g != 255 ||
48
            hictinting[MAXPALOOKUPS-1].b != 255);
49
}
50
 
51
static inline void hictinting_apply(float *color, int32_t palnum)
52
{
4658 terminx 53
    color[0] *= (float)hictinting[palnum].r * (1.f/255.f);
54
    color[1] *= (float)hictinting[palnum].g * (1.f/255.f);
55
    color[2] *= (float)hictinting[palnum].b * (1.f/255.f);
4487 helixhorne 56
}
57
 
58
static inline void hictinting_apply_ub(uint8_t *color, int32_t palnum)
59
{
4658 terminx 60
    color[0] = (uint8_t)(color[0] * (float)hictinting[palnum].r * (1.f/255.f));
61
    color[1] = (uint8_t)(color[1] * (float)hictinting[palnum].g * (1.f/255.f));
62
    color[2] = (uint8_t)(color[2] * (float)hictinting[palnum].b * (1.f/255.f));
4487 helixhorne 63
}
64
 
4486 helixhorne 65
// texcacheheader cachead.flags bits
66
enum
67
{
68
    CACHEAD_NONPOW2 = 1,
69
    CACHEAD_HASALPHA = 2,
70
    CACHEAD_COMPRESSED = 4,
4488 helixhorne 71
    CACHEAD_NOCOMPRESS = 8,
4486 helixhorne 72
};
73
 
74
// hicreplctyp hicr->flags bits
75
enum
76
{
77
    HICR_NOSAVE = 1,
78
 
79
    HICR_NOCOMPRESS = 16,
80
};
81
 
82
// hictinting[].f / gloadtile_hi() and daskinloader() <effect> arg bits
83
enum
84
{
85
    HICTINT_GRAYSCALE = 1,
86
    HICTINT_INVERT = 2,
87
    HICTINT_COLORIZE = 4,
88
    HICTINT_USEONART = 8,
5055 hendricks2 89
    HICTINT_APPLYOVERPALSWAP = 16,
90
    HICTINT_APPLYOVERALTPAL = 32,
4486 helixhorne 91
 
5055 hendricks2 92
    HICEFFECTMASK = (1|2|4|8|16|32),
4486 helixhorne 93
};
94
 
4889 terminx 95
#define GRAYSCALE_COEFF_RED 0.3
96
#define GRAYSCALE_COEFF_GREEN 0.59
97
#define GRAYSCALE_COEFF_BLUE 0.11
98
 
4766 hendricks2 99
#ifdef __cplusplus
100
}
1173 terminx 101
#endif
4766 hendricks2 102
 
103
#endif