Problem with scaling a square to fit the full screen resolution

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 762
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Problem with scaling a square to fit the full screen resolution

Post by Ats »

Hi, I've been having this weird problem on some screens where the background isn't properly fitting the screen size.
So I made a strip down example in order to test that.

Here's what I'm doing to scale the background square:

Code: Select all

BackgroundMeshSize.Scale.X = App.ScreenWidth * ScreenScale;
BackgroundMeshSize.Scale.Y = App.ScreenHeight * ScreenScale;
@RefreshContent(Component:Mesh_Screen);
And here's the weird part where this "ScreenScale" isn't the same for each screen resolution, even if the ratio is the same.

Code: Select all

// LG screen (1920x1080 16:9)
ScreenScale = 0.003834;

// Retroid Pocket 3+ (1334x750 16:9)
ScreenScale = 0.005496;

// Surface Go (1536x1024 3:2)
ScreenScale = 0.004043;

// Pixel 3a (2220x1080 18.5:9)
ScreenScale = 0.003834;
I named it ScreenScale, but I really have no idea what is it, and why this number isn't constant, since it's the ScreenWidth and Height that are changing.

Here's the full test:
Click left/right side of the screen to change the ScreenScale, or press left/right keys.
The numbers are the resolution of the screen, the scale applied to the background square, and the ScreenScale.

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGE Screen Ratio" ClearColor="1 0 0 1" FullScreen="255" ScreenMode="0" MouseVisible="255" FileVersion="2" AndroidPackageName="com.txori.screenratio">
  <OnLoaded>
    <ZExpression>
      <Expression>
<![CDATA[
// LG screen (1920x1080 16:9)
ScreenScale = 0.003834;

// Retroid Pocket 3+ (1334x750 16:9)
ScreenScale = 0.005496;

// Surface Go (1536x1024 3:2)
ScreenScale = 0.004043;

// Pixel 3a (2220x1080 18.5:9)
ScreenScale = 0.003834;]]>
      </Expression>
    </ZExpression>
  </OnLoaded>
  <OnUpdate>
    <KeyPress Comment="Left" CharCode="37" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="ScreenScale -= 0.000001;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Right" CharCode="39" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="ScreenScale += 0.000001;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Mouse click" Keys="{">
      <OnPressed>
        <ZExpression>
          <Expression>
<![CDATA[// Click left
if (App.MousePosition.X < -0.2) ScreenScale -= 0.000001;

// Click right
if (App.MousePosition.X > 0.2) ScreenScale += 0.000001;]]>
          </Expression>
        </ZExpression>
      </OnPressed>
    </KeyPress>
    <ZExpression>
      <Expression>
<![CDATA[BackgroundMeshSize.Scale.X = App.ScreenWidth * ScreenScale;
BackgroundMeshSize.Scale.Y = App.ScreenHeight * ScreenScale;
@RefreshContent(Component:Mesh_Screen);]]>
      </Expression>
    </ZExpression>
  </OnUpdate>
  <OnRender>
    <UseMaterial Material="ScreenMaterial"/>
    <RenderMesh Mesh="Mesh_Screen"/>
    <UseMaterial Material="FontMaterial"/>
    <RenderText Comment="resolution" Y="0.4" Scale="0.8" TextExpression="intToStr(App.ScreenWidth) + &quot;x&quot; + intToStr(App.ScreenHeight);"/>
    <RenderText Comment="mesh scale" Scale="0.8" TextExpression="intToStr(100*BackgroundMeshSize.Scale.X) + &quot;x&quot; + intToStr(100*BackgroundMeshSize.Scale.Y);"/>
    <RenderText Comment="screen scale" Y="-0.4" Scale="0.8" TextExpression="intToStr(ScreenScale*1000000);"/>
  </OnRender>
  <Content>
    <Mesh Name="Mesh_Screen">
      <Producers>
        <MeshBox Name="BackgroundMeshSize" Scale="5.9634 1.5839 1" Grid2DOnly="255"/>
      </Producers>
    </Mesh>
    <Font Name="Font" Bitmap="FontBitmap" FirstChar="32" CharPixelWidth="32" CharPixelHeight="32"/>
    <Bitmap Name="FontBitmap" Width="512" Height="256">
      <Producers>
        <BitmapFromFile Comment="Imported from ExportedFont.bmp" DataWidth="512" DataHeight="256">
          <BitmapFile>
