Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawmesh.c
| Show First 20 Lines • Show All 1,071 Lines • ▼ Show 20 Lines | static bool tex_mat_set_face_editmesh_cb(void *userData, int index) | ||||
| if (UNLIKELY(index >= em->bm->totface)) | if (UNLIKELY(index >= em->bm->totface)) | ||||
| return DM_DRAW_OPTION_NORMAL; | return DM_DRAW_OPTION_NORMAL; | ||||
| efa = BM_face_at_index(em->bm, index); | efa = BM_face_at_index(em->bm, index); | ||||
| return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN); | return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN); | ||||
| } | } | ||||
| void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, | void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, | ||||
psy-fi: Passing the dupliobject around is quite ugly.
I would add functions like GPU_begin_dupliobject… | |||||
| Object *ob, DerivedMesh *dm, const int draw_flags) | Object *ob, DerivedMesh *dm, const int draw_flags, DupliObject *dob) | ||||
| { | { | ||||
| /* if not cycles, or preview-modifiers, or drawing matcaps */ | /* if not cycles, or preview-modifiers, or drawing matcaps */ | ||||
| if ((draw_flags & DRAW_MODIFIERS_PREVIEW) || | if ((draw_flags & DRAW_MODIFIERS_PREVIEW) || | ||||
| (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) || | (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) || | ||||
| (BKE_scene_use_new_shading_nodes(scene) == false) || | (BKE_scene_use_new_shading_nodes(scene) == false) || | ||||
| ((ob->mode & OB_MODE_TEXTURE_PAINT) && ELEM(v3d->drawtype, OB_TEXTURE, OB_SOLID))) | ((ob->mode & OB_MODE_TEXTURE_PAINT) && ELEM(v3d->drawtype, OB_TEXTURE, OB_SOLID))) | ||||
| { | { | ||||
| draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags); | draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags); | ||||
| Show All 25 Lines | else | ||||
| else if (draw_flags & DRAW_FACE_SELECT) | else if (draw_flags & DRAW_FACE_SELECT) | ||||
| set_face_cb = tex_mat_set_face_mesh_cb; | set_face_cb = tex_mat_set_face_mesh_cb; | ||||
| else | else | ||||
| set_face_cb = NULL; | set_face_cb = NULL; | ||||
| /* test if we can use glsl */ | /* test if we can use glsl */ | ||||
| glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support() && !picking; | glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support() && !picking; | ||||
| GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); | GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL, dob); | ||||
| if (glsl || picking) { | if (glsl || picking) { | ||||
| /* draw glsl or solid */ | /* draw glsl or solid */ | ||||
| dm->drawMappedFacesMat(dm, | dm->drawMappedFacesMat(dm, | ||||
| tex_mat_set_material_cb, | tex_mat_set_material_cb, | ||||
| set_face_cb, &data); | set_face_cb, &data); | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines | |||||
Passing the dupliobject around is quite ugly.
I would add functions like GPU_begin_dupliobject / GPU_end_dupliobject that set/unset the global material dupli object around the call where the dupli is drawn.