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

automatic points size

parent 37764385
......@@ -36,6 +36,10 @@ void VBO::updateData(std::vector<T>& data)
CGoGNerr << "Error locked VBO" << CGoGNendl;
return;
}
if (data.empty())
return;
m_data_size = sizeof(T) / sizeof(float);
m_nbElts = uint32(data.size());
......
......@@ -46,6 +46,7 @@ struct MapParameters
Utils::VBO* colorVBO;
float verticesScaleFactor;
float basePSradius;
bool renderVertices;
bool renderEdges;
bool renderFaces;
......@@ -134,6 +135,7 @@ protected:
CGoGN::Utils::ShaderColorPerVertex* m_colorPerVertexShader;
CGoGN::Utils::ShaderSimpleColor* m_simpleColorShader;
CGoGN::Utils::PointSprite* m_pointSprite;
};
} // namespace SCHNApps
......
......@@ -115,7 +115,8 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
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->setColor(p.vertexColor);
map->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS);
......
......@@ -97,6 +97,9 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b)
MapHandlerGen* map = m_schnapps->getSelectedMap();
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;
view->updateGL();
m_plugin->pythonRecording("changeRenderVertices", "", view->getName(), map->getName(), b);
......@@ -112,7 +115,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i)
MapHandlerGen* map = m_schnapps->getSelectedMap();
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();
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