<![CDATA[789CED9D3D76DCBA1284B95C2DC24BB82BD0069C2BBFB153A70A152ABBA1B379FDD4C7754A0D92E210DD2431AA2FF0D18C6400C44FA1D100D1D32484104208218410420821841042082184104208218410420821841042082184A8E5E7CF9FAFAFAFFFFDF7DFED2FEFEFEFBF7EFD7A7A7A3ABB68F7F1F2F2F2F6F6E68FF0E7CF1F7BA87FFEF9C77F65CF885FE1B7F6E5B90536AC84B755F008E9D9E5A62C84189125E53191FCF1E3474A16A6CC36A7A424B584A53FFB1436912DFDEA0A1A28FD17429C88AB81D9FF66219B5AB29D9C22DA48D07EE84F6D96158567ECCFDEFE72110DB44596CDB328E15B43D614EC48FF85108C697E1019FB062AD19FBE250E89FBFDFB777F82819F3F7FA2B448DF74953D5A46EBED797E7EBE828F8B35F9DF7FFF3D2C2FE9BF102260B2C0E6744A9A2CD1E95EF7D7D7D7D9D272A6F637B999E662B27F8C2C4BFFC50EAC7FBA3565FFA69B28ED9A97A94E7F0BFD651882B0497A4BF5D8F09A22D7A7013B3F9496B5CE7EF5EF028925E901B398AD95EA5625D27F712F6C47559870B755AAD3DF427F192ECEF3F373F096DC3EBCE5B9428D942DAF8A64DBD96AACC64513D4ED95F358B6462FCA453C12C1269C1D683D540FCF2D22308A4454D0CEEFA63FE95E1AD8FF89C78A9C2DF6FF108D5BBD5132515DB5D525C42CD5FA2FCE85BDFD263B15CE8752FF3FF7CFA54C839CC2DF9EBB12E9A7B4A2AA17F2E22191FE9F8EEB159CD5DE22EEBF758BD1BFDF67D0CE36ABCD022F2F2F1965FF64D6DA2A20254DC6CAD9EA7C38FF13161D98F28ACCEC1EAC48B365EE870F9A5E73FA13174466C3E92CE9FFF3F333B7C83EFDE7F333BEDF0D794C7111BFD59FFF6F372F5A4CFD4C5A6D02E23FCE15D87DB4E70D2AF4998F18F1CF59B37C11D53335DC92757BEE68507F84DC270AE52F7A9CD2F33FE24B96F4DF6D456B14DF31DCA7FF6C9F07B214BBFAFDDF9547B04A5BFAD545CC98D9B281AC5C5009DEA66F74514656161540D08A8C0718B775B2161E21F78942F90F781C713C4BFAEFF7D8B803C466FCDD8A61FFD7A692B03938DC1540563F30AEEC59EC8960DEAFFCEA740ED07F3E7CEB6EC3235F3AEBC19A297D2A9C4DBFCE15161E21F78942F90F781C713CB3FAEF83DA667C577EB8C1CF2DAAB81A300C82CDC94B802B4FF4304B8AA6EC303356101E21F78942F90F781C7130B3FAEFBDC8BF79FF40FA2F5AB0A11C3481970017DC0707D8AD28F2D7611EAC389CE0C036F347081F3B09E53FE07144C01B145B69789DAABF09FC42366CBEBC7DBEA20DD71AF01998DD79B1FF47EBC7E3A9A87FF636B40E67DE6BBEF212A07492C2FC58BA45151E21F18942F98F791CC1F828B375747B8542E714307BF8165FB2FDD0A9FF7CFF40E97013B314D53FF79FD62110AEC8E8CF4E88EF49106A1BBC58B79E5DB4AF81CD108EA85D7967F09150FD0B313A70CBC3D0F2717DF18D18BC44C06A831323BA25A61AD5BF1042883A6C1EF9F3815B23F8A8F94508211E9BE062C2C78B4746104208D109BC4C6EF0878F420821841042082184104208218410E22E702DA75F427EE557AD85104224C201176E97BF704F0821441641FF6FBA9C4D0821CE0697631F73D54688C2D34F28FFC18F23841043E39A7C4C1CB48A58A8A1FC473E8E10420CCDEC6DBAD57925EA7F28FF918F238410CCCBCB0BDF85FBFEFE7EF18BC4E19C3FE02A8C0AFD0FE54F7F9CA7A7278F4CC165DEFEE576503945CE2B0E8457917E35567E5FDC2D552F877E08EFF5AFFCCA92E59832B7BF11722F7E6DE92C66F358B75F0AF8DE72BA9BB4DD19BC6639B7F0E3C70F0E61C35CB92FE12A8C0364A142FF43F9D31F87BB28425C6DFF723BB8F3B6AEB77BFAE306B7420DB7D7B6E0D27880BF59F9D5B41A7F3CDD72B392ECE818DB135F7996594ED7D587D17F13FF9569F7CAFACF21D2AACB59A1FFA1FCE98F7398FEE3BFD7F5769788A1431D2116247F89174CEC01318D7A00B8955F3987294F45E7073BC4BFB4A76D84ADB52B97F34B78FD68A545647393209382A2D0EDC3513A048AC0B28ECB3CFB65A7FF07FA5F67227AFD0F7DF876365C08A207FA8C8F65F8FAAF9CDBC774C083D4FE12B65CD65A090E284B395D0DD8F0B00263756319E1F16F57B54297E2B30F04DB9CD79FAA4E6444FD3F0C8CE2DC51E031794D072C7DAF7FFBD77EB66FEC871177C9FD29F82D42F4ABF0D16A123FFB1FF3AFFC8F676B9B15B5BFC05883DC6A8E2560B66ADFACE407B9ACBA62521EF4D85E6E6F7960A4FF2B98095A314ED75DAC239A2B30B7E09FDFA2FFEDAF56B2E0E57C56696F352B2F0E62DEA63F84FE73158D1590852BBFE5ECD25D0EE9FF0AE84BE9FA6F66D5DB07709EFB47FB7E08FD7F7E7E867F3BC46FF2BAEAB1FF03FC5F6E9F770AF601E3B668DB9D15BEDD161F42FFA7EEBDB3B390FEDF85F47F8522FD67BCFE2F7E2039D00E31D3E4701634A8FAACFFDFB5B1F5FF7346ACFC596DC127432AECFF75855F5FFD5D6A4640E5576C9194824E25595B47FABF0284AE2E0B17A27E9BF64860F99B78E2E7970FFCE79F3F7FE2E7F690CFCAAF18DE27850A65C963A9FFFF61F41F73FA405D74DDFE97CA017FC58637AADC0531E2FE631107E83F2ABF2E8B74BCCCEE3CC1E11FF712BBDDE59B9EEDAB3710B7955F39E1F064855B0C534FBA71FB30FA3F7D3E0E3A846752FABF9176653D502B1F86D7495DFADE0A036DB1617C6128F147FCD67A914D01B0E1C34BBE2BBF9A3E1BE7A51B22458BDFC7F0FF83118F8362722F1DBC436363905B56FA0FFC7CA6550EBFFF651FB316477CFE13EF7F8D72FE735DFF27F2DBEC8E28C19E9F6AB773C5FBBF6C330F7AFE2750BD639E0E37C1409BD7C723FF7FCBCA0A3D65721CFAFC67D07F5C6184FED37E732FE893A3F89C5B463FFF1F18F13828BB10790AB067B9F8103B12DEE23FBB2C5781CF6742CA120F670E7DFE13F23EEBFF773ADF9BE3C53B46AE2565DF8F627FF2230CF7FEEF2C3C6D5D7C89EAACDFFF33D671A63AB8A35A75F9A47976A1AE02CC9EBA2C5C0D2EAEF9017803F8FC4FD084D94B8136B2BE8537CA727ED0FB7FD62B1F423144B8D895FB3FC73A715D071FF10243CCEF0700E3B6CE4E2BBAFF6DF64E1ECCF5EDA6E4BEC441EBA8C11EEE3E41E32DE02FF3BA2C23DEFFB945FF4B47443AEDFDFF361064FF035F93F2415FE9BF83356F5D8578FA156E0DA8BD9B3A7C50BF3F71BCFF6BDD66C994C2A540FBB23085B19479E7D17AE9703D73B8FBFF1F4FFF85D807CE470D1AFF05AE66E88F96BD4208F14D60FFE7289BA742082184E6AF7351FD0B214E41FEAB7351FD0B214E019B2F61FFFAF41DD26F82EA5F08710AA5E757C597A8FE85104208218410420821C465E157D88EDCAD18F1663F21EE82AFD57A7D7D553F175743FA2F4411EDFD003A13B8825F82A1CBD58F44FA2F4411B3F7C38C722767806F062BCAA242FFBDC01E332831D98741FA2F44353F7EFCC099F0118347F0CDE723EABF165F4B48FF8538001E68C3DDCCC921BAEAFC3315FAEF7182C69D79AB91FE0B710C58020C742DBF83A15AFA365391FF9F4330E4A65CCDD2FDD289421DCC12DC55EEBD34ABB939593F0891A5FFD5F397DF49CE373B794C84DC983E5C3F66A5588EB9E987B005388B028F6ECA14CC5DB43F35862F7F0E89AFFCEA4BB81386CEC3BF6AE392EF837B514A4C8D2FEF9FCFB2AC8A9A3550B7FF7B4CF9D33958FF39DA26E85FABCEC627C28D199DBDB45AFF974696696956589CD9564E5C132DF5226E97FEEC5E5E5E38F1DC5DCED085B8B421C0D6BDDD95C34E61CEE510DE59B67A6885943945FABF9163CA9F0EDA17EDE81F8BF47F891E5B3498671EBC3BB1971EA3FF5E6C1BB321385A4A163C1522AC70A2FE87C87A6DFDA7641772C9757104CB64F6A215E7DE3D3E967A280F5751D62CCFAD7C4BF2458780A46F0D5985471629A92D21FD0F1CAFFF309FB8BBF6D8723C3CB9D8BC16BEB2FEB7E12FF98952B280DA14DD198ED272FAC15CEFD47FA8E89F0F729573A2FDC756227CDEE9395DC3AE9E970F2A7A14D2C4B3A4EC021FB37F97DBE19790FE070ED67FB3B2F8573CE876A70F710B0333CBF970F0FEB565C7866E4A9AA8A28A9EBF523FFC209DFA0F6BE1F503FF39EBB81D3C3C367F61F2C56FFDA37D8FEEBAE35978FAE0E0CE29E59F688AB134D1DC61B8F527DEDF8EB3B029989E387380FE8F7504F460FD0FC92E49F75D2C4D229CEF10FA6F1356F09C6475D4B3F43F5137D0CA6C3F671DB783E65BFD20712F30A6066E9D1DAE75F60281C4F50B56BBA63FBCBEC8DAE5E7E0238927074287AFB6AFEAF49FBB7A5116155C44FF6F1DF3FE529D0FA4FF2632ECAD72CC90CBD287D1F59F97724F1FE0638A8B03956F05C6E3F8B3606AB0B6601B7B472E611F21EBCCCFF47987DACAC9F593D863514B89CB16F64C1E7048BBF4FE072B3FAA28318BB0A0B0F6B56F9091CDCB3D2A7111FDEF31E496EABC42FF2B1677EDE1251B5FB9EFEF8CAEFF7CB2D7BF8139DAAF45AC967E1AD9D71A5E579EB5F74F96D91D36306FA4DE52F762DAFD1DD44F622E7CD75CD64008F67FF56B6B75FA1F46716216B7BF6E49967DA6473C0FD6FFD06D72FDFFB7CF8B085E0567E97FE2994CC04E72AB9FDC63F9CED0FACF9E13E8030FB7CE16E17EE2DF403CA7BFC301F30EFEF2DE130BB3279F53FCF33C7F614D917BF21670B2895A2DFFFF0AC16C706C22B08CACB97D46D89DF8F1E77F9051D6FB2F9C0E2ADF72E17ACBD2FFDBC71460A57DFE2045AB9132774B4B39F17CFBD0FA0F7108764E962DDA560E6604786CA07590F1BBA49B170EBF3EC0C7FEF71F3935EE90EDA048819B23D1164269B3129C65C4F33FFE66A527EEB21FAABDA77D4F39FF6F4F1126B5C4F3FFB364E97F38829E6259B165E867AA914BBF38F8AE65B85C25F7E476B5FE2FE9FCD2BC702F282126DCB647A17FB68B85BB1E01454DBC3166E93411F7AB9EF4DB33FF4836D1B99452D42F1951FF4B3958FFC3169853F4FE6FFAFD0F7EF28167AE942530BB5503FD1D351C4B60B2DC02A5FACF2D1B664336AA773744D839C5F7EC6865956B370BBE847518FF85F3EDF10271FD84056396AF66A9FF38BB935DCA252BC159A4FF8123F5DFC7917DE4CDBB8AFB7F902C1A2545FF314ECDF274C5CEAA255395B0B9E3EF02A7F897AC90B3F3CB10FA8F369D3535FB4FA42C2D22D8231DD61D7CD2F2CBF459E783ECCCCE0BF7327BB9044879D1A0ED39CCEE649772C94A7016E97FE000FD17A70353709463C9E2BBD13F156E41F77F06A4FFDF043ED328C4D5D0FDFFA720FDFF265883BA4FE9EC82083183E27F9D82F45F08710514FFF778A4FF42886F42E9FD0F2322FD174288EFC901F1BF8410425C10E9BF104208218410420821841042082184104208218410428871E1374FF13AE7AF5FBF0E88487B71BC36D203920A21C4E93C3D3DCDC654E589E0EC329E0957852E8F12423C127CFFBF87F5349BDF960308F170CB08313F2E6136AC084E2D8410A700916FAF9DE7586FA597D25F1C0EE29318935A0821CE05CE9F59573F2E25FECEAFC3AFC477134288718171FBFEFECEF17FA78FA04E981DBEB3EE49FFC5C5E198C2B666B79FDD9CB3E5EA8A75B73D71F603CF061AEE278400E6A748818B8D94F14D4A463F7FFEE45334FE0829E74638D9FED4024BF191999EA7288D8FBC9E7E0A27A6CFF5B33BB4CA89E547BF0DA708EE6AF7EAFE03C2F8B59F8770F72D5D61678F93A26F9C7E8852848C3A1F01F1790359874F66D3CFED3C1C883CD09F78A9FE4F4DF0A940E7FEAFF47F5FFAFC7D4F1348FFB7B0347EAF7FF8814B6E3FDB58E6889CFD95B334BF303DE722789F3190A2FF963EA76979B56D9DD8796C09F3F69794C4A762FD0FEDFBF699FEC95DFABF2F7D0EAADB33BEA4FF5FB262BCDD2E3F052C9593CF7527EA3F040147073BFB151B9FBCC87D7E7E4EE9AEB3E98773EF3DF5C38B8B76916E4FD17F68B054FF7FFCF8B154F814A4FF3BD2873BF7D67DF84AFABFCED2F8657DBBF2DB7F2864D07F38FF3BF58DEBDFBAE56CD63D867AB57303E99B1DC5DF67D50FD2B709A5BBB05F64515445F6F861099618CE55FABF3D7DEB42361D73CFEC7FE94CFABF0E4FB5E157F83EE8DEA5E079CACAE9AFF04C9FEB2D4BFF97DAB747FAA03C45AF9A2EA59F553F5847D80FFF2ED0F908D5FACF5D88B1AA0B87827620FDDF9EBED7397E4EF13C48FFD7C1F86DF5E700D32E8575FF554FE54CDBDAF7D6A14B48A148FF97D2CFD2FFF59AEFAC1CA7FAFC0F1237CBD3AAC24C88C44959FABF3D7D262C5753D297FEB7208515FDAF1877B9D898352BAEDDF9EDAC9CA9DEFE5F997F53584A3FDDFE5FA1F3114AFB218C87B0F9821C3BF72FC2F931FE95F43FA4CF0BB1ACED982BE87F98CB76EB7F45FF7900FB7F161EC259FA1FFA24BE1FC2FF1FD2CFF2FFC37F183A093A677FE729ADA2D9C19B353986A4824343FA1FD2B731CBC71552B61D8F2CFFCA1114B62276EB7F45FF19DDFFEF58CF09AE5AB625B2CE8F713D679DFF611DE6F9C53A7FBFF3795A788926EC78669DFFE17466EDEA7D3C8CFDCF5D259CFB4D497F74FDF7F4734F9E1CECBFC23B53E1A51B361197E685BBD20F47F876977FF4F33F8E0F25FBD78F6DF38E40A75FA5F54F5AB5072F53A7442CB9505296C0E1FCFF2C9D262E97DFCA6CA32CF17069F0E979FB26DE453CEBFFE74DED5CFD77C28ED5A0EF37D5A59F283EC7EF5F58775D1AD1E1FB2D4BE3EAFE330D7EFE7FFA6C42B76DD169452FF92741FFE468255C7A05AC336567F6FD5F7E964EFD5F297F67E5B03833B97B255F9E1FE859FF72FFB18EDA565467177D48FD9F3E374ACF2B0047967F76A079FBCE0E902DA3E3CBF46F19E377DCF77F1DDFFF6DDF05EE4F39F49F7FE8AEA1C4FB7FA60FAD0BCB96C4FB37DA6B8B96FC36BBE1F25B6FB7E6E84FD6AF456ABB65FA5E79B8FC2431BBA0FF36D6C25D5589F6C923E9FF445340CF147958F9BD93B03E98796FBDD7D78FDE93310BF849F5CEF453FA0F0851F0525E7E7F00AAFBCF59E4DEFF53CA40E7D05A1EB5FF6431FAFC251E9B47ED3F03E93F1735CBDA398C03FA8F656129D7596BA5E94BFFBF1BF0860D115CF551FBCF40FA1FF6777C3930C4E5B4537DFFE1FDFD8A3AA94E5FFAFFAD80DB7994770A1EB5FF0CA4FF13DD620146D9991A5DDF94BEC8825FEE186521FFA8FD672CFD0FDB67BEB37676A1367140FFF105915F9E365CFAD2FF6F42D60B534208218410420821841042082184104208218410420821841042082184104208218410428871E14B27FAC3C108211269E35B0D7439401B9FE8FA57A930B755CE2E5D021CC875A04B8784F82648FF4FE46D95B34BD74B08BBA67036425C0DE8FF7FFFFDF7EF070349A84746E080D70315FEE1E1708AA35C172FC4B722C4371C1484A893FEB7A072AA9BD82A3F44014EC977A5FC1C4577DF8DC44F4F4FBF7EFDE210877EB9714547AA6E08AB8DD7D757BEA5D93E262EBB381689E19155B3E06ED33625DF5EBB3DF40042B5DE167C8FEC40E88932EFB02F252BA6F36D033D1E9B83F51FED987B7FB8F47F8563F49FC75A4BCFE05A2ABFE90FB46E7738929532A75F715FDA10EDB40BB262B5F056BE611F53927538E536381116F8CEF664577A08F71FFBA1F701A4FF1B40856F0CBFBE11E9FF0A07E8FF8AF880DDB92F951FDFF71C2BAA1B592D750DF165FDA74C0141841343C8857302B7CF8B8BB0EEB8DDA31EBC420C4E485EF4A5C851BAFEB7D592DE4B8FD4FFBAE083D2FF15AAF59FAD149362FBE883D7FEB59F790B785F479D2D3F07A5EDD95CB87D68A3A58019C4BA10BB5076A7DC52D4105C15F62C9032FB21710BC6EA074D8CFAC93AD08595055266B7157403BFBD6BE9C17602A61596D67ECF8F93AEFFD367C75785B81DA9FF7011E4AE1C27E9FF2AD5FACF0ADFD63F74E3B67795DD969FD3EC1CBCB31D8667B49EC403450DC1766CF0C9B3E5DC992924DAD2491FC898A766FDC3FCA5FF70D77286FD3CE82D58CBA4787E9C0AFD9F6A8A0A0ED37FEE8AB93B4793F47F9552FDE73EBF24C5BC35B0A381DAF2432E8AA2D8B3A256249BDB10EB0A9FF52C90D0970F721509258459CE2D0B0164A3FDAEF479896489F04646A26214E97FA2B5D37298FEC3A6AAC848FABF022B006B458A739B4DE5A5A326EC83DD91E96CF98B9ADB12E4ECB2764E9D71F59F85F7C7072CA71D658F894FA4F6F022FA479F1176E78B7AE05D8C5C4704F7F3DCFD4D1E65B947A90FD37F547BC57B4045FA8FF566BB6041B74C3F2592CE8A7E9AFDD6D951B9672E553EDB45B9FA9FD86983F25774A771F51F0301663986737FFF67CF12E7E542015175D3174BBF7BA59BE7ACF02C59F0CC922EA729A71D5A8ED17FE452E1C29ACAF41F7DA6ED6C2B53C3D558D1CFDBE74DB11D9CABFF59A3B83DBC6AD592BEB81857FFDB8D57DEB1DD9DAC13241D82EF330B069ADBBDC877C7D22C9C5FCD3544D9F8AF483FE5B473CB31FA5F74EC1FD4F97F3CE5D0C90732FEA785FD5356BC9EA73852FF517E7F692BA5FC537378D28F30F524B8C4A0FACFCA06CB93CDE94EA1433ABE140D0E9FE00EDABD0530358644AE738F4F4170F913E167CFEAA2C7E83F2AA7C83F5FA7FFA81FAE704C0AD737FEA765D94931278EF4FF2F9DFFDFAD6CA16C75CAEF0CAAFF301582A041997B362567F59C35BFCDFACBFE360B6F01832C5F3A8F823A5FFD54701CF400FDAF3BF60F4AF77F3D71147E7646B832A5FAB9E5FC4F67A75D2A7FCA29CD2FAF08486450FDC77F0F5E505E82ED4B799ADB59E02FD1C4BCC4DBB1F5108E80B2F32AC58443E2DE04ECABEF4F3C80C74F91D303F41FB5512798A5FA8F2A727B63D6237465966427AB23F1CAB795D08AF3FF0E4BF7EEC223F15C6FC07A5E03E9FFACF3C7497101CD8AF9BA2F7D76CA58A77D052C28760FED69D24E87E73AB9C741ABF5BFF4D83FA83EFFE92E62EB6FC319FFD382ECB04DDED98BC2FBBFB6E64543DBB0AD78FFD7DF2C46B23DF3170F5EACD6AD95EDFBBAB7D407D2FFF5572DA0DEFB664F160756F8F6C207960E9E1DB648CAACFB91BFECD9BF587AC36EF6A5E32CB6385D3752ADFF185FE96F2E30D5FA1FDE40AF736455B07E7E26A5D2B6DCFFB3DBC0FEB2FC29F79FCCD2E9BF3DE0FEAEA952FF59DC66CF5BF203EE50B995C5059FA50CC3EDDE75C7D26D1E295E9A25DF26F7ABDDE713D63B270ADF33BF54DFFF5F7AECFFC8FBFFB9438E15CA645D3FB39EE580FB3F67E93F82D57A1B40A7536874FDE73DD3D9CD119E2076CC9510CF56815957DB2686A47FD9FA2BEF9E6FD9BA5A8767A2B6F257EEE5D8C816FD6F9FAB338B44CF0636F78BBCE547C6FF3A6017BB8859FD34654BBFE5BEBDFF3F259703CAEF25E70D91949BF347D7FF2DF76CE06F76CC952B2788D6FD334B4792025F5EF296753261F6BFB3B4EEF3AE8CAEFFD5C7FE0F8EFFE8DD55574C082184104208218410420821841042082184104208218410420821841042082184104208218410DF8ADBC7CD39AFAFAFBA73400821BE157CB3CD58774E0A2184E881F57F9468B3E2CA3C3F3FFFFEFD3BDCA8691FED4B8FBE2D84B80E7C43697A3461F17DF8E79F7F3884C12C03053513E29B80E1591A424B3C307C9BFAFBFBBB47F971CCECB78FD6B56C8179AFFEF355FF4B8B530E11B22F9CCA52FC174BEDD7AF5F898B62AB25AF07ACB82D6B0E67B98F95F805294EDD95F83829137A51D8CA16EB8A56FF21F297656A4F311B7D6623EBE5EF7FBAEAFAC1282B4A7FA5FC1C0068F7EC531D7F7036BE3CC775E5F18B9001DB2B733D7E3DC700EA6CA3A2F82908F16082B69ED4BD42C7DD6349CA78EAD9B7805DEF3FF650FD2A6A0FBE12C2B25345D7CB6F12D7E9797B0CFDAF5389D1F5FFACF46D50B02DD49F7E7ACB86F4B9B7B315C1B293AEFFAD2F7DDF53ACC74FEC09A0E355612DD863442D81122E9907FC5CFBB2F8B2FFDCF6C6D703EBF18B4BF5DFE999C21E40FFB7C48F96FE1F9C3EF7AB9EAD87E3F53FD8E4EC76C8D5FF3674ECBE36DAD2FFF7A58C107828BCD53687CFF3EFEDCF7C9AB8D71CFD52DEF1DBFEF523D7803531F7ABD9E8E41BE1A522AF266C4EB1AAB0DF76AE2F66CBEFBE8E945130BAFE70143FAF7FCCE69DF1191DE9FF8EF439746667BE87951F12C723DA418FCAD57FAC8F7AEA2AF47FFBE8A5B57FED67CE62873987AAF034B95941BBF4D8AE782BC1D377A71958599FF6543BE0456EC51269A37FF5DBEA0FF7F050FF3C34A4FF47A6CF8D92B5FF7598FEC3F903F5C3FA2551FF7996E97946AEEAB693F35A668717CE0B86FFE879B995E59BBFC8DD2A0D4B83BB0E1BB793604B8AFFB0AD5BAEFF7D89F3845814A57AA3FEDC1AF54B49BF9FD2F439FE785BFFD2FF53D2E76557BF0BF160FD87609AA04D7F25022EA02CFDE77EEB3E937DCFC8E96C71A1DF3B0ABCF05E2AE4C5DE1218F0FE258CEAED1E3FEE2D4BF448EB52FF49391ACD0A53F406C47AFFE72540E7FEF888FAB35EFFD2FF23D3F71EC88AB4EFC0DE52FAC7E83FCC72173488A71B5759FACF1E7B3F48B9EF19B9876F394273EF743CABFF219150725F3D6D77D7F30A851F814DEB94F37B4BF4F4D214855967BDFFF370DB676BADD44FCA13ADA4DF6F1CCED63F7FD9FF2C5FF69F95D6B92BFD07D0FF408A3BF460FD87327BE1837D9BA2FFEDB1D81DC93A5BF4A7472230FD4D9BF59FA78C8DC0E1C6B306EC735F88ED66A57FFEF9F3A7F3A548E97F4FFAD2FFE971F5BFE74CC56CFA07E83FDC17AC39FC4D8AFEF38EA1FBC92FABFF98AABC9C5EF220C8A1E43BF49F9F025FA2963A257A7DFC766EDA4AFF7BD297FE4F0FA4FF6639276EFBB6E95797FFF9F91972C79317BB807AF4DF9D1BEC8DEFD9560EFF71A587F748042644FF8FC8CEDADAAACB3D57BE6242C9FD0FEEF2D8F3511CF7E2B2F3A7E2FC40D8B9DE9D382FE54EF1FFF738F7B6A4DFCF61FEFFA2FB6DE4FFDF9E3E4B4D567687951F5216B4945D403DFACF7EFE5BF76B05E13FDE6AFCFF283F4EE02C6DD77AC991D7BDC735514B3E712097FE465FEA3F29A63B6F5E9C72FEA767737F4BFAFD94A6CFF5DFE9275C42FA7F57FA7CAC31C5057458F9A15DED694374B04EFDE7D78A79B4EED6FF2DE77F3ADF82C110C384E517DDF0B87BFBB8E866A29785EFCD25543E8CF3FECB194AF57FFAFCAAF8C1E7FF7966DFAD7EA3EB0FD77FC5142CFDBF377DF698D58DDF2C903E34ADED45F8157ED8A1FF5C2D6166DCADFFD3EAFB2F53F7F97F073A6353C092545A46583DED5B8973E574169899ED3F2B73F1BDB008F3FBBFEE2DF4D722D2CBCFAE4867B7F76974FD09EF24DA0845553C3D3D597358BE3D2E44E9FF8EF42105FD2F451E56FE95A1C4D6E9BD8569D36F65AD47FFC3FBBF7CE1A415BBF3FD5FC02AF7F671A722AE000DCB81DD3658EB594A31E7BEDCBFEBF71BACBFC2D0F9145BF61F53DE8F68C9BDFFA7256B44B72FEC273E88F47F47FAA6F929FB6B4BE92712FAE792CD195E53EDD1FF951755F63DE396FB7FFADFC5E0FD91593AEFD26C2F97A83E7F72CBBBB4615D824ACB5F773E6A14FD9F3E36E2575E242F7A7FFCCBDFF6A7DFCF59E9675D0174B0FE2F9952C1C6DBADFFB3FFB153FFA7AFEEFF4C0CFD609A6C5AC70F65F3BBA59F72177DB8BCBD3FC169417F70397F4A168ECD237CFF76E9FDFF5EE729E57F0CFD77AC422C4D9E08ECA375D7EF7CFFFF89E9B36B62F75EF0C1FABFE4470DD6E96EFD9F55837EFD9FCAEEFF17420821841042082184104208218410420821841042082184104208218410420821841042082184104208218410425C81101C560821C4F7C1AF5A4D89D324841062203878EED96511857828436F6BFB2125B2F36C2EB8BC3A25C1A59BE7999EFBB19F9F9F7FFFFEDD8678B0FAE9BCF67F0564D4BFEE6EA339982D9715CD81797979E1C8089645E2B5E43BA2F2DD8547B8432EB955C4D10AFCC2F6DDA13C5BAC13FAB02DAA190CD8C40823E25E3C368D357445FC7174A14056E42C6638FD5F4FB9C8284AD4FF95E02C59DD89034307B2C2B573B7498F76B112F32E455497524EB11FB86672A31D391C15253D71B105EBF0B91D32B0D2FFB342748174FD5F890998A2185F269E68CBB59996EAFF2DC9AFBB1E3334658AC446E42D6F4E71429CBBB70FD81CEACFEEF661F687B0655EF9FD5340B5FEDBE48EF44F89337571BFD301C52BD57F9EDFD1D5391466EE03A6EBFF44FAD31F01B9C52ADC6A208C538E05DC93A9A5FC364750A41E5F9C35A5D5398F5C7B168E25DA291AF6DFDBFE93181C1C709F4CF4BC2DE93C6797959763CD91E8CEB2AA2EF5FF9C8535312AEAECB2ACE1F3B815B5CE1B3C55FA7FD0CF8329882E9AEBF7ABD0FFE9F31450DA10804DC4DD89706DAC5031B4B32408351FD2E17921A5452A96002BC62D1B5DE976EFE946F595F128B7DCFFCF2ED11A5CCE1143F142C7C2F885159A7BF4AB48FF2712A28A6D8B16B6D2772772A2FE67B52F0A195C5515FAB964ABF480428675505D4775F02CB9EEACA1B1E570F025DAC74EFFC396F175B5321FC9D2F82DEAFFA5C38AA780D289988DDB1E71369BD6EDF0E024596A944430EF773ACD50D4E0A4B221805F65B5052F01B26A06AE3C6B080C5BF6EFA51C84B344D8D0B20A41FDA46FB10D07BB7AD016362DA65871ABC29F264456542B70788444A750FA506A537E00FD9F3EEF4526CEC2D6BEEE990F737DBF470E3AC03A93AE725CC8E0FFEFF1EFB1911FE65CAEA8AEA27F06254F5C027051ED671EC529C6F9ECFE384F31FD598C4B70F5A41BCFFF6E2031BB763990D285603CA49F3659929A41F57FFA3CDCB21C412C7490CDAC8E0A4D837E2E35CA0EACC3AC1F91EAB428426ABE619DDEFF013744A25004FBD31F2465AC057D0B878B9C6376ACAE496257BC0E412EFA13846C5A2FCD9D0296A4665CFD9F680AC85A5CB7FAEFEBBB94C4A7BFBBB128ED52A3EC80FD302DFDE92329366841D189ACDCC69D680ACEAD9C89EA87AB224CCA3DBA677387F7F6A2F33FD5E9BFBCBC84D3B6B9B3C0C1F67FD8BCB647CB3A94CB5D34F1E5DCA5DE9E2BD468D363F4BFC84A746CF0627EC9326E710AD75B365182B82A2ADECFC5E0B57AB604D14BEDFBA2CD0B7EA2145B88172C567E1EBF9DEDBBD20F79BAECB1FFABCFFF57A7EF58E5F02CE087AE5352BE6D2025233FCB8D34ED71D29587DB224B79BE3CFFD36F657957F7021FA3FF53D9F955873722B3CC15F60221F15CFDAFF0339C728E059DB3DF28E5F75F306079D1D433C5AC1C82CA1A088FA1FF4E9805528CE7DB063AB3084B980AE507DC33539CDB4B1B6AD0CFCE71CD479DCDFEACD8F6B211DA5678F58D31788A742F105B11FD89571F3567893BE0D8AD93380AA06FC15585B5526713A09C41CAD0CA9D2EB2EAF7BF8E7FBF2CCC0217BF7A94FD78A5CA0F967AD43E7828CDBEFFDBBFC4B62C66B720BBCBFE7FF0AAA9F54F1475F6A5D4DDF8C91FAE07AE9F44FD6F7719725DD045FB6BFC2A41DD81D50024A2B37D79678DBF478FED7C229493CF4771FFA936AA07856781B3CBB246B5F29B79603D042B779688AC9E337BF99B9335E9C38A48D7FF95C2A788DE97AF68E51ABD61173557FF8BDA176F3100FB88B3B23D29B713E22C3D7EAD7084D5E7FAACCDD9E9B37FA9A5627FFC91F0E3946797628DD2B7BDD88ECDEDF60CDFD6C298B4E67A8CC3C9C0A26499FEA609E7F70215E62ECF6843E8FFF431052CB5424FB21BF5BF6E8ACF7AF96B3671938EC33C66624456C4275D79F81545EB99450BF9A2D75EFCD815AFB5130F9299B8852BF42DA3BABB3E72F77FA7D5F931D7A9EBADC0EF5F743A6F8FD1FFA9E93FF6436EFC023F19052BCB17F559898B07268CA9F4C81A420821841042082184104208218410420821841042082184104208218410420821841042082184104208712EB8C23431A6A4E3770A59E2DF39C8AF10425C165C91977EB316AEB03B2C7ECA40208EDE6161238410824108A42289C6E4724070A8E1F065D7C5837C09710C1E7FE4EC527C2F70ED734A34F916848049772E3D009A1C1F1B5BE21D1C3F341DD887EEC245509E0A8F6E9DFEC3C5BD943E824DBCBFBFDFAB846DFC05CB0557DC734480AB0D73C4472E1567DCFCAF802F0104DF797D7D3DBB2C7B28D5370CC9FE20B667C1C195068D79018970ED824737C55CB4C4AD8AACF370D82F8F3F926E8EA22DDA9459A2EF7DBA952845A67BFC5C5713FF890212950E3154514A40B14782E3639E5D963D94EA1BA4665CFFD803E8FFF4378422066FE2585E524E27DDA870350EB62E1638360B400F37C65DFD323EF295C57F3ACAFF50BDC5302E30AE6E059BEF0750AD6F309FAE397CBEE401FC3FD35F95C023B8B59CF24441EDFF7CC05FE6DAA530B7F8C485AD357800A2CB6D4930442B864F2C84AEBEECEA1E252CF5CCB0CAD5E5520DCCD11185BA086BD9527DC3FC32B47E0E8AA9D9BF1FC03D32FBD1D83D22ACF39854427CE0FF8726A72B86CF657C221D3670F8B8E5A150C8B05EE871281DC961B22CFD173BC011D95BCD86A3586163FCF15BDE0166E83FFC30E98A015B142B8B9051A7FE5BFA2104BCFF70C1D32FDCBED57921A371C57338FD9F1DBFA3141E603C0EFA96C461432C9D53F4DF74122D9E229B667843906D5961560426171F0BF82DCAB07DA4F03AE5E7CF9F26FE107CFBC1B286EBFB763D1FA6F4FF2EA4FFA7801174410B6A0BE3EA3FE38F803D5F57B9C4E31C2ECBC1F96F1F3BFDD2ED10B05E84B3A06EB407C1BFCBFFCF82BF5472FCC1C63DE5C338D22D8F8C2A361A4C22581CAC9EB3A65A4B074E4E3E8E882FAF36A7338FA1FF138DA0110BFF18FAEF2209050B1F3B993D426959F46B05B4DD2617D8F92F1FF8CF367EF1B3FD014AB27DBF095B602CFEDC51D99775B503F0C7EB7F7ACA5882F92234F7443D2F4567D1BEE4018CFB22C0914BEC0AACFC6EE7B017AEFDC8475FEE02A6388BA70966D65E8FA7E9C661B88B86AF266B6DF8BB2C0D36A491E3D5A47E96632CABD283DC683E6ECAAC1BE7A4FF5760DCF363ACFF43084260FBF9F67D02C2FE7338FFB30ADF5E3EE61F7DD982DFFAE48592D86FEF7D16AC2CF8FC6ABFF3EA001EE3FC3F8EF5A2212AA6B3E1FCFF8FC4A02F02B0FE17759B502DFE31EB5D8C6AFDC77FF7D57AEEFD0F4BFA7FFB6B4540F37B6C457E85D372B4A4A04229FEB1D26E8FF63DE6FDDFA2231C56ED6CA85BB34AFF1F0C76D29E5D963B384CFF31B2EA065A100A9F913B7583F7464D39A1FF66399BE275EE2FAFDBFF139D2EEE997420A16DB2B78C455FA97262655DFA8A3D5A39F708F796F36989834EFA7F2283BE08C0C7FF2ABA0DC6AFEB43F8984BD8F375E3B9733AE6BDD1593AF5D31309FE7FDE19847AEF6E1DA480232889937E69833AB09CABEFFFAC70FE7057C1E51EFC65625ED2FF73C16A7DA05BA4D87F52BA26753B7C56E2B28056FB473C5A67B2BC05D0D2B9BE802B86CFFF045F4A67E82B567BBFF933517F42FB5650AACF53657099E963116A35E333977724AF28FBC66F644DCC0BAFC30F647F3E12E8A8035D07C7FA5F61C205174769B825AC657C20A339FAC775B83FF9F6B1ACB0E1DCEFF466E73C520E7F83E7DABD69B27405687FF98F899F55B704A89E5C98704B95783CE048BCE66D2A2DD5FA8F6D11EFF6E1632EE1226878E412EFFDABB8FF9FDFFF5DB2A27129D0EE5CAC4E2AB6204B1B143C46FC5FCF6BACFD41711770415CF64245D183E27F89DD60F23DBB2042082184104208218410420821841042082184104208210AF91F8E316CFE]]>
          </BitmapFile>
        </BitmapFromFile>
      </Producers>
    </Bitmap>
    <Material Name="FontMaterial" Shading="1" Light="0" Blend="2" Font="Font"/>
    <Material Name="ScreenMaterial" Color="0.251 0 0.502 1"/>
    <Variable Name="ScreenScale"/>
  </Content>
