Blender V2.61 - r43446
|
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_property_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "BKE_DerivedMesh.h"
#include "BKE_effect.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_property.h"
#include "BKE_scene.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "UI_resources.h"
#include "GPU_buffers.h"
#include "GPU_extensions.h"
#include "GPU_draw.h"
#include "GPU_material.h"
#include "ED_mesh.h"
#include "ED_uvedit.h"
#include "view3d_intern.h"
Go to the source code of this file.
Classes | |
struct | drawMeshFaceSelect_userData |
struct | drawEMTFMapped_userData |
struct | drawTFace_userData |
struct | TextureDrawState |
struct | TexMatCallback |
Typedefs | |
typedef struct drawMeshFaceSelect_userData | drawMeshFaceSelect_userData |
typedef struct drawEMTFMapped_userData | drawEMTFMapped_userData |
typedef struct drawTFace_userData | drawTFace_userData |
typedef struct TexMatCallback | TexMatCallback |
Enumerations | |
enum | { eEdge_Visible = (1<<0), eEdge_Select = (1<<1) } |
Functions | |
static void | get_marked_edge_info__orFlags (EdgeHash *eh, int v0, int v1, int flags) |
static EdgeHash * | get_tface_mesh_marked_edge_info (Mesh *me) |
static int | draw_mesh_face_select__setHiddenOpts (void *userData, int index) |
static int | draw_mesh_face_select__setSelectOpts (void *userData, int index) |
static int | draw_mesh_face_select__drawFaceOptsInv (void *userData, int index) |
static void | draw_mesh_face_select (RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) |
static Material * | give_current_material_or_def (Object *ob, int matnr) |
static int | set_draw_settings_cached (int clearcache, MTFace *texface, Material *ma, struct TextureDrawState gtexdraw) |
static void | draw_textured_begin (Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) |
static void | draw_textured_end (void) |
static int | draw_tface__set_draw_legacy (MTFace *tface, int has_mcol, int matnr) |
static int | draw_mcol__set_draw_legacy (MTFace *UNUSED(tface), int has_mcol, int UNUSED(matnr)) |
static int | draw_tface__set_draw (MTFace *tface, int has_mcol, int matnr) |
static void | add_tface_color_layer (DerivedMesh *dm) |
static int | draw_tface_mapped__set_draw (void *userData, int index) |
static int | draw_em_tf_mapped__set_draw (void *userData, int index) |
static int | wpaint__setSolidDrawOptions_material (void *userData, int index, int *drawSmooth_r) |
static int | wpaint__setSolidDrawOptions_facemask (void *userData, int index, int *drawSmooth_r) |
static void | draw_mesh_text (Scene *scene, Object *ob, int glsl) |
static int | compareDrawOptions (void *userData, int cur_index, int next_index) |
static int | compareDrawOptionsEm (void *userData, int cur_index, int next_index) |
void | draw_mesh_textured_old (Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) |
static void | tex_mat_set_material_cb (void *UNUSED(userData), int mat_nr, void *attribs) |
static void | tex_mat_set_texture_cb (void *userData, int mat_nr, void *attribs) |
static int | tex_mat_set_face_mesh_cb (void *userData, int index) |
static int | tex_mat_set_face_editmesh_cb (void *UNUSED(userData), int index) |
void | draw_mesh_textured (Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) |
Variables | |
static struct TextureDrawState | Gtexdraw |
Definition in file drawmesh.c.
typedef struct drawEMTFMapped_userData drawEMTFMapped_userData |
typedef struct drawMeshFaceSelect_userData drawMeshFaceSelect_userData |
typedef struct drawTFace_userData drawTFace_userData |
typedef struct TexMatCallback TexMatCallback |
anonymous enum |
Definition at line 95 of file drawmesh.c.
static void add_tface_color_layer | ( | DerivedMesh * | dm | ) | [static] |
Definition at line 447 of file drawmesh.c.
References MCol::b, CD_ASSIGN, CD_MCOL, CD_MFACE, CD_MTFACE, CD_TEXTURE_MCOL, CD_WEIGHT_MCOL, TextureDrawState::color_profile, copy_v3_v3(), CustomData_add_layer(), DM_get_face_data_layer(), DerivedMesh::faceData, GameSettings::flag, FTOCHAR, MCol::g, Material::game, GEMAT_INVISIBLE, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, give_current_material(), Gtexdraw, i, linearrgb_to_srgb_v3_v3(), MFace::mat_nr, MEM_mallocN(), MTFace::mode, DerivedMesh::numFaceData, TextureDrawState::ob, TextureDrawState::obcol, MCol::r, Material::r, set_draw_settings_cached(), and TF_OBCOL.
Referenced by draw_mesh_textured_old().
static int compareDrawOptions | ( | void * | userData, |
int | cur_index, | ||
int | next_index | ||
) | [static] |
Definition at line 661 of file drawmesh.c.
References data, MFace::mat_nr, drawTFace_userData::mf, drawTFace_userData::tf, and MTFace::tpage.
Referenced by ccgDM_drawFacesTex(), ccgDM_drawFacesTex_common(), ccgDM_drawMappedFaces(), ccgDM_drawMappedFacesTex(), cdDM_drawFacesTex(), cdDM_drawFacesTex_common(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesTex(), draw_mesh_textured_old(), emDM_drawFacesTex(), emDM_drawFacesTex_common(), emDM_drawMappedFaces(), and emDM_drawMappedFacesTex().
static int compareDrawOptionsEm | ( | void * | userData, |
int | cur_index, | ||
int | next_index | ||
) | [static] |
Definition at line 674 of file drawmesh.c.
References data, MFace::mat_nr, drawEMTFMapped_userData::mf, drawEMTFMapped_userData::tf, and MTFace::tpage.
Referenced by draw_mesh_textured_old().
static int draw_em_tf_mapped__set_draw | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 533 of file drawmesh.c.
References CD_MTFACE, CustomData_em_get(), data, EditFace::data, draw_tface__set_draw_legacy(), drawEMTFMapped_userData::em, EM_get_face_for_index(), EditMesh::fdata, EditFace::h, drawEMTFMapped_userData::has_mcol, drawEMTFMapped_userData::has_mtface, EditFace::mat_nr, and NULL.
Referenced by draw_mesh_textured_old().
static int draw_mcol__set_draw_legacy | ( | MTFace * | UNUSEDtface, |
int | has_mcol, | ||
int | UNUSEDmatnr | ||
) | [static] |
Definition at line 425 of file drawmesh.c.
Referenced by draw_mesh_textured_old().
static void draw_mesh_face_select | ( | RegionView3D * | rv3d, |
Mesh * | me, | ||
DerivedMesh * | dm | ||
) | [static] |
Definition at line 179 of file drawmesh.c.
References bglPolygonOffset(), BLI_edgehash_free(), data, RegionView3D::dist, draw_mesh_face_select__drawFaceOptsInv(), draw_mesh_face_select__setHiddenOpts(), draw_mesh_face_select__setSelectOpts(), Mesh::drawflag, DerivedMesh::drawMappedEdges, DerivedMesh::drawMappedFacesTex, drawMeshFaceSelect_userData::eh, get_tface_mesh_marked_edge_info(), drawMeshFaceSelect_userData::me, ME_DRAWFACES, NULL, setlinestyle(), TH_EDGE_FACESEL, and UI_ThemeColor().
Referenced by draw_mesh_textured(), and draw_mesh_textured_old().
static int draw_mesh_face_select__drawFaceOptsInv | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 168 of file drawmesh.c.
References MFace::flag, ME_FACE_SEL, ME_HIDE, and Mesh::mface.
Referenced by draw_mesh_face_select().
static int draw_mesh_face_select__setHiddenOpts | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 141 of file drawmesh.c.
References BLI_edgehash_lookup(), data, Mesh::drawflag, eEdge_Select, eEdge_Visible, drawMeshFaceSelect_userData::eh, drawMeshFaceSelect_userData::me, ME_DRAWEDGES, ME_HIDDENEDGES, Mesh::medge, MEdge::v1, and MEdge::v2.
Referenced by draw_mesh_face_select().
static int draw_mesh_face_select__setSelectOpts | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 158 of file drawmesh.c.
References BLI_edgehash_lookup(), data, eEdge_Select, drawMeshFaceSelect_userData::eh, drawMeshFaceSelect_userData::me, Mesh::medge, MEdge::v1, and MEdge::v2.
Referenced by draw_mesh_face_select().
Definition at line 575 of file drawmesh.c.
References BKE_image_get_ibuf(), CD_MASK_BAREMESH, CD_MTFACE, Object::data, MFace::flag, GameSettings::flag, Material::game, GEMAT_INVISIBLE, GEMAT_TEXT, get_ob_property(), DerivedMesh::getVertCo, GPUVertexAttribs::glindex, GPU_enable_material(), GPU_render_text(), Gtexdraw, i, GPUVertexAttribs::layer, Mesh::mat, MFace::mat_nr, MAX_PROPSTRING, Mesh::mcol, ME_SMOOTH, mesh_get_derived_deform(), Mesh::mface, Object::mode, Mesh::mtface, normal_tri_v3(), NULL, OB_MODE_EDIT, OBACT, paint_facesel_test(), paint_vertsel_test(), DerivedMesh::release, set_draw_settings_cached(), set_property_valstr(), strlen(), Mesh::totface, GPUVertexAttribs::totlayer, GPUVertexAttribs::type, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by draw_mesh_textured_old().
void draw_mesh_textured | ( | Scene * | scene, |
View3D * | v3d, | ||
RegionView3D * | rv3d, | ||
Object * | ob, | ||
DerivedMesh * | dm, | ||
int | draw_flags | ||
) |
Definition at line 853 of file drawmesh.c.
References Object::data, data, DRAW_DYNAMIC_PAINT_PREVIEW, DRAW_FACE_SELECT, draw_mesh_face_select(), draw_mesh_textured_old(), DerivedMesh::drawMappedFaces, DerivedMesh::drawMappedFacesMat, View3D::drawtype, GPU_begin_object_materials(), GPU_enable_material(), GPU_end_object_materials(), GPU_glsl_support(), Object::mode, NULL, OB_MATERIAL, OB_MODE_WEIGHT_PAINT, OB_NEG_SCALE, Scene::obedit, scene_use_new_shading_nodes(), tex_mat_set_face_editmesh_cb(), tex_mat_set_face_mesh_cb(), tex_mat_set_material_cb(), tex_mat_set_texture_cb(), Object::transflag, and wpaint__setSolidDrawOptions_material().
Referenced by draw_em_fancy(), and draw_mesh_fancy().
void draw_mesh_textured_old | ( | Scene * | scene, |
View3D * | v3d, | ||
RegionView3D * | rv3d, | ||
Object * | ob, | ||
DerivedMesh * | dm, | ||
int | draw_flags | ||
) |
Definition at line 687 of file drawmesh.c.
References add_tface_color_layer(), CD_MCOL, CD_MFACE, CD_MTFACE, CD_TEXTURE_MCOL, compareDrawOptions(), compareDrawOptionsEm(), CustomData_has_layer(), Object::data, data, DM_get_face_data_layer(), DRAW_DYNAMIC_PAINT_PREVIEW, draw_em_tf_mapped__set_draw(), DRAW_FACE_SELECT, draw_mcol__set_draw_legacy(), draw_mesh_face_select(), draw_mesh_text(), draw_textured_begin(), draw_textured_end(), draw_tface__set_draw(), draw_tface__set_draw_legacy(), draw_tface_mapped__set_draw(), DerivedMesh::drawFacesTex, DerivedMesh::drawMappedFaces, DerivedMesh::drawMappedFacesTex, Mesh::edit_mesh, drawEMTFMapped_userData::em, DerivedMesh::faceData, EditMesh::fdata, get_ob_property(), GPU_buffer_legacy(), GPU_enable_material(), drawEMTFMapped_userData::has_mcol, drawEMTFMapped_userData::has_mtface, drawEMTFMapped_userData::mf, drawTFace_userData::mf, Mesh::mface, Object::mode, NULL, OB_MODE_EDIT, OB_MODE_WEIGHT_PAINT, OB_NEG_SCALE, Scene::obedit, drawTFace_userData::tf, drawEMTFMapped_userData::tf, Object::transflag, and wpaint__setSolidDrawOptions_facemask().
Referenced by draw_mesh_textured().
static void draw_textured_begin | ( | Scene * | scene, |
View3D * | v3d, | ||
RegionView3D * | rv3d, | ||
Object * | ob | ||
) | [static] |
Definition at line 328 of file drawmesh.c.
References CLAMPIS, Object::col, RenderData::color_mgt_flag, TextureDrawState::color_profile, View3D::drawtype, FALSE, GPU_scene_object_lights(), Gtexdraw, RegionView3D::is_persp, TextureDrawState::islit, TextureDrawState::istex, View3D::lay, Object::mode, NULL, TextureDrawState::ob, OB_MODE_EDIT, OB_MODE_WEIGHT_PAINT, OB_SOLID, OB_TEXTURE, OB_WIRE, TextureDrawState::obcol, Scene::r, R_COLOR_MANAGEMENT, set_draw_settings_cached(), TRUE, and RegionView3D::viewmat.
Referenced by draw_mesh_textured_old().
static void draw_textured_end | ( | void | ) | [static] |
Definition at line 369 of file drawmesh.c.
References GPU_default_lights(), GPU_set_tpage(), and NULL.
Referenced by draw_mesh_textured_old().
static int draw_tface__set_draw | ( | MTFace * | tface, |
int | has_mcol, | ||
int | matnr | ||
) | [static] |
Definition at line 431 of file drawmesh.c.
References GameSettings::flag, Material::game, GEMAT_INVISIBLE, give_current_material(), Gtexdraw, MTFace::mode, TextureDrawState::ob, set_draw_settings_cached(), and TF_OBCOL.
Referenced by draw_mesh_textured_old(), and draw_tface_mapped__set_draw().
static int draw_tface__set_draw_legacy | ( | MTFace * | tface, |
int | has_mcol, | ||
int | matnr | ||
) | [static] |
Definition at line 392 of file drawmesh.c.
References TextureDrawState::color_profile, copy_v3_v3(), GameSettings::flag, Material::game, GEMAT_INVISIBLE, give_current_material(), Gtexdraw, linearrgb_to_srgb_v3_v3(), MA_OBCOLOR, TextureDrawState::ob, TextureDrawState::obcol, Material::r, set_draw_settings_cached(), and Material::shade_flag.
Referenced by draw_em_tf_mapped__set_draw(), and draw_mesh_textured_old().
static int draw_tface_mapped__set_draw | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 523 of file drawmesh.c.
References draw_tface__set_draw(), if(), MFace::mat_nr, Mesh::mcol, ME_HIDE, Mesh::mface, Mesh::mtface, and NULL.
Referenced by draw_mesh_textured_old().
static void get_marked_edge_info__orFlags | ( | EdgeHash * | eh, |
int | v0, | ||
int | v1, | ||
int | flags | ||
) | [static] |
Definition at line 101 of file drawmesh.c.
References BLI_edgehash_haskey(), BLI_edgehash_insert(), BLI_edgehash_lookup_p(), and NULL.
Referenced by get_tface_mesh_marked_edge_info().
Definition at line 112 of file drawmesh.c.
References BLI_edgehash_new(), eEdge_Select, eEdge_Visible, MFace::flag, get_marked_edge_info__orFlags(), i, ME_FACE_SEL, ME_HIDE, Mesh::mface, Mesh::totface, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by draw_mesh_face_select().
Definition at line 222 of file drawmesh.c.
References defmaterial, and give_current_material().
Referenced by set_draw_settings_cached().
static int set_draw_settings_cached | ( | int | clearcache, |
MTFace * | texface, | ||
Material * | ma, | ||
struct TextureDrawState | gtexdraw | ||
) | [static] |
Definition at line 239 of file drawmesh.c.
References GameSettings::alpha_blend, BKE_image_has_alpha(), CLAMPIS, GameSettings::flag, Material::game, GEMAT_BACKCULL, give_current_material_or_def(), GPU_BLEND_ALPHA, GPU_set_tpage(), Material::har, TextureDrawState::islit, TextureDrawState::istex, MA_SHLESS, Material::mode, Object::mode, NULL, TextureDrawState::ob, OB_MODE_TEXTURE_PAINT, spec(), Material::spec, Material::specb, Material::specg, Material::specr, and MTFace::tpage.
Referenced by add_tface_color_layer(), draw_mesh_text(), draw_textured_begin(), draw_tface__set_draw(), and draw_tface__set_draw_legacy().
static int tex_mat_set_face_editmesh_cb | ( | void * | UNUSEDuserData, |
int | index | ||
) | [static] |
Definition at line 845 of file drawmesh.c.
References EM_get_face_for_index(), and EditFace::h.
Referenced by draw_mesh_textured().
static int tex_mat_set_face_mesh_cb | ( | void * | userData, |
int | index | ||
) | [static] |
Definition at line 835 of file drawmesh.c.
References data, TexMatCallback::me, ME_HIDE, and Mesh::mface.
Referenced by draw_mesh_textured().
static void tex_mat_set_material_cb | ( | void * | UNUSEDuserData, |
int | mat_nr, | ||
void * | attribs | ||
) | [static] |
Definition at line 763 of file drawmesh.c.
References GPU_enable_material().
Referenced by draw_mesh_textured().
static void tex_mat_set_texture_cb | ( | void * | userData, |
int | mat_nr, | ||
void * | attribs | ||
) | [static] |
Definition at line 772 of file drawmesh.c.
References Image::bindcode, CD_MTFACE, data, ED_object_get_active_image(), glLoadMatrixf, GPUVertexAttribs::gltexco, GPU_disable_material(), GPU_enable_material(), GPU_verify_image(), GPUVertexAttribs::layer, TexMapping::mat, GPUVertexAttribs::name, TexMatCallback::ob, bNode::storage, NodeTexBase::tex_mapping, GPUVertexAttribs::totlayer, and GPUVertexAttribs::type.
Referenced by draw_mesh_textured().
static int wpaint__setSolidDrawOptions_facemask | ( | void * | userData, |
int | index, | ||
int * | drawSmooth_r | ||
) | [static] |
Definition at line 566 of file drawmesh.c.
References MFace::flag, ME_HIDE, and Mesh::mface.
Referenced by draw_mesh_textured_old().
static int wpaint__setSolidDrawOptions_material | ( | void * | userData, |
int | index, | ||
int * | drawSmooth_r | ||
) | [static] |
Definition at line 550 of file drawmesh.c.
References GameSettings::flag, Material::game, GEMAT_INVISIBLE, Mesh::mat, MFace::mat_nr, and Mesh::mface.
Referenced by draw_mesh_textured().
struct TextureDrawState Gtexdraw [static] |