1 /*
2 				 V3D Texture
3  */
4 
5 #ifndef V3DTEX_H
6 #define V3DTEX_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif /* __cplusplus */
11 
12 
13 /*
14  *	Texture Formats:
15  */
16 typedef enum {
17 	V3D_TEX_FORMAT_RGB,
18 	V3D_TEX_FORMAT_RGBA,
19 	V3D_TEX_FORMAT_LUMINANCE,
20 	V3D_TEX_FORMAT_LUMINANCE_ALPHA
21 } v3d_tex_format;
22 
23 
24 /*
25  *	Texture Reference:
26  */
27 typedef struct {
28 
29 	char		*name;		/* Reference name (any arbitary name) */
30 	char		*filename;	/* Full path file name */
31 
32 	float		priority;	/* Texture memory residency priority
33 					 * (0.0. to 1.0, 1.0 is highest) */
34 
35 	void		**data;		/* Array of GLint id's for each texture */
36 	int		total_frames;	/* Number of textures (size of member data */
37 
38 	int		width,		/* Size of each frame in pixels */
39 			height;
40 
41 	int		dimensions;	/* 1, 2, or 3 */
42 
43 } v3d_texture_ref_struct;
44 
45 extern void V3DTextureSelectFrame(v3d_texture_ref_struct *t, int frame_num);
46 extern void V3DTextureSelect(v3d_texture_ref_struct *t);
47 extern v3d_texture_ref_struct *V3DTextureLoadFromFile2D(
48 	const char *path,	/* Filename containing texture data */
49 	const char *name,	/* Name of texture for referancing */
50 	v3d_tex_format dest_fmt,
51 	void *client_data,
52 	int (*progress_cb)(void *, int, int)
53 );
54 extern v3d_texture_ref_struct *V3DTextureLoadFromFile2DPreempt(
55 	const char *path,	/* Filename containing texture data */
56 	const char *name,	/* Name of texture for referancing */
57 	v3d_tex_format dest_fmt
58 );
59 extern v3d_texture_ref_struct *V3DTextureLoadFromData1D(
60 	const void *data,	/* Texture data */
61 	const char *name,	/* Name of texture for referancing */
62 	int width,
63 	int bytes_per_pixel,	/* Bytes per pixel of data */
64 	v3d_tex_format dest_fmt,
65 	void *client_data,
66 	int (*progress_cb)(void *, int, int)
67 );
68 extern v3d_texture_ref_struct *V3DTextureLoadFromData2D(
69 	const void *data,	/* Texture data */
70 	const char *name,	/* Name of texture for referancing */
71 	int width, int height,
72 	int bytes_per_pixel,	/* Bytes per pixel of data */
73 	v3d_tex_format dest_fmt,
74 	void *client_data,
75 	int (*progress_cb)(void *, int, int)
76 );
77 extern void V3DTexturePriority(v3d_texture_ref_struct *t, float priority);
78 extern void V3DTextureDestroy(v3d_texture_ref_struct *t);
79 
80 
81 #ifdef __cplusplus
82 }
83 #endif /* __cplusplus */
84 
85 #endif	/* V3DTEX_H */
86