1. Go to OnRender and move the RenderMesh below the transf_Tile:RenderTransform component, the mesh will disappear from the preview.
2. Run the project, you'll notice the texture (tile) part will change its color even though both the mesh and the tile use the same material that does not use lighting - in fact the mesh stays the same like it was before launching. Removing the light_Reflector (in Lights) makes the tile behave like an ordinary texture again.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="Prg" Caption="Template (fps: 0)" ClearColor="0.502 0.502 0.7529 1" AmbientLightColor="0.502 0 1 0.5" Camera="cam_Front" FileVersion="2">
<OnLoaded>
<Variable Name="ScreenRatio"/>
<Variable Name="ScreenEdgeTop"/>
<Variable Name="ScreenEdgeRight"/>
<Constant Name="TilesPerX" Type="1" IntValue="16"/>
<Constant Name="TilesPerY" Type="1" IntValue="12"/>
<Constant Name="TextureInBmpPerX" Type="1" IntValue="10"/>
<Constant Name="TextureInBmpPerY" Type="1" IntValue="10"/>
<ZExpression Comment="Calculate">
<Expression>
<![CDATA[ScreenRatio = (1f*Prg.ViewportWidth/Prg.ViewportHeight);
ScreenEdgeTop = cam_Front.OrthoZoom*1f;
ScreenEdgeRight = cam_Front.OrthoZoom*ScreenRatio;
//Just so the tiles are the same size as meshes
transf_Tile.Scale.X = 2f/((bmp_Paint.Width/TextureInBmpPerX));
transf_Tile.Scale.Y = 2f/((bmp_Paint.Width/TextureInBmpPerY));
rTile_First.OriginX = (1f*bmp_Paint.Width/TextureInBmpPerX)*0.5;
rTile_First.OriginY = (1f*bmp_Paint.Height/TextureInBmpPerY)*0.5;]]>
</Expression>
</ZExpression>
</OnLoaded>
<OnUpdate>
<ZExpression Expression="Prg.Caption = "Template (fps: " + intToStr(Prg.FpsCounter) + ")";"/>
</OnUpdate>
<OnRender>
<UseMaterial Material="mat_ColorAlpha"/>
<RenderSetColor Color="0 1 1 1"/>
<RenderMesh Mesh="mesh_Rect"/>
<RenderTransformGroup Name="transf_Tile" Scale="0.0625 0.0625 1" Translate="2 0 1">
<Children>
<RenderTile Name="rTile_First" TileSet="tSet_Stickers" TileIndex="10" OriginX="16" OriginY="16"/>
</Children>
</RenderTransformGroup>
</OnRender>
<Lights>
<Light Name="light_Reflector" Position="2 2 2" Color="1 1 1 1"/>
</Lights>
<Content>
<Camera Name="cam_Front" Kind="1" Position="0 0 10" OrthoZoom="12"/>
<Bitmap Name="bmp_Paint" Width="320" Height="320" Filter="1">
<Producers>
<BitmapFromFile Comment="Imported from images.png" Transparency="1" HasAlphaLayer="1" DataWidth="320" DataHeight="320">
<BitmapFile>
<![CDATA[78DAEDDDD171DB30104551559C9E525466D28DD2412C92C2EEC3E29C19FF5A26045E811025BF5E0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0A7FEBE7FBDFFF76384707E381F4EEB9EE7DC3C38691E748E41C2989F74BE5F99F3A735F084E3BEF3FC573620790CA634F7D435EEA7635C352609E37E52FB9FB66FD598ECD0BFEEBF41FFBE3FDEDD73B273EC4F5BFFDE39BE8EB550EA58549D8BDDD7DF53F71CAEFEDEA9FDEB78ED4FE8EB93C73DA17F69EB90A9FB0F5D6BEFABBFAFA37FABC7FFCA187FF3EF4ADBE3B9F39855AFCDA9D74309EB90DDF71F3AF75B12FB57BD067C72EDB7D35A7FD5B14CEA5FC2F5474AA7BBD63A9FAE7DAB8F71EA7B5077F73FBFD9BF8EF587FE65CEF59431EA78BFBBFA789FEC794FEDDF95BD979DAFC156ED654EEC5FE53548F518A5DCEFD3312792EEF7EA6A60E218EC767D33AD7F5DD7C11DDDD4BFDCFB9E53DE079978DFBFFEEDDFC0DDFBD73D277638F6B4064E796CFDDBBB7F4FFEB6ABF73AECDEFB296BFCEEFE75AF3DF56FFF736ED55C99DCBFA47BA0A736306DEDB7FAD8F52FFFEF58796DF6D3EF48BA1755FF323E7799F0DC278EE9C4FB9F77E95FC5EB6E52E72BCEFFD31A78E573971DC795DCBFC99FFF48EEDF84EB9E8A75EED4FE55ED8126DC035A35EFF52FEFB3385DDFBB95789DBFEB1EE3B75E833AFA57B9FF50DD828A7D74FDCB9F8349E7FFB4F5D58AEBFF8EBDAB89FD7BF2BC4FFBFE97CA6BCE3BDD9DBC0E4C7CAF6B87EFDE5DB1075CFD3C25F6EFCEF598FF8BD033FF273420FD5E9BE4EF62AEFA1E96AEF761933F03A87DFDCFC1847550FA672E26CFF3B4FEFD74CD73C21A8439DF8FB662EE9DB80E4CEB60D763278D834A9DD3E0D3FAD7B91FE8F55E6F30FF9D07E680E71B0000000048F57EFD7EB7FE347BFD69FE01F44FFF00FDD33F40FFF40FD03FFD03F44FFF00FDD33F40FFF40FD03FFD03F44FFF00FDD33F40FFF40FD03FFD03F44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF44FFF40FFF40FD03FFD03F44FFF00FDD33F40FFF40FD03FFD8321FE015EB434BB]]>
</BitmapFile>
</BitmapFromFile>
</Producers>
</Bitmap>
<Material Name="mat_ColorAlpha" Shading="1" Light="0" Blend="1"/>
<TileSet Name="tSet_Stickers" Bitmap="bmp_Paint" TileWidth="32" TileHeight="32"/>
<Mesh Name="mesh_Rect">
<Producers>
<MeshBox/>
</Producers>
</Mesh>
<Mesh Name="mesh_RectangleWithTC">
<Producers>
<MeshBox Grid2DOnly="255"/>
<MeshExpression Comment="Color 0" HasTexCoords="255">
<Expression>
<![CDATA[int WhichTileX = 2;
TexCoord.X = (1f/TextureInBmpPerX) * (1f*WhichTileX);
TexCoord.Y = 1;//(1f/tilesInBmpY) * (1f*WhichTileY);]]>
</Expression>
</MeshExpression>
</Producers>
</Mesh>
</Content>
</ZApplication>