I'm afraid that's not enough information to give you a proper suggestion ..
That sounds like a bad idea yes.
K
Moderator: Moderators
I'm afraid that's not enough information to give you a proper suggestion ..
That sounds like a bad idea yes.
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;
for(int B=0; B<4; B++)
{
m = createModel(RockModel);
m.Position.X = -6 + 4*B;
m.Position.Y = -2;
}]]>
</Expression>
</ZExpression>
</OnLoaded>
<Content>
<Mesh Name="RockMesh">
<Producers>
<MeshBox XCount="4" YCount="4" Grid2DOnly="255"/>
<MeshExpression Name="RockMeshExpression">
<Expression>
<![CDATA[//V : current vertex
//N : current normal (turn off AutoNormals when modifying normals)
//C : current color (turn on VertexColors)
//TexCoord : current texture coordinate (turn on HasTexCoords)
if (V.X == -1 || V.X == 1 || V.Y == -1 || V.Y == 1) V.Z = 0;
else V.Z += cos(V.X*V.Y)*1.5+rnd();
V.X += rnd()*V.X;
V.Y += rnd()*V.Y;]]>
</Expression>
</MeshExpression>
<MeshTransform Rotation="-0.25 0 0"/>
</Producers>
</Mesh>
<Model Name="RockModel">
<OnSpawn>
<RefreshContent Component="RockMeshExpression"/>
</OnSpawn>
<OnRender>
<RenderMesh Mesh="RockMesh"/>
</OnRender>
</Model>
</Content>
</ZApplication>
Ah, that's easy .. simply move RockMesh into RockModel.Definitions and remove the RefreshContent component. So like this ..
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;
for(int B=0; B<4; B++)
{
m = createModel(RockModel);
m.Position.X = -6 + 4*B;
m.Position.Y = -2;
}]]>
</Expression>
</ZExpression>
</OnLoaded>
<Content>
<Model Name="RockModel">
<Definitions>
<Mesh Name="RockMesh">
<Producers>
<MeshBox XCount="4" YCount="4" Grid2DOnly="255"/>
<MeshExpression Name="RockMeshExpression">
<Expression>
<![CDATA[//V : current vertex
//N : current normal (turn off AutoNormals when modifying normals)
//C : current color (turn on VertexColors)
//TexCoord : current texture coordinate (turn on HasTexCoords)
if (V.X == -1 || V.X == 1 || V.Y == -1 || V.Y == 1) V.Z = 0;
else V.Z += cos(V.X*V.Y)*1.5+rnd();
V.X += rnd()*V.X;
V.Y += rnd()*V.Y;]]>
</Expression>
</MeshExpression>
<MeshTransform Rotation="-0.25 0 0"/>
</Producers>
</Mesh>
</Definitions>
<OnRender>
<RenderMesh Mesh="RockMesh"/>
</OnRender>
</Model>
</Content>
</ZApplication>