Description
I have the following setup to render a bunch of boxes:
<asset id="boxes">
<assetdata name="mapping" compute="dataflow['df.xml#makeboxes']">
<data id="extent-mapping" src="extent.json"/>
<data id="height-mapping" src="height.json"/>
<data id="color-mapping" src="color.json"/>
</assetdata>
<assetdata name="boxindex" compute="dataflow['df.xml#boxindices']">
<int name="boxindex">0</int>
</assetdata>
<assetmesh includes="mapping boxindex" type="tristrips">
</assetmesh>
</asset>
<model src="#boxes" id="0" >
<assetdata name="boxindex"><int name="boxindex">0</int></assetdata>
</model>
<!-- more of the models -->
df.xml#makeboxes
takes the custom attributes from the three json files and creates the box vertices with position, normal and color, while df.xml#boxindices
creates the appropriate index values for each individual box.
The initial rendering looks fine. Now I change the height-mapping by document.getElementById("height-mapping").setAttribute("src", "height2.json")
. The boxes all disappear and reappear shortly after with new heights (i. e. changed position attributes). So far so good.
For the following, the behavior seems not to be really deterministic. If I toggle the height-mapping between the two height-jsons at some point I always get: Mesh Error: Mesh does not have 'position' attribute.
for each model/box and all boxes disappear.
So far it has occurred on those different occasions:
- immediately when switching back to the original height.json
- the second time switching to height2.json (i. e. height -> height2 -> height -> height2_crash_)
Usually the other file still yields the correct result, i. e. I can toggle between a working rendering and the errors. But sometimes none of them work after the errors first appeared.
Can you imagine a case where Xflow "forgets" to do its computation when the src-attribute is toggled between two files?
The behavior also occurs with three different files. Only one can usually be rendered after some toggling.
However, to complicate the matter, I was not able to reproduce it with this simpler example:
<asset id="test">
<assetdata name="mapping" compute="position = xflow.add(pos, offset)">
<float3 name="offset">-0.5 0 0 -0.5 0 0 -0.5 0 0</float3>
<data id="positions" src="positions.json"/>
<float3 name="normal">0 0 1 0 0 1 0 0 1</float3>
</assetdata>
<assetmesh includes="mapping" type="tristrips">
</assetmesh>
</asset>
<model src="#test" id="0" >
</model>
...and toggling between positions.json and positions2.json which both contain a pos
array for a single triangle. Toggling repeatedly does not produce errors here.
I assume that my Xflow operators are correct since I get a successful rendering for each file at least once. Is there some kind of result caching at work which fails here?