Commit 46beef72 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

automatic points size

parent 37764385
...@@ -36,6 +36,10 @@ void VBO::updateData(std::vector<T>& data) ...@@ -36,6 +36,10 @@ void VBO::updateData(std::vector<T>& data)
CGoGNerr << "Error locked VBO" << CGoGNendl; CGoGNerr << "Error locked VBO" << CGoGNendl;
return; return;
} }
if (data.empty())
return;
m_data_size = sizeof(T) / sizeof(float); m_data_size = sizeof(T) / sizeof(float);
m_nbElts = uint32(data.size()); m_nbElts = uint32(data.size());
......
...@@ -46,6 +46,7 @@ struct MapParameters ...@@ -46,6 +46,7 @@ struct MapParameters
Utils::VBO* colorVBO; Utils::VBO* colorVBO;
float verticesScaleFactor; float verticesScaleFactor;
float basePSradius;
bool renderVertices; bool renderVertices;
bool renderEdges; bool renderEdges;
bool renderFaces; bool renderFaces;
...@@ -134,6 +135,7 @@ protected: ...@@ -134,6 +135,7 @@ protected:
CGoGN::Utils::ShaderColorPerVertex* m_colorPerVertexShader; CGoGN::Utils::ShaderColorPerVertex* m_colorPerVertexShader;
CGoGN::Utils::ShaderSimpleColor* m_simpleColorShader; CGoGN::Utils::ShaderSimpleColor* m_simpleColorShader;
CGoGN::Utils::PointSprite* m_pointSprite; CGoGN::Utils::PointSprite* m_pointSprite;
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -115,7 +115,8 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -115,7 +115,8 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
if(p.renderVertices) if(p.renderVertices)
{ {
m_pointSprite->setSize(map->getBBdiagSize() / 200.0f * p.verticesScaleFactor); // m_pointSprite->setSize(map->getBBdiagSize() / 200.0f * p.verticesScaleFactor);
m_pointSprite->setSize(p.basePSradius * 2 * p.verticesScaleFactor);
m_pointSprite->setAttributePosition(p.positionVBO); m_pointSprite->setAttributePosition(p.positionVBO);
m_pointSprite->setColor(p.vertexColor); m_pointSprite->setColor(p.vertexColor);
map->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS); map->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS);
......
...@@ -97,6 +97,9 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b) ...@@ -97,6 +97,9 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b)
MapHandlerGen* map = m_schnapps->getSelectedMap(); MapHandlerGen* map = m_schnapps->getSelectedMap();
if (view && map) if (view && map)
{ {
if (b)
m_plugin->h_viewParameterSet[view][map].basePSradius = map->getBBdiagSize() / (8 * std::sqrt(map->getNbOrbits(EDGE)));
m_plugin->h_viewParameterSet[view][map].renderVertices = b; m_plugin->h_viewParameterSet[view][map].renderVertices = b;
view->updateGL(); view->updateGL();
m_plugin->pythonRecording("changeRenderVertices", "", view->getName(), map->getName(), b); m_plugin->pythonRecording("changeRenderVertices", "", view->getName(), map->getName(), b);
...@@ -112,7 +115,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i) ...@@ -112,7 +115,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i)
MapHandlerGen* map = m_schnapps->getSelectedMap(); MapHandlerGen* map = m_schnapps->getSelectedMap();
if (view && map) if (view && map)
{ {
m_plugin->h_viewParameterSet[view][map].verticesScaleFactor = i / 50.0; m_plugin->h_viewParameterSet[view][map].verticesScaleFactor = i / 50.0;
view->updateGL(); view->updateGL();
m_plugin->pythonRecording("changeVerticesScaleFactor", "", view->getName(), map->getName(), i / 50.0); m_plugin->pythonRecording("changeVerticesScaleFactor", "", view->getName(), map->getName(), i / 50.0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment