|
Blender
V2.59
|
#include <string.h>#include "GL/glew.h"#include "BLI_math.h"#include "BLI_utildefines.h"#include "DNA_lamp_types.h"#include "DNA_material_types.h"#include "DNA_meshdata_types.h"#include "DNA_modifier_types.h"#include "DNA_node_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "DNA_smoke_types.h"#include "DNA_view3d_types.h"#include "MEM_guardedalloc.h"#include "IMB_imbuf.h"#include "IMB_imbuf_types.h"#include "BKE_bmfont.h"#include "BKE_global.h"#include "BKE_image.h"#include "BKE_main.h"#include "BKE_material.h"#include "BKE_node.h"#include "BKE_object.h"#include "BLI_threads.h"#include "BLI_blenlib.h"#include "GPU_buffers.h"#include "GPU_draw.h"#include "GPU_extensions.h"#include "GPU_material.h"#include "smoke_API.h"Go to the source code of this file.
Classes | |
| struct | GPUTextureState |
| struct | GPUMaterialFixed |
| struct | GPUMaterialState |
Defines | |
| #define | FIXEDMAT 8 |
Typedefs | |
| typedef struct GPUMaterialFixed | GPUMaterialFixed |
Functions | |
| static void | gpu_mcol (unsigned int ucol) |
| void | GPU_render_text (MTFace *tface, int mode, const char *textstr, int textlen, unsigned int *col, float *v1, float *v2, float *v3, float *v4, int glattrib) |
| static int | is_pow2 (int num) |
| static int | smaller_pow2 (int num) |
| static int | is_pow2_limit (int num) |
| static int | smaller_pow2_limit (int num) |
| void | GPU_set_mipmap (int mipmap) |
| void | GPU_set_linear_mipmap (int linear) |
| static int | gpu_get_mipmap (void) |
| static GLenum | gpu_get_mipmap_filter (int mag) |
| void | GPU_set_anisotropic (float value) |
| float | GPU_get_anisotropic () |
| static void | gpu_make_repbind (Image *ima) |
| static void | gpu_clear_tpage (void) |
| static void | gpu_set_blend_mode (GPUBlendMode blendmode) |
| static void | gpu_verify_alpha_mode (MTFace *tface) |
| static void | gpu_verify_reflection (Image *ima) |
| int | GPU_verify_image (Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap) |
| static void | gpu_verify_repeat (Image *ima) |
| int | GPU_set_tpage (MTFace *tface, int mipmap) |
| void | GPU_paint_set_mipmap (int mipmap) |
| void | GPU_paint_update_image (Image *ima, int x, int y, int w, int h, int mipmap) |
| void | GPU_update_images_framechange (void) |
| int | GPU_update_image_time (Image *ima, double time) |
| void | GPU_free_smoke (SmokeModifierData *smd) |
| void | GPU_create_smoke (SmokeModifierData *smd, int highres) |
| static void | gpu_queue_image_for_free (Image *ima) |
| void | GPU_free_unused_buffers (void) |
| void | GPU_free_image (Image *ima) |
| void | GPU_free_images (void) |
| void | GPU_free_images_anim (void) |
| static void | gpu_material_to_fixed (GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob) |
| static Material * | gpu_active_node_material (Material *ma) |
| void | GPU_begin_object_materials (View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, int glsl, int *do_alpha_pass) |
| int | GPU_enable_material (int nr, void *attribs) |
| void | GPU_set_material_blend_mode (int blendmode) |
| int | GPU_get_material_blend_mode (void) |
| void | GPU_disable_material (void) |
| void | GPU_end_object_materials (void) |
| int | GPU_default_lights (void) |
| int | GPU_scene_object_lights (Scene *scene, Object *ob, int lay, float viewmat[][4], int ortho) |
| void | GPU_state_init (void) |
| static void | gpu_get_print (const char *name, GLenum type) |
| void | GPU_state_print (void) |
Variables | |
| Material | defmaterial |
| static struct GPUTextureState | GTS |
| static ListBase | image_free_queue = {NULL, NULL} |
| static struct GPUMaterialState | GMS |
Definition in file gpu_draw.c.
| #define FIXEDMAT 8 |
Definition at line 924 of file gpu_draw.c.
Referenced by GPU_begin_object_materials().
| typedef struct GPUMaterialFixed GPUMaterialFixed |
Definition at line 985 of file gpu_draw.c.
References bNode::id, ID_MA, nodeGetActiveID(), Material::nodetree, NULL, and Material::use_nodes.
Referenced by GPU_begin_object_materials().
| void GPU_begin_object_materials | ( | View3D * | v3d, |
| RegionView3D * | rv3d, | ||
| Scene * | scene, | ||
| Object * | ob, | ||
| int | glsl, | ||
| int * | do_alpha_pass | ||
| ) |
Definition at line 999 of file gpu_draw.c.
References Material::alpha, GPUMaterialState::alphapass, GPUMaterialState::blendmode, GPUMaterialState::blendmode_fixed, Object::col, RenderData::color_mgt_flag, defmaterial, GPUMaterialFixed::diff, ELEM, FIXEDMAT, give_current_material(), GPUMaterialState::glay, GPUMaterialState::gmatbuf, GPUMaterialState::gmatbuf_fixed, GMS, GPUMaterialState::gob, gpu_active_node_material(), GPU_BLEND_ADD, GPU_BLEND_ALPHA, GPU_BLEND_SOLID, GPU_disable_material(), GPU_material_blend_mode(), GPU_material_from_blender(), gpu_material_to_fixed(), GPUMaterialState::gscene, GPUMaterialState::gviewinv, GPUMaterialState::gviewmat, GPUMaterialState::lastblendmode, GPUMaterialState::lastmatnr, GPUMaterialState::lastretval, View3D::lay, GPUMaterialState::matbuf, GPUMaterialState::matbuf_fixed, MEM_callocN(), NULL, Scene::r, R_COLOR_MANAGEMENT, Object::totcol, GPUMaterialState::totmat, View3D::transp, RegionView3D::viewinv, and RegionView3D::viewmat.
Referenced by draw_mesh_object(), draw_object_mesh_instance(), drawCurveDerivedMesh(), and drawDispList().
| static void gpu_clear_tpage | ( | void | ) | [static] |
Definition at line 339 of file gpu_draw.c.
References GPUTextureState::alphamode, GPUTextureState::curima, GPUTextureState::curtile, GPUTextureState::curtilemode, GPUTextureState::curtileXRep, GPUTextureState::curtileYRep, GTS, GPUTextureState::lasttface, and NULL.
Referenced by GPU_set_tpage().
| void GPU_create_smoke | ( | SmokeModifierData * | smd, |
| int | highres | ||
| ) |
Definition at line 823 of file gpu_draw.c.
References SmokeModifierData::domain, SmokeDomainSettings::fluid, GPU_texture_create_3D(), MOD_SMOKE_TYPE_DOMAIN, NULL, SmokeDomainSettings::res, SmokeDomainSettings::res_wt, SmokeDomainSettings::shadow, smoke_get_density(), smoke_turbulence_get_density(), SmokeDomainSettings::tex, SmokeDomainSettings::tex_shadow, SmokeModifierData::type, and SmokeDomainSettings::wt.
Referenced by draw_object().
| int GPU_default_lights | ( | void | ) |
Definition at line 1219 of file gpu_draw.c.
Referenced by draw_textured_end(), GPU_state_init(), view3d_main_area_draw(), and WM_read_homefile().
| void GPU_disable_material | ( | void | ) |
Definition at line 1180 of file gpu_draw.c.
References GPUMaterialState::alphapass, GPUMaterialState::gboundmat, GMS, GPU_BLEND_SOLID, GPU_material_from_blender(), GPU_material_unbind(), GPU_set_material_blend_mode(), GPUMaterialState::gscene, GPUMaterialState::lastmatnr, GPUMaterialState::lastretval, and NULL.
Referenced by draw_em_fancy(), draw_mesh_fancy(), draw_mesh_object_outline(), draw_object(), GPU_begin_object_materials(), and GPU_end_object_materials().
| int GPU_enable_material | ( | int | nr, |
| void * | attribs | ||
| ) |
Definition at line 1089 of file gpu_draw.c.
References GPUMaterialState::alphapass, GPUMaterialState::blendmode, Object::col, GPUMaterialFixed::diff, KDL::diff(), ELEM, Material::emit, GPUMaterialState::gboundmat, GPUMaterialState::glay, GPUMaterialState::gmatbuf, GMS, GPUMaterialState::gob, GPU_BLEND_ALPHA, GPU_BLEND_CLIP, GPU_BLEND_SOLID, GPU_material_bind(), GPU_material_bind_uniforms(), GPU_material_from_blender(), GPU_material_unbind(), GPU_material_vertex_attributes(), GPU_set_material_blend_mode(), GPUMaterialState::gscene, GPUMaterialState::gviewinv, GPUMaterialState::gviewmat, GPUMaterialFixed::hard, GPUMaterialState::lastmatnr, GPUMaterialState::lastretval, Object::lay, GPUMaterialState::matbuf, Object::mode, mul_v3_v3fl(), NULL, OB_MODE_TEXTURE_PAINT, Object::obmat, Material::r, Material::ref, Material::spec, spec(), GPUMaterialFixed::spec, Material::specr, and GPUMaterialState::totmat.
Referenced by bbs_mesh_solid(), bbs_mesh_solid_EM(), ccgDM_drawFacesTex_common(), draw_dm_faces_sel(), draw_em_fancy(), draw_em_fancy__setFaceOpts(), draw_mesh_fancy(), draw_mesh_object_outline(), draw_mesh_text(), draw_mesh_textured(), draw_object(), draw_object_mesh_instance(), drawCurveDerivedMesh(), and drawDispListsolid().
| void GPU_end_object_materials | ( | void | ) |
Definition at line 1194 of file gpu_draw.c.
References GPUMaterialState::blendmode, GPUMaterialState::gmatbuf, GMS, GPU_disable_material(), GTS, GPUMaterialState::matbuf, GPUMaterialState::matbuf_fixed, MEM_freeN(), NULL, and GPUTextureState::tilemode.
Referenced by draw_mesh_object(), draw_object_mesh_instance(), drawCurveDerivedMesh(), and drawDispList().
| void GPU_free_image | ( | Image * | ima | ) |
Definition at line 872 of file gpu_draw.c.
References Image::bindcode, BLI_thread_is_main(), gpu_queue_image_for_free(), GPU_texture_free(), Image::gputexture, IMA_MIPMAP_COMPLETE, MEM_freeN(), NULL, Image::repbind, Image::totbind, and Image::tpageflag.
Referenced by finish_bake_internal(), free_old_images(), GPU_free_images(), GPU_free_images_anim(), GPU_free_unused_buffers(), GPU_paint_set_mipmap(), GPU_paint_update_image(), GPU_verify_image(), image_free_buffers(), image_undo_restore(), paint_redraw(), and texture_paint_camera_project_exec().
| void GPU_free_images | ( | void | ) |
Definition at line 902 of file gpu_draw.c.
References ListBase::first, G, GPU_free_image(), Image::id, Main::image, Global::main, and ID::next.
Referenced by GPU_set_anisotropic(), GPU_set_linear_mipmap(), GPU_set_mipmap(), and texture_paint_toggle_exec().
| void GPU_free_images_anim | ( | void | ) |
Definition at line 912 of file gpu_draw.c.
References ELEM, ListBase::first, G, GPU_free_image(), Image::id, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE, Main::image, Global::main, ID::next, and Image::source.
Referenced by ED_view3d_draw_offscreen().
| void GPU_free_smoke | ( | SmokeModifierData * | smd | ) |
Definition at line 809 of file gpu_draw.c.
References SmokeModifierData::domain, GPU_texture_free(), MOD_SMOKE_TYPE_DOMAIN, NULL, SmokeDomainSettings::tex, SmokeDomainSettings::tex_shadow, and SmokeModifierData::type.
Referenced by draw_object().
| void GPU_free_unused_buffers | ( | void | ) |
Definition at line 850 of file gpu_draw.c.
References BLI_freelistN(), BLI_lock_thread(), BLI_thread_is_main(), BLI_unlock_thread(), ListBase::first, GPU_free_image(), Image::id, LOCK_OPENGL, and ID::next.
Referenced by wm_draw_update(), and WM_exit().
| float GPU_get_anisotropic | ( | void | ) |
Definition at line 311 of file gpu_draw.c.
References GPUTextureState::anisotropic, and GTS.
Referenced by GPU_verify_image().
| int GPU_get_material_blend_mode | ( | void | ) |
Definition at line 1175 of file gpu_draw.c.
References GMS, and GPUMaterialState::lastblendmode.
Referenced by ccgDM_drawMappedFacesGLSL(), cdDM_drawMappedFacesGLSL(), emDM_drawMappedFacesGLSL(), and RAS_OpenGLRasterizer::IndexPrimitivesInternal().
| static int gpu_get_mipmap | ( | void | ) | [static] |
Definition at line 271 of file gpu_draw.c.
References GPUTextureState::domipmap, and GTS.
Referenced by GPU_paint_update_image(), and GPU_verify_image().
| static GLenum gpu_get_mipmap_filter | ( | int | mag | ) | [static] |
Definition at line 276 of file gpu_draw.c.
References GPUTextureState::domipmap, GTS, and GPUTextureState::linearmipmap.
Referenced by GPU_paint_set_mipmap(), and GPU_verify_image().
| static void gpu_get_print | ( | const char * | name, |
| GLenum | type | ||
| ) | [static] |
Definition at line 1439 of file gpu_draw.c.
Referenced by GPU_state_print().
| static void gpu_make_repbind | ( | Image * | ima | ) | [static] |
Definition at line 318 of file gpu_draw.c.
References BKE_image_get_ibuf(), IMA_MIPMAP_COMPLETE, MEM_callocN(), MEM_freeN(), NULL, Image::repbind, Image::totbind, Image::tpageflag, Image::xrep, and Image::yrep.
Referenced by GPU_verify_image().
| static void gpu_material_to_fixed | ( | GPUMaterialFixed * | smat, |
| const Material * | bmat, | ||
| const int | gamma, | ||
| const Object * | ob | ||
| ) | [static] |
Definition at line 957 of file gpu_draw.c.
References CLAMPIS, Object::col, copy_v3_v3(), GPUMaterialFixed::diff, Material::emit, Material::har, GPUMaterialFixed::hard, linearrgb_to_srgb_v3_v3(), MA_OBCOLOR, MA_SHLESS, Material::mode, mul_v3_v3(), mul_v3_v3fl(), Material::r, Material::ref, Material::shade_flag, Material::spec, GPUMaterialFixed::spec, and Material::specr.
Referenced by GPU_begin_object_materials().
| static void gpu_mcol | ( | unsigned int | ucol | ) | [static] |
Definition at line 87 of file gpu_draw.c.
Referenced by GPU_render_text().
| void GPU_paint_set_mipmap | ( | int | mipmap | ) |
Definition at line 660 of file gpu_draw.c.
References Image::bindcode, GPUTextureState::domipmap, ListBase::first, G, GPU_free_image(), gpu_get_mipmap_filter(), GTS, Image::id, IMA_MIPMAP_COMPLETE, Main::image, Global::main, ID::next, and Image::tpageflag.
Referenced by texture_paint_toggle_exec().
| void GPU_paint_update_image | ( | Image * | ima, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| int | mipmap | ||
| ) |
Definition at line 692 of file gpu_draw.c.
References Image::bindcode, BKE_image_get_ibuf(), GPU_free_image(), gpu_get_mipmap(), IMA_MIPMAP_COMPLETE, IMB_partial_rect_from_float(), IMB_rect_from_float(), is_pow2(), MEM_freeN(), MEM_mallocN(), NULL, ImBuf::rect, ImBuf::rect_float, Image::repbind, Image::tpageflag, ImBuf::x, and ImBuf::y.
Referenced by imapaint_image_update().
| static void gpu_queue_image_for_free | ( | Image * | ima | ) | [static] |
Definition at line 841 of file gpu_draw.c.
References BLI_addtail(), BLI_lock_thread(), BLI_unlock_thread(), LOCK_OPENGL, and MEM_dupallocN().
Referenced by GPU_free_image().
| void GPU_render_text | ( | MTFace * | tface, |
| int | mode, | ||
| const char * | textstr, | ||
| int | textlen, | ||
| unsigned int * | col, | ||
| float * | v1, | ||
| float * | v2, | ||
| float * | v3, | ||
| float * | v4, | ||
| int | glattrib | ||
| ) |
Definition at line 94 of file gpu_draw.c.
References ListBase::first, gpu_mcol(), Image::ibufs, if(), matrixGlyph(), MAX3(), MAX4, MIN3, MIN4, MTFace::mode, NULL, TF_BMFONT, TF_OBCOL, MTFace::tpage, and MTFace::uv.
Referenced by draw_mesh_text(), GPC_RenderTools::RenderText(), and KX_BlenderRenderTools::RenderText().
Definition at line 1283 of file gpu_draw.c.
References Lamp::att1, Lamp::att2, Scene::base, copy_v3_v3(), Object::data, Lamp::dist, Lamp::energy, ListBase::first, glLoadMatrixf, LA_SPOT, LA_SUN, Base::lay, Object::lay, mul_v3_v3fl(), negate_v3_v3(), Base::next, OB_LAMP, Base::object, Object::obmat, Lamp::r, Lamp::spotblend, Lamp::spotsize, Lamp::type, Object::type, and where_is_object_simul().
Referenced by draw_textured_begin().
| void GPU_set_anisotropic | ( | float | value | ) |
Definition at line 297 of file gpu_draw.c.
References GPUTextureState::anisotropic, GPU_free_images(), and GTS.
| static void gpu_set_blend_mode | ( | GPUBlendMode | blendmode | ) | [static] |
Definition at line 364 of file gpu_draw.c.
References GPU_BLEND_ADD, GPU_BLEND_ALPHA, GPU_BLEND_CLIP, and GPU_BLEND_SOLID.
Referenced by GPU_set_material_blend_mode(), and gpu_verify_alpha_mode().
| void GPU_set_linear_mipmap | ( | int | linear | ) |
Definition at line 263 of file gpu_draw.c.
References GPU_free_images(), GTS, and GPUTextureState::linearmipmap.
Referenced by set_ge_parameters().
| void GPU_set_material_blend_mode | ( | int | blendmode | ) |
Definition at line 1166 of file gpu_draw.c.
References GMS, gpu_set_blend_mode(), and GPUMaterialState::lastblendmode.
Referenced by RAS_OpenGLRasterizer::BeginFrame(), ccgDM_drawMappedFacesGLSL(), cdDM_drawMappedFacesGLSL(), emDM_drawMappedFacesGLSL(), GPU_disable_material(), GPU_enable_material(), RAS_OpenGLRasterizer::IndexPrimitivesInternal(), RAS_OpenGLRasterizer::Init(), and RAS_OpenGLRasterizer::SetBlendingMode().
| void GPU_set_mipmap | ( | int | mipmap | ) |
Definition at line 255 of file gpu_draw.c.
References GPUTextureState::domipmap, GPU_free_images(), and GTS.
Referenced by main(), set_ge_parameters(), and WM_init().
| int GPU_set_tpage | ( | MTFace * | tface, |
| int | mipmap | ||
| ) |
Definition at line 611 of file gpu_draw.c.
References GPUTextureState::curima, GPUTextureState::curtile, GPUTextureState::curtilemode, GPUTextureState::curtileXRep, GPUTextureState::curtileYRep, gpu_clear_tpage(), gpu_verify_alpha_mode(), GPU_verify_image(), gpu_verify_reflection(), gpu_verify_repeat(), GTS, GPUTextureState::ima, GPUTextureState::lasttface, NULL, MTFace::tile, GPUTextureState::tile, GPUTextureState::tilemode, GPUTextureState::tileXRep, GPUTextureState::tileYRep, and MTFace::tpage.
Referenced by KX_PolygonMaterial::DefaultActivate(), draw_textured_end(), and set_draw_settings_cached().
| void GPU_state_init | ( | void | ) |
Definition at line 1363 of file gpu_draw.c.
References GPU_default_lights().
Referenced by RAS_OpenGLRasterizer::Init(), and wm_window_add_ghostwindow().
| void GPU_state_print | ( | void | ) |
Definition at line 1453 of file gpu_draw.c.
References gpu_get_print().
| int GPU_update_image_time | ( | Image * | ima, |
| double | time | ||
| ) |
Definition at line 768 of file gpu_draw.c.
References Image::animspeed, KDL::diff(), IMA_TWINANIM, Image::lastframe, Image::lastupdate, Image::tpageflag, Image::twend, Image::twsta, Image::xrep, and Image::yrep.
Referenced by KX_PolygonMaterial::DefaultActivate(), and GPU_texture_from_blender().
| void GPU_update_images_framechange | ( | void | ) |
Definition at line 750 of file gpu_draw.c.
References ListBase::first, G, Image::id, IMA_TWINANIM, Main::image, Image::lastframe, Global::main, ID::next, Image::tpageflag, Image::twend, Image::twsta, Image::xrep, and Image::yrep.
| static void gpu_verify_alpha_mode | ( | MTFace * | tface | ) | [static] |
Definition at line 399 of file gpu_draw.c.
References GPUTextureState::alphamode, gpu_set_blend_mode(), GTS, and MTFace::transp.
Referenced by GPU_set_tpage().
Definition at line 426 of file gpu_draw.c.
References Image::bindcode, BKE_image_get_ibuf(), GPUTextureState::curima, GPUTextureState::curtile, GPUTextureState::curtilemode, GPUTextureState::curtileXRep, GPUTextureState::curtileYRep, GPU_free_image(), GPU_get_anisotropic(), gpu_get_mipmap(), gpu_get_mipmap_filter(), gpu_make_repbind(), GTS, GPUTextureState::ima, IMA_MIPMAP_COMPLETE, IMA_TILES, IMA_TPAGE_REFRESH, IMA_TWINANIM, IMB_rect_from_float(), is_pow2_limit(), Image::lastframe, MAX2, MEM_freeN(), MEM_mallocN(), NULL, Image::ok, ImBuf::rect, ImBuf::rect_float, Image::repbind, smaller_pow2_limit(), GPUTextureState::tile, GPUTextureState::tilemode, GPUTextureState::tileXRep, GPUTextureState::tileYRep, Image::totbind, Image::tpageflag, ImBuf::x, Image::xrep, ImBuf::y, and Image::yrep.
Referenced by GPU_set_tpage(), and GPU_texture_from_blender().
| static void gpu_verify_reflection | ( | Image * | ima | ) | [static] |
Definition at line 409 of file gpu_draw.c.
References Image::flag, and IMA_REFLECT.
Referenced by GPU_set_tpage().
| static void gpu_verify_repeat | ( | Image * | ima | ) | [static] |
Definition at line 597 of file gpu_draw.c.
References GL_CLAMP_TO_EDGE, IMA_CLAMP_U, IMA_CLAMP_V, and Image::tpageflag.
Referenced by GPU_set_tpage().
| static int is_pow2 | ( | int | num | ) | [static] |
Definition at line 196 of file gpu_draw.c.
Referenced by GPU_paint_update_image(), and smaller_pow2().
| static int is_pow2_limit | ( | int | num | ) | [static] |
Definition at line 210 of file gpu_draw.c.
Referenced by GPU_verify_image().
| static int smaller_pow2 | ( | int | num | ) | [static] |
Definition at line 202 of file gpu_draw.c.
References is_pow2().
Referenced by smaller_pow2_limit().
| static int smaller_pow2_limit | ( | int | num | ) | [static] |
Definition at line 224 of file gpu_draw.c.
References smaller_pow2().
Referenced by GPU_verify_image().
Definition at line 69 of file material.c.
struct GPUMaterialState GMS [static] |
struct GPUTextureState GTS [static] |
ListBase image_free_queue = {NULL, NULL} [static] |
Definition at line 839 of file gpu_draw.c.