</ZApplication>
What I am doing wrong? Is there a way to find this "ScreenScale" number?
Thanks :wink:
User avatar
Kjell
Posts: 1915
Joined: Sat Feb 23, 2008 11:15 pm

Re: Problem with scaling a square to fit the full screen resolution

Post by Kjell »

Hi Ats,
Ats wrote: Wed Jan 04, 2023 11:51 amWhat I am doing wrong?
If you want to scale the background mesh to fill the screen in the setup you're using in your example then you can do the following:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGE Screen Ratio" ClearColor="1 0 0 1" FullScreen="255" ScreenMode="0" MouseVisible="255" FileVersion="2" AndroidPackageName="com.txori.screenratio">
  <OnUpdate>
    <ZExpression>
      <Expression>
<![CDATA[// Calculate screen aspect ratio

float r = (App.ScreenWidth*1f)/App.ScreenHeight;

// Calculate scale based on camera distance to mesh & camera fov

BackgroundMeshSize.Scale.Y = tan(App.FOV*PI/360)*App.CameraPosition.Z;
BackgroundMeshSize.Scale.X = BackgroundMeshSize.Scale.Y*r;

@RefreshContent(Component:Mesh_Screen);]]>
      </Expression>
    </ZExpression>
  </OnUpdate>
  <OnRender>
    <UseMaterial Material="ScreenMaterial"/>
    <RenderMesh Mesh="Mesh_Screen"/>
    <UseMaterial Material="FontMaterial"/>
    <RenderText Comment="resolution" Y="0.4" Scale="0.8" TextExpression="intToStr(App.ScreenWidth) + &quot;x&quot; + intToStr(App.ScreenHeight);"/>
    <RenderText Comment="mesh scale" Scale="0.8" TextExpression="intToStr(100*BackgroundMeshSize.Scale.X) + &quot;x&quot; + intToStr(100*BackgroundMeshSize.Scale.Y);"/>
  </OnRender>
  <Content>
    <Mesh Name="Mesh_Screen">
      <Producers>
        <MeshBox Name="BackgroundMeshSize" Grid2DOnly="255"/>
      </Producers>
    </Mesh>
    <Font Name="Font" Bitmap="FontBitmap" FirstChar="32" CharPixelWidth="32" CharPixelHeight="32"/>
    <Bitmap Name="FontBitmap" Width="512" Height="256">
      <Producers>
        <BitmapFromFile Comment="Imported from ExportedFont.bmp" DataWidth="512" DataHeight="256">
          <BitmapFile>
