[Bf-committers] Edge Drawing with derived mesh (all edges currently drawn twice)

Campbell Barton cbarton at metavr.com
Wed Sep 27 20:46:36 CEST 2006

Im posting because this isnt an area Im familier with..
just looking at a way to stop hidden faces being drawn in editmode and 
discovered that with a normal mesh (no modifiers)
all edges are being drawn twice.

Once  drawobject.c:1819 - Draws light wire edges, weather there hidden 
or not, but only in wire display mode.
  finalDM->drawEdges(finalDM, 1);

and the normal edge draw

 From 2104 - Read down to the last line,  if cageDM != finalDM then a 
second wire mesh is drawn. (line 1819)
I assume cageDM != finalDM means that the modifier has made the 2 
derived meshes different then draw the wire cage,
But you can see that  cageDM will never == finalDM, for the editmode 
object, I dried commenting drawobject.c:1819  and it worked fine.
static int draw_mesh_object(Base *base, int dt)
    Object *ob= base->object;
    Mesh *me= ob->data;
    int has_alpha= 0, drawlinked= 0, retval= 0;
    if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) {
        else drawlinked= 1;
    if(ob==G.obedit || drawlinked) {
        int cageNeedsFree, finalNeedsFree;
        DerivedMesh *finalDM, *cageDM;
        if (G.obedit!=ob) {
            finalDM = cageDM = editmesh_get_derived_base();
            cageNeedsFree = 0;
            finalNeedsFree = 1;
        } else {
            cageDM = editmesh_get_derived_cage_and_final(&finalDM, 
&cageNeedsFree, &finalNeedsFree);

        if(dt>OB_WIRE) init_gl_materials(ob, 0);    // no transp in 
editmode, the fancy draw over goes bad then
        draw_em_fancy(ob, G.editMesh, cageDM, finalDM, dt);

More information about the Bf-committers mailing list