Texture coordinates mismatch

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Texture coordinates mismatch

Post by rrTea »

On my new computer, some of the models look off. I'm coloring them using this method (launch it in preview once, just so the OnStart gets executed, then preview the model):

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnLoaded>
    <Variable Name="TextureMatrix" Type="5"/>
    <ZExpression Comment="TextureMatrix set">
      <Expression>
<![CDATA[//Used to make enemies change colors
//Highlighting etc

// Initialize the texture matrix

TextureMatrix[0,0] = 0.1;
TextureMatrix[1,1] = 0.1;
TextureMatrix[2,2] = 1;
TextureMatrix[3,3] = 1;

//
TextureMatrix[3,0] = 0.1;
TextureMatrix[3,1] = 0;]]>
      </Expression>
    </ZExpression>
  </OnLoaded>
  <Content>
    <Bitmap Name="bmp_Stickers" Width="240" Height="240" Filter="1">
      <Producers>
        <BitmapFromFile Comment="Imported from stickers.png" Transparency="2" HasAlphaLayer="1" DataWidth="240" DataHeight="240">
          <BitmapFile>
<![CDATA[789CED9D31AF24471546876C430B0952242744E0909F40468484841C20595A911193901160B17264420B6489849098106B03F8014E1D2004920327848D7B9FEBED9DDBF756DDAAAEEAE99A39472AEDBE9EEEAFAAABEA54F7F4CEBC5D96B1FCFB72195A968F0797FF8C2DBF5EC696CBEF97B1E5CBB1E5F5656C592E1F0F2D2F5FBE1C5A4683BFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBF6DE5F27A195A3EFCDAB191E5D39F8E2D7FFADDD872F9E3E0F2BD8F0697FF0E2D3FBFBC3FB4FCF6F2A3A1E587DFBD0C2DF88BBFF88BBFF88BBFF88BBFF88BBFF87B9CBF16F88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBFF88BBF7BFD2D15FCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFCC55FFC9DD85F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000380DCB602E5F0E2E000F0CFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFE02CC0BFECEC1A65FC9EF9ADF6FC68F393F9897E749F1F9E5A9749E2387E55FFEF7544ED6FE7ED65ED3EBFC605E3673B3B36387E527773B3BBCB7FD8674FB0A0EC337B873B3936387E56B773B39DCA3FD5DDD351C6E3D37989BE2DCDCE9D861F99EBB3B1DEED9FEB0BF95FBD59E13DC07E1B9B9F7FDDEE8FC92BB8D0EF76EFF22D9EBEF55143C1AD573B3F5FDDEE8FCA8BB950E8F6A7FC8CD8A7BE7D279C0FDD13C376BE7A8777C7269B7038EA3BA9E4A8747F6CF22E17D2F3470537F3DD77AF95BAAEFC6FE5EB7BFE027D75E70689EA3C1B963E697AE977BEF9F4BD7FB13DC3F5F657B8E465E73EAD87D5F2E4AA98FE0B654CFD1CA75FF2ABFF4BE744F7ECE5DE9F09EF677EE9FBDFE9A991DDDC5E1F37398BF933C1F3E327F9138D7D7DC6B9BBC01EEE2F079A99E9B3DEE6F27783E7C54FE751FD5F96B66E1EFC3509C9B0FFC7CF888FC4D3DD253CFDFAB4D4616FE3E0CD9F9C9F3E1C3FCBDEE2BE14C665B360B771F06738EF27CF8B0FC4D3DD257EFE748BB71F761B89AA33C1F3E3C7FDB4F8E4B8DB970DF5CF9C5F3E1C3F337F5580E5FBD04F044B5BB0F767F3B3ADFAD8F6B2F1428BA1B7CBD985F98E3AD0ECC9E9FAD533A7CB509E089AC9F9ADEFE6A7AFB35417E795CB8F6421ED34F355F22FB14F333F33AB2CFBDE667EB54B464C1FD73E5A7335722FB14F333F33AB2CFBDE667EBC45D0810992B7BE613F9EDF5E12F68DE79F783A577219F7CF2E7CD9775904F3EF963F2DF7BFF0FCBA8423EF9E48FCB4F7CF2D5B2FCE69FFF7A53D6BFAFC89FD39F5F7CF1C5F3766B9F54747EDA5FFE5DFE29EB4845BE9EEA4D3F7BEDB7FE2ECF27D716D90E2B5FFE29B3755DB27F64B6FCBB952FFB40B7C7CB91F5C82CABFF65DFEA3ED1E3A7DBA1EBB7F2E5387963ABB7A59F7B8DAFAE4FD62BFBD8CBD7ED92F9D61858FD66E5CB7EF1DA27EBB3F6956DF0E64FAEBF643FE87923CF2B377FAC79A48FB5CEA334FF237D2AB7AFFD99EA93C72772EB9BD54ED936ABED7A0C747EAECFADF1B38ECBCD1FAB9FACF5D25BC7F5762FDFAA4B9F57FA73C4F87AEBA7AEB7D43FD6985A7DEECD572B5FEFA7B7793ECB76A7EDA5F55FD629E77BAE6F72F3C75AC74AE3AAFB4FD6EB8DAF751E56BDD61A225FF7AEBF721D956D4BDB75DFCBEDB9F1D56DD5C7E8F3B7D60E8995AFDBA2CF5BF7A59EBBB9F963F9A48F97D758ED60AFF195FB785E58F9B24F65FBF4DCD6FDA3CF3FD77EBD56E98C5C5FEA6B6BEEFE569E8B754E32479F8BB7BE796BA66EB3751DD0EDF1E68F3CD6BBCFB7CED75A1773F3C76AAF3E47DD96D2FC4CF5CBFB026F6DD1F5EBF35B33BCF9991B8FB44DB757F79DD73F7A8DB2E68D6CA3FCB9D7F85A6B9EEECBC8FA63AD8B7A9BEC2F5DBF777FA5CF59D76D3967F55FC92F7D1DD0FD6C5D0FE4B1B9FB136B5C755FE7C636D73FB9F54666A6F9A3C723FD9CBB7EE939916BBFD55F56BED51F3ADB5A8BA3EBA7E5945ED3757F598E79F347BF6ED561ADC7F2EF3DC7578F47A97FAC71D4EDD26D4DEB9C35DE25BFE4FEDE7A61F57DCAC9DDDF7A7D9C3BBFD2FCB4C6CB9B977A2CAD7534F7FC44FEACEBB7FA50F7F14AEEFD5D69FDB41C89B45FBE6E657873C95A5F73D717EB9A2DEBD29EC87E4DDB4ACF67AC31B4CE61F4F8CA6DF2BE22F77CCC3A56F7A1B5A6C973C9DDFF7873D01A476FCD8DBC3F95E3E59D97B74659FD6F3D83F3CEC59B67B9F9691DAFCF43E65AEDF2FCF5D649EB7CB48356FB4ACF4FE45CB3C6528F85EE5BC6D76ED7BD8EAF3C77BD0EC8752EE5EB7B2BBD46E4DE5FE7D666DD377A8D4D7FE6D6379D53BA36586D8CBC7FD1D724DD5F567B4A7EC97E95FBEB7F5F91E3AAFB2BD73F8CEF13F738BE7A3DB3D61DAFFD7AADCDDDFF7863ADF7F5C6A3B43EEB3C2B579F8F7C369B6BBF756D92F5CBF1D6FBCAFD4ACFFF65DF5ACFBC75A69E4B8CEFE38DAF5E13E4BAA3B75BEB6A2E5FD7AFD71A7D6E7ABD91FDE6F58F55973557741B6ADA5F9A37F267ABFFBCF96FF5896E73CE2DBD0FE3FB58E36B9DB7F5672E5F9E9377FFAFE746A40EEBBCBDF553D6B3623D439559BADFBCF1D5FBCAFB1AEB7CACEB4AA47FE4B958D725EB1AA1FB8EF17DBCF1F5FA59AF31FA35391FD23E5EFEFADADA2FD63344BDBEEAF3D1F5E79ECFE7D632AB3D56BFE5E68F6C87E7836CB73E076FFDF7CEDB3A8792738CEF638D6FE938EB5CACB5C85B7FF4F156BBE5FA525A8F72EBBF3C5EAE9DDE7AA73FAF90EBFFB4BF3C6F5DAFB55EEA31CFBD3FF5B2F458A4F929C722C1F83EDEF85AEB4A69CCAD76E5D64F6BACE43A24FB4DF7B9ECCBDCF3496FCD927DE0B5A3747DD17D6CD5A5CF57B63FED539AFF561DBA9F2C0FBCF633BEF73FBE565B74FBF5F36F8F5CFF58C7597DADD79C5CBECCB4C6C11ADF1CA5FB2BDD47BA8E5CDBAD7C5D87AC479F8B6C47349FF12DB77FE6F1956DCAADD3F2EFA53E5ABFFBA8B375A6B5E694FAC6CAD7ED8E5E47A2F9D678CACC54971E939AF64B5286F5EFB0DE7A5DCA677CFDFC59C7578F815E7B727D720922F3F51AACEB92E7D2922FEBD17FD76B686DBE356EEB36FDEFFCE9CF96F67B6BBEEEAF3DF98CAF9D3FEBF8A63AAC75595FCF6BFB26D747DEBAD69A2FF3ACCFB9B4CC4D99AF73BCB57F4FFBBD3557DF1FB6E633BE7EFECCE39BEA88D0924D3EF9E48FCD8FD4B1279B7CF2C91F9B0F009048CFB94795720BBEB3E4CBD9DBBFE5C5E593C52B2D796766F9EBD7972CA3DC2AE7D158E7E8AB57AFBA95352F3D57C8CFFF92B7318FCFE6AFE9EC8BE54DB94787F1F7B61CEBAFEFA7FEBF12A32E9FC9DF9CBBB2041D5E54A97D3D1F5E785F177DDF37CA33FC8D71DCFCCF5F5FEBFC7DEBF099FDB5DCBD2A3E9EAFD1D7B378BE465FBFDA8EBF5DF8D9AFDACE759DA39F7DF6D990F276FED7DE2BC7EFA9A7F37711C57738B7BDF698ED8E9E8B996B6DD4DFBF2F2F16AB44DBE6E5DE33ABBBA9D41E3BDEDF51EE3E95B58E9EACEF01123DDEFFBAEEFAFEEE99B3C56373F7C22DC746FDAD75F851FC5D9D5DFBA6D5E123FC2DDD0FEB7BE7C83D747A5DFAFB8B3FFF23548EF4F7CA61EDAFEDD254FE6A72FEB65C87EF99E46E2A2D0E7BFEB63EBF8A5E7F3D676B5D3E9BBF89B0C35BEEDA5F1C7E42BBDBEAB0E56F2B257F6B9D8DB87CB6FB678B2B8F97A2BF2B2DF5EE7EFFDBE39888BF8FEEB0E76E8BC347F9DBCB5DEDF099FD0DDD4BFB2C97FCF3AAE83EF681823DFB68A2FE3EAAC325776B1DCEF9EB7DD7436F4B3FB7FADB728F7D267FB39FB7CA3DBF8A7BA11D6D72D60D578ED63AABC1611FAF0F5A1D2EF96BA1B7E7FD5D275ADDB3A9A8CBA9FD3D89FA9B7336E4ED12F6D7BAC6365F7737E182DCB65A70784BE9DC5B1C3EDA5FD74F45C4E3D4FE447A3E65FD3B6ECFE757216723EEFAFF7E54E367D5FEDB7EEEBBBF0487B794CEB9D6E1D6FB67E970D4DFA8BB518753FB8FF2377CBD8DB8BB6C3E47D9EB9ED8CC69F1CF0CAFCCC1E12DA573AD7178FCF3AB277AFB2BDB9F18E56FD5BD72D05FC3DDDE5CDD0F770FAFC8C4E17AA20EF7F4D7FFFCE44AE6BDAD43FE3DF1DBF6276EE16FF6F3CD86B7E9BEF991FC5DC1DF7A3C87E53EC77CFE593F1331DECF6EE4DDDE735F67BC6DFF487F9BAFBD99CF4C1EE0EE55B78F0CAFD91F7FEB29F5CFADFCDD3C4F76FC951E97FCED41ADBF2187F3DF1D7C187F57F0B79E5CDF1CE16FC9CD8DC3A5D785C333F9EB7CEFB766CED63EE3AAF257F66B78FF86EF1944FC7D94EF2FECE588EFDF15BD8CFAABF63BA2FD117F4B0E177EEF46748EB6DC73877D94FBD51CD3EA19FEF661F4FCB7D6F4567FAF32C435525FF37BDC37C8F527EAB0F6F86A7B9E96D7C3C7947CB45E8F1EC3F7F76FCBD31CFDC19B62FDDDFA73AFBF2BF59F7756C71FE8EF4A8DC315DE5E77C9D6C9D2FD72F818731D2DDC2F478EC1DFDBA2BD6C71B4E4AF5777ABBBCFC71FE8EFCA206FB7DDD2F03E377ACC220887678EE1F7D7DD9623EE9F4B6DA8F5F6F9B86519DA76EDAFA4B3B3D382BF3DC87FC621C22FBFF5ED65448932A2579655F1401951374099E8F777CADC9BBF517771188EA7F5F7BD6D59EF513E7DEFBD616584BF3FFEDB8B652DDEEBB5EEE2301CC7D64BEB3381EBB688C3CF077C7EE95A56775FFFE4FBCB551D3BDD4DDEE6FCCD3AFAB6421C861B10FBDCFFD60FDFE151FEAEEE1EED6FC85D1C869B90BFDE96D85E8F9F88F8EB7E6F28E8EF553D8DFEEE72B7D25F1C86FED45F77B75336EE6FED7BEB1EFEE6EE8B73FE86DFE306DDC561E8CB7E773D872D7F5BBF9FDBE2AF3CCBDCF5B5F9BABBB38C184D78348EF3D7AB6BBDFF7EE7DD0FDE147DFF6E39DCE2EF8AF434720CFEC2B9D9F7BE57A3DF073F5370B7F4CC5B3BACFD5D29B998DBCF3B0E7FE1DCF4BBF69AAE65B625D66BAEF677DD96CB6DF5B7E6F5373FD7F8F8F640FC858388FB5BBBDFD9FDF57A4405E02F9C9898BF2D9E1F7DFFBCB26D8BFD9AD71B9BF7C6F80BA726FE1C38FDBDD5DF91CFAF12117FAD5ED0CFA6AB5DDC568CBF7000F9E757D67D708EDCF3AB91FF7E24D9E3EF26037FE1F4D82E79DB7294FEFD68D4E73724DB365D6F8FF60AFEC21CD4BDB7EDE16FEFCF4F26D275D4F257B627D22B610FFDCEC05F3888F873ACA8BB2B117FB3C5C1F2D77B0FABCF34EA70DA6794BFFBC70C2011FB1C87E7EF9EEF2FB4F89B32533DD6E797AFDB5D8F3CAEB7BF7B460AC026F65C693B4DF5BDEF354D0E573AE77EF7A0D1616BFF5EFED6B403A08EEDFBD03DDFDF4F54F95BE9DA4AF6BB7F150E97F60B3B8CBB7033EA9E0D97DC4D142EE34DD7C912B9EF2B78ED2B9E47A3BF3DCF0BA04C1F6F25B77037F29DA3DABAB3EF8771174EC57E6F6F45E977D1ED0177E12C8CFAFDAEE4934F3EF9E4934FFEB60CFFFDCCE4934FFEB8FC44EBE72B9CB266AF9F8F229F7CF2E7CB4F9F6F249F7CF2BFC9FFF02F75E56CED279FFC47CEC75FF2C99F371F7FC9EF397F8EC86FACB3AAFD0D0E74CF57DBEE72FE907FDB7CFC1D971FF137D23FC13EBCCBF9497EDBFC1C998FBFF84BFE1CF9A3FD7D84FEC15FF2C93F67FE3DF8DBE91EAE2ABFE7FA1FC90F9CE34DC6B7F6FE3073CE53B4FFA87C630EE02FFEDE7CFEE32FFEE22FFEDEDA2FFCEDE717F9E43F6A3EFE924F3EF93DF31DC8279FFC79F39F33C9279FFC61F9EBEF0668AA6389FFBE37F2C9277F5CFE731D83B2C9279FFCB1F9CF750468C9269F7CF2C7E647EAD8934D3EF9E48FCD070048ACBF7FCF2AB7CAA9E593AF96C52AB7CA013812FCED9B037024A33CBBA5BF67C8023802FC1D9305700467F2B7E5195F6FDFF01766E25EFCAD6BDDED7201EE15FE8D0D605EF017605EF017605EF017605EF017E0FC943E23CE67C701CE0BFE02DC1F780A302FF80B302FF80B302FF80B302FF80B5007DF5F383617A027F7E22FDF1F8447E44CFEB6C0F7F7E191C1DF31590047C0EFAFEB9B037024F8DB370740F27F15172642]]>
          </BitmapFile>
        </BitmapFromFile>
      </Producers>
    </Bitmap>
    <Material Name="mat_Painted" Comment="For enemies" Shading="1" Light="0" Blend="1">
      <Textures>
        <MaterialTexture Name="matTex_Painted" Texture="bmp_Stickers" TextureScale="0.1 0.1 1" TextureX="0.1" TextureY="0.1" TextureWrapMode="2" TexCoords="1" Origin="0 0 0"/>
      </Textures>
    </Material>
    <Constant Name="SwatchWhite"/>
    <Constant Name="SwatchEneBody" Value="5.5"/>
    <Constant Name="SwatchEneBulletBody" Value="3.5"/>
    <Constant Name="SwatchPlayerBulletBody" Value="8"/>
    <Mesh Name="mesh_Bullet">
      <Producers>
        <MeshBox Scale="1 1 0.25" XCount="1"/>
        <MeshExpression Comment="Color green" HasTexCoords="255">
          <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.Y > 0-0.2)
   {V.X *= 0.5;}