<![CDATA[78DAED9D3D72DC381085E7B83A848FB027D0059C2B77ECD4A94287CA3674B6DBA5AE7DF5B641521CA21B4370DE176C6966BC20889F8746E3A76F3721841042082184104208218410420821841042082184104208218410420821442DDFBF7F7F7F7FFFFBEFBFFFF98F8F8F8F9F3F7FBEBCBCCCF5226F6F6FBF7FFFF657F8F3E78FBDD45F7FFD8577C44FF8D5BE7C789E2D87FF6C8257487F5C6ECA42881959531E13C96FDFBE6529B38D29A56F61E92FBE850D646B3F9D4103A5FF428887EBBFD9FF66219B5AB29D9C22DA48D0FE182CFE01FB67BFFFE3241A68932C1B6791C3DF0D5943B0F45F08D1629A1F44C6BE814AF4A76F8943E27EFDFA959EFFEFDFBF23B748DF74953D5A46EBED797D7D3D838F8B35F9C78F1FC39E25FD1742B412C1E674BA44A77BDDDFDFDF1773CB0FB57F73E63237D91F23CBD27F71AC7DBA3565FF4D37517E6F529DFE1E9EA496C32269AEC786E714B93E0DD8F921B7AC75F6D38F154E52F818C56CAE54372B91FE8B1EE3ADC284DBF6D956A7BF87CB57F1EBEB6BF096B8B73C57A891B23DAB22D976B49AAB725105756BE5DC97ADD2256E628FFD1CBA4CAE492CFD3FDBF86EFA93EEA581FD9FB8AD68BFFD3F45E5562F947059952EC70BE9BF9805F6F69BEC54381F4AFDFFDC3ED71E1AE414FEF6DC99C8C90BAA7A222FA4FFA202D72B38ABBD46DC7FEB1623CF7452FC27360ABCBDBDA59BB5360B482F1CCBE797FB7FC2A403435E9199DD8365A968A2C41B4DCF39FC8929FC03321B4EA2FFAFAFAF5C23C7F49FF7CFF87A37E431C5453C60FF7FBB78B1789CCDA4D50620FEC7B9027BB87C0215FACC5B8CF8EFAC51BE7A725A3452C32D59B7E68E0AF557C87DA390FFA2D729DDFF230EEBBFDB8A5629BE62784CFFD93E2F9AE8559FFFDD78052BB4B59F4E62C68C599E4021789DF24519676EF910B422E301C66D9DAC8557C87DA390FF01AF23CEA3FF7E8F8D3B406CC43FAC18F6FFDA50121607A7BB02C8CA07C695BD8BBD11CCFB8D9F9E41FF79F3ADBB0D471E3AEB1CD94B57EA917E9D2B2CBC42EE1B85FC0F781D7112FDF74E6D23BE2B3FDCE02A2E1106F7C5091D4F01CE3CD0C32C291AB2071C8808AF90FB4621FF3ADFF124FAEFADC8BFF9F844FA2F5AB0A01C3481A700275C070F8DBFCE5F8771B062738203DBCC5F217CCCCDFF80D7118BF58BA5341CA7EAAF02BF900D8B2FE18A365C6BC07B60FAAD14CD1F1F6BE826963F7B1B5A8733AF359F790A503A48617C2C5DA20AAF90F84621FF635E47B4BDCCE6D1ED150A9D43C0E2E65B7CC9F643A7FEF3FD03E7B709AF4751F973FB691D02E18A0CD5821029426D9D17F3D6895C04618B9A7611A8FC8510FB87009BB9C3D0F27E7DF285181C2260B5C18E11DD12A3F217420831F528F3E713B746F051E38B10425C9BE062C2C7934746104208D16FFFB343297C1442082184104208218410420821841077816B39FD12F2B9AE5514420871180EB870FE0BF784104214E9BF2E671342888783CBB1C75CB511A2F0A4E77FF0EB0821C4D4B8268F898356110B35E47FE4EB0821C4D42CDEA63B91FE87FC8F7C1D218460DEDEDEF82EDC8F8F8F935F240EE7FC80AB302AF43FE43FFD755E5E5E3C3205E779FF97070AA7C879C581F066EC59967F9FDCAD152F877E08E7FA377EB26439A60C22E4CE183FCE6C1E6BF66B01DF17A3C39F447C4E9ECF3D7CFBF68D43D830676E4BB80A63802C54E87FC87FFAEB70134588ABFD5FEE0777DED6B5F6D9835BA184DB6B5B70693CC0BFD9F8E9B6197F3CDD72B39C1C6818FB13FFE74EA4FF89E2BF31EC9E59FF39445A753E2BF43FE43FFD7586E93FFEF7BAD6EE123175A823C4820C762FCC7B0CA31E006EE3A72FF53FB72E2A1A7F8FF89F4157D95A9B5AFF79FE68B945647393209382A2D0EDD351DA05AAA7759CE7C52F3BFD3FD0FF3A13D1CB7FEACDB78BE142103DD0477C4CC3B77F82FEBB59CE7D16B65CD65C090E284B395D0DD8F0B00C6376630FC2EB9FD60A5D8BCF3E116C736AE7E1C5F47FFC5C38B717784C5ED3014BDFCBDFFE6B7FDB37F6C78CABE4FE167C8A10ED2A7CB492C4DFFE8FF927A8FDB6A2A6540152AB28708C56EDC94A7E91D3AA2B06E549B7EDE5B616E9FF73622668453FDD76B1CE68AEC0DC827F7E8FFEB73FED9CCE271A8715332F0E62DEA63F85FE7311CD1590850BBF459A26FD3FD096D2F5DFCCAADF9FC079EE1FEDFB29F4FFF5F515FEED10BFC9CBAAC7FE6F6B21ECDFCB326E8B96DD59E1DB65F129F4FFD6BD7626FD97FE4BFF7796FFC937247FD9C54C93C35ED0A0EA8BFE7FD7C6D6FFBFA6FC5975C13B432AECFF6D85DF9EFD9D6A4440E1572C918CF15F49D6A4FFFD4257F70817A27E9B7624B0FC4D3CF1F7DB27F0A8E3EF7693CFC64F0CAF934285B2E4B1D4FF7F19FDC7983E5113DDB6FFA572C08FD8F04295BB20744A77A4FECFB8CAC6CE136CFE712FB1DB5DBEE8D91EBD81B86DFC148618944FBA5B0C434FBA717B19FDBFFD7F3BE8149E49E9FFBD96FF05D61FABB5AEBA16265A6243FF4257E28FF8D55A910D01B0E1C321DF8D9F82715EBA205234F9BD86FF1FCCB81D1483BB7CFE1B933BAE59E93FEB8F0982150E9FFFB28F599323DEFF89F35FB3ECFFDCD67FF6DB1C8E28C19E9F6AB773C5F95FB69927DDFF13A85E312F9DB64CB478FDC0598066467B66E82983E3D4FB3F83FEE30A23B49FF69BC36D72AE651166F6FDFF8119B783B20B9187007B1799B86D5FD3FDCCDC43B11A02294BDC9C39F5FE4FC8FBA2FF3F48DC317DE3C93B7AAE2565DFCF627FF22B4C77FEF74BA3658A25C2EDFB7F74FF43DB50ADB87CD054B104B3A7EE11AE06731924F006F0FE9FA0098B9702DD3BC5586496E9FCA4F7FF6C17FE5CE16237EEFF9C6BC775A939D78E92DA02E4C0B8ADB3D38AEE7F5BBC9307637DBB28792CF18D335958C33D2668BC04FCE5B3AE34044CA1FF73CD5CDAFBFFAD23C8FEE75192AF28B7F291FE87396F5D81D42DAB41EDDDD4E18DFA29E38B2768CD66CD94C2A5408785C852E695476BA5D3B5CCE9EEFFBF9EFE0B710CEC8F9A34FE0B5CCDD01F4D7B8510E24960FFE7BC516684104268FC122A7F21C4E591FF4AE52F847842B0F812D6AF757847E52F84B830A5FB5785CA5F08218410420821841042CC0B1F611BB95A31E3CD7E42DC055FABF5FEFEAE762EA4FFD27FF1849D4B7B02BFC42FC1D0E5EAD27F212EA9FFF386D8E09BC126D27FDC49AEAD98D27F211EC2B76FDFB0277CC6E0117CF3F98CFAAFC997F45F889374B4E96EE6E4105D75FE990AFDF738410ADB24FD17E2B1600A305DACC68D10ED27D7FFDBFF4330CC2BCE45175F07B30477957B2BCDAA6E4ED6374264E97FF5F8E57792F3CD4E1E132137A60F978F5929F6C4DCF443D802EC458147376508AE7311F0E5CF21F18D9FEE324242E3E19FDAB8E4C7E056941253E3CBFBE7B32CAB31FA59B7FE2BFDDFF3088EB69938575D8C4F841B334EAEFF1B61DDB2C2E22CD672E29C68AD1571BDF43FEEEDEDAD6E95333421CE6D08B0756F73E5B053187339847796AD1E6A21654C91FE3F89FEA31E4BF57F8D1E5B3498671EBC3BB1958ED17FCFB6F5D9101C2DE5113C1422AC70A2FE87C87A6DF9A73C2E3C25D7C5112C93C58B568EADF1B1D44379B888B24679AEE52C5F740848FABB212BF3D2FF27D17F984FDC5C7B6C39EE9E9C6D9E0B9F59FFDBF097FC4689CDBEEECEF0C53BC983B9DEA9FF50D13F9FE42AE78DD61F5B89F071A767770DBB7ADE3EA96851ACFC89ABC063D6EFA4FFCFA0FF6665AD75BA7E710B1D33CBF93078FDDA1EC7866EAEFE57B4FC8DF2E117E9D47F580BEF9FE46EB78387C7C62F0CBEA16BDBF768AE07DE85870F0EEE9C550B18622C4D5477E86EFD89176DA560537076FD9F6B0BE860FD0FC9AE49F761CB6DEDB953E8BF0D58C17392D5501FA5FF89BA815A66FB396BBB1D34DFCA07897B86313470ED1C70ADB31728DDF3C3B35DD31F9E5F64ADF273F091C49D03A1C157DB5775FACF4D7DA223C627D1FF9E717FADCC27D27F1319F656C190CBD287D9F59FA7722F9FE46E7447E15B86F13AFE2E181AAC2ED8C6EE745426EEF9B9FD7F85DAF2C9E593D862514A89D316F64C0ED8A45D7AFF83E51F4594F88830A1B0FAB56FF0201B977B54E202F6FF5A9957E87FC5E4AEDDBC64FD2BF7FCCEECFACF3B7B8339DAAF45AC96BE1BD9E71A5E56FE686F9F2CB3076C605E48CD5D8B69D777503E894FE1BBE6B23A42B0FFAB8FADD5E97FE8C5898F805B92653F6BA17FB0FE876693EBFF0F93089E0567E97FE29ECC56DCBC7C72B7E55F40FFD973027DE0EED65923DC4E8278A23B60DC39BC636171E7738A7F9EC72FCC297277DE2EAA5CA256CBFFBFDF6CC0B06E0FB2EAF6116116FDE707659D7FE17450F8F6142EB72CFDF721C072FBFA498A562FDA0C9672E2FEF6A9F51FE210EC9C2C5BB42D1C8C08F0D840EB20E37749374F1C7E7E9278DC9553E30659A4485C1D89B690F6FF6CD83F3C9BB3F20FC5DE53BF0FD9FF6F6F1106B5C4FDFFE9A75438FF610B7A8A65C596A1EFA9C653FAC5C1572DC3E52AB93BB7ABF57F4DE7D7C685C33D17036EDBA2D03EDBC9C25DAF80AC26DE18B3B69B88DB55A766062A5C58D2FF873058FFC31258E9F9DFF4FB1F7CE7038F5C29536076AB06FA1B6AD896507172B354FFB966C368C846F5E18A082BA7F89E1DADAC72ED62C15DE33BFE177E6E8F1788CB274C18B37C35DB9695F45FFABFF311DE8FEC232FDE55DCFF836473F51FFDD42C4F57ECAC523255098B3B7E1638C5BF64995C1C5FA6D07FD4E9A2A9D9BF23656D12C11EE930EFE09D96778D2F417616C785C3E5B338894E396820FD97FE8BA98129A8C847E29CE8FE4FE9BFA883F7340A71CEF6A9FBFFA5FFA202AB50F729A928C40951FC2FE9BF10E26951FC5FE9BF10424CA4FF5323FD17428827D7FFBAF85F420821A4FF420821841042082184104208218410420821841042082144227CF294EF5F1D1091F6E414052415428887F3F2F2B21853B52290EBBCFA9F1EB05E08211E0EDFFFEF613DCDE6B7E900423CA48498BF86FE77C6E91342885301916FAF9DE7586FA597D29F1C0EE29318935A08211E0B9C3F8BAE7E5C4AFCCCC7E137E2BB0921C4058CDB8F8F0F8EFF7BFB0CEA84D141FAAF7210676EA288A66A7376FBDBCD399BAE26C6FF753FF062A0E17E4208607E8B1438DB4819DFA43CE8FBF7EFBC8BC65F2165DF08275B31042CC647667ADEA2343EF2007D7E60FA5C3E8743AB3C30FF68B76117C15DF55EDD7ED6FAAFFD3D85BB6FED0A3B7B9D147DE3F44394A27E7140C9976E3E594C3FB7F17020F2F440F3A5FA7F6B824F053AD77FA5FFC7D2E7EF7BAA40FADFD37FCFBFF981736E7F5B5FE6889CB9FABF46CFBE085E67ACD07F4B9FD3B467B5759DD8786C0AF3FB3FA6D0FF50BFBFFF4FFFE02EFD3F963E07D5EDE95FD2FF1EE3EDFC43C05A3E795F77A2FE4310B075B0B35DB1F1C993DCD7D7D794E6BA987ED8F7DE533E3CB96827E9F616FD9B064BF5FFDBB76FA5C15BA5FF07D2873BB77FF395F4FF58FF657D3BF3E9BF35FD87F33F51FFAD592E3EBAC750AF766E207DB3A32ACA07E9DB805254C5D54564AF1FA66089E15CA5FFFBD3B72664C331B7CCFE4367D2FF6D78A85D93D6A07BA782C729CBA71FE109E596A5FF6BF5DB237D509EA2A3A66BE967950FE611F6C78F154EAEFFDC8482AF2C6C0A92FE57FBDF78204EF13C48FF77F6DF567F069876296CFBAF06E87F8F2E555F35B0967E96FEFFB38333EB7F38DF6445612644E2A02CFDBF4BFF792098D77F3591FE6FE84FB5DD9588F559B3E2DA95DFF3DBFF1BE36F0A6BE9A7DBFF93EA3F8C87B0F89275E941D83F26FDDF489F276259CB3167D0FF30961DD6FF8AF67301FB7F6D4448D7FFD026E7F2FF87F4B3FCFFF01F864682C6D9DF784A8BE8CBCD879DFB9736F6314AFF43FAD66779BB42CAB2E3C8FC6F6C41612BE2B0FE57B49FD9FDFF50FBE0AA655B226BFF189773D6FE1FD6611E5FACF1F73B9F6F2B8768C28A67D6FE1F4E67D1AE7E72FB9F9B4AD8F73BA37D5B947EEECE93C1FE2B9C990A876ED8445C1B17EE4A3F6CE14BE9BF33EEFF71BC2BD97F7DDB36AF0874FA555AFFA4157BF032754AC49A0B25650A1CF6FF571CD1E2FC5B9EAD97256E2E0D3E3DAFDFC4BB8817FDFFBCA89DABFF30E4B2B6585F72FF67A2F88C5FBFB0E6BAD6A3C3F77BA6C6D5EDE736F9FEFF6042A76FE158F34F260E8E96C3B5236029E5B378FE97DFA553FF37F2DF59382CCE75D7F27FB97FA067FECBEDC71A6A5B509D4DF4AAE7BFB8527A8E008CCCFF6247F3FA5DEC207B7AC797E9A7F4DF79CFFF62C26E82D69E054E6F9F7CD750E2FD3FAE7561DA9278FF467B6DD19ADF2625FFD6DAAD3AFA93F56B9106846509979F243E2EE8BFF5B5705755A27D72B1FB7FB8391D2EA561F9F746C2FA60E6BDB55E9F3F7A4BC628E03BD53BD34F693F6C4587FB7F14F4ED76DDFB0F73EFFF2965A27D68CFD37E2E30BE0821FD3FBFFE7356B3AC9D2BB51F7B84A55C67AD95A62FFD7F36E00D9B22B8AAF4FFE184F51D9F0ECC128BAABAFDF0FA7E459954A72FFD7F2AE0769EE54C81F4FF0CB4CB67B3AC4C5DD83FAFF4C55DF0E18E5926F2D2FF331096CF7C654DEDC7F109915F9E365DFAD2FF2721EBC094104208218410420821841042082184104208218410420821841042082184104208218410625EF8D289FE7030428844DAF856135D0ED0C6273AFF552ACC76D8A30BB42E0EE43AE3EDC14248FFA5FF45FCDE64F6A615C2AE299C8D10A7D5FFBFFFFEFBC7271349A84746E080D773E9FFB5E1708AB35C172FC473EAFFD4062742D449FF370AA7BA8AADF04314E094E76EE49FA3E81EBB91F8E5E5E5E7CF9F1CE2D02F37AE6848D51561A5F1FEFECEB734DBC7C46917C722313CB26A85B5D05625DF5EBB3FF40042B5AEF91ED981D01365BEF5A564C574FE67073D1E9BC1FA8F7ACCBD3F5CFAFF70FDE7BED6D2D3B9D6F26FFA03AD3B1C8E6423CFE957DC9756443BECA6C76AE1A57CC33E26E69F536E831361827FEFD2D8460BE1F6637F24DAD2D2FF2FAB6367F875E9FF14FABF213EFDB380B5FCE3FB9E6D45753D6B64457C59FE29434010E1C41072619F40985C8479C75DEAC133C4E084E4495F8A1CA5EB7F5B2C53EB7F5DF041E9FF03F59FAD149362FBE89DD7FE6B7FF312F0B186BA987F0E4ADBB3B8E0DA68296004B126C42E94F357041785BD0BA4CCFE485C82B1F24115A37CB2367461668194D96D05DDC0AF774D3DD84EC0B0C2D2DAEFF929D2FFE0F8AA10B791FA0F1741EECC51FAFF58FD67856FCB1FBA717896DDE69FD3ECECBC8B0D8647B4F35704DBB1C127CF9673E74321D1964E7A47C638B5E81FE62F0F4C67D8CF83D682B94C8AE7A74EFF8BB23A5EFFB929E6AE1C49FF1FA8FFDCE6D7A49897060E54509B7FC84551147B56D4F357C4B6C267BD0B24F4ED935C45623F4C5BB3104036DA0F4F912C115EC848548C22FD4FB4761EA8FFB0A92A1E24FDDFA966AC1529CE6D3695D7B69AB00FF6C04317F35F54DD96203F2E6BE57476FD67E1FDF649A2E73CA83AD41E5E441E110E3F17E5C0AB18B98E086EE7B9EB9BDCCB72B7520FD37F147BC539A022FDC77CB39DB0A059A6EF1219A3FFB0DF3A1B2AB7CCB5C267BB2857FF131B6D50FE8AE634AFFEA323C02C4777EE6FFFEC59E267B9504054DDF4C5D4EF5EE9E631AB68F2C8234BBA9CA6EC767894FEE329152EAC3AFD479B691BDBC6D03091FE8745B1E9F43FAB17B79B57AD58D22717F3EA7FBBF0CA2BB69DF90F920EC1F791051DCDED5E3CF7C0D42CEC5FCD3544D9F8AF483F65B7F3A3F4BF68DBFF00FF8FA71C1AF944C6FF6D65FD9415AFE72D46EA3FF2EF87B6B236EA87CD93BE85694C454CA1FFAC6CB03CD99CEE14BAE033090E9FE00E3ABC04D01A12B9CE3DDE055134BFE077CF6AA263F41F8553E49FAFD37F940F17380685F31BFF1BB293624E8CF4FFAFEDFFEFB16C396F75CA3FB5FEC35408820665EE59945CD473D6FCF6D1C7C61D5E024EF7A5732FA8F3D5DF0AB6830ED0FFBA6DFF03F41F8923F38B23C28CFA9FA29F7BF6FF7436DAB5FCA7ECD2FCF28A00E9FFDA6A294FC1FA058DC5015FA28A798A7760E9216C0165E7558A0987C4BD0AD8579FDE8AF0FA29723A40FF511A758259AAFF2822B737163D4233EA7F5643E2996F2BA115FBFF5BE9EE2F9C5C6FC065F47FD1F993E8025A14F36D5FFAE290B1B3E421F841B17B687793763A3CB7C9DD0E5AADFFA5DBFEC7E8FFED3F17B1B5B7E98CFF35D9619BBCB31585F3BF36E745455BB7AD38FFEB278B531CADDC79315BB75AB6EFEB4EA94FA4FFDB472DA0DEC7464F160756F8F6C207960E1E1DF648CAA2FB91BFEC59BF583B61B778E8388B3D4ED793E83FFA57FAC98591FA1F4EA0D739B24A0BA76E17FD9EFB7F0E1BD85FE63FE5FE93453AFDB703EEEF2AD57F16B7C5FD96FC8207546E6372C17B294377BB77DEB1769B478A9766CDB7C9EDEAF0FE84EDC69932BE54DFFF5FBAED7FE4FDFFDC20E70A65B2AD9F59EF32E0FECFA25B3A5B6F43D61691D9F59FD74C1717477880383056423C5B05665D6DAB1892FE65ED6F9C3DDFB374B5DF15D316FEC6BD1C89FADF297AA5F1BFB0B85FE42D1F19FF6BC02AF648FD37654BBFE5BEBDFF3FE52903F2EF39E70591949BF367D7FF3DF76CE0DF1C182B3776106DFB67D6B624ADE9CF9AC267ED4C58FCDF595A8F795766D7FFEA6DFF83E33F7A73D515134208218410420821841042082184104208218410420821841042082184104208218410420821C453E137E7BCBFBFEBCE0121847836FD9FF4CE4921841059FA3F4BB45971665E5F5F7FFDFA156ED4B48FF6A547DF16429C07BEA1343D9AB0781EFEFAEB2F0E61507111B110A26E16501A424B5C18BE4DFDE3E3C3A3FC3866F6DB476B5A36C1BC57FFF9AAFFB5C929870839164E652DFE8BA5F6F3E7CFC449B19592970366DCF6680E67798C8DF805294EDD8DF83829037A51D8CAC5C9A9957F88FC650FB5B7588C3E9392FFFEB7AB2E1FF4B2A2F437F2CF01800E8F3ED5F10717E3CB735C57EEBF0819B0BF30B7E3D7730CA0CE3A2A8A9F82100F2668DB49DD2B74DC3CD6A48C879E6313D8EDF6632FD5AFA2F6E21B212C3B55743BFF26719D9EB76BE87F9D4ACCAEFF8F4ADF3A05DB4227ACD90D7D662B8265275DFF5B5FFAB1B7D88E9FD81340C78BC26AB0C7883A3C39E5F72A6A3F87E3EB2D4E6406EB7FFFEE8E0BE8FF9EF8D1D2FFC1E973BBEA597A18AFFFC12667B743AEFEB7A1638FD5D19EF67F2C6584C043E6ADB4397C9E7F6FFFCC87897BCDD12FE53D71FEC8256055CCED6A313AF94E78AAC8B3091B53AC28ECD7CEF9C562FEDDD73140DFCEAF3F1CC5CFCB1FA379677C46E97F4FFB4CF1698CCC3F248E7B74B00F73F51FF3A39EB20AEDDF3E7A6EEDBFF6373FE2803987A2F034B95A59990F9BA31BC1D3B34CDC8DF9694A13E5496EC51469A77FF569F5875B78287FEE1AD2FF91E973A564AD7F0DD37F387FA07E98BF24EA3F8F323DEFC845DD36729ECB1CF0C279C6F03FFAB3DCCAF2C55F3CDD0A0D5383BB361BB783E0A297BEA2FDF48B270F884551AA77EA4FAB7ECFA03F1C7FBC2D7FE9FF43D2E76957BF0B71B0FE43304DD02011700165E93FB75BF7991C7B474E678F0BFDDE5EE099F75CE159EC2D8101EF5FC2A8DEEFF1E3D652B17EB1D67E52B646B3C2149D80D86EFF3C05E85C1F9F517FB6CB5FFA3F327D6F81AC48C736EC3D56FF6196BBA0413CDDB8CAD27FF6D8FB46CA63EFC82D7CCF169A7B87E345FD0F89849CFBEC69BFBB9E6728FC0A6C5AA7ECDF5BA3A795A6284C4FFBE7EE76CCD6DA289F94372A5D5F5E2C7FFE3251FF2BD6D72EA6FF811477E860FD87327BE6837D9BA2FFEDB6D803C9EED79F1E89C0F0B75FFF79C8D8091C6E3C6AC03EF7895845FBFCF3E74FE7A148E9BFF45FFABF58203D7B2A1EA5FF705FB0E6F03729FACF2B86EE273FADFE63A8F27C7ACE8320F7EB3FBF05BE4429754AF497FBFF7BAC14E9BFF45FFA8F7974E2B2EFF8FCBFBEBE42EE78F06217508FFEBB7383BDF13DCBCA63F41F03A2FF8F789CD5B515977BAE7CC6849C1FF0D8F3561CF7E2B2F3A762FF4058B93E9C384FE51EE2FFEF71EE5D407FB8FD17DD6F23FFFFFEF4596AB21E372CFF90B2A0A5EC02EAD17FF6F3F71F2B68DB7F85FFFFD66C015A5BAEF59CE359F76ED74429F9C081A7F457FA5AFB4931DD79F1E221FB7F7A16F72FA03F5CFE9D7E42E97F4AFABCAD31C505342CFFD0AE76B7211F77EAD17F3E56CCBDF5B0FEEFD9FFD3790A065D0C03965F74136E5971EB0B8785EF7D4A287C18E7FD973394EAFFEDFF47C507EFFFE791FDB0FACDAE3F5CFE1543B0F4FFDEF4D96356D77FD3F30F4D6B5B117EC21F07F47FE3C0E961FDBF6D9E7FB975EFFF0F3A6343C09A54DA83307B3A3613E7C2E9DFF6BFDD7E36C6E2C38513CEFFBAB7D08F45A4E79F5D919DDEA7D9F5279C49B41E8AA2787979B1EAB0E7F6B810A5FF07D28714F41F8A1CBF7EDD7625B64E0FEBFF860EF7E87F38FFCB174E5AB63BCFFF2EAA9CDFA9882B40C374E0B00DD67A9652CCB92FD7EFFAFD06DB47183ADF62CFFA63CAF988EAFB7F12D74C03ED81FDC41791FE1FB34F52D6D7C6EBFF9ACD198EA9F6E8FFC64195BAFB7FFACF62F0FA48C55D9AEDE512D5FB4F122F6DD896A0D2FCD7ED8F9A45FF6F9F0BF11B07C98BCE8F4BFF37D2CFBA0268B0FEAF9952C1C63BACFF8BFF63A7FEDFBEBAFF3331F48369B2691DBF948DEF967ECA5DF4E1F2F6A2F91D5FCE9FD8906C1CE1FBB74BEFFFF7324FC9FF35F41FA380A5C903817DB4E6FACCF7FF3F307D764D1C5E0B1EACFF6B7ED4609D1ED6FF4535E8D7FF5BD9FDFF4208218410420821841042082184104208218410420821841042082184104208218410420821841042082184104288331082C30A2184781EFCAAD594384D420821268283E7AA342E8C8732C4E5F329919D179F92123305FCB3839EFBB15F5F5F7FFDFAD58678B0F2E9BCF67FCF4BF5CFBBDB680E66CB65457360DEDEDE3832823D22F15AF20351F9EEC223DCE129B945C4D10AFCC2F6C3A13C5BAC117AB72D2A1974D8C40823E25E3C368D557445FC7134A1A2C85953EBFF76CA454651A2FE6F0467C96A4E1C18BA22BE676836E9D12E3662DEA588EA5ACA29F603974C6EB423D83FB91D561C30E1EA022A6DB7FFAC105D75FABF11137080FEF784657FB8FE67F975B76386A60C9158884C1C53DAF2B1D6FEFB133687FA1FE7667F085BE685DF3F0454EBBF0DEE7523EFCEA9D999C57940F64AF59FC77734750E8599FB82E9FACFFAD31F0179511FAC04423FE558C03D0FB5947F2F1114A9C71767556965CE3DD7DE856389768A86FDEF6DFB490C0E1EA6C01B21F63A87DAA0F3FCB8741328D19D65455DEAFF791456C528A833E7D3C771CB6A9D37B8D4FF83761E4C4134D15CBF5F85FE8721A0B422009B8829A5B14145D7CE9220947C4887C785941AA998026C18B76C74A5DBBD0F37AA4FEEEE08A1D84FAEFFDC2CA7AB4DE858E8BFB04273B77E15E93F0B51C5B2C5B6DF6046FDCFAADF355755857EAED92A29F90FF3A0BA861ADE25D79D3535361D0EBE44FBD8E97FD8D3BFCE96E7878C5FA1FF16B5FFD26EC54340E940CCC66D8F389B4DEB7678709224FAFFBF1CF73B9D66C86A7052591748D77F9E0264950C5C795611E8B6ECDF4BD9086789B0A1650582F2495F629BDAD583BAB06131C58AABD67F4CE82CC3E115129D4275B3C52BE9FFEDFF6B9189A3B0D5AF7BE6C358DFEF91830EB0CEA4AB1C6732F8FF7BFC7B6CE48731970B2AB17E91F3C4290067D5FEE65E9C629C2FAE8FF310F3CCE21F5C3DE9C6F38F1D944E61529A108C87F4DD2617D3FFD0DDB21C412C7490CDAC860A4D837E26EABF3598ED2D529D1645BB612CEC38CAF56F7045240A45B03FFD4552FA5AD0B7B0B9287D397B3A129BE279087291289BD64A738780EBE93F0F015993EB56FF7D7E9795E1E0054AD47FF6C3B4F4A7BF68D0A66C8E5A03E34BA2E7842744B993AFC5A20883728FEED9D8E1ADBD68FF4F75FA6F6F6F61B76DEE2830D8FE0F8BD7F66A599B72B989261ECE1DA3FFA8D331FA5F6425A2F3627CC9326EB10BD76B36F7FC2F4B50FAF95C745E2B674B10ADD4BE2F5ABCE0374AB18578C262F9E7FEDB59BF1BED9087CB1EFBBF7AFF7F75FAB0527814F04DD7E9F38B3AFFFFEDBFBDDCACFCE9CAC37591A53C5FEEFFE9B7B2BCA97B86C7E8FFAD6CFF2A8CA2F4492B7B818AF4BFC2CFF0907D2C689CFD46299F7F4187E54953CF10B3B1092AAB235C43FF17478114E37980FE87294C85F22F4EE7539CDB6B0B6AD0CFCE7ECD5B9DCDFEAC58F6B21EDA1678F58D31155B743CCF6C45F4275EBDD59C256EC0B6DBF45E007D0BAE2ACC953AAB604D3C51CB9D2EB2EAF35FE3CF978551E0E4578FB21FAF54F9BF6C51FD5D69F1FC6FFF14DB1EB1B80499D53E219BC8EAE2A1D41E6B93130FE593A8FFED2A43AE0BBA687D8D8F120CBB281E12D159BFBCB2B6D8AF3BDF08F9E4FD51DC7EAA8DEA49E151E0CCF9AC567E330FAC8560E6CE1291D572162F7FCB359E6145A4EBFF46E65344EFCB235AB9466F5845CDD5FFA2FAC52906B6D9B0573677405CA4C7AF15B6B0FA589FB5381BFC4B63D6C72F360A9CBC884A4F7BB11D9BDBEC174DE8762F5FAEC738EC0C2C4A36F7F2B1B07FAFC23EDF18D1A6D07F1F02D66A6180FED70DF15987BFD6C47F98C74CCCC886F8A42B0F1F51B4965934912F3AF6E2DBAE78AE9DB891CCC42D5CA16F0FAABBEB2377FD777B7CCC75EA7A2DF0F98B4EE7ED18FD6FDB8FFD911BBFC07746C1CAF249BDF44DDCDBA7D2236B082184104208218410420821841042082184104208218410420821841042082184104208218410420821C463C115A68931251DBF53C8127FE620BF4208715A70455EFACD5AB8C26E58FC94B986DDBA7B748510E24B1002A948A231B80C080E351D3EED3A79902F218619A2321407836B9F53A2C9B720044CBA73E94A332F0D8E579DE20D8E1F5A671FBA0B1741792A3CBA75FA0F17F75AFA0836F1F1F171AF12B6F117EC29B8E29E23029CAD9B233E72A938E3E67F057C0920F8CEFBFBBBF46DAD4BF607B17D78FDCE1BEA1412E1DA058F6E8AB968895B1159E3E1B05F1E7F24DD1C455DB429B344DFFB761B518A4CF7F8BD4E68E321205169174311A50414BB121C1F53FAD69A55297194A4FF9D84CE9BD897B7235BA51B15AEC6C1D6C504C74601E8E1CEB8AB5FC6473EB3F80FF33F542F31CC0B8CAB8AC5F70BE81BCCA749FD6317F0FF4025F00A6E2DA7BC5150FB3F9FF097B97629CC2DDE7161730DEE80687277B54F4F133EB110BAFAB4B37BE4B0D433C32A376F2F8039AAF8835CB3A5FA86F14596C34306AF1F9FC03DB2F8D138DC23ACF19854427CE0FF8726A72B868F65BC231D3670F8B8E7A5389A799643E921FA7F990749FF2F264168393A42F2A806FF25591B98A1FFF0C3A42B066C51CC2CC2833AF5DFD20F21E04FBBFB85EB7798FECF2B9ED3E9FF62FF9DAEFCD11F273D2531AFE5F310FD379D448DA7C8A619DE10649B56981581C1C5FB027E3DA0FF3C4FF9FEFDBB893F04DFFEB047C3F57D421FA6F45FFA7F7ED08326DD3F7C8199EFAD59F375954BDCCEE1B21C9CFFF6B1D32FDD76016B45D80BEA467B10FCBBFCFF2CF86B39C73FD8B9A63C8C916EF9D28506930816072BE7ACA1D6D2819393B723E2CB33AF4B5E43FFB907CD98F96BE8BF8B24142C7CEC64710BA53DA25F2BA0ED36B8C0CE7FFB043639FEB67F809CEC5F6FC212188B3F3754F6659D6D03FC05FCFF9882F9243477473D4F45C76C51131BFA30DD41809153ECA2FCBB9DC35EB8F6236F7DB9D7EC6F6D7E13CCACB51E9E3986BB68F86AB2D686BFCBD260431A4F9CE2ACD318CBAA742337AA8FAB32EBC639E9FFB34D54EBF47FC6C38FFBF7B71F1310F69FC3F99F5EF84893FD30F8D5072FE4C47EBDF75D30B3E0FDABFDCEAB61D3BAD9F7FF635B2F2AA26238D3FE9F0732E94100D6FFA266138A25F72C46B5FE871DF2B9F73FACE93FAC08687E8FADC84738ED8996145428C53F56DAEC51BF63CEFF166DE1B0626743DDAA55FA7F31D8492BFD6FF5013DABAEA305A1F011B95337786DD49413FA6F96B3295EE7FAF2B6FD7FA3DDC53D830E24B44D3665D257AA9C9859971EB1472DE76EE1DEB33F2DB1D349FF1FC8A4070178FB5F45B341FF757D081F2B7C055039379E3B87635E1B5DA4533F17FDFFBC3208F53E5C3B48015B501207FDD20A0D2EA0EAFB3F2B9C3F61CD05FFAD70174BFF1F0B66EB13DD22C5FE93D239A9DBE18B129705B43ABC5A56B52ED239BF802B86F7FF045F4A67E82B567BBFF933517F42FD4EA7CFB7CAE0323E09B592F191CB1B9217947DE337B2E69AA03D5B1D4456439DE83A38D6FF0A132EB8384AC32D612EE31D19D5D1DFAFC3FDC93EADB0EEDCEFF466E7FC9AFF10EF7578D164ED0AD0FEFC8F899F553705A81E5CDAB7D0869C0B0347E2396F5319AFFF5816F1661F3E16F99A5CD6E0914BBCF7AFE2FE7F3EFFBB6645E352A09EC1B16209B2B442D9B2BD40FC5F7FD65CEB83E2980B62D2700962BCFE8B27E11A072D85104208218410420821841042082184104208218410426CF32F8E316CFE]]>
          </BitmapFile>
        </BitmapFromFile>
      </Producers>
    </Bitmap>
    <Material Name="FontMaterial" Shading="1" Light="0" Blend="2" Font="Font"/>
    <Material Name="ScreenMaterial" Color="0.251 0 0.502 1"/>
  </Content>
