diff options
Diffstat (limited to '')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/include/g3d/texture.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/include/g3d/texture.h b/src/others/mimesh/libg3d-0.0.8/include/g3d/texture.h new file mode 100644 index 0000000..f5643a8 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/include/g3d/texture.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* $Id$ */ | ||
2 | |||
3 | /* | ||
4 | libg3d - 3D object loading library | ||
5 | |||
6 | Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de> | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __G3D_TEXTURE_H__ | ||
24 | #define __G3D_TEXTURE_H__ | ||
25 | |||
26 | #include <g3d/types.h> | ||
27 | |||
28 | #ifdef __cplusplus | ||
29 | extern "C" { | ||
30 | #endif /* ifdef __cplusplus */ | ||
31 | |||
32 | /** | ||
33 | * SECTION:texture | ||
34 | * @short_description: Texture loading and manipulation | ||
35 | * @include: g3d/texture.h | ||
36 | * | ||
37 | * A texture is an image used in materials. Here are some helper functions, | ||
38 | * mostly for cached loading of a #G3DImage. | ||
39 | */ | ||
40 | |||
41 | /** | ||
42 | * g3d_texture_load_from_stream: | ||
43 | * @context: a valid context | ||
44 | * @model: a valid model or NULL | ||
45 | * @stream: an open stream | ||
46 | * | ||
47 | * Load a texture image from a stream. The file type is determined by the | ||
48 | * extension of the stream URI, so it should be valid. If @model is not NULL | ||
49 | * the texture image is cached (or retrieved from cache if available). | ||
50 | * | ||
51 | * Returns: the texture image or NULL in case of an error. | ||
52 | */ | ||
53 | EAPI | ||
54 | G3DImage *g3d_texture_load_from_stream(G3DContext *context, G3DModel *model, | ||
55 | G3DStream *stream); | ||
56 | |||
57 | /** | ||
58 | * g3d_texture_load_cached: | ||
59 | * @context: a valid context | ||
60 | * @model: a valid model | ||
61 | * @filename: the file name of the texture to load | ||
62 | * | ||
63 | * Loads a texture image from file and attaches it to a hash table in the | ||
64 | * model. On a second try to load this texture it is returned from cache. | ||
65 | * | ||
66 | * Returns: the texture image | ||
67 | */ | ||
68 | EAPI | ||
69 | G3DImage *g3d_texture_load_cached(G3DContext *context, G3DModel *model, | ||
70 | const gchar *filename); | ||
71 | |||
72 | /** | ||
73 | * g3d_texture_free: | ||
74 | * @texture: a texture image | ||
75 | * | ||
76 | * Frees all memory used by this texture image. | ||
77 | */ | ||
78 | EAPI | ||
79 | void g3d_texture_free(G3DImage *texture); | ||
80 | |||
81 | /** | ||
82 | * g3d_texture_prepare: | ||
83 | * @texture: a texture image | ||
84 | * | ||
85 | * Resizes the image to dimensions which are a power of 2 to be | ||
86 | * usable as an OpenGL texture. | ||
87 | * (FIXME: unimplemented) | ||
88 | * | ||
89 | * Returns: TRUE on success, FALSE else | ||
90 | */ | ||
91 | EAPI | ||
92 | gboolean g3d_texture_prepare(G3DImage *texture); | ||
93 | |||
94 | /** | ||
95 | * g3d_texture_flip_y: | ||
96 | * @texture: a texture image | ||
97 | * | ||
98 | * Mirror the image along the x axis - all y coordinates are inverted. | ||
99 | * | ||
100 | * Returns: TRUE on success, FALSE on error. | ||
101 | */ | ||
102 | EAPI | ||
103 | gboolean g3d_texture_flip_y(G3DImage *texture); | ||
104 | |||
105 | /** | ||
106 | * g3d_texture_merge_alpha: | ||
107 | * @image: a texture image or NULL | ||
108 | * @aimage: an image with alpha information | ||
109 | * | ||
110 | * Merges alpha information from @aimage into output image. If @image is NULL a | ||
111 | * new image is created, else @image is returned with alpha from @aimage. | ||
112 | * | ||
113 | * Returns: a texture image or NULL in case of an error. | ||
114 | */ | ||
115 | EAPI | ||
116 | G3DImage *g3d_texture_merge_alpha(G3DImage *image, G3DImage *aimage); | ||
117 | |||
118 | #ifdef __cplusplus | ||
119 | } | ||
120 | #endif /* ifdef __cplusplus */ | ||
121 | |||
122 | #endif /* __G3D_TEXTURE_H__ */ | ||
123 | |||