2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2005 Blender Foundation.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): Brecht Van Lommel.
25 * ***** END GPL LICENSE BLOCK *****
32 #ifndef __GPU_DRAW_H__
33 #define __GPU_DRAW_H__
46 struct SmokeModifierData;
48 /* OpenGL drawing functions related to shading. These are also
49 * shared with the game engine, where there were previously
50 * duplicates of some of these functions. */
53 * - sets the default Blender opengl state, if in doubt, check
54 * the contents of this function
55 * - this is called when starting Blender, for opengl rendering,
56 * and for switching back from the game engine for example. */
58 void GPU_state_init(void);
62 void GPU_state_print(void);
65 * - first the state is initialized by a particular object and
67 * - after this, materials can be quickly enabled by their number,
68 * GPU_enable_material returns 0 if drawing should be skipped
69 * - after drawing, the material must be disabled again */
71 void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d,
72 struct Scene *scene, struct Object *ob, int glsl, int *do_alpha_after);
73 void GPU_end_object_materials(void);
75 int GPU_enable_material(int nr, void *attribs);
76 void GPU_disable_material(void);
78 void GPU_set_material_alpha_blend(int alphablend);
79 int GPU_get_material_alpha_blend(void);
82 * - this is mutually exclusive with material drawing, a mesh should
83 * be drawn using one or the other
84 * - passing NULL clears the state again */
86 int GPU_set_tpage(struct MTFace *tface, int mipmap, int transp);
89 * - returns how many lights were enabled
90 * - this affects fixed functions materials and texface, not glsl */
92 int GPU_default_lights(void);
93 int GPU_scene_object_lights(struct Scene *scene, struct Object *ob,
94 int lay, float viewmat[][4], int ortho);
97 * - based on moving uv coordinates */
99 void GPU_render_text(struct MTFace *tface, int mode,
100 const char *textstr, int textlen, unsigned int *col,
101 float *v1, float *v2, float *v3, float *v4, int glattrib);
104 * - these will free textures on changes */
106 void GPU_set_mipmap(int mipmap);
107 void GPU_set_linear_mipmap(int linear);
108 void GPU_paint_set_mipmap(int mipmap);
110 /* Anisotropic filtering settings
111 * - these will free textures on changes */
112 void GPU_set_anisotropic(float value);
113 float GPU_get_anisotropic(void);
115 /* enable gpu mipmapping */
116 void GPU_set_gpu_mipmapping(int gpu_mipmap);
118 /* Image updates and free
119 * - these deal with images bound as opengl textures */
121 void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap);
122 void GPU_update_images_framechange(void);
123 int GPU_update_image_time(struct Image *ima, double time);
124 int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap);
125 void GPU_free_image(struct Image *ima);
126 void GPU_free_images(void);
127 void GPU_free_images_anim(void);
129 /* smoke drawing functions */
130 void GPU_free_smoke(struct SmokeModifierData *smd);
131 void GPU_create_smoke(struct SmokeModifierData *smd, int highres);
133 /* Delayed free of OpenGL buffers by main thread */
134 void GPU_free_unused_buffers(void);