</ZApplication>
Which basically calculates the opposite side of a right triangle of which you know the angle ( Camera.FOV ) and one side ( Camera.Position.Z ) using Pythagoras' theorem.

However, i doubt this is the most convenient setup for your particular situation. You'll probably end up using either a separate camera for your background, in which case you can just use a FOV of 90 and distance of 1 ( or a Orthographic projection ) so you can omit the right-angle calculation, or you could just use a vertex shader to bypass any camera / projection / matrix calculations altogether.

K
User avatar
Ats
Posts: 762
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Problem with scaling a square to fit the full screen resolution

Post by Ats »

Thanks for your help, Kjell :wink:
I managed to get something working on all screens, using a FOV 90, distance 1, as you told:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGE Screen Ratio" ClearColor="0 1 0 1" FullScreen="255" ScreenMode="0" Camera="CameraBG" MouseVisible="255" FileVersion="2" AndroidPackageName="com.txori.screenratio">
  <OnLoaded>
    <ZExpression>
      <Expression>
<![CDATA[float r = (App.ScreenWidth*1f)/App.ScreenHeight;
BackgroundMeshSize.Scale.Y = 0.25 * tan(App.FOV*PI/360) * App.CameraPosition.Z; // WHY 0.25??
BackgroundMeshSize.Scale.X = BackgroundMeshSize.Scale.Y * r;

CameraBG.Position.X = 0;
CameraBG.Position.Y = 0;
CameraBG.Position.Z = 1;]]>
      </Expression>
    </ZExpression>
  </OnLoaded>
  <OnUpdate>
    <KeyPress Comment="Left" CharCode="37" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.X += 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Right" CharCode="39" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.X -= 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Up" CharCode="40" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.Y += 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Down" CharCode="38" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.Y -= 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Mouse click" Keys="{">
      <OnPressed>
        <ZExpression>
          <Expression>
