-
Notifications
You must be signed in to change notification settings - Fork 0
/
xtexture.h
54 lines (47 loc) · 1.09 KB
/
xtexture.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* This file belongs to the 'xlib' (now 'xlab') game engine.
* Copyright 2009 xfacter
* Copyright 2016 wickles
* This work is licensed under the LGPLv3
* subject to all terms as reproduced in the included LICENSE file.
*/
#ifndef __X_TEXTURE_H__
#define __X_TEXTURE_H__
#include <psptypes.h>
#define X_MAPPED (1)
#define X_RGBA (2)
#define X_GRAYSCALE (3)
int NextPow2(int num);
class xTexture
{
private:
int type;
bool swizzled;
bool in_vram;
u16 buf_width;
u16 buf_height;
u16 width;
u16 height;
float x_scale;
float y_scale;
u8* clut;
u8* data;
public:
xTexture();
~xTexture();
bool LoadTGA(char* filename);
bool LoadPNG(char* filename);
bool LoadBMP(char* filename);
void Free();
void SetMode(int maxmips);
void SetImage(int maxmips, int mipmap);
void Swizzle();
void GrayscaleToAlpha();
void MoveToVRAM();
void MoveFromVRAM();
int Width() {return (int)width;}
int Height() {return (int)height;}
bool Swizzled() {return swizzled;}
bool Valid() {return (data ? 1 : 0);}
};
#endif