diff --git a/wrap/gl/gl_mesh_attributes_multi_viewer_bo_manager.h b/wrap/gl/gl_mesh_attributes_multi_viewer_bo_manager.h index 22e7949e..d34d6db6 100644 --- a/wrap/gl/gl_mesh_attributes_multi_viewer_bo_manager.h +++ b/wrap/gl/gl_mesh_attributes_multi_viewer_bo_manager.h @@ -369,61 +369,37 @@ namespace vcg const PVData& dt = it->second; //const InternalRendAtts& atts = it->second._intatts; - glPushAttrib(GL_ALL_ATTRIB_BITS); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMultMatrix(_tr); - - if ((dt._glopts != NULL) && (dt._glopts->_perbbox_enabled)) - drawBBox(dt._glopts); - - if (dt.isPrimitiveActive(PR_SOLID)) - { - bool somethingmore = dt.isPrimitiveActive(PR_WIREFRAME_EDGES) || dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES) || dt.isPrimitiveActive(PR_POINTS); - if (somethingmore) - { - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1.0, 1); - } - drawFilledTriangles(dt._intatts[size_t(PR_SOLID)],dt._glopts,textid); - if (somethingmore) - glDisable(GL_POLYGON_OFFSET_FILL); - } - - if (dt.isPrimitiveActive(PR_WIREFRAME_EDGES) || dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES)) - { - //InternalRendAtts tmpatts = atts; - bool pointstoo = dt.isPrimitiveActive(PR_POINTS); - - if (pointstoo) - { - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1.0, 1); - } - bool solidtoo = dt.isPrimitiveActive(PR_SOLID); - - if (dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES)) - { - drawWiredTriangles(dt._intatts[size_t(PR_WIREFRAME_TRIANGLES)],dt._glopts,textid); - } - else - { - if (dt.isPrimitiveActive(PR_WIREFRAME_EDGES)) - drawEdges(dt._intatts[size_t(PR_WIREFRAME_EDGES)],dt._glopts); - } - - if (pointstoo || solidtoo) - glDisable(GL_POLYGON_OFFSET_FILL); - } - if (dt.isPrimitiveActive(PR_POINTS)) - drawPoints(dt._intatts[size_t(PR_POINTS)],it->second._glopts); - - glPopMatrix(); - glPopAttrib(); - glFlush(); - glFinish(); + drawFun(dt, textid); } + + void drawAllocatedAttributesSubset(UNIQUE_VIEW_ID_TYPE viewid,const PVData& dt, const std::vector& textid = std::vector()) const + { + typename ViewsMap::const_iterator it = _perviewreqatts.find(viewid); + if (it == _perviewreqatts.end()) + return; + + PVData tmp = dt; + + if (!(_currallocatedboatt[INT_ATT_NAMES::ATT_VERTPOSITION])) + { + for (PRIMITIVE_MODALITY pm = PRIMITIVE_MODALITY(0); pm < PR_ARITY; pm = next(pm)) + { + tmp._pmmask[size_t(pm)] = 0; + tmp._intatts[size_t(pm)] = InternalRendAtts(); + } + } + else + { + for (PRIMITIVE_MODALITY pm = PRIMITIVE_MODALITY(0); pm < PR_ARITY; pm = next(pm)) + { + tmp._intatts[size_t(pm)] = InternalRendAtts::intersectionSet(tmp._intatts[size_t(pm)],_meaningfulattsperprimitive[size_t(pm)]); + tmp._intatts[size_t(pm)] = InternalRendAtts::intersectionSet(tmp._intatts[size_t(pm)],_currallocatedboatt); + } + } + drawFun(dt, textid); + } + bool isBORenderingAvailable() const { return _borendering; @@ -1284,6 +1260,63 @@ namespace vcg return 0; } + void drawFun(const PVData& dt, const std::vector& textid = std::vector()) const + { + glPushAttrib(GL_ALL_ATTRIB_BITS); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMultMatrix(_tr); + + if ((dt._glopts != NULL) && (dt._glopts->_perbbox_enabled)) + drawBBox(dt._glopts); + + if (dt.isPrimitiveActive(PR_SOLID)) + { + bool somethingmore = dt.isPrimitiveActive(PR_WIREFRAME_EDGES) || dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES) || dt.isPrimitiveActive(PR_POINTS); + if (somethingmore) + { + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0, 1); + } + drawFilledTriangles(dt._intatts[size_t(PR_SOLID)], dt._glopts, textid); + if (somethingmore) + glDisable(GL_POLYGON_OFFSET_FILL); + } + + if (dt.isPrimitiveActive(PR_WIREFRAME_EDGES) || dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES)) + { + //InternalRendAtts tmpatts = atts; + bool pointstoo = dt.isPrimitiveActive(PR_POINTS); + + if (pointstoo) + { + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0, 1); + } + bool solidtoo = dt.isPrimitiveActive(PR_SOLID); + + if (dt.isPrimitiveActive(PR_WIREFRAME_TRIANGLES)) + { + drawWiredTriangles(dt._intatts[size_t(PR_WIREFRAME_TRIANGLES)], dt._glopts, textid); + } + else + { + if (dt.isPrimitiveActive(PR_WIREFRAME_EDGES)) + drawEdges(dt._intatts[size_t(PR_WIREFRAME_EDGES)], dt._glopts); + } + + if (pointstoo || solidtoo) + glDisable(GL_POLYGON_OFFSET_FILL); + } + if (dt.isPrimitiveActive(PR_POINTS)) + drawPoints(dt._intatts[size_t(PR_POINTS)], dt._glopts); + + glPopMatrix(); + glPopAttrib(); + glFlush(); + glFinish(); + } + void drawFilledTriangles(const InternalRendAtts& req,const GL_OPTIONS_DERIVED_TYPE* glopts,const std::vector& textureindex = std::vector()) const { if (_mesh.VN() == 0) diff --git a/wrap/qt/qt_thread_safe_mesh_attributes_multi_viewer_bo_manager.h b/wrap/qt/qt_thread_safe_mesh_attributes_multi_viewer_bo_manager.h index 82333932..470cec01 100644 --- a/wrap/qt/qt_thread_safe_mesh_attributes_multi_viewer_bo_manager.h +++ b/wrap/qt/qt_thread_safe_mesh_attributes_multi_viewer_bo_manager.h @@ -74,6 +74,12 @@ namespace vcg vcg::NotThreadSafeGLMeshAttributesMultiViewerBOManager::draw(viewid,_textids.textId()); } + void drawAllocatedAttributesSubset(UNIQUE_VIEW_ID_TYPE viewid,const PerViewData& dt) const + { + QReadLocker locker(&_lock); + vcg::NotThreadSafeGLMeshAttributesMultiViewerBOManager::drawAllocatedAttributesSubset(viewid,dt,_textids.textId()); + } + bool isBORenderingAvailable() const { QReadLocker locker(&_lock);