<![CDATA[// Click left
if (App.MousePosition.X < -0.5) CameraBG.Position.X += 0.1;
// Click right
if (App.MousePosition.X > 0.5) CameraBG.Position.X -= 0.1;
// Click up
if (App.MousePosition.Y < -0.5) CameraBG.Position.Y += 0.1;
// Click down
if (App.MousePosition.Y > 0.5) CameraBG.Position.Y -= 0.1;]]>
          </Expression>
        </ZExpression>
      </OnPressed>
    </KeyPress>
  </OnUpdate>
  <OnRender>
    <UseMaterial Material="ScreenMaterial"/>
    <RenderMesh Mesh="Mesh_Screen"/>
  </OnRender>
  <Content>
    <Mesh Name="Mesh_Screen">
      <Producers>
        <MeshBox Name="BackgroundMeshSize" Scale="3.539 1.0355 1" Grid2DOnly="255"/>
      </Producers>
    </Mesh>
    <Material Name="ScreenMaterial" Color="0.7529 0.7529 0.7529 1">
      <Textures>
        <MaterialTexture Texture="BitmapScreen" TexCoords="1"/>
      </Textures>
    </Material>
    <Bitmap Name="BitmapScreen" Width="128" Height="128" Filter="1">
      <Producers>
        <BitmapExpression>
          <Expression>
