surface_render.cpp 14.3 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
#include "surface_render.h"

#include "mapHandler.h"
4
#include "slot_debug.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11

namespace CGoGN
{

namespace SCHNApps
{

Pierre Kraemer's avatar
Pierre Kraemer committed
12
bool Surface_Render_Plugin::enable()
Pierre Kraemer's avatar
Pierre Kraemer committed
13
{
14
	//	magic line that init static variables of GenericMap in the plugins
15
	GenericMap::copyAllStatics(m_schnapps->getStaticPointers());
16

Pierre Kraemer's avatar
Pierre Kraemer committed
17 18
	m_dockTab = new Surface_Render_DockTab(m_schnapps, this);
	m_schnapps->addPluginDockTab(this, m_dockTab, "Surface_Render");
Pierre Kraemer's avatar
Pierre Kraemer committed
19 20

	m_flatShader = new CGoGN::Utils::ShaderFlat();
21
	m_flatShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f));
Pierre Kraemer's avatar
Pierre Kraemer committed
22 23
	m_flatShader->setExplode(1.0f);

24
	m_phongShader = new CGoGN::Utils::ShaderPhong();
25 26 27
	m_phongShader->setAmbiant(CGoGN::Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f));
	m_phongShader->setSpecular(CGoGN::Geom::Vec4f(0.9f, 0.9f, 0.9f, 1.0f));
	m_phongShader->setShininess(80.0f);
28 29

	m_colorPerVertexShader = new CGoGN::Utils::ShaderColorPerVertex();
Pierre Kraemer's avatar
Pierre Kraemer committed
30 31 32 33 34 35 36

	m_simpleColorShader = new CGoGN::Utils::ShaderSimpleColor();

	m_pointSprite = new CGoGN::Utils::PointSprite();

	registerShader(m_flatShader);
	registerShader(m_phongShader);
37
	registerShader(m_colorPerVertexShader);
Pierre Kraemer's avatar
Pierre Kraemer committed
38 39 40 41 42 43 44
	registerShader(m_simpleColorShader);
	registerShader(m_pointSprite);

	connect(m_schnapps, SIGNAL(selectedViewChanged(View*, View*)), this, SLOT(selectedViewChanged(View*, View*)));
	connect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
	connect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
45
	connect(m_schnapps, SIGNAL(schnappsClosing()), this, SLOT(schnappsClosing()));
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47 48 49 50 51 52 53 54

	foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
		mapAdded(map);

	m_dockTab->updateMapParameters();

	return true;
}

Pierre Kraemer's avatar
Pierre Kraemer committed
55
void Surface_Render_Plugin::disable()
Pierre Kraemer's avatar
Pierre Kraemer committed
56 57 58 59 60 61
{
	delete m_flatShader;
	delete m_phongShader;
	delete m_simpleColorShader;
	delete m_pointSprite;

62 63 64 65
	disconnect(m_schnapps, SIGNAL(selectedViewChanged(View*, View*)), this, SLOT(selectedViewChanged(View*, View*)));
	disconnect(m_schnapps, SIGNAL(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)), this, SLOT(selectedMapChanged(MapHandlerGen*, MapHandlerGen*)));
	disconnect(m_schnapps, SIGNAL(mapAdded(MapHandlerGen*)), this, SLOT(mapAdded(MapHandlerGen*)));
	disconnect(m_schnapps, SIGNAL(mapRemoved(MapHandlerGen*)), this, SLOT(mapRemoved(MapHandlerGen*)));
66
	disconnect(m_schnapps, SIGNAL(schnappsClosing()), this, SLOT(schnappsClosing()));
67

Pierre Kraemer's avatar
Pierre Kraemer committed
68 69 70 71
	foreach(MapHandlerGen* map, m_schnapps->getMapSet().values())
		mapRemoved(map);
}

