1 #include "vogleditor_statetreecontextitem.h"
2 #include "vogleditor_statetreearbprogramitem.h"
3 #include "vogleditor_statetreearbprogramenvitem.h"
4 #include "vogleditor_statetreedisplaylistitem.h"
5 #include "vogleditor_statetreeframebufferitem.h"
6 #include "vogleditor_statetreematrixitem.h"
7 #include "vogleditor_statetreepolygonstippleitem.h"
8 #include "vogleditor_statetreeprogramitem.h"
9 #include "vogleditor_statetreequeryitem.h"
10 #include "vogleditor_statetreerenderbufferitem.h"
11 #include "vogleditor_statetreeshaderitem.h"
12 #include "vogleditor_statetreesyncitem.h"
13 #include "vogleditor_statetreetexenvitem.h"
14 #include "vogleditor_statetreevertexarrayitem.h"
15 #include "vogl_gl_state_snapshot.h"
17 struct vogl_gl_object_state_handle_less_than
19 inline bool operator()(const vogl_gl_object_state* a, const vogl_gl_object_state* b) const
21 return a->get_snapshot_handle() < b->get_snapshot_handle();
25 #define STR_INT(val) tmp.sprintf("%d", val)
27 vogleditor_stateTreeContextItem::vogleditor_stateTreeContextItem(QString name, QString value, vogleditor_stateTreeItem* parent, vogl_context_snapshot& contextState)
28 : vogleditor_stateTreeItem(name, value, parent),
29 m_pState(&contextState),
30 m_pDiffBaseState(NULL),
31 m_pAttributesItem(NULL),
32 m_pCreationItem(NULL),
35 m_pPolygonStippleItem(NULL),
40 const vogl_context_desc& desc = contextState.get_context_desc();
43 m_pAttributesItem = new vogleditor_stateTreeContextAttributesItem("Attributes", this, desc);
44 this->appendChild(m_pAttributesItem);
46 m_pCreationItem = new vogleditor_stateTreeContextCreationItem("Created by", this, desc);
47 this->appendChild(m_pCreationItem);
49 m_pDirectItem = new vogleditor_stateTreeContextDirectItem("Direct", this, desc);
50 this->appendChild(m_pDirectItem);
52 m_pSharedItem = new vogleditor_stateTreeContextSharedItem("Shared context", this, desc);
53 this->appendChild(m_pSharedItem);
55 const vogl_context_info& info = contextState.get_context_info();
56 vogleditor_stateTreeContextInfoItem* pInfoNode = new vogleditor_stateTreeContextInfoItem("Info", "", this, info);
57 m_contextInfoItems.push_back(pInfoNode);
58 this->appendChild(pInfoNode);
60 // in order for the rest of this information to be available, info must be valid
63 vogl_general_context_state& generalState = contextState.get_general_state();
64 vogleditor_stateTreeContextGeneralItem* pGeneralNode = new vogleditor_stateTreeContextGeneralItem("General", "", this, generalState, info);
65 m_generalStateItems.push_back(pGeneralNode);
66 this->appendChild(pGeneralNode);
68 vogl_display_list_state displayListState = contextState.get_display_list_state();
69 vogl_display_list_map& displayLists = displayListState.get_display_list_map();
70 if (displayLists.size() > 0)
72 vogleditor_stateTreeDisplaylistItem* pDisplayListStateNode = new vogleditor_stateTreeDisplaylistItem("DisplayLists", "", this, &displayListState);
73 this->appendChild(pDisplayListStateNode);
76 vogl_light_state& lightState = contextState.get_light_state();
77 if (lightState.is_valid())
79 vogleditor_stateTreeItem* pLightStateNode = new vogleditor_stateTreeItem("Lights", tmp.sprintf("[%u]", lightState.get_num_lights()), this);
80 this->appendChild(pLightStateNode);
82 for (uint i = 0; i < lightState.get_num_lights(); i++)
84 const vogl_state_vector& lightVec = lightState.get_light(i);
85 vogleditor_stateTreeLightItem* pLightNode = new vogleditor_stateTreeLightItem(tmp.sprintf("GL_LIGHT%u", i), i, pLightStateNode, &lightVec);
86 m_lightItems.push_back(pLightNode);
87 pLightStateNode->appendChild(pLightNode);
91 vogl_material_state& materialState = contextState.get_material_state();
92 if (materialState.is_valid())
94 vogleditor_stateTreeItem* pMaterialNode = new vogleditor_stateTreeItem("Material", "", this);
95 this->appendChild(pMaterialNode);
97 vogleditor_stateTreeContextMaterialItem* pFront = new vogleditor_stateTreeContextMaterialItem("GL_FRONT", materialState.cFront, pMaterialNode, materialState);
98 m_materialItems.push_back(pFront);
99 pMaterialNode->appendChild(pFront);
101 vogleditor_stateTreeContextMaterialItem* pBack = new vogleditor_stateTreeContextMaterialItem("GL_BACK", materialState.cBack, pMaterialNode, materialState);
102 m_materialItems.push_back(pBack);
103 pMaterialNode->appendChild(pBack);
106 vogl_matrix_state& matrixState = contextState.get_matrix_state();
107 if (matrixState.is_valid())
109 vogleditor_stateTreeItem* pMatrixStateNode = new vogleditor_stateTreeItem("Matrix", "", this);
110 this->appendChild(pMatrixStateNode);
112 vogleditor_stateTreeItem* pProjectionMatrixNode = new vogleditor_stateTreeItem("GL_PROJECTION stack", tmp.sprintf("[%u]", matrixState.get_matrix_stack_depth(GL_PROJECTION, 0)), pMatrixStateNode);
113 pMatrixStateNode->appendChild(pProjectionMatrixNode);
114 vogleditor_stateTreeItem* pModelviewMatrixNode = new vogleditor_stateTreeItem("GL_MODELVIEW stack", tmp.sprintf("[%u]", matrixState.get_matrix_stack_depth(GL_MODELVIEW, 0)), pMatrixStateNode);
115 pMatrixStateNode->appendChild(pModelviewMatrixNode);
116 vogleditor_stateTreeItem* pColorMatrixNode = new vogleditor_stateTreeItem("GL_COLOR stack", tmp.sprintf("[%u]", matrixState.get_matrix_stack_depth(GL_COLOR, 0)), pMatrixStateNode);
117 pMatrixStateNode->appendChild(pColorMatrixNode);
119 { vogleditor_stateTreeMatrixStackItem* pItem = new vogleditor_stateTreeMatrixStackItem("GL_PROJECTION", GL_PROJECTION, 0, pProjectionMatrixNode, matrixState); pProjectionMatrixNode->appendChild(pItem); m_matrixStackItems.push_back(pItem); }
120 { vogleditor_stateTreeMatrixStackItem* pItem = new vogleditor_stateTreeMatrixStackItem("GL_MODELVIEW", GL_MODELVIEW, 0, pModelviewMatrixNode, matrixState); pModelviewMatrixNode->appendChild(pItem); m_matrixStackItems.push_back(pItem); }
121 { vogleditor_stateTreeMatrixStackItem* pItem = new vogleditor_stateTreeMatrixStackItem("GL_COLOR", GL_COLOR, 0, pColorMatrixNode, matrixState); pColorMatrixNode->appendChild(pItem); m_matrixStackItems.push_back(pItem); }
124 vogleditor_stateTreeItem* pTextureMatrixNode = new vogleditor_stateTreeItem("GL_TEXTURE", "", pMatrixStateNode);
125 pMatrixStateNode->appendChild(pTextureMatrixNode);
126 for (uint texcoord_index = 0; texcoord_index < info.get_max_texture_coords(); texcoord_index++)
128 vogleditor_stateTreeItem* pTextureStackNode = new vogleditor_stateTreeItem(tmpName.sprintf("GL_TEXTURE%u stack", texcoord_index), tmpName.sprintf("[%u]",matrixState.get_matrix_stack_depth(GL_TEXTURE0 + texcoord_index, texcoord_index)), pTextureMatrixNode);
129 pTextureMatrixNode->appendChild(pTextureStackNode);
131 { vogleditor_stateTreeMatrixStackItem* pItem = new vogleditor_stateTreeMatrixStackItem(tmpName.sprintf("GL_TEXTURE%u", texcoord_index), GL_TEXTURE0 + texcoord_index, texcoord_index, pTextureStackNode, matrixState); pTextureStackNode->appendChild(pItem); m_matrixStackItems.push_back(pItem); }
134 vogleditor_stateTreeItem* pMatrixMatrixNode = new vogleditor_stateTreeItem("GL_MATRIX", "", pMatrixStateNode);
135 pMatrixStateNode->appendChild(pMatrixMatrixNode);
136 for (uint i = 0; i < info.get_max_arb_program_matrices(); i++)
138 vogleditor_stateTreeItem* pMatrixStackNode = new vogleditor_stateTreeItem(tmpName.sprintf("GL_MATRIX%u_ARB stack", i), tmpName.sprintf("[%u]",matrixState.get_matrix_stack_depth(GL_MATRIX0_ARB + i, i)), pMatrixMatrixNode);
139 pMatrixMatrixNode->appendChild(pMatrixStackNode);
141 { vogleditor_stateTreeMatrixStackItem* pItem = new vogleditor_stateTreeMatrixStackItem(tmpName.sprintf("GL_MATRIX%u_ARB", i), GL_MATRIX0_ARB + i, i, pMatrixStackNode, matrixState); pMatrixStackNode->appendChild(pItem); m_matrixStackItems.push_back(pItem); }
145 vogl_arb_program_environment_state& programState = contextState.get_arb_program_environment_state();
146 if (programState.is_valid())
148 vogleditor_stateTreeItem* pProgramStateNode = new vogleditor_stateTreeItem("ARB Program Env", "", this);
149 this->appendChild(pProgramStateNode);
151 for (uint i = 0; i < programState.cNumTargets; i++)
153 vogleditor_stateTreeArbProgramEnvItem* pProgramNode = new vogleditor_stateTreeArbProgramEnvItem(enum_to_string(programState.get_target_enum(i)), i, pProgramStateNode, programState);
154 m_arbProgramEnvItems.push_back(pProgramNode);
155 pProgramStateNode->appendChild(pProgramNode);
159 vogl_polygon_stipple_state& stippleState = contextState.get_polygon_stipple_state();
160 if (stippleState.is_valid())
162 m_pPolygonStippleItem = new vogleditor_stateTreePolygonStippleItem("Polygon Stipple", this, stippleState);
163 this->appendChild(m_pPolygonStippleItem);
166 vogl_texenv_state& texEnvState = contextState.get_texenv_state();
167 if (texEnvState.is_valid())
169 m_pTexEnvItem = new vogleditor_stateTreeTexEnvItem("Texture Env", this, texEnvState, info);
170 this->appendChild(m_pTexEnvItem);
173 // sort all state objects by snapshot handle
174 vogl_gl_object_state_ptr_vec objectState = contextState.get_objects();
175 objectState.sort(vogl_gl_object_state_handle_less_than());
176 vogleditor_stateTreeItem* pObjectsNode = new vogleditor_stateTreeItem("Objects", "", this);
177 this->appendChild(pObjectsNode);
180 // Append a node for each of the state object types
181 #define DEF(x) vogleditor_stateTreeItem* pNode##x = new vogleditor_stateTreeItem(#x "s", "", pObjectsNode);
182 VOGL_GL_OBJECT_STATE_TYPES
185 for (vogl_gl_object_state_ptr_vec::iterator iter = objectState.begin(); iter != objectState.end(); iter++)
187 switch((*iter)->get_type())
191 vogl_texture_state* pTexState = static_cast<vogl_texture_state*>(*iter);
193 valueStr = valueStr.sprintf("%s (%u x %u x %u) %s", enum_to_string(pTexState->get_target()).toStdString().c_str(), pTexState->get_texture().get_width(), pTexState->get_texture().get_height(), pTexState->get_texture().get_depth(), enum_to_string(pTexState->get_texture().get_ogl_internal_fmt()).toStdString().c_str());
194 vogleditor_stateTreeTextureItem* pNode = new vogleditor_stateTreeTextureItem(int64_to_string(pTexState->get_snapshot_handle()), valueStr, pNodeTexture, pTexState, info);
195 m_textureItems.push_back(pNode);
196 pNodeTexture->appendChild(pNode);
201 vogl_buffer_state* pBuffer = static_cast<vogl_buffer_state*>(*iter);
202 vogleditor_stateTreeBufferItem* pNode = new vogleditor_stateTreeBufferItem(int64_to_string(pBuffer->get_snapshot_handle()), enum_to_string(pBuffer->get_target()), pNodeBuffer, pBuffer);
203 m_bufferItems.push_back(pNode);
204 pNodeBuffer->appendChild(pNode);
210 const vogl_sampler_state* pSampler = static_cast<const vogl_sampler_state*>(*iter);
211 vogleditor_stateTreeSamplerItem* pNode = new vogleditor_stateTreeSamplerItem(int64_to_string(pSampler->get_snapshot_handle()), "", pNodeSampler, pSampler, info);
212 m_samplerItems.push_back(pNode);
213 pNodeSampler->appendChild(pNode);
219 vogl_query_state* pQuery = static_cast<vogl_query_state*>(*iter);
220 vogleditor_stateTreeQueryItem* pNode = new vogleditor_stateTreeQueryItem(int64_to_string(pQuery->get_snapshot_handle()), pQuery->get_snapshot_handle(), pNodeQuery, pQuery);
221 m_queryItems.push_back(pNode);
222 pNodeQuery->appendChild(pNode);
225 case cGLSTRenderbuffer:
227 vogl_renderbuffer_state* pRenderbuffer = static_cast<vogl_renderbuffer_state*>(*iter);
228 vogleditor_stateTreeRenderbufferItem* pNode = new vogleditor_stateTreeRenderbufferItem(int64_to_string(pRenderbuffer->get_snapshot_handle()), pRenderbuffer->get_snapshot_handle(), pNodeRenderbuffer, *pRenderbuffer);
233 pRenderbuffer->get_desc().get_int(GL_RENDERBUFFER_WIDTH, &width);
234 pRenderbuffer->get_desc().get_int(GL_RENDERBUFFER_HEIGHT, &height);
235 pRenderbuffer->get_desc().get_int(GL_RENDERBUFFER_INTERNAL_FORMAT, &format);
236 valueStr = valueStr.sprintf("(%d x %d) %s", width, height, enum_to_string(format).toStdString().c_str());
237 pNode->setValue(valueStr);
238 m_renderbufferItems.push_back(pNode);
239 pNodeRenderbuffer->appendChild(pNode);
243 case cGLSTFramebuffer:
245 vogl_framebuffer_state* pFramebuffer = static_cast<vogl_framebuffer_state*>(*iter);
246 if (!pFramebuffer->is_valid())
251 vogleditor_stateTreeFramebufferItem* pNode = new vogleditor_stateTreeFramebufferItem(int64_to_string(pFramebuffer->get_snapshot_handle()), "", pFramebuffer->get_snapshot_handle(), pNodeFramebuffer, pFramebuffer);
252 m_framebufferItems.push_back(pNode);
253 pNodeFramebuffer->appendChild(pNode);
257 case cGLSTVertexArray:
259 vogl_vao_state* pVAO = static_cast<vogl_vao_state*>(*iter);
260 if (!pVAO->is_valid())
265 vogleditor_stateTreeVertexArrayItem* pNode = new vogleditor_stateTreeVertexArrayItem(int64_to_string(pVAO->get_snapshot_handle()), tmp.sprintf("[%u]", info.get_max_vertex_attribs()), pVAO->get_snapshot_handle(), pNodeVertexArray, *pVAO, info);
266 m_vertexArrayItems.push_back(pNode);
267 pNodeVertexArray->appendChild(pNode);
273 vogl_shader_state* pShader = static_cast<vogl_shader_state*>(*iter);
274 if (!pShader->is_valid())
279 vogleditor_stateTreeShaderItem* pNode = new vogleditor_stateTreeShaderItem(int64_to_string(pShader->get_snapshot_handle()), enum_to_string(pShader->get_shader_type()), pNodeShader, *pShader);
280 m_shaderItems.push_back(pNode);
281 pNodeShader->appendChild(pNode);
287 vogl_program_state* pProgram = static_cast<vogl_program_state*>(*iter);
288 if (!pProgram->is_valid())
293 vogleditor_stateTreeProgramItem* pNode = new vogleditor_stateTreeProgramItem(int64_to_string(pProgram->get_snapshot_handle()), "", pNodeProgram, *pProgram, info);
294 m_programItems.push_back(pNode);
295 pNodeProgram->appendChild(pNode);
301 vogl_sync_state* pSync = static_cast<vogl_sync_state*>(*iter);
302 vogleditor_stateTreeSyncItem* pNode = new vogleditor_stateTreeSyncItem(int64_to_string(pSync->get_snapshot_handle()), pNodeSync, *pSync);
303 m_syncItems.push_back(pNode);
304 pNodeSync->appendChild(pNode);
307 case cGLSTARBProgram:
309 vogl_arb_program_state* pARBProgram = static_cast<vogl_arb_program_state*>(*iter);
310 if (!pARBProgram->is_valid())
314 vogleditor_stateTreeArbProgramItem* pNode = new vogleditor_stateTreeArbProgramItem(int64_to_string(pARBProgram->get_snapshot_handle()), "", pNodeARBProgram, *pARBProgram);
315 m_arbProgramItems.push_back(pNode);
316 pNodeARBProgram->appendChild(pNode);
322 // in the Invalid and default case add the object to the invalids
323 vogleditor_stateTreeItem* pNode = new vogleditor_stateTreeItem(int64_to_string((*iter)->get_snapshot_handle()), get_gl_object_state_type_str((*iter)->get_type()), pNodeARBProgram);
324 pNodeARBProgram->appendChild(pNode);
329 // update the value of the list node to reflect the number of elements in that list
330 #define DEF(x) pNode##x->setValue(tmp.sprintf("[%d]", pNode##x->childCount()));
331 VOGL_GL_OBJECT_STATE_TYPES
334 // only append list if there are objects of that type
335 #define DEF(x) if (pNode##x->childCount() > 0) pObjectsNode->appendChild(pNode##x);
336 VOGL_GL_OBJECT_STATE_TYPES
343 vogleditor_stateTreeContextItem::~vogleditor_stateTreeContextItem()
346 m_pDiffBaseState = NULL;
347 m_pAttributesItem = NULL;
348 m_pCreationItem = NULL;
349 m_pDirectItem = NULL;
350 m_pSharedItem = NULL;
351 m_pPolygonStippleItem = NULL;
352 m_pTexEnvItem = NULL;
355 void vogleditor_stateTreeContextItem::set_diff_base_state(const vogl_context_snapshot* pBaseState)
357 m_pDiffBaseState = pBaseState;
359 if (m_pAttributesItem != NULL)
361 m_pAttributesItem->set_diff_base_state(&(m_pDiffBaseState->get_context_desc()));
364 if (m_pCreationItem != NULL)
366 m_pCreationItem->set_diff_base_state(&(m_pDiffBaseState->get_context_desc()));
369 if (m_pDirectItem != NULL)
371 m_pDirectItem->set_diff_base_state(&(m_pDiffBaseState->get_context_desc()));
374 if (m_pSharedItem != NULL)
376 m_pSharedItem->set_diff_base_state(&(m_pDiffBaseState->get_context_desc()));
379 if (m_pPolygonStippleItem != NULL)
381 m_pPolygonStippleItem->set_diff_base_state(&(m_pDiffBaseState->get_polygon_stipple_state()));
384 if (m_pTexEnvItem != NULL)
386 m_pTexEnvItem->set_diff_base_state(&(m_pDiffBaseState->get_context_info()), &(m_pDiffBaseState->get_texenv_state()));
389 for (vogleditor_stateTreeContextGeneralItem** iter = m_generalStateItems.begin(); iter != m_generalStateItems.end(); iter++)
391 if (m_pDiffBaseState != NULL)
393 (*iter)->set_diff_base_state(&(pBaseState->get_general_state()));
397 (*iter)->set_diff_base_state(NULL);
401 for (vogleditor_stateTreeContextInfoItem** iter = m_contextInfoItems.begin(); iter != m_contextInfoItems.end(); iter++)
403 if (m_pDiffBaseState != NULL)
405 (*iter)->set_diff_base_state(&(pBaseState->get_context_info()));
409 (*iter)->set_diff_base_state(NULL);
413 vogl_gl_object_state_ptr_vec texObjs;
414 m_pDiffBaseState->get_all_objects_of_category(cGLSTTexture, texObjs);
415 for (vogleditor_stateTreeTextureItem** iter = m_textureItems.begin(); iter != m_textureItems.end(); iter++)
417 for (vogl_gl_object_state** diffIter = texObjs.begin(); diffIter != texObjs.end(); diffIter++)
419 const vogl_texture_state* pDiffTex = static_cast<const vogl_texture_state*>(*diffIter);
420 if (pDiffTex->get_snapshot_handle() == (*iter)->get_texture_state()->get_snapshot_handle())
422 (*iter)->set_diff_base_state(pDiffTex);
428 vogl_gl_object_state_ptr_vec queryObjects;
429 m_pDiffBaseState->get_all_objects_of_category(cGLSTQuery, queryObjects);
430 for (vogleditor_stateTreeQueryItem** iter = m_queryItems.begin(); iter != m_queryItems.end(); iter++)
432 for (vogl_gl_object_state** diffIter = queryObjects.begin(); diffIter != queryObjects.end(); diffIter++)
434 const vogl_query_state* pDiffState = static_cast<const vogl_query_state*>(*diffIter);
435 if (pDiffState->get_snapshot_handle() == (*iter)->get_handle())
437 (*iter)->set_diff_base_state(pDiffState);
443 vogl_gl_object_state_ptr_vec renderbufferObjects;
444 m_pDiffBaseState->get_all_objects_of_category(cGLSTRenderbuffer, renderbufferObjects);
445 for (vogleditor_stateTreeRenderbufferItem** iter = m_renderbufferItems.begin(); iter != m_renderbufferItems.end(); iter++)
447 for (vogl_gl_object_state** diffIter = renderbufferObjects.begin(); diffIter != renderbufferObjects.end(); diffIter++)
449 const vogl_renderbuffer_state* pDiffState = static_cast<const vogl_renderbuffer_state*>(*diffIter);
450 if (pDiffState->get_snapshot_handle() == (*iter)->get_handle())
452 (*iter)->set_diff_base_state(pDiffState);
458 vogl_gl_object_state_ptr_vec framebufferObjects;
459 m_pDiffBaseState->get_all_objects_of_category(cGLSTFramebuffer, framebufferObjects);
460 for (vogleditor_stateTreeFramebufferItem** iter = m_framebufferItems.begin(); iter != m_framebufferItems.end(); iter++)
462 for (vogl_gl_object_state** diffIter = framebufferObjects.begin(); diffIter != framebufferObjects.end(); diffIter++)
464 const vogl_framebuffer_state* pDiffState = static_cast<const vogl_framebuffer_state*>(*diffIter);
465 if (pDiffState->get_snapshot_handle() == (*iter)->get_handle())
467 (*iter)->set_diff_base_state(pDiffState);
473 vogl_gl_object_state_ptr_vec samplerObjects;
474 m_pDiffBaseState->get_all_objects_of_category(cGLSTSampler, samplerObjects);
475 for (vogleditor_stateTreeSamplerItem** iter = m_samplerItems.begin(); iter != m_samplerItems.end(); iter++)
477 for (vogl_gl_object_state** diffIter = samplerObjects.begin(); diffIter != samplerObjects.end(); diffIter++)
479 const vogl_sampler_state* pDiffObj = static_cast<const vogl_sampler_state*>(*diffIter);
480 if (pDiffObj->get_snapshot_handle() == (*iter)->get_sampler_state()->get_snapshot_handle())
482 (*iter)->set_diff_base_state(pDiffObj);
488 vogl_gl_object_state_ptr_vec bufferObjects;
489 m_pDiffBaseState->get_all_objects_of_category(cGLSTBuffer, bufferObjects);
490 for (vogleditor_stateTreeBufferItem** iter = m_bufferItems.begin(); iter != m_bufferItems.end(); iter++)
492 for (vogl_gl_object_state** diffIter = bufferObjects.begin(); diffIter != bufferObjects.end(); diffIter++)
494 const vogl_buffer_state* pDiffObj = static_cast<const vogl_buffer_state*>(*diffIter);
495 if (pDiffObj->get_snapshot_handle() == (*iter)->get_buffer_state()->get_snapshot_handle())
497 (*iter)->set_diff_base_state(pDiffObj);
503 vogl_gl_object_state_ptr_vec vertexArrayObjects;
504 m_pDiffBaseState->get_all_objects_of_category(cGLSTVertexArray, vertexArrayObjects);
505 for (vogleditor_stateTreeVertexArrayItem** iter = m_vertexArrayItems.begin(); iter != m_vertexArrayItems.end(); iter++)
507 for (vogl_gl_object_state** diffIter = vertexArrayObjects.begin(); diffIter != vertexArrayObjects.end(); diffIter++)
509 const vogl_vao_state* pDiffObj = static_cast<const vogl_vao_state*>(*diffIter);
510 if (pDiffObj->get_snapshot_handle() == (*iter)->get_handle())
512 (*iter)->set_diff_base_state(pDiffObj);
518 vogl_gl_object_state_ptr_vec shaderObjects;
519 m_pDiffBaseState->get_all_objects_of_category(cGLSTShader, shaderObjects);
520 for (vogleditor_stateTreeShaderItem** iter = m_shaderItems.begin(); iter != m_shaderItems.end(); iter++)
522 for (vogl_gl_object_state** diffIter = shaderObjects.begin(); diffIter != shaderObjects.end(); diffIter++)
524 const vogl_shader_state* pDiffObj = static_cast<const vogl_shader_state*>(*diffIter);
525 if (pDiffObj->get_snapshot_handle() == (*iter)->get_current_state()->get_snapshot_handle())
527 (*iter)->set_diff_base_state(pDiffObj);
533 vogl_gl_object_state_ptr_vec programObjects;
534 m_pDiffBaseState->get_all_objects_of_category(cGLSTProgram, programObjects);
535 for (vogleditor_stateTreeProgramItem** iter = m_programItems.begin(); iter != m_programItems.end(); iter++)
537 for (vogl_gl_object_state** diffIter = programObjects.begin(); diffIter != programObjects.end(); diffIter++)
539 const vogl_program_state* pDiffObj = static_cast<const vogl_program_state*>(*diffIter);
540 if (pDiffObj->get_snapshot_handle() == (*iter)->get_current_state()->get_snapshot_handle())
542 (*iter)->set_diff_base_state(pDiffObj);
548 vogl_gl_object_state_ptr_vec syncObjects;
549 m_pDiffBaseState->get_all_objects_of_category(cGLSTSync, syncObjects);
550 for (vogleditor_stateTreeSyncItem** iter = m_syncItems.begin(); iter != m_syncItems.end(); iter++)
552 for (vogl_gl_object_state** diffIter = syncObjects.begin(); diffIter != syncObjects.end(); diffIter++)
554 vogl_sync_state* pDiffObj = static_cast<vogl_sync_state*>(*diffIter);
555 if (pDiffObj->get_snapshot_handle() == (*iter)->get_current_state()->get_snapshot_handle())
557 (*iter)->set_diff_base_state(pDiffObj);
563 vogl_gl_object_state_ptr_vec arbProgramObjects;
564 m_pDiffBaseState->get_all_objects_of_category(cGLSTARBProgram, arbProgramObjects);
565 for (vogleditor_stateTreeArbProgramItem** iter = m_arbProgramItems.begin(); iter != m_arbProgramItems.end(); iter++)
567 for (vogl_gl_object_state** diffIter = arbProgramObjects.begin(); diffIter != arbProgramObjects.end(); diffIter++)
569 const vogl_arb_program_state* pDiffObj = static_cast<const vogl_arb_program_state*>(*diffIter);
570 if (pDiffObj->get_snapshot_handle() == (*iter)->get_current_state()->get_snapshot_handle())
572 (*iter)->set_diff_base_state(pDiffObj);
578 const vogl_light_state* lightState = &(pBaseState->get_light_state());
579 VOGL_ASSERT(lightState->is_valid() || m_lightItems.size() == 0);
580 if (lightState->is_valid())
582 for (vogleditor_stateTreeLightItem** iter = m_lightItems.begin(); iter != m_lightItems.end(); iter++)
584 const vogl_state_vector& lightVec = lightState->get_light((*iter)->get_light_index());
585 (*iter)->set_diff_base_state(&lightVec);
589 const vogl_arb_program_environment_state* progEnvState = &(pBaseState->get_arb_program_environment_state());
590 VOGL_ASSERT(progEnvState->is_valid() || m_arbProgramEnvItems.size() == 0);
591 if (progEnvState->is_valid())
593 for (vogleditor_stateTreeArbProgramEnvItem** iter = m_arbProgramEnvItems.begin(); iter != m_arbProgramEnvItems.end(); iter++)
595 (*iter)->set_diff_base_state(progEnvState);
599 const vogl_material_state* materialState = &(pBaseState->get_material_state());
600 VOGL_ASSERT(materialState->is_valid() || m_materialItems.size() == 0);
601 if (materialState->is_valid())
603 for (vogleditor_stateTreeContextMaterialItem** iter = m_materialItems.begin(); iter != m_materialItems.end(); iter++)
605 (*iter)->set_diff_base_state(materialState);
609 const vogl_matrix_state* matrixState = &(pBaseState->get_matrix_state());
610 VOGL_ASSERT(matrixState->is_valid() || m_matrixStackItems.size() == 0);
611 if (matrixState->is_valid())
613 for (vogleditor_stateTreeMatrixStackItem** iter = m_matrixStackItems.begin(); iter != m_matrixStackItems.end(); iter++)
615 if (m_pDiffBaseState != NULL)
617 (*iter)->set_diff_base_state(matrixState);