ImageEngine/cortex — pull request #19 by ldmoser (2013-07-04 20:39:54+00:00)
Title: Adding a dynamic attribute "sceneInterface:linkHash" computed by LinkedScene

The motivation for this new attribute is the following:

- We want to be able to optimize the OpenGL visualization of large scenes and seems natural to use instancing at places where the scene refers to external scenes (there's a good chance that an external scene may be referred several times in the same master scene). By having a unique hash that takes in consideration the time remapping as well, we can safely instantiate the scene, knowing that, if the time changes we will still be able to apply updates as opposed to have to recreate the entire GL scene from scratch.

- We also look for ways to, at render time, be able to know that a given sub-tree of the scene matches exactly a previously seen one, and use 3delight procedural instancing to save memory and computation resources.

Two important caveats:

1) It computes the hash every time the attribute value is requested. No caches. Which may impact performance if used naively. The assumption is that readers would need that information only the first time, then (when time changes), they have already the knowledge of what's unique and will not require to load the attribute again. It was done that way for the sake of simplicity of implementation and should be re-evaluated if performance really becomes a problem.

2) It does not return the attribute by the function attributeNames(). I've opted to not add because on normal circumstances, that attribute is not important for generic readers. Only readers that know about it, will pay the price to compute it's value. Maybe if we find a way to bake the hash in the scene, then we could change that with no bad consequences.