svn merge -r40000:40179 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / blenkernel / intern / cdderivedmesh.c
index d86c0a3..0cff6d7 100644 (file)
@@ -268,6 +268,44 @@ static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
 
        BLI_pbvh_update(cddm->pbvh, PBVH_UpdateNormals, face_nors);
 }
+// Jason
+static void cdDM_drawSelectedVerts(DerivedMesh *dm)
+{
+       CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
+       MVert *mv = cddm->mvert;
+       int i;
+       if( GPU_buffer_legacy(dm) ) {
+               char prev_sel= 0; /* always invalid */;
+
+               glBegin(GL_POINTS);
+               for(i = 0; i < dm->numVertData; i++, mv++) {
+                       if(!(mv->flag & ME_HIDE)) {
+                               const char sel= mv->flag & 1;
+                               if(prev_sel != sel) {
+                                       prev_sel= sel;
+
+                                       // TODO define selected color
+                                       if(sel) {
+                                               glColor3f(1.0f, 1.0f, 0.0f);
+                                       }else {
+                                               glColor3f(0.0f, 0.0f, 0.0f);
+                                       }
+                               }
+
+                               glVertex3fv(mv->co);
+                       }
+               }
+               glEnd();
+       }
+       else {  /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
+               GPU_vertex_setup(dm);
+               if( !GPU_buffer_legacy(dm) ) {
+                       if(dm->drawObject->tot_triangle_point)  glDrawArrays(GL_POINTS,0, dm->drawObject->tot_triangle_point);
+                       else                                                    glDrawArrays(GL_POINTS,0, dm->drawObject->tot_loose_point);
+               }
+               GPU_buffer_unbind();
+       }
+}
 
 static void cdDM_drawVerts(DerivedMesh *dm)
 {
@@ -1554,6 +1592,8 @@ static CDDerivedMesh *cdDM_create(const char *desc)
        dm->getFaceMap = cdDM_getFaceMap;
 
        dm->drawVerts = cdDM_drawVerts;
+       // Jason
+       dm->drawSelectedVerts = cdDM_drawSelectedVerts;
 
        dm->drawUVEdges = cdDM_drawUVEdges;
        dm->drawEdges = cdDM_drawEdges;