if (V.X==0 && V.Y<0)
   {V.Y+=0.1;}

if (abs(V.X) > 0.1)
   {V.Y -= 0.7;}

V *= 0.9;
V.Y -= 0.1;

TexCoord.X = SwatchEneBulletBody;]]>
          </Expression>
        </MeshExpression>
        <MeshBox XCount="1"/>
        <MeshExpression Comment="Color white" HasTexCoords="255">
          <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 (abs(V.X) > 0.1) V.Y = sin(V.X*Pi*2);
V.Y -=0.5;

V *= 0.5;
//V.Z += 0.2;

TexCoord.X = SwatchWhite;]]>
          </Expression>
        </MeshExpression>
        <MeshCombine/>
        <MeshTransform Scale="0.8 0.8 1" Position="0 0.1 0"/>
        <MeshNoise NoiseSpeed="0.5 0.5 0.5" NoiseScale="1 1 1"/>
      </Producers>
    </Mesh>
    <Model Name="Model1">
      <OnRender>
        <UseMaterial Name="useMat_Enemy" Material="mat_Painted"/>
        <RenderTransformGroup Name="transf_EneBody" Scale="0.85 0.85 0.85">
          <Children>
            <ZExpression Comment="Swatch row 0">
              <Expression>
<![CDATA[// Update the texture matrix
TextureMatrix[0,0] = 0.1;
TextureMatrix[1,1] = 0.1;

TextureMatrix[3,0] = 0.1;
TextureMatrix[3,1] = 0;]]>
              </Expression>
            </ZExpression>
            <ZExpression Comment="Upload" Expression="setMatrix(2, TextureMatrix);"/>
            <RenderMesh Mesh="mesh_Bullet"/>
          </Children>
        </RenderTransformGroup>
      </OnRender>
    </Model>
  </Content>
</ZApplication>
and on my old computer, my laptop and other computers this was tested on the model is white (middle) and green (outer parts). On my new computer, the middle white part is red. So instead of white and green, it becomes red and green. I can't see why, any ideas?
Post Reply