src/glRenderer.cpp

changeset 978
4603d8fd063e
parent 973
c1b60c7d5135
child 981
5d5d84ab2c48
equal deleted inserted replaced
977:dc3ceb65cda7 978:4603d8fd063e
98 98
99 // ============================================================================= 99 // =============================================================================
100 // 100 //
101 GLRenderer::GLRenderer (QWidget* parent) : 101 GLRenderer::GLRenderer (QWidget* parent) :
102 QGLWidget (parent), 102 QGLWidget (parent),
103 HierarchyElement (parent) 103 HierarchyElement (parent),
104 m_document (nullptr)
104 { 105 {
105 m_isPicking = false; 106 m_isPicking = false;
106 m_camera = (ECamera) m_config->camera(); 107 m_camera = (ECamera) m_config->camera();
107 m_drawToolTip = false; 108 m_drawToolTip = false;
108 m_editmode = AbstractEditMode::createByType (this, EditModeType::Select); 109 m_editmode = AbstractEditMode::createByType (this, EditModeType::Select);
340 void GLRenderer::hardRefresh() 341 void GLRenderer::hardRefresh()
341 { 342 {
342 if (not RendererInitialized) 343 if (not RendererInitialized)
343 return; 344 return;
344 345
345 compiler()->compileDocument (CurrentDocument()); 346 compiler()->compileDocument (currentDocument());
346 refresh(); 347 refresh();
347 } 348 }
348 349
349 // ============================================================================= 350 // =============================================================================
350 // 351 //
911 doMakeCurrent(); 912 doMakeCurrent();
912 913
913 // Clear the selection if we do not wish to add to it. 914 // Clear the selection if we do not wish to add to it.
914 if (not additive) 915 if (not additive)
915 { 916 {
916 LDObjectList oldsel = Selection(); 917 LDObjectList oldSelection = selectedObjects();
917 CurrentDocument()->clearSelection(); 918 currentDocument()->clearSelection();
918 919
919 for (LDObject* obj : oldsel) 920 for (LDObject* obj : oldSelection)
920 compileObject (obj); 921 compileObject (obj);
921 } 922 }
922 923
923 // Paint the picking scene 924 // Paint the picking scene
924 setPicking (true); 925 setPicking (true);
990 991
991 // Update everything now. 992 // Update everything now.
992 m_window->updateSelection(); 993 m_window->updateSelection();
993 994
994 // Recompile the objects now to update their color 995 // Recompile the objects now to update their color
995 for (LDObject* obj : Selection()) 996 for (LDObject* obj : selectedObjects())
996 compileObject (obj); 997 compileObject (obj);
997 998
998 if (removedObj) 999 if (removedObj)
999 compileObject (removedObj); 1000 compileObject (removedObj);
1000 1001
1135 1136
1136 // ============================================================================= 1137 // =============================================================================
1137 // 1138 //
1138 void GLRenderer::forgetObject (LDObject* obj) 1139 void GLRenderer::forgetObject (LDObject* obj)
1139 { 1140 {
1140 if (compiler() != null) 1141 compiler()->dropObjectInfo (obj);
1141 compiler()->dropObject (obj); 1142 compiler()->unstage (obj);
1143
1144 if (m_objectAtCursor == obj)
1145 m_objectAtCursor = nullptr;
1142 } 1146 }
1143 1147
1144 // ============================================================================= 1148 // =============================================================================
1145 // 1149 //
1146 uchar* GLRenderer::getScreencap (int& w, int& h) 1150 uchar* GLRenderer::getScreencap (int& w, int& h)
1580 LDSubfile* ref = LDSpawn<LDSubfile>(); 1584 LDSubfile* ref = LDSpawn<LDSubfile>();
1581 ref->setColor (MainColor); 1585 ref->setColor (MainColor);
1582 ref->setFileInfo (GetDocument (primName)); 1586 ref->setFileInfo (GetDocument (primName));
1583 ref->setPosition (Origin); 1587 ref->setPosition (Origin);
1584 ref->setTransform (IdentityMatrix); 1588 ref->setTransform (IdentityMatrix);
1585 LDDocument::current()->insertObj (m_window->getInsertionPoint(), ref); 1589 currentDocument()->insertObj (m_window->getInsertionPoint(), ref);
1586 ref->select(); 1590 ref->select();
1587 m_window->buildObjList(); 1591 m_window->buildObjList();
1588 m_window->R()->refresh(); 1592 m_window->R()->refresh();
1589 ev->acceptProposedAction(); 1593 ev->acceptProposedAction();
1590 } 1594 }

mercurial