|    239  | 
   239  | 
|    240 // ============================================================================= | 
   240 // ============================================================================= | 
|    241 // | 
   241 // | 
|    242 void GLCompiler::unstage (LDObject* obj) | 
   242 void GLCompiler::unstage (LDObject* obj) | 
|    243 { | 
   243 { | 
|    244 	m_staged.removeOne (obj); | 
   244 	m_staged.remove (obj); | 
|    245 } | 
   245 } | 
|    246  | 
   246  | 
|    247 // ============================================================================= | 
   247 // ============================================================================= | 
|    248 // | 
   248 // | 
|    249 void GLCompiler::compileDocument (LDDocument* doc) | 
   249 void GLCompiler::compileDocument (LDDocument* doc) | 
|    257  | 
   257  | 
|    258 // ============================================================================= | 
   258 // ============================================================================= | 
|    259 // | 
   259 // | 
|    260 void GLCompiler::compileStaged() | 
   260 void GLCompiler::compileStaged() | 
|    261 { | 
   261 { | 
|    262 	removeDuplicates (m_staged); | 
   262 	for (QSetIterator<LDObject*> it (m_staged); it.hasNext();) | 
|    263  | 
   263 		compileObject (it.next()); | 
|    264 	for (auto it = m_staged.begin(); it != m_staged.end(); ++it) | 
        | 
|    265 	{ | 
        | 
|    266 		if (*it == null) | 
        | 
|    267 			continue; | 
        | 
|    268  | 
        | 
|    269 		compileObject (*it); | 
        | 
|    270 	} | 
        | 
|    271  | 
   264  | 
|    272 	m_staged.clear(); | 
   265 	m_staged.clear(); | 
|    273 } | 
   266 } | 
|    274  | 
   267  | 
|    275 // ============================================================================= | 
   268 // ============================================================================= | 
|    290 		{ | 
   283 		{ | 
|    291 			it = m_objectInfo.erase (it); | 
   284 			it = m_objectInfo.erase (it); | 
|    292 			continue; | 
   285 			continue; | 
|    293 		} | 
   286 		} | 
|    294  | 
   287  | 
|    295 		if (it.key()->document() == CurrentDocument() | 
   288 		if (it.key()->document() == currentDocument() and not it.key()->isHidden()) | 
|    296 			and not it.key()->isHidden()) | 
        | 
|    297 		{ | 
        | 
|    298 			vbodata += it->data[vbonum]; | 
   289 			vbodata += it->data[vbonum]; | 
|    299 		} | 
        | 
|    300  | 
   290  | 
|    301 		++it; | 
   291 		++it; | 
|    302 	} | 
   292 	} | 
|    303  | 
   293  | 
|    304 	glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); | 
   294 	glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); | 
|    309 	m_vboSizes[vbonum] = vbodata.size(); | 
   299 	m_vboSizes[vbonum] = vbodata.size(); | 
|    310 } | 
   300 } | 
|    311  | 
   301  | 
|    312 // ============================================================================= | 
   302 // ============================================================================= | 
|    313 // | 
   303 // | 
|    314 void GLCompiler::dropObject (LDObject* obj) | 
   304 void GLCompiler::dropObjectInfo (LDObject* obj) | 
|    315 { | 
   305 { | 
|    316 	auto it = m_objectInfo.find (obj); | 
   306 	if (m_objectInfo.contains (obj)) | 
|    317  | 
   307 	{ | 
|    318 	if (it != m_objectInfo.end()) | 
   308 		m_objectInfo.remove (obj); | 
|    319 	{ | 
        | 
|    320 		m_objectInfo.erase (it); | 
        | 
|    321 		needMerge(); | 
   309 		needMerge(); | 
|    322 	} | 
   310 	} | 
|    323  | 
        | 
|    324 	unstage (obj); | 
        | 
|    325 } | 
   311 } | 
|    326  | 
   312  | 
|    327 // ============================================================================= | 
   313 // ============================================================================= | 
|    328 // | 
   314 // | 
|    329 void GLCompiler::compileObject (LDObject* obj) | 
   315 void GLCompiler::compileObject (LDObject* obj) | 
|    333 	if (obj == null or obj->document() == null or obj->document()->isImplicit()) | 
   319 	if (obj == null or obj->document() == null or obj->document()->isImplicit()) | 
|    334 		return; | 
   320 		return; | 
|    335  | 
   321  | 
|    336 	ObjectVBOInfo info; | 
   322 	ObjectVBOInfo info; | 
|    337 	info.isChanged = true; | 
   323 	info.isChanged = true; | 
|    338 	dropObject (obj); | 
   324 	dropObjectInfo (obj); | 
|    339  | 
   325  | 
|    340 	switch (obj->type()) | 
   326 	switch (obj->type()) | 
|    341 	{ | 
   327 	{ | 
|    342 		// Note: We cannot split quads into triangles here, it would mess up the | 
   328 		// Note: We cannot split quads into triangles here, it would mess up the | 
|    343 		// wireframe view. Quads must go into separate vbos. | 
   329 		// wireframe view. Quads must go into separate vbos. |