Pierre Kraemer's avatar
Pierre Kraemer committed
72
void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
Pierre Kraemer's avatar
Pierre Kraemer committed
73
{
74 75
	const MapParameters& p = h_viewParameterSet[view][map];
	if(p.positionVBO)
Pierre Kraemer's avatar
Pierre Kraemer committed
76
	{
sylvain thery's avatar
sylvain thery committed
77 78 79 80 81 82 83 84 85
        if(p.renderFaces)
        {
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
            glEnable(GL_LIGHTING);
            glEnable(GL_POLYGON_OFFSET_FILL);
            glPolygonOffset(1.0f, 1.0f);
            switch(p.faceStyle)
            {
                case MapParameters::FLAT :
86 87 88 89 90 91 92 93
					if(p.colorVBO)
					{
						m_colorPerVertexShader->setAttributePosition(p.positionVBO);
						m_colorPerVertexShader->setAttributeColor(p.colorVBO);
						map->draw(m_colorPerVertexShader, CGoGN::Algo::Render::GL2::TRIANGLES);
					}
					else
					{
94
						m_flatShader->setBackColor(p.backColor);
95 96
						m_flatShader->setAttributePosition(p.positionVBO);
						m_flatShader->setDiffuse(p.diffuseColor);
97
						m_flatShader->setDoubleSided(p.renderBackfaces);
98 99
						map->draw(m_flatShader, CGoGN::Algo::Render::GL2::TRIANGLES);
					}
sylvain thery's avatar
sylvain thery committed
100 101 102 103
                    break;
                case MapParameters::PHONG :
                    if(p.normalVBO != NULL)
                    {
104
						m_phongShader->setBackColor(p.backColor);
sylvain thery's avatar
sylvain thery committed
105 106 107
                        m_phongShader->setAttributePosition(p.positionVBO);
                        m_phongShader->setAttributeNormal(p.normalVBO);
                        m_phongShader->setDiffuse(p.diffuseColor);
108
						m_phongShader->setDoubleSided(p.renderBackfaces);
sylvain thery's avatar
sylvain thery committed
109 110 111 112 113 114
                        map->draw(m_phongShader, CGoGN::Algo::Render::GL2::TRIANGLES);
                    }
                    break;
            }
            glDisable(GL_POLYGON_OFFSET_FILL);
        }
115 116

		if(p.renderVertices)
Pierre Kraemer's avatar
Pierre Kraemer committed
117
		{
118
			m_pointSprite->setSize(p.basePSradius * p.verticesScaleFactor); 
119
			m_pointSprite->setAttributePosition(p.positionVBO);
120
			m_pointSprite->setColor(p.vertexColor);
121 122
			map->draw(m_pointSprite, CGoGN::Algo::Render::GL2::POINTS);
		}
123

124 125 126 127
		if(p.renderEdges)
		{
			glLineWidth(1.0f);
			m_simpleColorShader->setAttributePosition(p.positionVBO);
128
			m_simpleColorShader->setColor(p.simpleColor);
129 130
			map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES);
		}
sylvain thery's avatar
sylvain thery committed
131

132 133 134 135 136 137 138 139
		if(p.renderBoundary)
		{
			glLineWidth(5.0f);
			CGoGN::Geom::Vec4f c(0.8f, 0.8f, 0.1f, 1.0f);
			m_simpleColorShader->setColor(c);
			m_simpleColorShader->setAttributePosition(p.positionVBO);
			map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::BOUNDARY);
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
140 141 142 143 144 145 146
	}
}





Pierre Kraemer's avatar
Pierre Kraemer committed
147
void Surface_Render_Plugin::selectedViewChanged(View *prev, View *cur)
Pierre Kraemer's avatar
Pierre Kraemer committed
148
{
149
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
150 151 152
	m_dockTab->updateMapParameters();
}

Pierre Kraemer's avatar
Pierre Kraemer committed
153
void Surface_Render_Plugin::selectedMapChanged(MapHandlerGen *prev, MapHandlerGen *cur)
Pierre Kraemer's avatar
Pierre Kraemer committed
154
{
155
	DEBUG_SLOT();
156 157 158 159 160 161 162

	if (prev)
		disconnect(prev, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
	if (cur)
		connect(cur, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));


Pierre Kraemer's avatar
Pierre Kraemer committed
163 164 165
	m_dockTab->updateMapParameters();
}

