Problem with Model-local complex variables - solved
Posted: Thu Sep 01, 2016 8:58 pm
Model.Definitions can contain declarations of model instance-local variables. Everything goes fine when these local variables have simple type - float, int, string, ... The problem is when they are vec* or mat4. Then, they are not treated as local, but as global variables. See this example:
It should show:
1 3
2 4
,but shows:
1 3
4 4
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<ZExpression>
<Expression>
<![CDATA[model m = createModel(Model1);
m.Position.X = -5;
m.Variable1 = 1;
m.Variable2.X = 2;
m = createModel(Model1);
m.Position.X = 5;
m.Variable1 = 3;
m.Variable2.X = 4;]]>
</Expression>
</ZExpression>
</OnLoaded>
<Content>
<Model Name="Model1">
<Definitions>
<Variable Name="Variable1"/>
<Variable Name="Variable2" Type="7"/>
</Definitions>
<OnRender>
<RenderText TextFloatRef="Variable1" Y="0.9" Scale="10" UseModelSpace="255"/>
<RenderText TextFloatRef="Variable2.X" Y="-0.9" Scale="10" UseModelSpace="255"/>
</OnRender>
</Model>
</Content>
</ZApplication>
1 3
2 4
,but shows:
1 3
4 4