src/glcompiler.cpp

changeset 1306
be85306198a2
parent 1305
31627acdd4b5
child 1313
4baed9f54de3
equal deleted inserted replaced
1305:31627acdd4b5 1306:be85306198a2
22 #include "glcompiler.h" 22 #include "glcompiler.h"
23 #include "miscallenous.h" 23 #include "miscallenous.h"
24 #include "guiutilities.h" 24 #include "guiutilities.h"
25 #include "documentmanager.h" 25 #include "documentmanager.h"
26 #include "grid.h" 26 #include "grid.h"
27 #include "algorithms/invert.h"
27 28
28 void checkGLError(HierarchyElement* element, QString file, int line) 29 void checkGLError(HierarchyElement* element, QString file, int line)
29 { 30 {
30 struct ErrorInfo 31 struct ErrorInfo
31 { 32 {
373 374
374 // TODO: try use interfaces to remove these special treatments? 375 // TODO: try use interfaces to remove these special treatments?
375 case LDObjectType::SubfileReference: 376 case LDObjectType::SubfileReference:
376 { 377 {
377 LDSubfileReference* subfileReference = static_cast<LDSubfileReference*>(object); 378 LDSubfileReference* subfileReference = static_cast<LDSubfileReference*>(object);
378 // TODO: move winding to Model and use it here 379 auto data = subfileReference->inlinePolygons(
379 auto data = subfileReference->inlinePolygons(m_documents, CounterClockwise); 380 m_documents,
381 m_renderer->model()->winding()
382 );
380 383
381 for (LDPolygon& poly : data) 384 for (LDPolygon& poly : data)
382 compilePolygon (poly, index, info); 385 compilePolygon (poly, index, info);
383 break; 386 break;
384 } 387 }
405 void GLCompiler::compilePolygon( 408 void GLCompiler::compilePolygon(
406 LDPolygon& poly, 409 LDPolygon& poly,
407 const QModelIndex& polygonOwnerIndex, 410 const QModelIndex& polygonOwnerIndex,
408 ObjectVboData& objectInfo 411 ObjectVboData& objectInfo
409 ) { 412 ) {
413 if (m_renderer->model()->winding() == Clockwise)
414 ::invertPolygon(poly);
415
410 VboClass surface; 416 VboClass surface;
411 int vertexCount; 417 int vertexCount;
412 418
413 switch (poly.num) 419 switch (poly.num)
414 { 420 {
482 488
483 489
484 int GLCompiler::vboSize (int vbonum) const 490 int GLCompiler::vboSize (int vbonum) const
485 { 491 {
486 return m_vboSizes[vbonum]; 492 return m_vboSizes[vbonum];
493 }
494
495 void GLCompiler::fullUpdate()
496 {
497 m_objectInfo.clear();
498 recompile();
487 } 499 }
488 500
489 /* 501 /*
490 * Recompiles the entire model. 502 * Recompiles the entire model.
491 */ 503 */

mercurial