src/glCompiler.cc

changeset 784
f82ab4d3c7b4
parent 772
e117509e1b51
child 786
71d786ce0dcc
equal deleted inserted replaced
783:1db20d88650f 784:f82ab4d3c7b4
241 m_staged.removeOne (LDObjectWeakPtr (obj)); 241 m_staged.removeOne (LDObjectWeakPtr (obj));
242 } 242 }
243 243
244 // ============================================================================= 244 // =============================================================================
245 // 245 //
246 void GLCompiler::compileDocument (LDDocument* doc) 246 void GLCompiler::compileDocument (LDDocumentPtr doc)
247 { 247 {
248 if (doc == null) 248 if (doc == null)
249 return; 249 return;
250 250
251 for (LDObjectPtr obj : doc->objects()) 251 for (LDObjectPtr obj : doc->objects())
276 276
277 QVector<GLfloat> vbodata; 277 QVector<GLfloat> vbodata;
278 278
279 for (auto it = m_objectInfo.begin(); it != m_objectInfo.end(); ++it) 279 for (auto it = m_objectInfo.begin(); it != m_objectInfo.end(); ++it)
280 { 280 {
281 if (it.key()->document() == getCurrentDocument() && not it.key()->isHidden()) 281 if (it.key() == null)
282 it = m_objectInfo.erase (it);
283 elif (it.key().toStrongRef()->document() == getCurrentDocument() && not it.key().toStrongRef()->isHidden())
282 vbodata += it->data[vbonum]; 284 vbodata += it->data[vbonum];
283 } 285 }
284 286
285 glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); 287 glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]);
286 glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_STATIC_DRAW); 288 glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_STATIC_DRAW);
309 // 311 //
310 void GLCompiler::compileObject (LDObjectPtr obj) 312 void GLCompiler::compileObject (LDObjectPtr obj)
311 { 313 {
312 // print ("Compile %1\n", g_objectOrigins[obj]); 314 // print ("Compile %1\n", g_objectOrigins[obj]);
313 315
314 if (obj == null || obj->document() == null || obj->document()->isImplicit()) 316 if (obj == null || obj->document() == null || obj->document().toStrongRef()->isImplicit())
315 return; 317 return;
316 318
317 ObjectVBOInfo info; 319 ObjectVBOInfo info;
318 info.isChanged = true; 320 info.isChanged = true;
319 dropObject (obj); 321 dropObject (obj);

mercurial