volume_render_dockTab.cpp 2.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
#include "volume_render_dockTab.h"

#include "volume_render.h"
#include "schnapps.h"
#include "mapHandler.h"

namespace CGoGN
{

namespace SCHNApps
{

Volume_Render_DockTab::Volume_Render_DockTab(SCHNApps* s, Surface_Render_Plugin* p) :
  m_schnapps(s),
  m_plugin(p),
  b_updatingUI(false)
{
	setupUi(this);
}

void Volume_Render_DockTab::positionAttributeChanged(int index)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changePositionAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_positionAttribute->currentText()), true);
	}
}

void Volume_Render_DockTab::colorAttributeChanged(int index)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changeColorAttribute(view, map, map->getAttribute<PFP2::VEC3, VERTEX>(combo_colorAttribute->currentText()), true);
	}
}

void Volume_Render_DockTab::facesScaleFactorChanged(int i)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changeFacesScaleFactor(view, map, i, true);
	}
}

void Volume_Render_DockTab::volumesScaleFactorChanged(int i)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changeVolumesScaleFactor(view, map, i, true);
	}
}

void Volume_Render_DockTab::renderEdgesChanged(bool b)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changeRenderEdges(view, map, b, true);
	}
}

void Volume_Render_DockTab::renderFacesChanged(bool b)
{
	if(!b_refreshingUI)
	{
		View* view = m_window->getCurrentView();
		MapHandlerGen* map = m_currentParams->selectedMap;
		if(map)
			m_plugin->changeRenderFaces(view, map, b, true);
	}
}

void Volume_Render_DockTab::faceStyleChanged(QAbstractButton* b)
{
	if(!b_updatingUI)
	{
		View* view = m_schnapps->getSelectedView();
		MapHandlerGen* map = m_schnapps->getSelectedMap();
		if(view && map)
		{
			if(radio_flatShading->isChecked())
				m_plugin->h_viewParameterSet[view][map].faceStyle = MapParameters::FLAT;
			else if(radio_smoothShading->isChecked())
				m_plugin->h_viewParameterSet[view][map].faceStyle = MapParameters::SMOOTH;
			view->updateGL();
		}
	}
}

} // namespace SCHNApps

} // namespace CGoGN