<![CDATA[
if (x<=0.02 || x>=0.98 || y<=0.02 || y>=0.98) Pixel = 1;]]>
          </Expression>
        </BitmapExpression>
      </Producers>
    </Bitmap>
    <Camera Name="CameraBG" Position="0 0 1" ClipNear="0.01" ClipFar="1" FOV="90"/>
  </Content>
</ZApplication>
But it raises two questions:


Why do I have to multiply by 0.25 here!?

Code: Select all

BackgroundMeshSize.Scale.Y = 0.25 * tan(App.FOV*PI/360) * App.CameraPosition.Z;
To remove that, I have to place the camera at a distance of 4... :?


And what's going on with the ClipNear of the camera?
  • If it's 0.00, it works on the preview, but the width is too big in release
  • If it's 0.01, it's broken in preview, but works on all screens in release
  • If it's 0.10, it's broken in preview, and it displays nothing on some screens in release, while some other screens are working perfectly
User avatar
Kjell
Posts: 1915
Joined: Sat Feb 23, 2008 11:15 pm

Re: Problem with scaling a square to fit the full screen resolution

Post by Kjell »

Hi Ats,

Ehm .. there's no RefreshContent in that example. And you're using the App.CameraPosition.Z in the calculation instead of the active camera ( CameraBG ). But once you use a FOV of 90 with a distance of 1 you don't need the calculation anymore, all you need is ..

