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, bool glsl, bool *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_material_diffuse_get(int nr, float diff[4]);
80 void GPU_set_material_alpha_blend(int alphablend);
81 int GPU_get_material_alpha_blend(void);
84 * - this is mutually exclusive with material drawing, a mesh should
85 * be drawn using one or the other
86 * - passing NULL clears the state again */
88 int GPU_set_tpage(struct MTFace *tface, int mipmap, int transp);
91 * - returns how many lights were enabled
92 * - this affects fixed functions materials and texface, not glsl */
94 int GPU_default_lights(void);
95 int GPU_scene_object_lights(struct Scene *scene, struct Object *ob,
96 int lay, float viewmat[4][4], int ortho);
99 * - based on moving uv coordinates */
101 void GPU_render_text(struct MTFace *tface, int mode,
102 const char *textstr, int textlen, unsigned int *col,
103 float *v1, float *v2, float *v3, float *v4, int glattrib);
106 * - these will free textures on changes */
108 void GPU_set_mipmap(int mipmap);
109 int GPU_get_mipmap(void);
110 void GPU_set_linear_mipmap(int linear);
111 int GPU_get_linear_mipmap(void);
112 void GPU_paint_set_mipmap(int mipmap);
114 /* Anisotropic filtering settings
115 * - these will free textures on changes */
116 void GPU_set_anisotropic(float value);
117 float GPU_get_anisotropic(void);
119 /* enable gpu mipmapping */
120 void GPU_set_gpu_mipmapping(int gpu_mipmap);
122 /* Image updates and free
123 * - these deal with images bound as opengl textures */
125 void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
126 void GPU_update_images_framechange(void);
127 int GPU_update_image_time(struct Image *ima, double time);
128 int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data);
129 void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth, int mipmap, int use_hight_bit_depth, struct Image *ima);
130 void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x, int y, int mipmap, struct Image *ima, struct ImBuf *ibuf);
131 int GPU_upload_dxt_texture(struct ImBuf *ibuf);
132 void GPU_free_image(struct Image *ima);
133 void GPU_free_images(void);
134 void GPU_free_images_anim(void);
136 /* smoke drawing functions */
137 void GPU_free_smoke(struct SmokeModifierData *smd);
138 void GPU_create_smoke(struct SmokeModifierData *smd, int highres);
140 /* Delayed free of OpenGL buffers by main thread */
141 void GPU_free_unused_buffers(void);