Blender V2.61 - r43446

GPU_draw.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2005 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): Brecht Van Lommel.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef GPU_GAME_H
00033 #define GPU_GAME_H
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 struct Image;
00040 struct ImageUser;
00041 struct MTFace;
00042 struct Object;
00043 struct Scene;
00044 struct View3D;
00045 struct RegionView3D;
00046 struct SmokeModifierData;
00047 
00048 /* OpenGL drawing functions related to shading. These are also
00049  * shared with the game engine, where there were previously
00050  * duplicates of some of these functions. */
00051 
00052 /* Initialize
00053  * - sets the default Blender opengl state, if in doubt, check
00054  *   the contents of this function
00055  * - this is called when starting Blender, for opengl rendering,
00056  *   and for switching back from the game engine for example. */
00057 
00058 void GPU_state_init(void);
00059 
00060 /* Debugging */
00061 
00062 void GPU_state_print(void);
00063 
00064 /* Material drawing
00065  * - first the state is initialized by a particular object and
00066  *   it's materials
00067  * - after this, materials can be quickly enabled by their number,
00068  *   GPU_enable_material returns 0 if drawing should be skipped
00069  * - after drawing, the material must be disabled again */
00070 
00071 void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d, 
00072     struct Scene *scene, struct Object *ob, int glsl, int *do_alpha_after);
00073 void GPU_end_object_materials(void);
00074 
00075 int GPU_enable_material(int nr, void *attribs);
00076 void GPU_disable_material(void);
00077 
00078 void GPU_set_material_alpha_blend(int alphablend);
00079 int GPU_get_material_alpha_blend(void);
00080 
00081 /* TexFace drawing
00082  * - this is mutually exclusive with material drawing, a mesh should
00083  *   be drawn using one or the other
00084  * - passing NULL clears the state again */
00085 
00086 int GPU_set_tpage(struct MTFace *tface, int mipmap, int transp);
00087 
00088 /* Lights
00089  * - returns how many lights were enabled
00090  * - this affects fixed functions materials and texface, not glsl */
00091 
00092 int GPU_default_lights(void);
00093 int GPU_scene_object_lights(struct Scene *scene, struct Object *ob,
00094     int lay, float viewmat[][4], int ortho);
00095 
00096 /* Text render
00097  * - based on moving uv coordinates */
00098 
00099 void GPU_render_text(struct MTFace *tface, int mode,
00100     const char *textstr, int textlen, unsigned int *col,
00101     float *v1, float *v2, float *v3, float *v4, int glattrib);
00102 
00103 /* Mipmap settings
00104  * - these will free textures on changes */
00105 
00106 void GPU_set_mipmap(int mipmap);
00107 void GPU_set_linear_mipmap(int linear);
00108 void GPU_paint_set_mipmap(int mipmap);
00109 
00110 /* Anisotropic filtering settings
00111  * - these will free textures on changes */
00112 void GPU_set_anisotropic(float value);
00113 float GPU_get_anisotropic(void);
00114 
00115 /* Image updates and free
00116  * - these deal with images bound as opengl textures */
00117 
00118 void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap);
00119 void GPU_update_images_framechange(void);
00120 int GPU_update_image_time(struct Image *ima, double time);
00121 int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap);
00122 void GPU_free_image(struct Image *ima);
00123 void GPU_free_images(void);
00124 void GPU_free_images_anim(void);
00125 
00126 /* smoke drawing functions */
00127 void GPU_free_smoke(struct SmokeModifierData *smd);
00128 void GPU_create_smoke(struct SmokeModifierData *smd, int highres);
00129 
00130 /* Delayed free of OpenGL buffers by main thread */
00131 void GPU_free_unused_buffers(void);
00132 
00133 #ifdef __cplusplus
00134 }
00135 #endif
00136 
00137 #endif
00138