Code: Select all

BackgroundMeshSize.Scale.X = (App.ScreenWidth*1f)/App.ScreenHeight;
BackgroundMeshSize.Scale.Y = 1; // You can remove this since it's already 1
Might as well just go with orthographic instead of perspective though. So, like this ..

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGE Screen Ratio" ClearColor="0 1 0 1" FullScreen="255" ScreenMode="0" Camera="CameraBG" MouseVisible="255" FileVersion="2" AndroidPackageName="com.txori.screenratio">
  <OnLoaded>
    <ZExpression>
      <Expression>
<![CDATA[// Only need to scale mesh based on screen aspect ratio

BackgroundMeshSize.Scale.X = (App.ScreenWidth*1f)/App.ScreenHeight;]]>
      </Expression>
    </ZExpression>
    <RefreshContent Component="Mesh_Screen"/>
  </OnLoaded>
  <OnUpdate>
    <KeyPress Comment="Left" CharCode="37" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.X += 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Right" CharCode="39" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.X -= 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Up" CharCode="40" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.Y += 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Down" CharCode="38" RepeatDelay="0.15">
      <OnPressed>
        <ZExpression Expression="CameraBG.Position.Y -= 0.1;"/>
      </OnPressed>
    </KeyPress>
    <KeyPress Comment="Mouse click" Keys="{">
      <OnPressed>
        <ZExpression>
          <Expression>
<![CDATA[// Click left
if (App.MousePosition.X < -0.5) CameraBG.Position.X += 0.1;
// Click right
if (App.MousePosition.X > 0.5) CameraBG.Position.X -= 0.1;
// Click up
if (App.MousePosition.Y < -0.5) CameraBG.Position.Y += 0.1;
// Click down
if (App.MousePosition.Y > 0.5) CameraBG.Position.Y -= 0.1;]]>
          </Expression>
        </ZExpression>
      </OnPressed>
    </KeyPress>
  </OnUpdate>
  <OnRender>
    <UseMaterial Material="ScreenMaterial"/>
    <RenderMesh Mesh="Mesh_Screen"/>
  </OnRender>
  <Content>
    <Mesh Name="Mesh_Screen">
      <Producers>
        <MeshBox Name="BackgroundMeshSize" Grid2DOnly="255"/>
      </Producers>
    </Mesh>
    <Material Name="ScreenMaterial" Color="0.7529 0.7529 0.7529 1">
      <Textures>
        <MaterialTexture Texture="BitmapScreen" TexCoords="1"/>
      </Textures>
    </Material>
    <Bitmap Name="BitmapScreen" Width="128" Height="128" Filter="1">
      <Producers>
        <BitmapExpression Expression="if (x&lt;=0.02 || x&gt;=0.98 || y&lt;=0.02 || y&gt;=0.98) Pixel = 1;"/>
      </Producers>
    </Bitmap>
    <Camera Name="CameraBG" Kind="1" Position="0 0 1"/>
  </Content>
</ZApplication>
K
User avatar
Ats
Posts: 762
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Problem with scaling a square to fit the full screen resolution

Post by Ats »

Oh :oops:
Of course, it was coming from App.CameraPosition.Z
I made so much copy and paste from one project to another for trying out the android devices that I completely messed up...

As for the rest, I'll re-read everything tomorrow after a good night of sleep. That 0.25 thing out of nowhere killed me :lol:
Post Reply