Pierre Kraemer's avatar
Pierre Kraemer committed
166
void Surface_Render_Plugin::mapAdded(MapHandlerGen *map)
Pierre Kraemer's avatar
Pierre Kraemer committed
167
{
168
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
169 170
	connect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
	connect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
171
	connect(map, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
Pierre Kraemer's avatar
Pierre Kraemer committed
172 173
}

Pierre Kraemer's avatar
Pierre Kraemer committed
174
void Surface_Render_Plugin::mapRemoved(MapHandlerGen *map)
Pierre Kraemer's avatar
Pierre Kraemer committed
175
{
176
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
177 178
	disconnect(map, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(vboAdded(Utils::VBO*)));
	disconnect(map, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(vboRemoved(Utils::VBO*)));
179
	disconnect(map, SIGNAL(boundingBoxModified()), this, SLOT(selectedMapBoundingBoxModified()));
Pierre Kraemer's avatar
Pierre Kraemer committed
180 181 182 183 184 185
}





Pierre Kraemer's avatar
Pierre Kraemer committed
186
void Surface_Render_Plugin::vboAdded(Utils::VBO *vbo)
Pierre Kraemer's avatar
Pierre Kraemer committed
187
{
188
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
189 190 191 192 193 194 195 196
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());

	if(map == m_schnapps->getSelectedMap())
	{
		if(vbo->dataSize() == 3)
		{
			m_dockTab->addPositionVBO(QString::fromStdString(vbo->name()));
			m_dockTab->addNormalVBO(QString::fromStdString(vbo->name()));
197
			m_dockTab->addColorVBO(QString::fromStdString(vbo->name()));
Pierre Kraemer's avatar
Pierre Kraemer committed
198 199 200 201
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
202
void Surface_Render_Plugin::vboRemoved(Utils::VBO *vbo)
Pierre Kraemer's avatar
Pierre Kraemer committed
203
{
204
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
205 206 207 208 209 210 211 212
	MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());

	if(map == m_schnapps->getSelectedMap())
	{
		if(vbo->dataSize() == 3)
		{
			m_dockTab->removePositionVBO(QString::fromStdString(vbo->name()));
			m_dockTab->removeNormalVBO(QString::fromStdString(vbo->name()));
Pierre Kraemer's avatar
Pierre Kraemer committed
213
			m_dockTab->removeColorVBO(QString::fromStdString(vbo->name()));
Pierre Kraemer's avatar
Pierre Kraemer committed
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
		}
	}

	QSet<View*> viewsToUpdate;

	QHash<View*, QHash<MapHandlerGen*, MapParameters> >::iterator i;
	for (i = h_viewParameterSet.begin(); i != h_viewParameterSet.end(); ++i)
	{
		View* view = i.key();
		QHash<MapHandlerGen*, MapParameters>& viewParamSet = i.value();
		MapParameters& mapParam = viewParamSet[map];
		if(mapParam.positionVBO == vbo)
		{
			mapParam.positionVBO = NULL;
			if(view->isLinkedToMap(map)) viewsToUpdate.insert(view);
		}
		if(mapParam.normalVBO == vbo)
		{
			mapParam.normalVBO = NULL;
			if(view->isLinkedToMap(map)) viewsToUpdate.insert(view);
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
235 236 237 238 239
		if(mapParam.colorVBO == vbo)
		{
			mapParam.colorVBO = NULL;
			if(view->isLinkedToMap(map)) viewsToUpdate.insert(view);
		}
Pierre Kraemer's avatar
Pierre Kraemer committed
240 241 242 243 244 245 246
	}

	foreach(View* v, viewsToUpdate)
		v->updateGL();
}


247 248 249 250 251 252 253 254 255 256 257 258
void Surface_Render_Plugin::selectedMapBoundingBoxModified()
{
	MapHandlerGen* m = m_schnapps->getSelectedMap();

	QList<View*> views = m->getLinkedViews();
	if (m)
		foreach(View* v, views)
		{
			if (h_viewParameterSet.contains(v))
				h_viewParameterSet[v][m].basePSradius = m->getBBdiagSize() / (2 * std::sqrt(m->getNbOrbits(EDGE)));
		}
}
Pierre Kraemer's avatar
Pierre Kraemer committed
259 260 261



Pierre Kraemer's avatar
Pierre Kraemer committed
262
void Surface_Render_Plugin::changePositionVBO(const QString& view, const QString& map, const QString& vbo)
Pierre Kraemer's avatar
Pierre Kraemer committed
263
{
264
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
265 266 267 268 269 270 271 272 273 274 275 276 277 278
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		Utils::VBO* vbuf = m->getVBO(vbo);
		h_viewParameterSet[v][m].positionVBO = vbuf;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
279
void Surface_Render_Plugin::changeNormalVBO(const QString& view, const QString& map, const QString& vbo)
Pierre Kraemer's avatar
Pierre Kraemer committed
280
{
281
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
282 283 284 285 286 287 288 289 290 291
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		Utils::VBO* vbuf = m->getVBO(vbo);
		h_viewParameterSet[v][m].normalVBO = vbuf;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
		}
	}
}

void Surface_Render_Plugin::changeColorVBO(const QString& view, const QString& map, const QString& vbo)
{
	DEBUG_SLOT();
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		Utils::VBO* vbuf = m->getVBO(vbo);
		h_viewParameterSet[v][m].colorVBO = vbuf;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
Pierre Kraemer's avatar
Pierre Kraemer committed
309 310 311 312
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
313
void Surface_Render_Plugin::changeRenderVertices(const QString& view, const QString& map, bool b)
Pierre Kraemer's avatar
Pierre Kraemer committed
314
{
315
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
316 317 318 319 320
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].renderVertices = b;
321 322
		if (b)
			h_viewParameterSet[v][m].basePSradius = m->getBBdiagSize() / (2 * std::sqrt(m->getNbOrbits(EDGE)));
Pierre Kraemer's avatar
Pierre Kraemer committed
323 324 325 326 327 328 329 330
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
331
void Surface_Render_Plugin::changeVerticesScaleFactor(const QString& view, const QString& map, float f)
Pierre Kraemer's avatar
Pierre Kraemer committed
332
{
333
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
334 335 336 337 338 339 340 341 342 343 344 345 346
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].verticesScaleFactor = f;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
347
void Surface_Render_Plugin::changeRenderEdges(const QString& view, const QString& map, bool b)
Pierre Kraemer's avatar
Pierre Kraemer committed
348
{
349
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
350 351 352 353 354
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].renderEdges = b;
355 356
		if (b)
			h_viewParameterSet[v][m].basePSradius = m->getBBdiagSize() / (16 * std::sqrt(m->getNbOrbits(EDGE)));
Pierre Kraemer's avatar
Pierre Kraemer committed
357 358 359 360 361 362 363 364
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

Pierre Kraemer's avatar
Pierre Kraemer committed
365
void Surface_Render_Plugin::changeRenderFaces(const QString& view, const QString& map, bool b)
Pierre Kraemer's avatar
Pierre Kraemer committed
366
{
367
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
368 369 370 371 372 373 374 375 376 377 378 379 380
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].renderFaces = b;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

Sylvain Thery's avatar
Sylvain Thery committed
381
void Surface_Render_Plugin::changeFacesStyle(const QString& view, const QString& map, int iStyle)
Pierre Kraemer's avatar
Pierre Kraemer committed
382
{
Sylvain Thery's avatar
Sylvain Thery committed
383
	MapParameters::FaceShadingStyle style = MapParameters::FaceShadingStyle(iStyle);
384
	DEBUG_SLOT();
Pierre Kraemer's avatar
Pierre Kraemer committed
385 386 387 388 389 390 391 392 393 394 395 396 397
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].faceStyle = style;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

398 399
void Surface_Render_Plugin::changeRenderBoundary(const QString& view, const QString& map, bool b)
{
400
	DEBUG_SLOT();
401 402 403 404 405 406 407 408 409 410 411 412 413
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].renderBoundary = b;
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

414 415
void Surface_Render_Plugin::changeFaceColor(const QString& view, const QString& map, float r, float g, float b)
{
416
	DEBUG_SLOT();
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].diffuseColor = Geom::Vec4f(r,g,b,0);
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

void Surface_Render_Plugin::changeEdgeColor(const QString& view, const QString& map, float r, float g, float b)
{
432
	DEBUG_SLOT();
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].simpleColor = Geom::Vec4f(r,g,b,0);
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

void Surface_Render_Plugin::changeVertexColor(const QString& view, const QString& map, float r, float g, float b)
{
448
	DEBUG_SLOT();
449 450 451 452 453 454 455 456 457 458 459 460 461 462
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if(v && m)
	{
		h_viewParameterSet[v][m].vertexColor = Geom::Vec4f(r,g,b,0);
		if(v->isSelectedView())
		{
			if(v->isLinkedToMap(m))	v->updateGL();
			if(m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}


463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
void Surface_Render_Plugin::changeBackColor(const QString& view, const QString& map, float r, float g, float b)
{
	DEBUG_SLOT();
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if (v && m)
	{
		h_viewParameterSet[v][m].backColor = Geom::Vec4f(r, g, b, 0);
		if (v->isSelectedView())
		{
			if (v->isLinkedToMap(m))	v->updateGL();
			if (m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}

479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
void Surface_Render_Plugin::changeRenderBackfaces(const QString& view, const QString& map, bool b)
{
	DEBUG_SLOT();
	View* v = m_schnapps->getView(view);
	MapHandlerGen* m = m_schnapps->getMap(map);
	if (v && m)
	{
		h_viewParameterSet[v][m].renderBackfaces = b;
		if (v->isSelectedView())
		{
			if (v->isLinkedToMap(m))	v->updateGL();
			if (m->isSelectedMap()) m_dockTab->updateMapParameters();
		}
	}
}
494 495


Sylvain Thery's avatar
Sylvain Thery committed
496

497
void Surface_Render_Plugin::schnappsClosing()
Sylvain Thery's avatar
Sylvain Thery committed
498 499 500
{
	m_dockTab->m_colorDial->close();
}
Sylvain Thery's avatar
Sylvain Thery committed
501 502 503 504 505
#if CGOGN_QT_DESIRED_VERSION == 5
	Q_PLUGIN_METADATA(IID "CGoGN.SCHNapps.Plugin")
#else
	Q_EXPORT_PLUGIN2(Surface_Render_Plugin, Surface_Render_Plugin)
#endif
Sylvain Thery's avatar
Sylvain Thery committed
506

Pierre Kraemer's avatar
Pierre Kraemer committed
507 508 509 510

} // namespace SCHNApps

} // namespace CGoGN