From 86cc05f0d7166112bf2051a503140d949761b94a Mon Sep 17 00:00:00 2001 From: Solargale Date: Tue, 23 Jun 2020 04:18:00 -0600 Subject: [PATCH] Fixed the discrepancy between the screen coords and the game coords and also fixed mouse problem when zoomed out too far. --- Collector/Collector.csproj | 16 +- Collector/Content/Content.mgcb | 2 +- Collector/Main.cs | 14 +- Collector/OLD/Assets/air.png | Bin 1450 -> 0 bytes Collector/OLD/Assets/crosshair.png | Bin 1435 -> 0 bytes Collector/OLD/Assets/grass.png | Bin 2268 -> 0 bytes Collector/OLD/Assets/jungleGrass.png | Bin 1163 -> 0 bytes Collector/OLD/Assets/man.png | Bin 1626 -> 0 bytes Collector/OLD/Assets/roof.png | Bin 2960 -> 0 bytes Collector/OLD/Assets/sand.png | Bin 2156 -> 0 bytes Collector/OLD/Assets/snow.png | Bin 2155 -> 0 bytes Collector/OLD/Assets/stone.png | Bin 2230 -> 0 bytes Collector/OLD/Assets/tree.png | Bin 2440 -> 0 bytes Collector/OLD/Assets/wall.png | Bin 1380 -> 0 bytes Collector/OLD/Assets/water.png | Bin 1139 -> 0 bytes Collector/OLD/Assets/wood.png | Bin 3006 -> 0 bytes .../Collector/Character/InputController.java | 113 - .../LegacyJava/Collector/Character/Mouse.java | 25 - .../Collector/Character/Player.java | 68 - .../LegacyJava/Collector/Dimension/Block.java | 13 - .../Collector/Dimension/BlockMaterials.java | 29 - .../Collector/Dimension/Chunks.java | 192 -- .../Collector/Dimension/Inventory.java | 23 - .../Collector/Dimension/ItemStack.java | 14 - .../LegacyJava/Collector/Dimension/World.java | 56 - .../Collector/Dimension/WorldRenderer.java | 57 - Collector/OLD/LegacyJava/Collector/Main.java | 94 - .../LegacyJava/Collector/Restrictions.java | 23 - .../ThirdPartyCode/OpenSimplexNoise.java | 2125 ----------------- .../OLD/LegacyJava/Collector/UI/GUI.java | 55 - .../Collector/UI/InventoryInterface.java | 4 - .../OLD/LegacyJava/Collector/UI/MiniMap.java | 5 - Collector/Program.cs | 6 +- Collector/Restrictions.cs | 17 +- Collector/src/Character/InputController.cs | 372 ++- Collector/src/Character/Player.cs | 34 +- Collector/src/Character/PlayerMouse.cs | 29 +- Collector/src/Dimension/Chunks.cs | 37 +- Collector/src/Dimension/Collision.cs | 18 + Collector/src/Dimension/World.cs | 23 +- Collector/src/Dimension/WorldRenderer.cs | 4 +- Collector/src/ThirdPartyCode/QuadTree.cs | 320 --- 42 files changed, 316 insertions(+), 3472 deletions(-) delete mode 100644 Collector/OLD/Assets/air.png delete mode 100644 Collector/OLD/Assets/crosshair.png delete mode 100644 Collector/OLD/Assets/grass.png delete mode 100644 Collector/OLD/Assets/jungleGrass.png delete mode 100644 Collector/OLD/Assets/man.png delete mode 100644 Collector/OLD/Assets/roof.png delete mode 100644 Collector/OLD/Assets/sand.png delete mode 100644 Collector/OLD/Assets/snow.png delete mode 100644 Collector/OLD/Assets/stone.png delete mode 100644 Collector/OLD/Assets/tree.png delete mode 100644 Collector/OLD/Assets/wall.png delete mode 100644 Collector/OLD/Assets/water.png delete mode 100644 Collector/OLD/Assets/wood.png delete mode 100644 Collector/OLD/LegacyJava/Collector/Character/InputController.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Character/Mouse.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Character/Player.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/Block.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/BlockMaterials.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/Chunks.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/Inventory.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/ItemStack.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/World.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Dimension/WorldRenderer.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Main.java delete mode 100644 Collector/OLD/LegacyJava/Collector/Restrictions.java delete mode 100644 Collector/OLD/LegacyJava/Collector/ThirdPartyCode/OpenSimplexNoise.java delete mode 100644 Collector/OLD/LegacyJava/Collector/UI/GUI.java delete mode 100644 Collector/OLD/LegacyJava/Collector/UI/InventoryInterface.java delete mode 100644 Collector/OLD/LegacyJava/Collector/UI/MiniMap.java create mode 100644 Collector/src/Dimension/Collision.cs delete mode 100644 Collector/src/ThirdPartyCode/QuadTree.cs diff --git a/Collector/Collector.csproj b/Collector/Collector.csproj index 806d792..1f1a548 100644 --- a/Collector/Collector.csproj +++ b/Collector/Collector.csproj @@ -8,18 +8,32 @@ + + + - + + + + + + + + + + + + diff --git a/Collector/Content/Content.mgcb b/Collector/Content/Content.mgcb index c6502b0..31b3512 100644 --- a/Collector/Content/Content.mgcb +++ b/Collector/Content/Content.mgcb @@ -152,7 +152,7 @@ /processorParam:ColorKeyEnabled=True /processorParam:GenerateMipmaps=False /processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False +/processorParam:ResizeToPowerOfTwo=True /processorParam:MakeSquare=False /processorParam:TextureFormat=Color /build:man.png diff --git a/Collector/Main.cs b/Collector/Main.cs index ab342ef..0a3047d 100644 --- a/Collector/Main.cs +++ b/Collector/Main.cs @@ -18,7 +18,9 @@ namespace Collector private InputController _inputController; private Player _player; private PlayerMouse _playerMouse; - private OrthographicCamera _cam; + private static OrthographicCamera _cam; + public static int VirtualWidth; + public static int VirtualHeight; private WorldRenderer WorldRenderer { get; set; } public static Dictionary Materials { get; } = new Dictionary(); @@ -40,12 +42,16 @@ namespace Collector { Materials.Add(name,Content.Load(name.ToString())); } + + VirtualWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; + VirtualHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; - var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480); + var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, VirtualWidth, VirtualHeight); _player = new Player(0, 0); _cam = new OrthographicCamera(viewportAdapter); - _cam.LookAt(new Vector2(Player.X, Player.Y)); - + _cam.LookAt(new Vector2(Player.X+IRestrictions.TileSize/2, Player.Y+IRestrictions.TileSize/2)); + _cam.Zoom = IRestrictions.Zoom; + _spriteBatch = new SpriteBatch(GraphicsDevice); _playerMouse = new PlayerMouse(Content, _spriteBatch, _cam); _inputController = new InputController(_playerMouse, _cam, _spriteBatch, Content); diff --git a/Collector/OLD/Assets/air.png b/Collector/OLD/Assets/air.png deleted file mode 100644 index 22d5f8a3ef41351e3b32db68b3f562a379c10793..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1450 zcmV;b1y%ZqP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=HGcH}4whTmDmECES?#Bwl~b7lv#{Q1GyNhO`` zBvTLb5K{&$WJ%})T(1A~_i%sVVlU=GR7*J}k1OPmxu9eIyvnM{hgI(fe{~+@?jB%> z1g)HpmbSb@&d}#AuiH+6JiaoN`yMzR2g)|YwjEp^wZ?BJ{cdx_W*dMUoJ^DbtX}gO;;yoa5D5bmo zrJUkr=ndAz?v>|cx911B+3n&?_JwcWV>BD1pR+3=VajPw>YB>xLGPH^T5ly3^~qro z8alIN6vMWtSWC@Uf1p&##6UABP@_VF`f4jxgc!K9qGhg*WeE*1GFO>!!z?sdB})?n z?208Jkn$Z1Ew_2Ot7N`8-w3KqFgDl6w~PC%;#hlv$lIMO#Km*fAqr2xKO3ll2#uZ8 zxDtGox7XwaHokQ(#ztK1zMmO(Vm-_v~2@O5nM+ELjnRmkwi*}NST!g zi8KHz2%RPH0Rj{wHw4K+BmoZgFnr@3rKQS|PcaTd2~MIUY(E2`0$3qLtRD@AHB_R+ z5MxYHqs1Ick~DW%N}A@WT2wS>)TFBBG;1-jV9}DPnPn@Pv*6T?8T&C?&bbsgEwEhh zc7Z}E2On~TBOd9{!;b8ZQn7q$sIjK1)oQM#ag&C9+)~qKEw|FCV=48}V^3YX_1w$A zQX4YDh$9Vk!$uzErna%ZD_@{Sn;I`tQ&Defkg8rLXdWkVG6OLV1mFs4AcloKnR%lS zc#@mUd}i#5$Otk{IE^MT5Dc9-4!YTGat>L13OA>=xbc4_=O(&Ol6%kXSJc}4Jl93+ z+=er$Ua3i?zM7A%^cRu)KzuYcD*{7gLgbM%ck-nQ-;`FZ~9Dn_Cq^uLvTH2u3k2F;kxt#S}cp*FAiEy^HfK z?{j~S9wl!wz$XyTGTpF!Lh4`F!#GnfjKXP4m`HgeYVL#7|8kzJw zagga5(rZq35PxSJG709`M({V@cDc7bNy zw!e>UyLkcxo`EZ^?XNa~nNQN|Z7p^L^lk$e*KJMS11@)f{wG~BBu5I+^cM=i`x$*x z4(PiDy4T#^TKhPC05a57>IOJC1cr;0z3%buaA$A-o@w>>1EK_Sy6vv;UH||924YJ` zL;(K){{a7>y{D4^000SaNLh0L04^f{04^f|c%?sf00007bV*G`2jm0^5)lezC#P-z z000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0000jNklG7tlh^`LS{1poj4XJBF&1*2eifC0}7jFe_)0B?*J_4J1DZvX%Q07*qoM6N<$ Eg7vnNE&u=k diff --git a/Collector/OLD/Assets/crosshair.png b/Collector/OLD/Assets/crosshair.png deleted file mode 100644 index 5635c25430c9af46a27007242fdb968d604e82c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1435 zcmV;M1!Ve(P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=HGcH}4whTmDmECES?#Bwl~b7lv#{Q1GyNhO`` zBvTLb5K{&$Koa`6lByBioH zK`G~_r7iD}Gy3zE*R7{O9$zWSeK#DB4P`50+XgO++mO&{z_+caY(>J`ayY+_Z8>Gr z*HhTz{MhX)40zqlf+(k$NCWb~UNvRZjeStWt;IEv^BfnCOVQ)EySgIs%w0(Q%K7wC z&bQzdUqbO{coR-ymznN-`F3p-ZlC_zG=IQLgL*ZZz!d^ z{H2`YrRWXT#qO2mWVhu9x!G;v4EBX@zGE~Sqo1=YAz{jCPwJY=s-fR8qqRmQB=yN* z5gIBpWh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%3Hd(rOoW56xk)+wYT}bpXf&C-c57=hEO7y+Z`=C zCC!Hay`9{C*_&VHGnP&J81|0y)lPQv*NJ@LM^Q0<1EX`$^{K$3L|nWrS; zby?xO#aXS?SnHnrg`vE*vdndwLr7o|OGrV4j2g+gyEO}w6K+x{4s^ZP_Qx;~+y$C-+x|Yb?dA#Ke+I6!w!hi{W_CX>@2HM@dakSAh-}0003uNklU$5}-}h!VR-N**9i5)_4iYUA7I zG=O(}XN&!|kI+ diff --git a/Collector/OLD/Assets/jungleGrass.png b/Collector/OLD/Assets/jungleGrass.png deleted file mode 100644 index ecff7a219dcc0af21f626653c45e901bcf4bac10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1163 zcmV;61a$j}P)EX>4Tx04R}tkv&MmKpe$i(`rRp9PA+CkfAzR5f#x*t5Adrp;l+0Yt2!bCVPL58BE>hzEl0u6Z503ls?%w0>9U#<8OtS)`fTmZ> zR3a{BvMXZn6#;Z2jA@L>%ra&rDGAThj* ziotoGIKqmuN_UyKw^epMfjASU6!LlC{fxdT3-sOs-K%bI&3&9c0BPzfc>^3A z0z(DLUh{Z&S9@>&o@w^?1Eh~~yWu%=F8}}l32;bRa{vG?BLDy{BLR4&KXw2B00(qQ zO+^Rf1O^TO0qk=Zv;Y7A8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b z0(414K~yNu1;NQq69F8+;onSKx&oD=bZDiUMWjU(+%bZp2N$Boc<^MxoA@HWf$`u? zW8xB*h(?2mQKQzdYRh!*(AoZeAKs3SHQ0vVP-9URsKYYUIVIzipaMF_7w zc2;6N{oktV8%9Na>b#?eZMz20VvWC;JgL5KW8l!i=sMQP*r8EIC_w{yjUbz_#$`E4 zTj4D;Qk;}*pAkYQX$?|gR*o#n!nmYp0y?vDgb$?cp$W;P?4gJeM28LLWt#7tkTG;F z%5>gMu!S<}CJRdTVf6)o%Xlo+adv&GcT7n?D!pQ#is_;=o1F~ccW{(jGWTHn87_MV z`^&3!5}<+ysvw|nE;AV-puo%BWm6o5b+8ysCBsUfV%OK|Wy(yBWv40JUw`C@c^%8n zgyV+WJ>W~a2(;iURG~sa(waHICe+|Fx8*!la*j4GDL#;~P51|G zl`UYIt8%(18Metf@d?S$f-+;WpA9m0oPW&Ably!2b@yD5DTd8h&e2$5MvAnd#)M?3 z5a{@Gjz%5YD&M#%=kCfCHu0*8(xdtq!Jtc-OQ~Z|mfjO(SGt8@uHtVT@F%QM`+4`H dZZ~JN;(u=xA?l4CsXPDx002ovPDHLkV1fiJ7IXjr diff --git a/Collector/OLD/Assets/man.png b/Collector/OLD/Assets/man.png deleted file mode 100644 index aa2beb9f6e9c326b2a8d806264060f4ffb224ea3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1626 zcmdUvYgZFj6ow}ft`!1O5D^GyUA3ZupjNp@!9b-_EEShP1BfCZMpmpK6(#~o#VF8v zsUQR!7GkXgM8H%bRD=XAM4%WEg+MR^Bqow@Ny22N6R=;}U(oYm*531;ea@QwytB`L zwTEnOW^V=nfO$x8;9da0VIe>_F~Xi>4NZChN83x@0n~ImOaOq<$032Fh>RQW-t?TT zTxS{3Gh3rUDcxCbRqf zN7^Z#b_=jp@@wRFgti$t5)XPDhIyjGDdA?|mX1L(6ot)F2WQ(FQV02RH_#aD3#|A& z%!M40i`~Mf_*#uirBdO(#5slUg;s%pILl?A_oy!WW75GwVKxQflUkYEdpeM*lTakz5O(BaU83h%PaK*FG$vYMokJ z8ama^24D?%&Q5(0zDdM$l3n@!JVe8rFSVyW{~%p(^IZMa z!%re2uov6Fes_^~k4yE&HfQYSI;13@KA6Vi-Vbye#OqnfxbS4F0TdtBR6M!yo#dBT)QU`U(a^sC#$QjPZl}uZY2K01PJiEYrVX?V)W%7VybRP@5A45{QV}ypcA@cAZ@BiGXv1i_5i>~EF554 zbsMJ^XS3!r)`A7-32v?&)Of2)CAil~StqiQE4qFaAaC^Z@<*Q{B^Rlj#i-Yu`fxFt z%%`VE5zCn1A#PkiY+S)|BaT!%4#TeV7rqD5V-^&!zc)5L`a`I1E zaw>-AwC@g=t{2I>;#7iQB!`^Ngb(nj{B zRH`T)T}0Wxy?l(b%L|=8hU`JAuAMRS3w~~cv9|+fq^-FxNMhz+;I5O=a4J%zz{#RY z83d2_kT&s$GyWY!Eve{EV-8G{F~LWu`0XE_1&^6hri&3)Oe2WYr$$M4SV~CKlscGw zM!C1}|fhE`fI8`k@j4c6D$YecZfdk^h}B1f0Ohi;-!k l_Z`&aZc^+1zjSiwQ`EhQe=EKInUx+*NYI|ZnjNt@e*+y;VpsqG diff --git a/Collector/OLD/Assets/roof.png b/Collector/OLD/Assets/roof.png deleted file mode 100644 index 21534abea4aead6a410e68ee1f69f90702cabe93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2960 zcmV;B3vcv^P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvvg9ZX{O1&N1SB?b95zSH4d(chfWY-$cTdb# zjw;(Ml2E3WGUJcmAM+bN?4lSSlEfUN#m8r#x!^(U{*?7g)~{cEvFG8-xVaOIA&0x$ zuM%~9V4Sg@b-byZg7NSnC=Z>eUnhzRVo?Q0qbhQ=71*wViVAY9n*DySsySv!pGVMr z_R;y}27Jx@@h));k&?%+XPZ*Ycow!k!EZgRjhyGcP>-Om@8&FJ*u=w;v+I|)m2Q6v zzJC2?J|l#yxZu*Z)&Me?fak2fW&4+(Us-QH%~#mJzGC{dpRV|bBS$^dIm&v%x;nkJc12vtMgtNG z9_E#C3Bsa*OWihGaW%@sfbtw$M_Wm%2t`yRn_HlnKJXo_~Ltzq{~RF+pVI`U-aOWF4%q1o-C-%YXeR3te6H`GiK_#GVYyjwz+$V}B5I(QTy6pFurT1hgP2lR0dNsi2N;7O@nj>pKoJ%t z=0pTX3IHlFot@_j1SkaVFp|A<5#S((p&NS=t)(1z4= zptL}8!R~?urBtr2`WkAisY=bJmInGX-$IKmHEFq(&fRsyagRN9>A9C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z8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b03At0K~y-)W4yI8;y(ig mfQf-ZFlxZ40iy;C76Sm(B?9{OEAVsx0000>UTN- diff --git a/Collector/OLD/Assets/water.png b/Collector/OLD/Assets/water.png deleted file mode 100644 index 8a0445194d021426c51e1d30892dfcc308ca5b37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1139 zcmV-(1dRKMP)EX>4Tx04R}tkv&MmKpe$i)0V1K9PA+K5TQC*5EXIMDionYs1;guFuC+YXws0h zxHt-~1qVMCs}3&Cx;nTDg5U>;lcSTOi%KKJM7R&y2ud?N7-Gt3I{I`PzI z#o)Y89AQOSB|aw}HR*!Hk6c$=e&bwlSm2ovGo6|vju4B5Hdfl06-|wJk~perI^_!) zmsQSNoV8MwHSft^7|!X-OI)Wphy)g}2niw-RIz~)Du~gllVTx7`*9C{zvGw4rI2d_ zj2!bQLxb%2!T;cQw^n{)+)WC{f#8d6e+&bmU7%63?eAmTZkz!AXW&Y2`O9@+`jhlp zON$->J=?&=bxTwBfXf}A@5zu&*^&G-g?t`(KcjET0=>6D*Q(oFb04P_CX>@2HM@dakSAh-}0006?NklN);;0$$Dj4A3zWiB+j233;mYypfL7)Hm?jWG zVnjlqs6vd$Sr_^kp;iWW0J{AnZ_CW&4rY9mLTnmBj5yFsq|F&ZKw=17#}QJZ)Jh*C zlNp3S3<0QoYg_(5jR^BRLn(+&6Vf!`&Q2oNQeeD+Dh?2Ye};jVuA>tHV6Xx?uaRh5 zd|AK@r$PuE_K$Fn5MzX#`D?f`-y?oa6RikcN(g2gwp(8Idv2-#e45erd!AFmmSyEO z=a@66+(1gqwKA!ap4*o9Qg~k$2mw@i-ac^F1vlfc+2FM@#mJ9&Ua>{)@dEN?&LJgU zw%ZjqCC<9=y=l=>cvt1-j@An9;Evxn?xaQnU+(<8-4KzLqBABs0D-AiyjCvL#33d6+@S6(=DhShY_{;QLl9Z}u9X1PTA>td zp7}A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ZbQ^^kk_@3P<_G(c+vCTpvw$fcq; zoPdD!<~)sRK%*M4-khgYlHPDaE)}aQ%S0pxabBXeV&vxKE2w0|&FwvW$L8d#6*|M1 zTRTVG+Bu>-N;z471>do`xxI&$$Gmyv>e4V5rBU|;OU(xNcb^c=d4#UXU>vjibB`lA?_^~e1Y z>0rbgjfn0jMVXeZEVwW-x>9JB}IvZNY% z>~{uOh7Le3OPWzgE)`i;P_G62wSPo62i>)dPlM4RD;pb3vV#6Np^%Ex^$JnwQw=@l zLx=7#p+8QrOdZ$M`2L%(xjk?&CWR7@TElYb_kGq+)kuqyN9~xrkfgZ;z%g~6#ThF# z4_yeh9`3Q*hN(bkt`0}a7eD>*EmF5JOqcV^3;2#nqZ-nvhWL)j`Q-%++aoJ=zWee= zx?UhcT_LWX@sO&-QwfU><)ybSk&iooK>cHrHnRyUh`4k24uAF$BJ?l>h!0kL(p;es zY#Ip&O3j)LrJC8MX*0>y6p9k@YvJPwiEZlq4Pg{CzY1Eyxc~qF07*qoM6N<$f_iVO AQ~&?~ diff --git a/Collector/OLD/LegacyJava/Collector/Character/InputController.java b/Collector/OLD/LegacyJava/Collector/Character/InputController.java deleted file mode 100644 index 7e5d613..0000000 --- a/Collector/OLD/LegacyJava/Collector/Character/InputController.java +++ /dev/null @@ -1,113 +0,0 @@ -package Collector.Character; - -import Collector.Main; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input; -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.math.Vector3; -import Collector.Dimension.Chunks; -import Collector.Restrictions; - -import java.util.HashMap; - -public class InputController implements Restrictions { - - private Player player; - private HashMap> animations; - private Mouse mouse; - int i = 0; - - public InputController(Player player, Mouse mouse) { - this.player = player; - this.mouse = mouse; - animations = new HashMap<>(); - animations.put("Up", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Up"))); - animations.put("UpRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpRight"))); - animations.put("UpLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "UpLeft"))); - animations.put("Down", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Down"))); - animations.put("DownRight", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownRight"))); - animations.put("DownLeft", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "DownLeft"))); - animations.put("Left", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Left"))); - animations.put("Right", new Animation<>(1 / 4f, player.getTextureAtlas().findRegions(player.getSpriteName() + "_" + "Right"))); - } - - public void handleInput() { - i++; - if (Gdx.input.isKeyPressed(Input.Keys.Q)) { - Main.cam.zoom += 5; - } - if (Gdx.input.isKeyPressed(Input.Keys.E)) { - Main.cam.zoom -= 5; - } - if ((Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) || Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT) )&& i > KEY_DELAY) { - Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); - Main.cam.unproject(mousePos); - int x = mouse.getSelectedX(mousePos) >> TILE_SHIFT; - int y = mouse.getSelectedY(mousePos) >> TILE_SHIFT; - if(Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) { - i = 0; - Chunks.placeBlock(x, y, "wood"); - } - if (Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) { - i = 0; - Chunks.removeBlock(x,y); - } - } - - if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("UpLeft")); - Player.addX(-MOVEMENT_SPEED); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.W) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("UpRight")); - Player.addX(MOVEMENT_SPEED); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(MOVEMENT_SPEED, MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("DownLeft")); - Player.addX(-MOVEMENT_SPEED); - Player.addY(-MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, -MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("DownRight")); - Player.addX(MOVEMENT_SPEED); - Player.addY(-MOVEMENT_SPEED); - - Main.cam.translate(MOVEMENT_SPEED, -MOVEMENT_SPEED); - } - else if (Gdx.input.isKeyPressed(Input.Keys.A) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Left")); - Player.addX(-MOVEMENT_SPEED); - Main.cam.translate(-MOVEMENT_SPEED, 0); - } - else if (Gdx.input.isKeyPressed(Input.Keys.D) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Right")); - Player.addX(MOVEMENT_SPEED); - Main.cam.translate(MOVEMENT_SPEED, 0); - } - else if (Gdx.input.isKeyPressed(Input.Keys.S) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Down")); - Player.addY(-MOVEMENT_SPEED); - Main.cam.translate(0, -MOVEMENT_SPEED); - } - if (Gdx.input.isKeyPressed(Input.Keys.W) && i > KEY_DELAY) { - i = 0; - player.setAnimation(animations.get("Up")); - Player.addY(MOVEMENT_SPEED); - Main.cam.translate(0, MOVEMENT_SPEED); - } - Main.cam.update(); - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Character/Mouse.java b/Collector/OLD/LegacyJava/Collector/Character/Mouse.java deleted file mode 100644 index 2f7f713..0000000 --- a/Collector/OLD/LegacyJava/Collector/Character/Mouse.java +++ /dev/null @@ -1,25 +0,0 @@ -package Collector.Character; - -import Collector.Restrictions; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.math.Vector3; - -public class Mouse implements Restrictions { - Texture crosshair; - - public Mouse() { - this.crosshair = new Texture("assets/crosshair.png"); - } - - public Texture getCrosshair() { - return crosshair; - } - - public int getSelectedX(Vector3 mousePos) { - return ((int)(mousePos.x)>>4)<<4; - } - - public int getSelectedY(Vector3 mousePos) { - return ((int)(mousePos.y)>>4)<<4; - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Character/Player.java b/Collector/OLD/LegacyJava/Collector/Character/Player.java deleted file mode 100644 index beb933a..0000000 --- a/Collector/OLD/LegacyJava/Collector/Character/Player.java +++ /dev/null @@ -1,68 +0,0 @@ -package Collector.Character; - -import Collector.Restrictions; -import Collector.Dimension.Inventory; -import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.badlogic.gdx.utils.Array; - -public class Player implements Restrictions { - public static int x; - public static int y; - private String spriteName; - private TextureAtlas textureAtlas; - private Animation animation; - private Inventory playerInventory; - - public Player(int x, int y) { - //Player location - Player.x = x< keyFrames = textureAtlas.findRegions(spriteName + "_Down"); - float frameDuration = 1 / 4f; - animation = new Animation<>(frameDuration, keyFrames); - } - - public static int getX() { - return x; - } - - public static int getY() { - return y; - } - - public static void addX(int x){ - Player.x += x; - } - - public static void addY(int y){ - Player.y += y; - } - - public String getSpriteName() { - return spriteName; - } - - public Animation getAnimation() { - return animation; - } - - public void setAnimation(Animation animationTemp) { - animation = animationTemp; - } - - public void dispose(){ - textureAtlas.dispose(); - } - - public TextureAtlas getTextureAtlas() { - return textureAtlas; - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/Block.java b/Collector/OLD/LegacyJava/Collector/Dimension/Block.java deleted file mode 100644 index 5e77709..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/Block.java +++ /dev/null @@ -1,13 +0,0 @@ -package Collector.Dimension; - -public class Block { - private final String name; - - public Block(String name) { - this.name = name; - } - - public String getName() { - return name; - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/BlockMaterials.java b/Collector/OLD/LegacyJava/Collector/Dimension/BlockMaterials.java deleted file mode 100644 index 7cadbb8..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/BlockMaterials.java +++ /dev/null @@ -1,29 +0,0 @@ -package Collector.Dimension; - -import com.badlogic.gdx.graphics.Texture; - -import java.util.HashMap; - -public class BlockMaterials { - public static HashMap materials = new HashMap<>(); - public static HashMap textures = new HashMap<>(); - - //Private so the singleton can't be instantiated - private BlockMaterials() {} - - public static void create(){ - materials.put("grass",new Block("grass")); - materials.put("wood",new Block("wood")); - materials.put("water",new Block("water")); - materials.put("stone",new Block("stone")); - materials.put("snow",new Block("snow")); - materials.put("sand",new Block("sand")); - materials.put("air",new Block("air")); - materials.put("roof",new Block("roof")); - materials.put("wall",new Block("wall")); - - for (String s:BlockMaterials.materials.keySet()) { - textures.put(s,new Texture("assets/" + s + ".png")); - } - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/Chunks.java b/Collector/OLD/LegacyJava/Collector/Dimension/Chunks.java deleted file mode 100644 index bebcc65..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/Chunks.java +++ /dev/null @@ -1,192 +0,0 @@ -//https://www.redblobgames.com/maps/terrain-from-noise/ -package Collector.Dimension; - -import com.github.czyzby.kiwi.util.tuple.immutable.Triple; -import Collector.ThirdPartyCode.OpenSimplexNoise; - -import java.util.HashMap; - -import static Collector.Dimension.BlockMaterials.materials; -import static Collector.Restrictions.*; - -public class Chunks { - public static HashMap, Block> loadedChunks = new HashMap<>(); - public static HashMap, Block> savedChunks = new HashMap<>(); - public static OpenSimplexNoise gen1 = new OpenSimplexNoise(SEED + 1); - public static OpenSimplexNoise gen2 = new OpenSimplexNoise(SEED); - - public static void createStructures() { - int i = 10; - setBlock(3 + i, 2,1,"wall"); - setBlock(4 + i, 2,1,"wall"); - setBlock(3 + i, 3,1, "roof"); - setBlock(4 + i, 3,1,"roof"); - } - - public static void setBlock(int x, int y,int z, String name) { - loadedChunks.put(new Triple<>(x, y, z), materials.get(name)); - savedChunks.put(new Triple<>(x, y, z), materials.get(name)); - } - - public static void placeBlock(int x, int y, String name){ - Triple triple = new Triple<>(x, y, 1); - if(Chunks.loadedChunks.get(triple).getName().equals("air")) { - Chunks.loadedChunks.replace(triple, Chunks.loadedChunks.get(triple), materials.get(name)); - Chunks.savedChunks.replace(triple, Chunks.savedChunks.get(triple), materials.get(name)); - } - } - - public static void removeBlock(int x, int y){ - Triple triple = new Triple<>(x, y, 1); - if(!Chunks.loadedChunks.get(triple).getName().equals("air")) { - Chunks.loadedChunks.replace(triple, Chunks.loadedChunks.get(triple), materials.get("air")); - Chunks.savedChunks.replace(triple, Chunks.savedChunks.get(triple), materials.get("air")); - } - } - - public static void ungenerateChunk(int x, int y) { - int startX = x << CHUNK_SHIFT; - int startY = y << CHUNK_SHIFT; - int endX = startX + CHUNK_SIZE; - int endY = startY + CHUNK_SIZE; - - //Going from start of selected chunk to end of selected chunk in x and y - for (int i = startX; i != endX; i++) { - for (int j = startY; j != endY; j++) { - loadedChunks.remove(new Triple<>(i, j, 0), getTerrain(i, j)); - } - } - //Second Layer - for (int i = startX; i != endX; i++){ - for (int j = startY; j != endY; j++) { - Triple triple = new Triple<>(i, j,1); - loadedChunks.remove(triple, loadedChunks.get(triple)); - } - } - } - - public static void generateChunk(int x, int y) { - int startX = x << CHUNK_SHIFT; - int startY = y << CHUNK_SHIFT; - int endX = startX + CHUNK_SIZE; - int endY = startY + CHUNK_SIZE; - - //Going from start of selected chunk to end of selected chunk in x and y - for (int i = startX; i != endX; i++) { - for (int j = startY; j != endY; j++) { - Triple triple = new Triple<>(i, j, 0); - if(savedChunks.get(triple) != null){ - loadedChunks.put(triple,savedChunks.get(triple)); - } - else { - loadedChunks.put(triple, getTerrain(i, j)); - savedChunks.put(triple, getTerrain(i,j)); - } - } - } - - //Second Layer - for (int i = startX; i != endX; i++){ - for (int j = startY; j != endY; j++) { - Triple triple = new Triple<>(i, j,1); - loadedChunks.put(triple, getBlocks(i,j,1)); - savedChunks.put(triple, getBlocks(i,j,1)); - } - } - } - - public static Block getBlocks(int x, int y, int z) { - return savedChunks.getOrDefault(new Triple<>(x, y, z), new Block("air")); - } - - public static double noise1(double nx, double ny) { - return gen1.eval(nx, ny) / 2 + 0.5; - } - - public static double noise2(double nx, double ny) { - return gen2.eval(nx, ny) / 2 + 0.5; - } - - public static Block getTerrain(int x, int y) { - double moisture, elevation, nx, ny; - double scale = 0.01; - nx = x * scale; - ny = y * scale; - elevation = (0.17 * noise1(1 * nx, 1 * ny) - + 0.42 * noise1(2 * nx, 2 * ny) - + 0.16 * noise1(4 * nx, 4 * ny) - + 0.00 * noise1(8 * nx, 8 * ny) - + 0.00 * noise1(16 * nx, 16 * ny) - + 0.03 * noise1(32 * nx, 32 * ny)); - elevation /= (0.17+0.42+0.16+0.00+0.00+0.03); - elevation = Math.pow(elevation, 3.00); - moisture = (1.00 * noise2( 1 * nx, 1 * ny) - + 0.00 * noise2( 2 * nx, 2 * ny) - + 1.00 * noise2( 4 * nx, 4 * ny) - + 0.00 * noise2( 8 * nx, 8 * ny) - + 0.00 * noise2(16 * nx, 16 * ny) - + 0.00 * noise2(32 * nx, 32 * ny)); - moisture /= (0.00+1.00+0.00+0.00+0.00+0.00); - - return getBiomeBlock(moisture, elevation); - } - - public static Block getBiomeBlock(double moisture, double elevation) { - String biome = getBiome(moisture, elevation); - if (biome.equals("Tundra")) return materials.get("snow"); - if (biome.equals("Taiga")) return materials.get("snow"); - if (biome.equals("Snow")) return materials.get("snow"); - - if (biome.equals("Grassland")) return materials.get("grass"); - if (biome.equals("Shrubland")) return materials.get("grass"); - if (biome.equals("TemperateDeciduousForest")) return materials.get("grass"); - - if (biome.equals("TemperateRainForest")) return materials.get("grass"); - if (biome.equals("TropicalSeasonalForest")) return materials.get("grass"); - if (biome.equals("TropicalForest")) return materials.get("grass"); - if (biome.equals("TropicalRainForest")) return materials.get("grass"); - - if (biome.equals("Beach")) return materials.get("sand"); - if (biome.equals("Bare")) return materials.get("sand"); - if (biome.equals("Scorched")) return materials.get("sand"); - if (biome.equals("TemperateDesert")) return materials.get("sand"); - if (biome.equals("SubtropicalDesert")) return materials.get("sand"); - - return materials.get("water"); - } - - public static String getBiome(double moisture, double elevation) { - if (elevation < 0.1) return "Ocean"; - if (elevation < 0.12) return "Beach"; - - if (elevation > 0.8) { - if (moisture < 0.1) return "Scorched"; - if (moisture < 0.2) return "Bare"; - if (moisture < 0.5) return "Tundra"; - return "Snow"; - } - - if (elevation > 0.6) { - if (moisture < 0.33) return "TemperateDesert"; - if (moisture < 0.66) return "Shrubland"; - return "Taiga"; - } - - if (elevation > 0.3) { - if (moisture < 0.16) return "TemperateDesert"; - if (moisture < 0.50) return "Grassland"; - if (moisture < 0.83) return "TemperateDeciduousForest"; - return "TemperateRainForest"; - } - - if (moisture < 0.16) return "SubtropicalDesert"; - if (moisture < 0.33) return "Grassland"; - if (moisture < 0.66) return "TropicalSeasonalForest"; - return "TropicalRainForest"; - } - - public static Boolean isEmpty(int x, int y){ - return loadedChunks.get(new Triple<>(x * 8, y * 8,0)) == null; - } - -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/Inventory.java b/Collector/OLD/LegacyJava/Collector/Dimension/Inventory.java deleted file mode 100644 index 291cf27..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/Inventory.java +++ /dev/null @@ -1,23 +0,0 @@ -package Collector.Dimension; - -import java.util.LinkedList; - -public class Inventory { - private LinkedList inventory = new LinkedList(); - - public LinkedList getInventory() { - return inventory; - } - - public void setInventory(LinkedList inventory) { - this.inventory = inventory; - } - - public void addItem(Block block){ - inventory.add((ItemStack) block); - } - - public void removeItem(ItemStack itemStack){ - inventory.remove(itemStack); - } -} \ No newline at end of file diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/ItemStack.java b/Collector/OLD/LegacyJava/Collector/Dimension/ItemStack.java deleted file mode 100644 index 9ba79b3..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/ItemStack.java +++ /dev/null @@ -1,14 +0,0 @@ -package Collector.Dimension; - -import Collector.Dimension.Block; - -public class ItemStack extends Block { - int value; - int quantity; - - public ItemStack(String name, int value, int quantity) { - super(name); - this.value = value; - this.quantity = quantity; - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/World.java b/Collector/OLD/LegacyJava/Collector/Dimension/World.java deleted file mode 100644 index 6a59f53..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/World.java +++ /dev/null @@ -1,56 +0,0 @@ -package Collector.Dimension; - -import Collector.Character.Player; - -import static Collector.Restrictions.*; - -public class World { - public static void generateWorld(int x, int y) { - if (Chunks.isEmpty(x, y)) { - Chunks.generateChunk(x, y); - } - } - - public static void ungenerateWorld(int x, int y) { - if (!Chunks.isEmpty(x, y)) { - Chunks.ungenerateChunk(x, y); - } - } - - public static void loadChunks() { - for (int i = -(RENDER_DISTANCE); i < RENDER_DISTANCE; i++) { - for (int j = -(RENDER_DISTANCE); j < RENDER_DISTANCE; j++) { - generateWorld( - i + Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE), - j + Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE) - ); - } - } - } - - public static void unloadChunks() { - for (int i = -RENDER_DISTANCE; i < RENDER_DISTANCE+1; i++) { - //Down - ungenerateWorld( - Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i, - (Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+3 - ); - //Up - ungenerateWorld( - Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+i-1, - (Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))-4 - ); - //Right - ungenerateWorld( - Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)-4, - (Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i - ); - //Left - ungenerateWorld( - Player.getX() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE)+3, - (Player.getY() / (TILE_SIZE * SUPER_CHUNK_SIZE * CHUNK_SIZE))+i - ); - } - - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Dimension/WorldRenderer.java b/Collector/OLD/LegacyJava/Collector/Dimension/WorldRenderer.java deleted file mode 100644 index f699d1c..0000000 --- a/Collector/OLD/LegacyJava/Collector/Dimension/WorldRenderer.java +++ /dev/null @@ -1,57 +0,0 @@ -package Collector.Dimension; - -import Collector.Character.Player; -import Collector.Main; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.g2d.Batch; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.math.Vector3; -import com.badlogic.gdx.scenes.scene2d.Stage; -import com.github.czyzby.kiwi.util.tuple.immutable.Triple; -import Collector.Character.InputController; -import Collector.Character.Mouse; -import Collector.Restrictions; - -import java.util.Iterator; - -public class WorldRenderer implements Restrictions { - private Mouse mouse; - private InputController inputController; - private Player player; - - public WorldRenderer(InputController inputController, Mouse mouse, Player player) { - this.inputController = inputController; - this.mouse = mouse; - this.player = player; - } - - public void drawWorld(SpriteBatch batch, int layer) { - for (Triple chunkpair : Chunks.loadedChunks.keySet()) { - if (chunkpair.getThird() == layer) { - batch.draw( - BlockMaterials.textures.get(Chunks.loadedChunks.get(chunkpair).getName()), - chunkpair.getFirst() << TILE_SHIFT, - chunkpair.getSecond() << TILE_SHIFT - ); - } - } - } - - private void mouseCrosshair(SpriteBatch batch) { - Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); - Main.cam.unproject(mousePos); - int x = mouse.getSelectedX(mousePos); - int y = mouse.getSelectedY(mousePos); - batch.draw(mouse.getCrosshair(), x, y); - } - - public void render(SpriteBatch batch, float timeSinceLastUpdate) { - //Higher means draws in a lower layer - drawWorld(batch,0); - batch.draw(player.getAnimation().getKeyFrame(timeSinceLastUpdate, true), Player.x, Player.y,TILE_SIZE,TILE_SIZE); - drawWorld(batch,1); - mouseCrosshair(batch); - inputController.handleInput(); - batch.setProjectionMatrix(Main.cam.combined); - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Main.java b/Collector/OLD/LegacyJava/Collector/Main.java deleted file mode 100644 index 0c53f0f..0000000 --- a/Collector/OLD/LegacyJava/Collector/Main.java +++ /dev/null @@ -1,94 +0,0 @@ -package Collector; - -import Collector.Dimension.*; -import com.badlogic.gdx.ApplicationAdapter; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.GL30; -import com.badlogic.gdx.graphics.OrthographicCamera; -import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.utils.viewport.ExtendViewport; -import Collector.Character.InputController; -import Collector.Character.Mouse; -import Collector.Character.Player; -import Collector.UI.GUI; - -import static Collector.Restrictions.*; - -public class Main extends ApplicationAdapter { - private Stage stage; - private SpriteBatch batch; - private WorldRenderer worldRenderer; - private GUI gui; - private ExtendViewport extendViewport; - public static float chunkLoadingTime = 0; - float playerAnimationTime = 0f; //accumulator - public static OrthographicCamera cam; - private InputController inputController; - private Mouse mouse; - private Player player; - - - @Override - public void create () { - Gdx.graphics.setWindowedMode(1024, 576); - - //Declaring all objects needed for the game - cam = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); - extendViewport = new ExtendViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, cam); - mouse = new Mouse(); - player = new Player(0, 0); - inputController = new InputController(player,mouse); - worldRenderer = new WorldRenderer(inputController,mouse,player); - batch = new SpriteBatch(); - stage = new Stage(); - gui = new GUI(stage); - - Gdx.input.setInputProcessor(stage); - - BlockMaterials.create(); - Chunks.createStructures(); - - //cam.translate(TILE_SIZE, TILE_SIZE); - cam.zoom = 25f; - } - - @Override - public void resize(int width, int height) { - stage.getViewport().update(width, height, true); - } - - @Override - public void render () { - float deltaTime = Gdx.graphics.getDeltaTime(); - Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); - - playerAnimationTime += deltaTime; - chunkLoadingTime += deltaTime; - - gui.debugInfo(stage,mouse); - - stage.act(deltaTime); - batch.begin(); - worldRenderer.render(batch,playerAnimationTime); - - if (chunkLoadingTime > RENDER_TIME) { - chunkLoadingTime -= RENDER_TIME; - World.loadChunks(); - World.unloadChunks(); - } - - cam.update(); - batch.end(); - stage.draw(); - } - - - @Override - public void dispose () { - gui.dispose(); - player.dispose(); - stage.dispose(); - batch.dispose(); - } -} diff --git a/Collector/OLD/LegacyJava/Collector/Restrictions.java b/Collector/OLD/LegacyJava/Collector/Restrictions.java deleted file mode 100644 index 449e2a7..0000000 --- a/Collector/OLD/LegacyJava/Collector/Restrictions.java +++ /dev/null @@ -1,23 +0,0 @@ -package Collector; - -public interface Restrictions { - int SEED = 1; - - float VIEWPORT_HEIGHT = 9/2f; - float VIEWPORT_WIDTH = 16/2f; - - int MOVEMENT_SPEED = 16; - int FREE_SPEED = 2; - int KEY_DELAY = 0; - - int TILE_SIZE = 32; - int CHUNK_SIZE = 8; - int SUPER_CHUNK_SIZE = 1; - - int TILE_SHIFT = (int)(Math.log(TILE_SIZE)/Math.log(2)); - int CHUNK_SHIFT = (int)(Math.log(CHUNK_SIZE)/Math.log(2)); - //int SUPER_CHUNK_SHIFT = (int)(Math.log(SUPER_CHUNK_SIZE)/Math.log(2)); - - int RENDER_DISTANCE = 3; - float RENDER_TIME = 1/60f; -} diff --git a/Collector/OLD/LegacyJava/Collector/ThirdPartyCode/OpenSimplexNoise.java b/Collector/OLD/LegacyJava/Collector/ThirdPartyCode/OpenSimplexNoise.java deleted file mode 100644 index 0ae4c27..0000000 --- a/Collector/OLD/LegacyJava/Collector/ThirdPartyCode/OpenSimplexNoise.java +++ /dev/null @@ -1,2125 +0,0 @@ -package Collector.ThirdPartyCode;/* - * OpenSimplex Noise in Java. - * by Kurt Spencer - * - * v1.1 (October 5, 2014) - * - Added 2D and 4D implementations. - * - Proper gradient sets for all dimensions, from a - * dimensionally-generalizable scheme with an actual - * rhyme and reason behind it. - * - Removed default permutation array in favor of - * default seed. - * - Changed seed-based constructor to be independent - * of any particular randomization library, so results - * will be the same when ported to other languages. - */ - -public class OpenSimplexNoise { - - private static final double STRETCH_CONSTANT_2D = -0.211324865405187; //(1/Math.sqrt(2+1)-1)/2; - private static final double SQUISH_CONSTANT_2D = 0.366025403784439; //(Math.sqrt(2+1)-1)/2; - private static final double STRETCH_CONSTANT_3D = -1.0 / 6; //(1/Math.sqrt(3+1)-1)/3; - private static final double SQUISH_CONSTANT_3D = 1.0 / 3; //(Math.sqrt(3+1)-1)/3; - private static final double STRETCH_CONSTANT_4D = -0.138196601125011; //(1/Math.sqrt(4+1)-1)/4; - private static final double SQUISH_CONSTANT_4D = 0.309016994374947; //(Math.sqrt(4+1)-1)/4; - - private static final double NORM_CONSTANT_2D = 47; - private static final double NORM_CONSTANT_3D = 103; - private static final double NORM_CONSTANT_4D = 30; - - private static final long DEFAULT_SEED = 0; - - //Gradients for 2D. They approximate the directions to the - //vertices of an octagon from the center. - private static final byte[] gradients2D = new byte[]{ - 5, 2, 2, 5, - -5, 2, -2, 5, - 5, -2, 2, -5, - -5, -2, -2, -5, - }; - //Gradients for 3D. They approximate the directions to the - //vertices of a rhombicuboctahedron from the center, skewed so - //that the triangular and square facets can be inscribed inside - //circles of the same radius. - private static final byte[] gradients3D = new byte[]{ - -11, 4, 4, -4, 11, 4, -4, 4, 11, - 11, 4, 4, 4, 11, 4, 4, 4, 11, - -11, -4, 4, -4, -11, 4, -4, -4, 11, - 11, -4, 4, 4, -11, 4, 4, -4, 11, - -11, 4, -4, -4, 11, -4, -4, 4, -11, - 11, 4, -4, 4, 11, -4, 4, 4, -11, - -11, -4, -4, -4, -11, -4, -4, -4, -11, - 11, -4, -4, 4, -11, -4, 4, -4, -11, - }; - - public OpenSimplexNoise() { - this(DEFAULT_SEED); - } - - //Gradients for 4D. They approximate the directions to the - //vertices of a disprismatotesseractihexadecachoron from the center, - //skewed so that the tetrahedral and cubic facets can be inscribed inside - //spheres of the same radius. - private static final byte[] gradients4D = new byte[]{ - 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, - -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, - 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, - -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, - 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, - -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, - 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, - -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, - 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, - -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, - 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, - -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, - 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, - -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, - 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, - -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, - }; - private final short[] perm; - - //3D OpenSimplex Noise. - public double eval(double x, double y, double z) { - - //Place input coordinates on simplectic honeycomb. - double stretchOffset = (x + y + z) * STRETCH_CONSTANT_3D; - double xs = x + stretchOffset; - double ys = y + stretchOffset; - double zs = z + stretchOffset; - - //Floor to get simplectic honeycomb coordinates of rhombohedron (stretched cube) super-cell origin. - int xsb = fastFloor(xs); - int ysb = fastFloor(ys); - int zsb = fastFloor(zs); - - //Skew out to get actual coordinates of rhombohedron origin. We'll need these later. - double squishOffset = (xsb + ysb + zsb) * SQUISH_CONSTANT_3D; - double xb = xsb + squishOffset; - double yb = ysb + squishOffset; - double zb = zsb + squishOffset; - - //Compute simplectic honeycomb coordinates relative to rhombohedral origin. - double xins = xs - xsb; - double yins = ys - ysb; - double zins = zs - zsb; - - //Sum those together to get a value that determines which region we're in. - double inSum = xins + yins + zins; - - //Positions relative to origin point. - double dx0 = x - xb; - double dy0 = y - yb; - double dz0 = z - zb; - - //We'll be defining these inside the next block and using them afterwards. - double dx_ext0, dy_ext0, dz_ext0; - double dx_ext1, dy_ext1, dz_ext1; - int xsv_ext0, ysv_ext0, zsv_ext0; - int xsv_ext1, ysv_ext1, zsv_ext1; - - double value = 0; - if (inSum <= 1) { //We're inside the tetrahedron (3-Simplex) at (0,0,0) - - //Determine which two of (0,0,1), (0,1,0), (1,0,0) are closest. - byte aPoint = 0x01; - double aScore = xins; - byte bPoint = 0x02; - double bScore = yins; - if (aScore >= bScore && zins > bScore) { - bScore = zins; - bPoint = 0x04; - } else if (aScore < bScore && zins > aScore) { - aScore = zins; - aPoint = 0x04; - } - - //Now we determine the two lattice points not part of the tetrahedron that may contribute. - //This depends on the closest two tetrahedral vertices, including (0,0,0) - double wins = 1 - inSum; - if (wins > aScore || wins > bScore) { //(0,0,0) is one of the closest two tetrahedral vertices. - byte c = (bScore > aScore ? bPoint : aPoint); //Our other closest vertex is the closest out of a and b. - - if ((c & 0x01) == 0) { - xsv_ext0 = xsb - 1; - xsv_ext1 = xsb; - dx_ext0 = dx0 + 1; - dx_ext1 = dx0; - } else { - xsv_ext0 = xsv_ext1 = xsb + 1; - dx_ext0 = dx_ext1 = dx0 - 1; - } - - if ((c & 0x02) == 0) { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0; - if ((c & 0x01) == 0) { - ysv_ext1 -= 1; - dy_ext1 += 1; - } else { - ysv_ext0 -= 1; - dy_ext0 += 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1; - } - - if ((c & 0x04) == 0) { - zsv_ext0 = zsb; - zsv_ext1 = zsb - 1; - dz_ext0 = dz0; - dz_ext1 = dz0 + 1; - } else { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz_ext1 = dz0 - 1; - } - } else { //(0,0,0) is not one of the closest two tetrahedral vertices. - byte c = (byte)(aPoint | bPoint); //Our two extra vertices are determined by the closest two. - - if ((c & 0x01) == 0) { - xsv_ext0 = xsb; - xsv_ext1 = xsb - 1; - dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_3D; - dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D; - } else { - xsv_ext0 = xsv_ext1 = xsb + 1; - dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D; - dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D; - } - - if ((c & 0x02) == 0) { - ysv_ext0 = ysb; - ysv_ext1 = ysb - 1; - dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D; - } else { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D; - } - - if ((c & 0x04) == 0) { - zsv_ext0 = zsb; - zsv_ext1 = zsb - 1; - dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D; - } else { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D; - } - } - - //Contribution (0,0,0) - double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0; - if (attn0 > 0) { - attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, dx0, dy0, dz0); - } - - //Contribution (1,0,0) - double dx1 = dx0 - 1 - SQUISH_CONSTANT_3D; - double dy1 = dy0 - 0 - SQUISH_CONSTANT_3D; - double dz1 = dz0 - 0 - SQUISH_CONSTANT_3D; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1); - } - - //Contribution (0,1,0) - double dx2 = dx0 - 0 - SQUISH_CONSTANT_3D; - double dy2 = dy0 - 1 - SQUISH_CONSTANT_3D; - double dz2 = dz1; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2); - } - - //Contribution (0,0,1) - double dx3 = dx2; - double dy3 = dy1; - double dz3 = dz0 - 1 - SQUISH_CONSTANT_3D; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3); - } - } else if (inSum >= 2) { //We're inside the tetrahedron (3-Simplex) at (1,1,1) - - //Determine which two tetrahedral vertices are the closest, out of (1,1,0), (1,0,1), (0,1,1) but not (1,1,1). - byte aPoint = 0x06; - double aScore = xins; - byte bPoint = 0x05; - double bScore = yins; - if (aScore <= bScore && zins < bScore) { - bScore = zins; - bPoint = 0x03; - } else if (aScore > bScore && zins < aScore) { - aScore = zins; - aPoint = 0x03; - } - - //Now we determine the two lattice points not part of the tetrahedron that may contribute. - //This depends on the closest two tetrahedral vertices, including (1,1,1) - double wins = 3 - inSum; - if (wins < aScore || wins < bScore) { //(1,1,1) is one of the closest two tetrahedral vertices. - byte c = (bScore < aScore ? bPoint : aPoint); //Our other closest vertex is the closest out of a and b. - - if ((c & 0x01) != 0) { - xsv_ext0 = xsb + 2; - xsv_ext1 = xsb + 1; - dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_3D; - dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D; - } else { - xsv_ext0 = xsv_ext1 = xsb; - dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_3D; - } - - if ((c & 0x02) != 0) { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D; - if ((c & 0x01) != 0) { - ysv_ext1 += 1; - dy_ext1 -= 1; - } else { - ysv_ext0 += 1; - dy_ext0 -= 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_3D; - } - - if ((c & 0x04) != 0) { - zsv_ext0 = zsb + 1; - zsv_ext1 = zsb + 2; - dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 - 3 * SQUISH_CONSTANT_3D; - } else { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_3D; - } - } else { //(1,1,1) is not one of the closest two tetrahedral vertices. - byte c = (byte)(aPoint & bPoint); //Our two extra vertices are determined by the closest two. - - if ((c & 0x01) != 0) { - xsv_ext0 = xsb + 1; - xsv_ext1 = xsb + 2; - dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D; - dx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D; - } else { - xsv_ext0 = xsv_ext1 = xsb; - dx_ext0 = dx0 - SQUISH_CONSTANT_3D; - dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D; - } - - if ((c & 0x02) != 0) { - ysv_ext0 = ysb + 1; - ysv_ext1 = ysb + 2; - dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D; - } else { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy0 - SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D; - } - - if ((c & 0x04) != 0) { - zsv_ext0 = zsb + 1; - zsv_ext1 = zsb + 2; - dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D; - } else { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz0 - SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D; - } - } - - //Contribution (1,1,0) - double dx3 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D; - double dy3 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D; - double dz3 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx3, dy3, dz3); - } - - //Contribution (1,0,1) - double dx2 = dx3; - double dy2 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D; - double dz2 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx2, dy2, dz2); - } - - //Contribution (0,1,1) - double dx1 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D; - double dy1 = dy3; - double dz1 = dz2; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx1, dy1, dz1); - } - - //Contribution (1,1,1) - dx0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D; - dy0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D; - dz0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D; - double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0; - if (attn0 > 0) { - attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 1, ysb + 1, zsb + 1, dx0, dy0, dz0); - } - } else { //We're inside the octahedron (Rectified 3-Simplex) in between. - double aScore; - byte aPoint; - boolean aIsFurtherSide; - double bScore; - byte bPoint; - boolean bIsFurtherSide; - - //Decide between point (0,0,1) and (1,1,0) as closest - double p1 = xins + yins; - if (p1 > 1) { - aScore = p1 - 1; - aPoint = 0x03; - aIsFurtherSide = true; - } else { - aScore = 1 - p1; - aPoint = 0x04; - aIsFurtherSide = false; - } - - //Decide between point (0,1,0) and (1,0,1) as closest - double p2 = xins + zins; - if (p2 > 1) { - bScore = p2 - 1; - bPoint = 0x05; - bIsFurtherSide = true; - } else { - bScore = 1 - p2; - bPoint = 0x02; - bIsFurtherSide = false; - } - - //The closest out of the two (1,0,0) and (0,1,1) will replace the furthest out of the two decided above, if closer. - double p3 = yins + zins; - if (p3 > 1) { - double score = p3 - 1; - if (aScore <= bScore && aScore < score) { - aScore = score; - aPoint = 0x06; - aIsFurtherSide = true; - } else if (aScore > bScore && bScore < score) { - bScore = score; - bPoint = 0x06; - bIsFurtherSide = true; - } - } else { - double score = 1 - p3; - if (aScore <= bScore && aScore < score) { - aScore = score; - aPoint = 0x01; - aIsFurtherSide = false; - } else if (aScore > bScore && bScore < score) { - bScore = score; - bPoint = 0x01; - bIsFurtherSide = false; - } - } - - //Where each of the two closest points are determines how the extra two vertices are calculated. - if (aIsFurtherSide == bIsFurtherSide) { - if (aIsFurtherSide) { //Both closest points on (1,1,1) side - - //One of the two extra points is (1,1,1) - dx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D; - dy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D; - dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D; - xsv_ext0 = xsb + 1; - ysv_ext0 = ysb + 1; - zsv_ext0 = zsb + 1; - - //Other extra point is based on the shared axis. - byte c = (byte)(aPoint & bPoint); - if ((c & 0x01) != 0) { - dx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D; - xsv_ext1 = xsb + 2; - ysv_ext1 = ysb; - zsv_ext1 = zsb; - } else if ((c & 0x02) != 0) { - dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D; - xsv_ext1 = xsb; - ysv_ext1 = ysb + 2; - zsv_ext1 = zsb; - } else { - dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D; - xsv_ext1 = xsb; - ysv_ext1 = ysb; - zsv_ext1 = zsb + 2; - } - } else {//Both closest points on (0,0,0) side - - //One of the two extra points is (0,0,0) - dx_ext0 = dx0; - dy_ext0 = dy0; - dz_ext0 = dz0; - xsv_ext0 = xsb; - ysv_ext0 = ysb; - zsv_ext0 = zsb; - - //Other extra point is based on the omitted axis. - byte c = (byte)(aPoint | bPoint); - if ((c & 0x01) == 0) { - dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D; - xsv_ext1 = xsb - 1; - ysv_ext1 = ysb + 1; - zsv_ext1 = zsb + 1; - } else if ((c & 0x02) == 0) { - dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D; - dy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D; - xsv_ext1 = xsb + 1; - ysv_ext1 = ysb - 1; - zsv_ext1 = zsb + 1; - } else { - dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D; - dz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D; - xsv_ext1 = xsb + 1; - ysv_ext1 = ysb + 1; - zsv_ext1 = zsb - 1; - } - } - } else { //One point on (0,0,0) side, one point on (1,1,1) side - byte c1, c2; - if (aIsFurtherSide) { - c1 = aPoint; - c2 = bPoint; - } else { - c1 = bPoint; - c2 = aPoint; - } - - //One contribution is a permutation of (1,1,-1) - if ((c1 & 0x01) == 0) { - dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_3D; - dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D; - dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D; - xsv_ext0 = xsb - 1; - ysv_ext0 = ysb + 1; - zsv_ext0 = zsb + 1; - } else if ((c1 & 0x02) == 0) { - dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D; - dy_ext0 = dy0 + 1 - SQUISH_CONSTANT_3D; - dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D; - xsv_ext0 = xsb + 1; - ysv_ext0 = ysb - 1; - zsv_ext0 = zsb + 1; - } else { - dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D; - dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D; - dz_ext0 = dz0 + 1 - SQUISH_CONSTANT_3D; - xsv_ext0 = xsb + 1; - ysv_ext0 = ysb + 1; - zsv_ext0 = zsb - 1; - } - - //One contribution is a permutation of (0,0,2) - dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D; - dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D; - dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D; - xsv_ext1 = xsb; - ysv_ext1 = ysb; - zsv_ext1 = zsb; - if ((c2 & 0x01) != 0) { - dx_ext1 -= 2; - xsv_ext1 += 2; - } else if ((c2 & 0x02) != 0) { - dy_ext1 -= 2; - ysv_ext1 += 2; - } else { - dz_ext1 -= 2; - zsv_ext1 += 2; - } - } - - //Contribution (1,0,0) - double dx1 = dx0 - 1 - SQUISH_CONSTANT_3D; - double dy1 = dy0 - 0 - SQUISH_CONSTANT_3D; - double dz1 = dz0 - 0 - SQUISH_CONSTANT_3D; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1); - } - - //Contribution (0,1,0) - double dx2 = dx0 - 0 - SQUISH_CONSTANT_3D; - double dy2 = dy0 - 1 - SQUISH_CONSTANT_3D; - double dz2 = dz1; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2); - } - - //Contribution (0,0,1) - double dx3 = dx2; - double dy3 = dy1; - double dz3 = dz0 - 1 - SQUISH_CONSTANT_3D; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3); - } - - //Contribution (1,1,0) - double dx4 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D; - double dy4 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D; - double dz4 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D; - double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4; - if (attn4 > 0) { - attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 0, dx4, dy4, dz4); - } - - //Contribution (1,0,1) - double dx5 = dx4; - double dy5 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D; - double dz5 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D; - double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5; - if (attn5 > 0) { - attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 0, zsb + 1, dx5, dy5, dz5); - } - - //Contribution (0,1,1) - double dx6 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D; - double dy6 = dy4; - double dz6 = dz5; - double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6; - if (attn6 > 0) { - attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 0, ysb + 1, zsb + 1, dx6, dy6, dz6); - } - } - - //First extra vertex - double attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0; - if (attn_ext0 > 0) - { - attn_ext0 *= attn_ext0; - value += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, dx_ext0, dy_ext0, dz_ext0); - } - - //Second extra vertex - double attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1; - if (attn_ext1 > 0) - { - attn_ext1 *= attn_ext1; - value += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, dx_ext1, dy_ext1, dz_ext1); - } - - return value / NORM_CONSTANT_3D; - } - - //4D OpenSimplex Noise. - public double eval(double x, double y, double z, double w) { - - //Place input coordinates on simplectic honeycomb. - double stretchOffset = (x + y + z + w) * STRETCH_CONSTANT_4D; - double xs = x + stretchOffset; - double ys = y + stretchOffset; - double zs = z + stretchOffset; - double ws = w + stretchOffset; - - //Floor to get simplectic honeycomb coordinates of rhombo-hypercube super-cell origin. - int xsb = fastFloor(xs); - int ysb = fastFloor(ys); - int zsb = fastFloor(zs); - int wsb = fastFloor(ws); - - //Skew out to get actual coordinates of stretched rhombo-hypercube origin. We'll need these later. - double squishOffset = (xsb + ysb + zsb + wsb) * SQUISH_CONSTANT_4D; - double xb = xsb + squishOffset; - double yb = ysb + squishOffset; - double zb = zsb + squishOffset; - double wb = wsb + squishOffset; - - //Compute simplectic honeycomb coordinates relative to rhombo-hypercube origin. - double xins = xs - xsb; - double yins = ys - ysb; - double zins = zs - zsb; - double wins = ws - wsb; - - //Sum those together to get a value that determines which region we're in. - double inSum = xins + yins + zins + wins; - - //Positions relative to origin point. - double dx0 = x - xb; - double dy0 = y - yb; - double dz0 = z - zb; - double dw0 = w - wb; - - //We'll be defining these inside the next block and using them afterwards. - double dx_ext0, dy_ext0, dz_ext0, dw_ext0; - double dx_ext1, dy_ext1, dz_ext1, dw_ext1; - double dx_ext2, dy_ext2, dz_ext2, dw_ext2; - int xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0; - int xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1; - int xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2; - - double value = 0; - if (inSum <= 1) { //We're inside the pentachoron (4-Simplex) at (0,0,0,0) - - //Determine which two of (0,0,0,1), (0,0,1,0), (0,1,0,0), (1,0,0,0) are closest. - byte aPoint = 0x01; - double aScore = xins; - byte bPoint = 0x02; - double bScore = yins; - if (aScore >= bScore && zins > bScore) { - bScore = zins; - bPoint = 0x04; - } else if (aScore < bScore && zins > aScore) { - aScore = zins; - aPoint = 0x04; - } - if (aScore >= bScore && wins > bScore) { - bScore = wins; - bPoint = 0x08; - } else if (aScore < bScore && wins > aScore) { - aScore = wins; - aPoint = 0x08; - } - - //Now we determine the three lattice points not part of the pentachoron that may contribute. - //This depends on the closest two pentachoron vertices, including (0,0,0,0) - double uins = 1 - inSum; - if (uins > aScore || uins > bScore) { //(0,0,0,0) is one of the closest two pentachoron vertices. - byte c = (bScore > aScore ? bPoint : aPoint); //Our other closest vertex is the closest out of a and b. - if ((c & 0x01) == 0) { - xsv_ext0 = xsb - 1; - xsv_ext1 = xsv_ext2 = xsb; - dx_ext0 = dx0 + 1; - dx_ext1 = dx_ext2 = dx0; - } else { - xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1; - dx_ext0 = dx_ext1 = dx_ext2 = dx0 - 1; - } - - if ((c & 0x02) == 0) { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb; - dy_ext0 = dy_ext1 = dy_ext2 = dy0; - if ((c & 0x01) == 0x01) { - ysv_ext0 -= 1; - dy_ext0 += 1; - } else { - ysv_ext1 -= 1; - dy_ext1 += 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1; - dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1; - } - - if ((c & 0x04) == 0) { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb; - dz_ext0 = dz_ext1 = dz_ext2 = dz0; - if ((c & 0x03) != 0) { - if ((c & 0x03) == 0x03) { - zsv_ext0 -= 1; - dz_ext0 += 1; - } else { - zsv_ext1 -= 1; - dz_ext1 += 1; - } - } else { - zsv_ext2 -= 1; - dz_ext2 += 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1; - dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1; - } - - if ((c & 0x08) == 0) { - wsv_ext0 = wsv_ext1 = wsb; - wsv_ext2 = wsb - 1; - dw_ext0 = dw_ext1 = dw0; - dw_ext2 = dw0 + 1; - } else { - wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1; - dw_ext0 = dw_ext1 = dw_ext2 = dw0 - 1; - } - } else { //(0,0,0,0) is not one of the closest two pentachoron vertices. - byte c = (byte)(aPoint | bPoint); //Our three extra vertices are determined by the closest two. - - if ((c & 0x01) == 0) { - xsv_ext0 = xsv_ext2 = xsb; - xsv_ext1 = xsb - 1; - dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_4D; - dx_ext2 = dx0 - SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1; - dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - dx_ext1 = dx_ext2 = dx0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x02) == 0) { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb; - dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D; - dy_ext1 = dy_ext2 = dy0 - SQUISH_CONSTANT_4D; - if ((c & 0x01) == 0x01) { - ysv_ext1 -= 1; - dy_ext1 += 1; - } else { - ysv_ext2 -= 1; - dy_ext2 += 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1; - dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - dy_ext1 = dy_ext2 = dy0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x04) == 0) { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb; - dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D; - dz_ext1 = dz_ext2 = dz0 - SQUISH_CONSTANT_4D; - if ((c & 0x03) == 0x03) { - zsv_ext1 -= 1; - dz_ext1 += 1; - } else { - zsv_ext2 -= 1; - dz_ext2 += 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1; - dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - dz_ext1 = dz_ext2 = dz0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x08) == 0) { - wsv_ext0 = wsv_ext1 = wsb; - wsv_ext2 = wsb - 1; - dw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - SQUISH_CONSTANT_4D; - dw_ext2 = dw0 + 1 - SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1; - dw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - dw_ext1 = dw_ext2 = dw0 - 1 - SQUISH_CONSTANT_4D; - } - } - - //Contribution (0,0,0,0) - double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0; - if (attn0 > 0) { - attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 0, dx0, dy0, dz0, dw0); - } - - //Contribution (1,0,0,0) - double dx1 = dx0 - 1 - SQUISH_CONSTANT_4D; - double dy1 = dy0 - 0 - SQUISH_CONSTANT_4D; - double dz1 = dz0 - 0 - SQUISH_CONSTANT_4D; - double dw1 = dw0 - 0 - SQUISH_CONSTANT_4D; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1); - } - - //Contribution (0,1,0,0) - double dx2 = dx0 - 0 - SQUISH_CONSTANT_4D; - double dy2 = dy0 - 1 - SQUISH_CONSTANT_4D; - double dz2 = dz1; - double dw2 = dw1; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2); - } - - //Contribution (0,0,1,0) - double dx3 = dx2; - double dy3 = dy1; - double dz3 = dz0 - 1 - SQUISH_CONSTANT_4D; - double dw3 = dw1; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3); - } - - //Contribution (0,0,0,1) - double dx4 = dx2; - double dy4 = dy1; - double dz4 = dz1; - double dw4 = dw0 - 1 - SQUISH_CONSTANT_4D; - double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; - if (attn4 > 0) { - attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4); - } - } else if (inSum >= 3) { //We're inside the pentachoron (4-Simplex) at (1,1,1,1) - //Determine which two of (1,1,1,0), (1,1,0,1), (1,0,1,1), (0,1,1,1) are closest. - byte aPoint = 0x0E; - double aScore = xins; - byte bPoint = 0x0D; - double bScore = yins; - if (aScore <= bScore && zins < bScore) { - bScore = zins; - bPoint = 0x0B; - } else if (aScore > bScore && zins < aScore) { - aScore = zins; - aPoint = 0x0B; - } - if (aScore <= bScore && wins < bScore) { - bScore = wins; - bPoint = 0x07; - } else if (aScore > bScore && wins < aScore) { - aScore = wins; - aPoint = 0x07; - } - - //Now we determine the three lattice points not part of the pentachoron that may contribute. - //This depends on the closest two pentachoron vertices, including (0,0,0,0) - double uins = 4 - inSum; - if (uins < aScore || uins < bScore) { //(1,1,1,1) is one of the closest two pentachoron vertices. - byte c = (bScore < aScore ? bPoint : aPoint); //Our other closest vertex is the closest out of a and b. - - if ((c & 0x01) != 0) { - xsv_ext0 = xsb + 2; - xsv_ext1 = xsv_ext2 = xsb + 1; - dx_ext0 = dx0 - 2 - 4 * SQUISH_CONSTANT_4D; - dx_ext1 = dx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb; - dx_ext0 = dx_ext1 = dx_ext2 = dx0 - 4 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x02) != 0) { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1; - dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D; - if ((c & 0x01) != 0) { - ysv_ext1 += 1; - dy_ext1 -= 1; - } else { - ysv_ext0 += 1; - dy_ext0 -= 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb; - dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 4 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x04) != 0) { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1; - dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D; - if ((c & 0x03) != 0x03) { - if ((c & 0x03) == 0) { - zsv_ext0 += 1; - dz_ext0 -= 1; - } else { - zsv_ext1 += 1; - dz_ext1 -= 1; - } - } else { - zsv_ext2 += 1; - dz_ext2 -= 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb; - dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 4 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x08) != 0) { - wsv_ext0 = wsv_ext1 = wsb + 1; - wsv_ext2 = wsb + 2; - dw_ext0 = dw_ext1 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 2 - 4 * SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb; - dw_ext0 = dw_ext1 = dw_ext2 = dw0 - 4 * SQUISH_CONSTANT_4D; - } - } else { //(1,1,1,1) is not one of the closest two pentachoron vertices. - byte c = (byte)(aPoint & bPoint); //Our three extra vertices are determined by the closest two. - - if ((c & 0x01) != 0) { - xsv_ext0 = xsv_ext2 = xsb + 1; - xsv_ext1 = xsb + 2; - dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D; - dx_ext2 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb; - dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D; - dx_ext1 = dx_ext2 = dx0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x02) != 0) { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1; - dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - dy_ext1 = dy_ext2 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c & 0x01) != 0) { - ysv_ext2 += 1; - dy_ext2 -= 1; - } else { - ysv_ext1 += 1; - dy_ext1 -= 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb; - dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D; - dy_ext1 = dy_ext2 = dy0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x04) != 0) { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1; - dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - dz_ext1 = dz_ext2 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c & 0x03) != 0) { - zsv_ext2 += 1; - dz_ext2 -= 1; - } else { - zsv_ext1 += 1; - dz_ext1 -= 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb; - dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D; - dz_ext1 = dz_ext2 = dz0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x08) != 0) { - wsv_ext0 = wsv_ext1 = wsb + 1; - wsv_ext2 = wsb + 2; - dw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb; - dw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D; - dw_ext1 = dw_ext2 = dw0 - 3 * SQUISH_CONSTANT_4D; - } - } - - //Contribution (1,1,1,0) - double dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dw4 = dw0 - 3 * SQUISH_CONSTANT_4D; - double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; - if (attn4 > 0) { - attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4); - } - - //Contribution (1,1,0,1) - double dx3 = dx4; - double dy3 = dy4; - double dz3 = dz0 - 3 * SQUISH_CONSTANT_4D; - double dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3); - } - - //Contribution (1,0,1,1) - double dx2 = dx4; - double dy2 = dy0 - 3 * SQUISH_CONSTANT_4D; - double dz2 = dz4; - double dw2 = dw3; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); - } - - //Contribution (0,1,1,1) - double dx1 = dx0 - 3 * SQUISH_CONSTANT_4D; - double dz1 = dz4; - double dy1 = dy4; - double dw1 = dw3; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); - } - - //Contribution (1,1,1,1) - dx0 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D; - dy0 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D; - dz0 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D; - dw0 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D; - double attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0; - if (attn0 > 0) { - attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 1, dx0, dy0, dz0, dw0); - } - } else if (inSum <= 2) { //We're inside the first dispentachoron (Rectified 4-Simplex) - double aScore; - byte aPoint; - boolean aIsBiggerSide = true; - double bScore; - byte bPoint; - boolean bIsBiggerSide = true; - - //Decide between (1,1,0,0) and (0,0,1,1) - if (xins + yins > zins + wins) { - aScore = xins + yins; - aPoint = 0x03; - } else { - aScore = zins + wins; - aPoint = 0x0C; - } - - //Decide between (1,0,1,0) and (0,1,0,1) - if (xins + zins > yins + wins) { - bScore = xins + zins; - bPoint = 0x05; - } else { - bScore = yins + wins; - bPoint = 0x0A; - } - - //Closer between (1,0,0,1) and (0,1,1,0) will replace the further of a and b, if closer. - if (xins + wins > yins + zins) { - double score = xins + wins; - if (aScore >= bScore && score > bScore) { - bScore = score; - bPoint = 0x09; - } else if (aScore < bScore && score > aScore) { - aScore = score; - aPoint = 0x09; - } - } else { - double score = yins + zins; - if (aScore >= bScore && score > bScore) { - bScore = score; - bPoint = 0x06; - } else if (aScore < bScore && score > aScore) { - aScore = score; - aPoint = 0x06; - } - } - - //Decide if (1,0,0,0) is closer. - double p1 = 2 - inSum + xins; - if (aScore >= bScore && p1 > bScore) { - bScore = p1; - bPoint = 0x01; - bIsBiggerSide = false; - } else if (aScore < bScore && p1 > aScore) { - aScore = p1; - aPoint = 0x01; - aIsBiggerSide = false; - } - - //Decide if (0,1,0,0) is closer. - double p2 = 2 - inSum + yins; - if (aScore >= bScore && p2 > bScore) { - bScore = p2; - bPoint = 0x02; - bIsBiggerSide = false; - } else if (aScore < bScore && p2 > aScore) { - aScore = p2; - aPoint = 0x02; - aIsBiggerSide = false; - } - - //Decide if (0,0,1,0) is closer. - double p3 = 2 - inSum + zins; - if (aScore >= bScore && p3 > bScore) { - bScore = p3; - bPoint = 0x04; - bIsBiggerSide = false; - } else if (aScore < bScore && p3 > aScore) { - aScore = p3; - aPoint = 0x04; - aIsBiggerSide = false; - } - - //Decide if (0,0,0,1) is closer. - double p4 = 2 - inSum + wins; - if (aScore >= bScore && p4 > bScore) { - bScore = p4; - bPoint = 0x08; - bIsBiggerSide = false; - } else if (aScore < bScore && p4 > aScore) { - aScore = p4; - aPoint = 0x08; - aIsBiggerSide = false; - } - - //Where each of the two closest points are determines how the extra three vertices are calculated. - if (aIsBiggerSide == bIsBiggerSide) { - if (aIsBiggerSide) { //Both closest points on the bigger side - byte c1 = (byte)(aPoint | bPoint); - byte c2 = (byte)(aPoint & bPoint); - if ((c1 & 0x01) == 0) { - xsv_ext0 = xsb; - xsv_ext1 = xsb - 1; - dx_ext0 = dx0 - 3 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 + 1 - 2 * SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsb + 1; - dx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x02) == 0) { - ysv_ext0 = ysb; - ysv_ext1 = ysb - 1; - dy_ext0 = dy0 - 3 * SQUISH_CONSTANT_4D; - dy_ext1 = dy0 + 1 - 2 * SQUISH_CONSTANT_4D; - } else { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - dy_ext1 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x04) == 0) { - zsv_ext0 = zsb; - zsv_ext1 = zsb - 1; - dz_ext0 = dz0 - 3 * SQUISH_CONSTANT_4D; - dz_ext1 = dz0 + 1 - 2 * SQUISH_CONSTANT_4D; - } else { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - dz_ext1 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x08) == 0) { - wsv_ext0 = wsb; - wsv_ext1 = wsb - 1; - dw_ext0 = dw0 - 3 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 + 1 - 2 * SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsb + 1; - dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - } - - //One combination is a permutation of (0,0,0,2) based on c2 - xsv_ext2 = xsb; - ysv_ext2 = ysb; - zsv_ext2 = zsb; - wsv_ext2 = wsb; - dx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D; - dy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D; - dz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D; - if ((c2 & 0x01) != 0) { - xsv_ext2 += 2; - dx_ext2 -= 2; - } else if ((c2 & 0x02) != 0) { - ysv_ext2 += 2; - dy_ext2 -= 2; - } else if ((c2 & 0x04) != 0) { - zsv_ext2 += 2; - dz_ext2 -= 2; - } else { - wsv_ext2 += 2; - dw_ext2 -= 2; - } - - } else { //Both closest points on the smaller side - //One of the two extra points is (0,0,0,0) - xsv_ext2 = xsb; - ysv_ext2 = ysb; - zsv_ext2 = zsb; - wsv_ext2 = wsb; - dx_ext2 = dx0; - dy_ext2 = dy0; - dz_ext2 = dz0; - dw_ext2 = dw0; - - //Other two points are based on the omitted axes. - byte c = (byte)(aPoint | bPoint); - - if ((c & 0x01) == 0) { - xsv_ext0 = xsb - 1; - xsv_ext1 = xsb; - dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsb + 1; - dx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x02) == 0) { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D; - if ((c & 0x01) == 0x01) - { - ysv_ext0 -= 1; - dy_ext0 += 1; - } else { - ysv_ext1 -= 1; - dy_ext1 += 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x04) == 0) { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D; - if ((c & 0x03) == 0x03) - { - zsv_ext0 -= 1; - dz_ext0 += 1; - } else { - zsv_ext1 -= 1; - dz_ext1 += 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c & 0x08) == 0) - { - wsv_ext0 = wsb; - wsv_ext1 = wsb - 1; - dw_ext0 = dw0 - SQUISH_CONSTANT_4D; - dw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsb + 1; - dw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D; - } - - } - } else { //One point on each "side" - byte c1, c2; - if (aIsBiggerSide) { - c1 = aPoint; - c2 = bPoint; - } else { - c1 = bPoint; - c2 = aPoint; - } - - //Two contributions are the bigger-sided point with each 0 replaced with -1. - if ((c1 & 0x01) == 0) { - xsv_ext0 = xsb - 1; - xsv_ext1 = xsb; - dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsb + 1; - dx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x02) == 0) { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D; - if ((c1 & 0x01) == 0x01) { - ysv_ext0 -= 1; - dy_ext0 += 1; - } else { - ysv_ext1 -= 1; - dy_ext1 += 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x04) == 0) { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D; - if ((c1 & 0x03) == 0x03) { - zsv_ext0 -= 1; - dz_ext0 += 1; - } else { - zsv_ext1 -= 1; - dz_ext1 += 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x08) == 0) { - wsv_ext0 = wsb; - wsv_ext1 = wsb - 1; - dw_ext0 = dw0 - SQUISH_CONSTANT_4D; - dw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsb + 1; - dw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D; - } - - //One contribution is a permutation of (0,0,0,2) based on the smaller-sided point - xsv_ext2 = xsb; - ysv_ext2 = ysb; - zsv_ext2 = zsb; - wsv_ext2 = wsb; - dx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D; - dy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D; - dz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D; - if ((c2 & 0x01) != 0) { - xsv_ext2 += 2; - dx_ext2 -= 2; - } else if ((c2 & 0x02) != 0) { - ysv_ext2 += 2; - dy_ext2 -= 2; - } else if ((c2 & 0x04) != 0) { - zsv_ext2 += 2; - dz_ext2 -= 2; - } else { - wsv_ext2 += 2; - dw_ext2 -= 2; - } - } - - //Contribution (1,0,0,0) - double dx1 = dx0 - 1 - SQUISH_CONSTANT_4D; - double dy1 = dy0 - 0 - SQUISH_CONSTANT_4D; - double dz1 = dz0 - 0 - SQUISH_CONSTANT_4D; - double dw1 = dw0 - 0 - SQUISH_CONSTANT_4D; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1); - } - - //Contribution (0,1,0,0) - double dx2 = dx0 - 0 - SQUISH_CONSTANT_4D; - double dy2 = dy0 - 1 - SQUISH_CONSTANT_4D; - double dz2 = dz1; - double dw2 = dw1; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2); - } - - //Contribution (0,0,1,0) - double dx3 = dx2; - double dy3 = dy1; - double dz3 = dz0 - 1 - SQUISH_CONSTANT_4D; - double dw3 = dw1; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3); - } - - //Contribution (0,0,0,1) - double dx4 = dx2; - double dy4 = dy1; - double dz4 = dz1; - double dw4 = dw0 - 1 - SQUISH_CONSTANT_4D; - double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; - if (attn4 > 0) { - attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4); - } - - //Contribution (1,1,0,0) - double dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5; - if (attn5 > 0) { - attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5); - } - - //Contribution (1,0,1,0) - double dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6; - if (attn6 > 0) { - attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6); - } - - //Contribution (1,0,0,1) - double dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7; - if (attn7 > 0) { - attn7 *= attn7; - value += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7); - } - - //Contribution (0,1,1,0) - double dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8; - if (attn8 > 0) { - attn8 *= attn8; - value += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8); - } - - //Contribution (0,1,0,1) - double dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9; - if (attn9 > 0) { - attn9 *= attn9; - value += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9); - } - - //Contribution (0,0,1,1) - double dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10; - if (attn10 > 0) { - attn10 *= attn10; - value += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); - } - } else { //We're inside the second dispentachoron (Rectified 4-Simplex) - double aScore; - byte aPoint; - boolean aIsBiggerSide = true; - double bScore; - byte bPoint; - boolean bIsBiggerSide = true; - - //Decide between (0,0,1,1) and (1,1,0,0) - if (xins + yins < zins + wins) { - aScore = xins + yins; - aPoint = 0x0C; - } else { - aScore = zins + wins; - aPoint = 0x03; - } - - //Decide between (0,1,0,1) and (1,0,1,0) - if (xins + zins < yins + wins) { - bScore = xins + zins; - bPoint = 0x0A; - } else { - bScore = yins + wins; - bPoint = 0x05; - } - - //Closer between (0,1,1,0) and (1,0,0,1) will replace the further of a and b, if closer. - if (xins + wins < yins + zins) { - double score = xins + wins; - if (aScore <= bScore && score < bScore) { - bScore = score; - bPoint = 0x06; - } else if (aScore > bScore && score < aScore) { - aScore = score; - aPoint = 0x06; - } - } else { - double score = yins + zins; - if (aScore <= bScore && score < bScore) { - bScore = score; - bPoint = 0x09; - } else if (aScore > bScore && score < aScore) { - aScore = score; - aPoint = 0x09; - } - } - - //Decide if (0,1,1,1) is closer. - double p1 = 3 - inSum + xins; - if (aScore <= bScore && p1 < bScore) { - bScore = p1; - bPoint = 0x0E; - bIsBiggerSide = false; - } else if (aScore > bScore && p1 < aScore) { - aScore = p1; - aPoint = 0x0E; - aIsBiggerSide = false; - } - - //Decide if (1,0,1,1) is closer. - double p2 = 3 - inSum + yins; - if (aScore <= bScore && p2 < bScore) { - bScore = p2; - bPoint = 0x0D; - bIsBiggerSide = false; - } else if (aScore > bScore && p2 < aScore) { - aScore = p2; - aPoint = 0x0D; - aIsBiggerSide = false; - } - - //Decide if (1,1,0,1) is closer. - double p3 = 3 - inSum + zins; - if (aScore <= bScore && p3 < bScore) { - bScore = p3; - bPoint = 0x0B; - bIsBiggerSide = false; - } else if (aScore > bScore && p3 < aScore) { - aScore = p3; - aPoint = 0x0B; - aIsBiggerSide = false; - } - - //Decide if (1,1,1,0) is closer. - double p4 = 3 - inSum + wins; - if (aScore <= bScore && p4 < bScore) { - bScore = p4; - bPoint = 0x07; - bIsBiggerSide = false; - } else if (aScore > bScore && p4 < aScore) { - aScore = p4; - aPoint = 0x07; - aIsBiggerSide = false; - } - - //Where each of the two closest points are determines how the extra three vertices are calculated. - if (aIsBiggerSide == bIsBiggerSide) { - if (aIsBiggerSide) { //Both closest points on the bigger side - byte c1 = (byte)(aPoint & bPoint); - byte c2 = (byte)(aPoint | bPoint); - - //Two contributions are permutations of (0,0,0,1) and (0,0,0,2) based on c1 - xsv_ext0 = xsv_ext1 = xsb; - ysv_ext0 = ysv_ext1 = ysb; - zsv_ext0 = zsv_ext1 = zsb; - wsv_ext0 = wsv_ext1 = wsb; - dx_ext0 = dx0 - SQUISH_CONSTANT_4D; - dy_ext0 = dy0 - SQUISH_CONSTANT_4D; - dz_ext0 = dz0 - SQUISH_CONSTANT_4D; - dw_ext0 = dw0 - SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_4D; - dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_4D; - dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - 2 * SQUISH_CONSTANT_4D; - if ((c1 & 0x01) != 0) { - xsv_ext0 += 1; - dx_ext0 -= 1; - xsv_ext1 += 2; - dx_ext1 -= 2; - } else if ((c1 & 0x02) != 0) { - ysv_ext0 += 1; - dy_ext0 -= 1; - ysv_ext1 += 2; - dy_ext1 -= 2; - } else if ((c1 & 0x04) != 0) { - zsv_ext0 += 1; - dz_ext0 -= 1; - zsv_ext1 += 2; - dz_ext1 -= 2; - } else { - wsv_ext0 += 1; - dw_ext0 -= 1; - wsv_ext1 += 2; - dw_ext1 -= 2; - } - - //One contribution is a permutation of (1,1,1,-1) based on c2 - xsv_ext2 = xsb + 1; - ysv_ext2 = ysb + 1; - zsv_ext2 = zsb + 1; - wsv_ext2 = wsb + 1; - dx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - dy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - dz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - if ((c2 & 0x01) == 0) { - xsv_ext2 -= 2; - dx_ext2 += 2; - } else if ((c2 & 0x02) == 0) { - ysv_ext2 -= 2; - dy_ext2 += 2; - } else if ((c2 & 0x04) == 0) { - zsv_ext2 -= 2; - dz_ext2 += 2; - } else { - wsv_ext2 -= 2; - dw_ext2 += 2; - } - } else { //Both closest points on the smaller side - //One of the two extra points is (1,1,1,1) - xsv_ext2 = xsb + 1; - ysv_ext2 = ysb + 1; - zsv_ext2 = zsb + 1; - wsv_ext2 = wsb + 1; - dx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D; - dy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D; - dz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D; - - //Other two points are based on the shared axes. - byte c = (byte)(aPoint & bPoint); - - if ((c & 0x01) != 0) { - xsv_ext0 = xsb + 2; - xsv_ext1 = xsb + 1; - dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsb; - dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x02) != 0) { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c & 0x01) == 0) - { - ysv_ext0 += 1; - dy_ext0 -= 1; - } else { - ysv_ext1 += 1; - dy_ext1 -= 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x04) != 0) { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c & 0x03) == 0) - { - zsv_ext0 += 1; - dz_ext0 -= 1; - } else { - zsv_ext1 += 1; - dz_ext1 -= 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c & 0x08) != 0) - { - wsv_ext0 = wsb + 1; - wsv_ext1 = wsb + 2; - dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsb; - dw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D; - } - } - } else { //One point on each "side" - byte c1, c2; - if (aIsBiggerSide) { - c1 = aPoint; - c2 = bPoint; - } else { - c1 = bPoint; - c2 = aPoint; - } - - //Two contributions are the bigger-sided point with each 1 replaced with 2. - if ((c1 & 0x01) != 0) { - xsv_ext0 = xsb + 2; - xsv_ext1 = xsb + 1; - dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D; - dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - } else { - xsv_ext0 = xsv_ext1 = xsb; - dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x02) != 0) { - ysv_ext0 = ysv_ext1 = ysb + 1; - dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c1 & 0x01) == 0) { - ysv_ext0 += 1; - dy_ext0 -= 1; - } else { - ysv_ext1 += 1; - dy_ext1 -= 1; - } - } else { - ysv_ext0 = ysv_ext1 = ysb; - dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x04) != 0) { - zsv_ext0 = zsv_ext1 = zsb + 1; - dz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - if ((c1 & 0x03) == 0) { - zsv_ext0 += 1; - dz_ext0 -= 1; - } else { - zsv_ext1 += 1; - dz_ext1 -= 1; - } - } else { - zsv_ext0 = zsv_ext1 = zsb; - dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D; - } - - if ((c1 & 0x08) != 0) { - wsv_ext0 = wsb + 1; - wsv_ext1 = wsb + 2; - dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - dw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D; - } else { - wsv_ext0 = wsv_ext1 = wsb; - dw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D; - } - - //One contribution is a permutation of (1,1,1,-1) based on the smaller-sided point - xsv_ext2 = xsb + 1; - ysv_ext2 = ysb + 1; - zsv_ext2 = zsb + 1; - wsv_ext2 = wsb + 1; - dx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - dy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - dz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - dw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - if ((c2 & 0x01) == 0) { - xsv_ext2 -= 2; - dx_ext2 += 2; - } else if ((c2 & 0x02) == 0) { - ysv_ext2 -= 2; - dy_ext2 += 2; - } else if ((c2 & 0x04) == 0) { - zsv_ext2 -= 2; - dz_ext2 += 2; - } else { - wsv_ext2 -= 2; - dw_ext2 += 2; - } - } - - //Contribution (1,1,1,0) - double dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D; - double dw4 = dw0 - 3 * SQUISH_CONSTANT_4D; - double attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4; - if (attn4 > 0) { - attn4 *= attn4; - value += attn4 * attn4 * extrapolate(xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4); - } - - //Contribution (1,1,0,1) - double dx3 = dx4; - double dy3 = dy4; - double dz3 = dz0 - 3 * SQUISH_CONSTANT_4D; - double dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D; - double attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3; - if (attn3 > 0) { - attn3 *= attn3; - value += attn3 * attn3 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3); - } - - //Contribution (1,0,1,1) - double dx2 = dx4; - double dy2 = dy0 - 3 * SQUISH_CONSTANT_4D; - double dz2 = dz4; - double dw2 = dw3; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2); - } - - //Contribution (0,1,1,1) - double dx1 = dx0 - 3 * SQUISH_CONSTANT_4D; - double dz1 = dz4; - double dy1 = dy4; - double dw1 = dw3; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1); - } - - //Contribution (1,1,0,0) - double dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5; - if (attn5 > 0) { - attn5 *= attn5; - value += attn5 * attn5 * extrapolate(xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5); - } - - //Contribution (1,0,1,0) - double dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6; - if (attn6 > 0) { - attn6 *= attn6; - value += attn6 * attn6 * extrapolate(xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6); - } - - //Contribution (1,0,0,1) - double dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7; - if (attn7 > 0) { - attn7 *= attn7; - value += attn7 * attn7 * extrapolate(xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7); - } - - //Contribution (0,1,1,0) - double dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D; - double attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8; - if (attn8 > 0) { - attn8 *= attn8; - value += attn8 * attn8 * extrapolate(xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8); - } - - //Contribution (0,1,0,1) - double dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9; - if (attn9 > 0) { - attn9 *= attn9; - value += attn9 * attn9 * extrapolate(xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9); - } - - //Contribution (0,0,1,1) - double dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D; - double dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D; - double dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D; - double attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10; - if (attn10 > 0) { - attn10 *= attn10; - value += attn10 * attn10 * extrapolate(xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10); - } - } - - //First extra vertex - double attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0 - dw_ext0 * dw_ext0; - if (attn_ext0 > 0) - { - attn_ext0 *= attn_ext0; - value += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0, dx_ext0, dy_ext0, dz_ext0, dw_ext0); - } - - //Second extra vertex - double attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1 - dw_ext1 * dw_ext1; - if (attn_ext1 > 0) - { - attn_ext1 *= attn_ext1; - value += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1, dx_ext1, dy_ext1, dz_ext1, dw_ext1); - } - - //Third extra vertex - double attn_ext2 = 2 - dx_ext2 * dx_ext2 - dy_ext2 * dy_ext2 - dz_ext2 * dz_ext2 - dw_ext2 * dw_ext2; - if (attn_ext2 > 0) - { - attn_ext2 *= attn_ext2; - value += attn_ext2 * attn_ext2 * extrapolate(xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2, dx_ext2, dy_ext2, dz_ext2, dw_ext2); - } - - return value / NORM_CONSTANT_4D; - } - - private double extrapolate(int xsb, int ysb, double dx, double dy) - { - int index = perm[(perm[xsb & 0xFF] + ysb) & 0xFF] & 0x0E; - return gradients2D[index] * dx - + gradients2D[index + 1] * dy; - } - - private double extrapolate(int xsb, int ysb, int zsb, double dx, double dy, double dz) - { - int index = permGradIndex3D[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF]; - return gradients3D[index] * dx - + gradients3D[index + 1] * dy - + gradients3D[index + 2] * dz; - } - private final short[] permGradIndex3D; - - //Initializes the class using a permutation array generated from a 64-bit seed. - //Generates a proper permutation (i.e. doesn't merely perform N successive pair swaps on a base array) - //Uses a simple 64-bit LCG. - public OpenSimplexNoise(long seed) { - perm = new short[256]; - permGradIndex3D = new short[256]; - short[] source = new short[256]; - for (short i = 0; i < 256; i++) - source[i] = i; - seed = seed * 6364136223846793005L + 1442695040888963407L; - seed = seed * 6364136223846793005L + 1442695040888963407L; - seed = seed * 6364136223846793005L + 1442695040888963407L; - for (int i = 255; i >= 0; i--) { - seed = seed * 6364136223846793005L + 1442695040888963407L; - int r = (int) ((seed + 31) % (i + 1)); - if (r < 0) - r += (i + 1); - perm[i] = source[r]; - permGradIndex3D[i] = (short) ((perm[i] % (gradients3D.length / 3)) * 3); - source[r] = source[i]; - } - } - - private static int fastFloor(double x) { - int xi = (int) x; - return x < xi ? xi - 1 : xi; - } - - //2D OpenSimplex Noise. - public double eval(double x, double y) { - - //Place input coordinates onto grid. - double stretchOffset = (x + y) * STRETCH_CONSTANT_2D; - double xs = x + stretchOffset; - double ys = y + stretchOffset; - - //Floor to get grid coordinates of rhombus (stretched square) super-cell origin. - int xsb = fastFloor(xs); - int ysb = fastFloor(ys); - - //Skew out to get actual coordinates of rhombus origin. We'll need these later. - double squishOffset = (xsb + ysb) * SQUISH_CONSTANT_2D; - double xb = xsb + squishOffset; - double yb = ysb + squishOffset; - - //Compute grid coordinates relative to rhombus origin. - double xins = xs - xsb; - double yins = ys - ysb; - - //Sum those together to get a value that determines which region we're in. - double inSum = xins + yins; - - //Positions relative to origin point. - double dx0 = x - xb; - double dy0 = y - yb; - - //We'll be defining these inside the next block and using them afterwards. - double dx_ext, dy_ext; - int xsv_ext, ysv_ext; - - double value = 0; - - //Contribution (1,0) - double dx1 = dx0 - 1 - SQUISH_CONSTANT_2D; - double dy1 = dy0 - 0 - SQUISH_CONSTANT_2D; - double attn1 = 2 - dx1 * dx1 - dy1 * dy1; - if (attn1 > 0) { - attn1 *= attn1; - value += attn1 * attn1 * extrapolate(xsb + 1, ysb + 0, dx1, dy1); - } - - //Contribution (0,1) - double dx2 = dx0 - 0 - SQUISH_CONSTANT_2D; - double dy2 = dy0 - 1 - SQUISH_CONSTANT_2D; - double attn2 = 2 - dx2 * dx2 - dy2 * dy2; - if (attn2 > 0) { - attn2 *= attn2; - value += attn2 * attn2 * extrapolate(xsb + 0, ysb + 1, dx2, dy2); - } - - if (inSum <= 1) { //We're inside the triangle (2-Simplex) at (0,0) - double zins = 1 - inSum; - if (zins > xins || zins > yins) { //(0,0) is one of the closest two triangular vertices - if (xins > yins) { - xsv_ext = xsb + 1; - ysv_ext = ysb - 1; - dx_ext = dx0 - 1; - dy_ext = dy0 + 1; - } else { - xsv_ext = xsb - 1; - ysv_ext = ysb + 1; - dx_ext = dx0 + 1; - dy_ext = dy0 - 1; - } - } else { //(1,0) and (0,1) are the closest two vertices. - xsv_ext = xsb + 1; - ysv_ext = ysb + 1; - dx_ext = dx0 - 1 - 2 * SQUISH_CONSTANT_2D; - dy_ext = dy0 - 1 - 2 * SQUISH_CONSTANT_2D; - } - } else { //We're inside the triangle (2-Simplex) at (1,1) - double zins = 2 - inSum; - if (zins < xins || zins < yins) { //(0,0) is one of the closest two triangular vertices - if (xins > yins) { - xsv_ext = xsb + 2; - ysv_ext = ysb + 0; - dx_ext = dx0 - 2 - 2 * SQUISH_CONSTANT_2D; - dy_ext = dy0 + 0 - 2 * SQUISH_CONSTANT_2D; - } else { - xsv_ext = xsb + 0; - ysv_ext = ysb + 2; - dx_ext = dx0 + 0 - 2 * SQUISH_CONSTANT_2D; - dy_ext = dy0 - 2 - 2 * SQUISH_CONSTANT_2D; - } - } else { //(1,0) and (0,1) are the closest two vertices. - dx_ext = dx0; - dy_ext = dy0; - xsv_ext = xsb; - ysv_ext = ysb; - } - xsb += 1; - ysb += 1; - dx0 = dx0 - 1 - 2 * SQUISH_CONSTANT_2D; - dy0 = dy0 - 1 - 2 * SQUISH_CONSTANT_2D; - } - - //Contribution (0,0) or (1,1) - double attn0 = 2 - dx0 * dx0 - dy0 * dy0; - if (attn0 > 0) { - attn0 *= attn0; - value += attn0 * attn0 * extrapolate(xsb, ysb, dx0, dy0); - } - - //Extra Vertex - double attn_ext = 2 - dx_ext * dx_ext - dy_ext * dy_ext; - if (attn_ext > 0) { - attn_ext *= attn_ext; - value += attn_ext * attn_ext * extrapolate(xsv_ext, ysv_ext, dx_ext, dy_ext); - } - - return value / NORM_CONSTANT_2D; - } - - private double extrapolate(int xsb, int ysb, int zsb, int wsb, double dx, double dy, double dz, double dw) - { - int index = perm[(perm[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF] + wsb) & 0xFF] & 0xFC; - return gradients4D[index] * dx - + gradients4D[index + 1] * dy - + gradients4D[index + 2] * dz - + gradients4D[index + 3] * dw; - } -} \ No newline at end of file diff --git a/Collector/OLD/LegacyJava/Collector/UI/GUI.java b/Collector/OLD/LegacyJava/Collector/UI/GUI.java deleted file mode 100644 index 97c7abb..0000000 --- a/Collector/OLD/LegacyJava/Collector/UI/GUI.java +++ /dev/null @@ -1,55 +0,0 @@ -package Collector.UI; - -import Collector.Character.Mouse; -import Collector.Main; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.g2d.BitmapFont; -import com.badlogic.gdx.math.Vector3; -import com.badlogic.gdx.scenes.scene2d.Stage; -import com.badlogic.gdx.scenes.scene2d.ui.Label; -import com.badlogic.gdx.scenes.scene2d.ui.Table; -import com.badlogic.gdx.utils.Align; -import com.badlogic.gdx.utils.viewport.ExtendViewport; -import Collector.Restrictions; - -public class GUI implements Restrictions { - private final BitmapFont font; - private ExtendViewport guiViewport; - private final Table table; - private final Label label; - - public GUI(Stage stage) { - font = new BitmapFont(); - table = new Table(); - table.setDebug(true); - guiViewport = new ExtendViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight(),stage.getCamera()); - stage.setViewport(guiViewport); - - //Creating block selection debug menu - - table.top().left(); - label = new Label("x=N/A y=N/A", new Label.LabelStyle(font,Color.WHITE)); - table.add(label); - - //Creating Minimap - - - } - - public void debugInfo(Stage stage, Mouse mouse){ - table.setFillParent(true); - stage.addActor(table); - - //Mouse position - Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); - Main.cam.unproject(mousePos); - int x = mouse.getSelectedX(mousePos) >> TILE_SHIFT; - int y = mouse.getSelectedY(mousePos) >> TILE_SHIFT; - label.setText("x="+ x + " y=" + y); - } - - public void dispose(){ - font.dispose(); - } -} diff --git a/Collector/OLD/LegacyJava/Collector/UI/InventoryInterface.java b/Collector/OLD/LegacyJava/Collector/UI/InventoryInterface.java deleted file mode 100644 index 457bdba..0000000 --- a/Collector/OLD/LegacyJava/Collector/UI/InventoryInterface.java +++ /dev/null @@ -1,4 +0,0 @@ -package Collector.UI; - -public class InventoryInterface { -} diff --git a/Collector/OLD/LegacyJava/Collector/UI/MiniMap.java b/Collector/OLD/LegacyJava/Collector/UI/MiniMap.java deleted file mode 100644 index 7e23939..0000000 --- a/Collector/OLD/LegacyJava/Collector/UI/MiniMap.java +++ /dev/null @@ -1,5 +0,0 @@ -package Collector.UI; - -public class MiniMap { - -} diff --git a/Collector/Program.cs b/Collector/Program.cs index 91eca7d..ee416bc 100644 --- a/Collector/Program.cs +++ b/Collector/Program.cs @@ -5,10 +5,10 @@ namespace Collector public static class Program { [STAThread] - static void Main() + private static void Main() { - using (var game = new Main()) - game.Run(); + using var game = new Main(); + game.Run(); } } } \ No newline at end of file diff --git a/Collector/Restrictions.cs b/Collector/Restrictions.cs index c26f56d..5ab03bb 100644 --- a/Collector/Restrictions.cs +++ b/Collector/Restrictions.cs @@ -1,4 +1,7 @@ using System; +using Collector.Character; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using static Collector.IRestrictions; namespace Collector @@ -6,17 +9,17 @@ namespace Collector public interface IRestrictions { public const int Seed = 1; - public const float ViewportHeight = 9/2f; - public const float ViewportWidth = 16/2f; + public const int TileSize = 1; + public const float ViewportHeight = 9f; + public const float ViewportWidth = 16f; public const int MovementSpeed = 1; - public const int FreeSpeed = 2; - public const int KeyDelay = 0; - public const int TileSize = 32; + public const int KeyDelay = 20; public const int ChunkSize = 8; public const int SuperChunkSize = 1; - public const int TileShift = 5; public const int ChunkShift = 3; - public const int RenderDistance = 3; + public const int RenderDistance = 5; public const float RenderTime = 1/60f; + public const float Zoom = 30; + public const float Scale = ViewportWidth/ViewportHeight; } } \ No newline at end of file diff --git a/Collector/src/Character/InputController.cs b/Collector/src/Character/InputController.cs index 1d47fe7..da745d4 100644 --- a/Collector/src/Character/InputController.cs +++ b/Collector/src/Character/InputController.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using Collector; -using Collector.Character; using Collector.Dimension; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; @@ -9,201 +6,198 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGame.Extended; -public class InputController : IRestrictions +namespace Collector.Character { - private readonly PlayerMouse _playerMouse; - private readonly OrthographicCamera _cam; - private readonly Dictionary _animations; - private readonly Texture2D _texture; - private readonly SpriteBatch _spriteBatch; - private string Input { get; set; } - private int _frameNumber; - private int _timeSinceLastFrame; - - - public InputController(PlayerMouse playerMouse, OrthographicCamera cam, SpriteBatch spriteBatch, ContentManager contentManager) + public class InputController : IRestrictions { - Input = "Down"; - _playerMouse = playerMouse; - _cam = cam; - _spriteBatch = spriteBatch; - _frameNumber = 0; - _texture = contentManager.Load("man"); - _animations = new Dictionary - { - ["Up"] = new[] - { - new Rectangle(32 * 0, 0, 32, 32), - new Rectangle(32 * 1, 0, 32, 32), - new Rectangle(32 * 2, 0, 32, 32), - new Rectangle(32 * 3, 0, 32, 32) - }, - ["Right"] = new[] - { - new Rectangle(32 * 0 + 32 * 4, 32, 32, 32), - new Rectangle(32 * 1 + 32 * 4, 32, 32, 32), - new Rectangle(32 * 2 + 32 * 4, 32, 32, 32), - new Rectangle(32 * 3 + 32 * 4, 32, 32, 32) - }, - ["UpRight"] = new[] - { - new Rectangle(32 * 0 + 32 * 4, 32 * 2, 32, 32), - new Rectangle(32 * 1 + 32 * 4, 32 * 2, 32, 32), - new Rectangle(32 * 2 + 32 * 4, 32 * 2, 32, 32), - new Rectangle(32 * 3 + 32 * 4, 32 * 2, 32, 32) - }, - ["DownRight"] = new[] - { - new Rectangle(32 * 0 + 32 * 4, 32 * 3, 32, 32), - new Rectangle(32 * 1 + 32 * 4, 32 * 3, 32, 32), - new Rectangle(32 * 2 + 32 * 4, 32 * 3, 32, 32), - new Rectangle(32 * 3 + 32 * 4, 32 * 3, 32, 32) - }, - ["Left"] = new[] - { - new Rectangle(32 * 0, 32, 32, 32), - new Rectangle(32 * 1, 32, 32, 32), - new Rectangle(32 * 2, 32, 32, 32), - new Rectangle(32 * 3, 32, 32, 32) - }, - ["UpLeft"] = new[] - { - new Rectangle(32 * 0, 32 * 2, 32, 32), - new Rectangle(32 * 1, 32 * 2, 32, 32), - new Rectangle(32 * 2, 32 * 2, 32, 32), - new Rectangle(32 * 3, 32 * 2, 32, 32) - }, - ["DownLeft"] = new[] - { - new Rectangle(32 * 0, 32, 32, 32), - new Rectangle(32 * 1, 32, 32, 32), - new Rectangle(32 * 2, 32, 32, 32), - new Rectangle(32 * 3, 32, 32, 32) - }, - ["Down"] = new[] - { - new Rectangle(32 * 0 + 32 * 4, 0, 32, 32), - new Rectangle(32 * 1 + 32 * 4, 0, 32, 32), - new Rectangle(32 * 2 + 32 * 4, 0, 32, 32), - new Rectangle(32 * 3 + 32 * 4, 0, 32, 32) - }, - }; - } + private readonly PlayerMouse _playerMouse; + private readonly OrthographicCamera _cam; + private readonly Dictionary _animations; + private readonly Texture2D _texture; + private readonly SpriteBatch _spriteBatch; + private string Input { get; set; } + private int _frameNumber; + private int _timeSinceLastFrame; - public void PlayerInput(Main main, PlayerMouse playerMouse, GameTime gameTime) - { - var keyboardState = Keyboard.GetState(); - var mouseState = Mouse.GetState(); - const int movementSpeed = IRestrictions.MovementSpeed; - if (keyboardState.IsKeyDown(Keys.Escape)) - { - Quit(main); - } - if (keyboardState.IsKeyUp(Keys.W) && keyboardState.IsKeyUp(Keys.A) && keyboardState.IsKeyUp(Keys.S) && keyboardState.IsKeyUp(Keys.D)) - { - Input = Input.Contains("Right") ? "DownRight" : "DownLeft"; - _frameNumber = 0; - _playerMouse.Draw(); - } - if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.D)) + public InputController(PlayerMouse playerMouse, OrthographicCamera cam, SpriteBatch spriteBatch, ContentManager contentManager) { - UpdateAnimationFrame(gameTime); - Input = "UpRight"; - Player.Y += -movementSpeed; - Player.X += movementSpeed; - _cam.Move(new Vector2(movementSpeed, -movementSpeed)); - } - else if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.A)) - { - UpdateAnimationFrame(gameTime); - Input = "UpLeft"; - Player.Y += -movementSpeed; - Player.X += -movementSpeed; - _cam.Move(new Vector2(-movementSpeed, -movementSpeed)); - } - else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.D)) - { - UpdateAnimationFrame(gameTime); - Input = "DownRight"; - Player.Y += movementSpeed; - Player.X += movementSpeed; - _cam.Move(new Vector2(movementSpeed, movementSpeed)); - } - else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.A)) - { - UpdateAnimationFrame(gameTime); - Input = "DownLeft"; - Player.Y += movementSpeed; - Player.X += -movementSpeed; - _cam.Move(new Vector2(-movementSpeed, movementSpeed)); - } - else if (keyboardState.IsKeyDown(Keys.W)) - { - UpdateAnimationFrame(gameTime); - Input = "Up"; - Player.Y += -movementSpeed; - _cam.Move(new Vector2(0, -movementSpeed)); - } - else if (keyboardState.IsKeyDown(Keys.A)) - { - UpdateAnimationFrame(gameTime); - Player.X += -movementSpeed; - _cam.Move(new Vector2(-movementSpeed, 0)); - Input = "Left"; - } - else if (keyboardState.IsKeyDown(Keys.S)) - { - UpdateAnimationFrame(gameTime); - Player.Y += movementSpeed; - _cam.Move(new Vector2(0, movementSpeed)); Input = "Down"; - } - else if (keyboardState.IsKeyDown(Keys.D)) - { - UpdateAnimationFrame(gameTime); - Player.X += movementSpeed; - _cam.Move(new Vector2(movementSpeed, 0)); - Input = "Right"; - } - if (keyboardState.IsKeyDown(Keys.Q)) - { - _cam.ZoomIn(0.01f); - } - if (keyboardState.IsKeyDown(Keys.E)) - { - _cam.ZoomOut(0.01f); - } - - if (mouseState.LeftButton == ButtonState.Pressed) - { - Chunks.RemoveBlock(playerMouse.GetSelectedXTile(),playerMouse.GetSelectedYTile()); - } - if (mouseState.RightButton == ButtonState.Pressed) - { - Chunks.PlaceBlock(playerMouse.GetSelectedXTile(),playerMouse.GetSelectedYTile(),Blocks.BlockWood); - } - } - - private void UpdateAnimationFrame(GameTime gameTime) - { - _timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds; - if (_timeSinceLastFrame <= 99) return; - _frameNumber++; - _timeSinceLastFrame = 0; - if (_frameNumber > 3) - { + _playerMouse = playerMouse; + _cam = cam; + _spriteBatch = spriteBatch; _frameNumber = 0; + _texture = contentManager.Load("man"); + const int tileSize = 32; + _animations = new Dictionary + { + ["Up"] = new[] + { + new Rectangle(0, 0, tileSize, tileSize), + new Rectangle(1, 0, tileSize, tileSize), + new Rectangle(2, 0, tileSize, tileSize), + new Rectangle(3, 0, tileSize, tileSize) + }, + ["Right"] = new[] + { + new Rectangle(0 + 4, 1, tileSize, tileSize), + new Rectangle(1 + 4, 1, tileSize, tileSize), + new Rectangle(2 + 4, 1, tileSize, tileSize), + new Rectangle(3 + 4, 1, tileSize, tileSize) + }, + ["UpRight"] = new[] + { + new Rectangle(0 + 4, 2, tileSize, tileSize), + new Rectangle(1 + 4, 2, tileSize, tileSize), + new Rectangle(2 + 4, 2, tileSize, tileSize), + new Rectangle(3 + 4, 2, tileSize, tileSize) + }, + ["DownRight"] = new[] + { + new Rectangle(0 + 4, 3, tileSize, tileSize), + new Rectangle(1 + 4, 3, tileSize, tileSize), + new Rectangle(2 + 4, 3, tileSize, tileSize), + new Rectangle(3 + 4, 3, tileSize, tileSize) + }, + ["Left"] = new[] + { + new Rectangle(0, 1, tileSize, tileSize), + new Rectangle(1, 1, tileSize, tileSize), + new Rectangle(2, 1, tileSize, tileSize), + new Rectangle(3, 1, tileSize, tileSize) + }, + ["UpLeft"] = new[] + { + new Rectangle(0, 2, tileSize, tileSize), + new Rectangle(1, 2, tileSize, tileSize), + new Rectangle(2, 2, tileSize, tileSize), + new Rectangle(3, 2, tileSize, tileSize) + }, + ["DownLeft"] = new[] + { + new Rectangle(0, 1, tileSize, tileSize), + new Rectangle(1, 1, tileSize, tileSize), + new Rectangle(2, 1, tileSize, tileSize), + new Rectangle(3, 1, tileSize, tileSize) + }, + ["Down"] = new[] + { + new Rectangle(0 + 4, 0, tileSize, tileSize), + new Rectangle(1 + 4, 0, tileSize, tileSize), + new Rectangle(2 + 4, 0, tileSize, tileSize), + new Rectangle(3 + 4, 0, tileSize, tileSize) + }, + }; } - } - private static void Quit(Game main) - { - main.Exit(); - } + public void PlayerInput(Main main, PlayerMouse playerMouse, GameTime gameTime) + { + const int movementSpeed = IRestrictions.MovementSpeed; + var keyboardState = Keyboard.GetState(); + var mouseState = Mouse.GetState(); + if (keyboardState.IsKeyDown(Keys.Escape)) + { + Quit(main); + } + if (keyboardState.IsKeyUp(Keys.W) && keyboardState.IsKeyUp(Keys.A) && keyboardState.IsKeyUp(Keys.S) && keyboardState.IsKeyUp(Keys.D)) + { + Input = Input.Contains("Right") ? "DownRight" : "DownLeft"; - public void Draw() - { - _spriteBatch.Draw(_texture, new Vector2(Player.X, Player.Y), _animations[Input][_frameNumber], Color.White); + _frameNumber = 0; + _playerMouse.Draw(); + } + if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.D)) + { + UpdateAnimationFrame(gameTime); + Input = "UpRight"; + Player.Move(_cam,movementSpeed,-movementSpeed); + } + else if (keyboardState.IsKeyDown(Keys.W) && keyboardState.IsKeyDown(Keys.A)) + { + UpdateAnimationFrame(gameTime); + Input = "UpLeft"; + Player.Move(_cam,-movementSpeed,-movementSpeed); + } + else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.D)) + { + UpdateAnimationFrame(gameTime); + Input = "DownRight"; + Player.Move(_cam,movementSpeed,movementSpeed); + } + else if (keyboardState.IsKeyDown(Keys.S) && keyboardState.IsKeyDown(Keys.A)) + { + UpdateAnimationFrame(gameTime); + Input = "DownLeft"; + Player.Move(_cam,-movementSpeed,movementSpeed); + } + else if (keyboardState.IsKeyDown(Keys.W)) + { + UpdateAnimationFrame(gameTime); + Input = "Up"; + Player.Move(_cam,0,-movementSpeed); + } + else if (keyboardState.IsKeyDown(Keys.A)) + { + UpdateAnimationFrame(gameTime); + Player.Move(_cam,-movementSpeed,0); + Input = "Left"; + } + else if (keyboardState.IsKeyDown(Keys.S)) + { + UpdateAnimationFrame(gameTime); + Player.Move(_cam,0,movementSpeed); + Input = "Down"; + } + else if (keyboardState.IsKeyDown(Keys.D)) + { + UpdateAnimationFrame(gameTime); + Player.Move(_cam,movementSpeed,0); + Input = "Right"; + } + if (keyboardState.IsKeyDown(Keys.Q)) + { + _cam.ZoomIn(1f); + } + if (keyboardState.IsKeyDown(Keys.E)) + { + _cam.ZoomOut(1f); + } + + if (mouseState.LeftButton == ButtonState.Pressed) + { + Chunks.RemoveBlock(PlayerMouse.GetSelectedX(),PlayerMouse.GetSelectedY()); + } + if (mouseState.RightButton == ButtonState.Pressed) + { + Chunks.PlaceBlock(PlayerMouse.GetSelectedX(),PlayerMouse.GetSelectedY(),Blocks.BlockWood); + } + } + + private void UpdateAnimationFrame(GameTime gameTime) + { + _timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds; + if (_timeSinceLastFrame <= 99) return; + _frameNumber++; + _timeSinceLastFrame = 0; + if (_frameNumber > 3) + { + _frameNumber = 0; + } + } + + private static void Quit(Game main) + { + main.Exit(); + } + + public void Draw() + { + _spriteBatch.Draw( + _texture + ,Player.PlayerBounds + ,_animations[Input][_frameNumber] + ,Color.White + ); + } } } \ No newline at end of file diff --git a/Collector/src/Character/Player.cs b/Collector/src/Character/Player.cs index 6b5f3a0..84ad348 100644 --- a/Collector/src/Character/Player.cs +++ b/Collector/src/Character/Player.cs @@ -1,19 +1,35 @@ +using System; using System.Collections.Generic; +using Collector.Dimension; +using Humper; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Media; +using MonoGame.Extended; +using MonoGame.Extended.Collections; +using Collision = Collector.Dimension.Collision; namespace Collector.Character { public class Player : IRestrictions { - public static int X { get; set; } - public static int Y { get; set; } - public Dictionary Animation { get; set; } - //private Inventory PlayerInventory { get; } + public static int X { get; private set; } + public static int Y { get; private set; } + private static Dictionary Animation { get; set; } + public static Rectangle PlayerBounds; - public Player(int x, int y) { - X = x<("crosshair"); } - public void Draw() { - _spriteBatch.Draw(Crosshair,new Vector2(GetSelectedX(),GetSelectedY()), Color.White); - } - - public int GetSelectedX() - { - return ((int) (Mouse.GetState().X + _cam.Position.X) >> 5) << 5; + _spriteBatch.Draw( + Crosshair, + new Rectangle(GetSelectedX(),GetSelectedY(),1,1), + new Rectangle(0,0,32,32), + Color.White + ); } - public int GetSelectedY() + public static int GetSelectedX() { - return ((int) (Mouse.GetState().Y + _cam.Position.Y) >> 5) << 5; - } - - public int GetSelectedXTile() - { - return (int) (Mouse.GetState().X + _cam.Position.X) >> 5; + return (int) Math.Floor(_cam.ScreenToWorld(Mouse.GetState().X,Mouse.GetState().Y).X); } - public int GetSelectedYTile() + public static int GetSelectedY() { - return (int) (Mouse.GetState().Y + _cam.Position.Y) >> 5; + return (int) Math.Floor(_cam.ScreenToWorld(Mouse.GetState().X,Mouse.GetState().Y).Y); } } } \ No newline at end of file diff --git a/Collector/src/Dimension/Chunks.cs b/Collector/src/Dimension/Chunks.cs index af3c4fe..dcfdbbd 100644 --- a/Collector/src/Dimension/Chunks.cs +++ b/Collector/src/Dimension/Chunks.cs @@ -3,7 +3,8 @@ using System; using System.Collections.Generic; using Collector.ThirdPartyCode; -using Microsoft.Xna.Framework.Graphics; +using Humper; +using Microsoft.Xna.Framework; namespace Collector.Dimension { @@ -11,7 +12,10 @@ namespace Collector.Dimension { public static Dictionary, Blocks> LoadedChunks { get; } = new Dictionary, Blocks>(); private static readonly Dictionary, Blocks> SavedChunks = new Dictionary, Blocks>(); - + private static readonly Dictionary, Collision> savedCollisions = new Dictionary, Collision>(); + public static readonly Dictionary, Collision> loadedCollisions = new Dictionary, Collision>(); + + private static readonly OpenSimplexNoise Gen1 = new OpenSimplexNoise(IRestrictions.Seed+ 1); private static readonly OpenSimplexNoise Gen2 = new OpenSimplexNoise(IRestrictions.Seed); @@ -25,28 +29,37 @@ namespace Collector.Dimension private static void SetBlock(int x, int y, int z, Blocks name) { - LoadedChunks[new Tuple(x, y, z)] = name; - SavedChunks[new Tuple(x, y, z)] = name; + var tuple = new Tuple(x, y, z); + var pair = new Tuple(x, y); + + loadedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize,false); + savedCollisions[pair] = new Collision(x,y,IRestrictions.TileSize,false); + LoadedChunks[tuple] = name; + SavedChunks[tuple] = name; } public static void PlaceBlock(int x, int y, Blocks name) { - var triple = new Tuple(x, y, 1); - if (!LoadedChunks.ContainsKey(triple)) return; - if (LoadedChunks[triple].Equals(Blocks.BlockAir)) + var tuple = new Tuple(x, y, 1); + if (!LoadedChunks.ContainsKey(tuple)) return; + if (LoadedChunks[tuple].Equals(Blocks.BlockAir)) { SetBlock(x, y, 1, name); } } public static void RemoveBlock(int x, int y){ - var triple = new Tuple(x, y, 1); + var tuple = new Tuple(x, y, 1); + var pair = new Tuple(x,y); - if (!LoadedChunks.ContainsKey(triple)) return; - if (LoadedChunks[triple].Equals(Blocks.BlockAir)) return; + if (!LoadedChunks.ContainsKey(tuple)) return; + if (LoadedChunks[tuple].Equals(Blocks.BlockAir)) return; - LoadedChunks[triple] = Blocks.BlockAir; - SavedChunks[triple] = Blocks.BlockAir; + loadedCollisions[pair] = null; + savedCollisions[pair] = null; + + LoadedChunks[tuple] = Blocks.BlockAir; + SavedChunks[tuple] = Blocks.BlockAir; } public static void UngenerateChunk(int x, int y) { diff --git a/Collector/src/Dimension/Collision.cs b/Collector/src/Dimension/Collision.cs new file mode 100644 index 0000000..feed5b7 --- /dev/null +++ b/Collector/src/Dimension/Collision.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; + +namespace Collector.Dimension +{ + public class Collision + { + private readonly int _tileWidth; + private bool _entity; + public Rectangle Rectangle { get; private set; } + + public Collision(int x, int y,int tileWidth, bool entity) + { + _entity = entity; + _tileWidth = tileWidth; + Rectangle = new Rectangle(x,y,tileWidth,tileWidth); + } + } +} \ No newline at end of file diff --git a/Collector/src/Dimension/World.cs b/Collector/src/Dimension/World.cs index d6d39c3..7934a7d 100644 --- a/Collector/src/Dimension/World.cs +++ b/Collector/src/Dimension/World.cs @@ -4,7 +4,8 @@ using Collector.Character; namespace Collector.Dimension { public static class World { - private static void GenerateWorld(int x, int y) { + private static void GenerateWorld(int x, int y) + { if (Chunks.IsEmpty(x, y)) { Chunks.GenerateChunk(x, y); } @@ -21,8 +22,8 @@ namespace Collector.Dimension for (var i = -(IRestrictions.RenderDistance); i < IRestrictions.RenderDistance; i++) { for (var j = -(IRestrictions.RenderDistance); j < IRestrictions.RenderDistance; j++) { GenerateWorld( - i + Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize), - j + Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize) + i + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize), + j + Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize) ); } } @@ -32,23 +33,23 @@ namespace Collector.Dimension for (var i = -IRestrictions.RenderDistance; i < IRestrictions.RenderDistance+1; i++) { //Down UngenerateWorld( - Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i, - (Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+3 + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i, + (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+IRestrictions.RenderDistance ); //Up UngenerateWorld( - Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i-1, - (Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-4 + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+i, + (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))-IRestrictions.RenderDistance ); //Right UngenerateWorld( - Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-4, - (Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)-IRestrictions.RenderDistance, + (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i ); //Left UngenerateWorld( - Player.X / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+3, - (Player.Y / (IRestrictions.TileSize * IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i + Player.X / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize)+IRestrictions.RenderDistance, + (Player.Y / (IRestrictions.SuperChunkSize * IRestrictions.ChunkSize))+i ); } } diff --git a/Collector/src/Dimension/WorldRenderer.cs b/Collector/src/Dimension/WorldRenderer.cs index 9498221..8a65fa7 100644 --- a/Collector/src/Dimension/WorldRenderer.cs +++ b/Collector/src/Dimension/WorldRenderer.cs @@ -27,8 +27,8 @@ namespace Collector.Dimension batch.Draw( Main.Materials[Chunks.LoadedChunks[chunkpair]], new Rectangle( - chunkpair.Item1 << IRestrictions.TileShift, - chunkpair.Item2 << IRestrictions.TileShift, + chunkpair.Item1, + chunkpair.Item2, IRestrictions.TileSize, IRestrictions.TileSize ), Color.White diff --git a/Collector/src/ThirdPartyCode/QuadTree.cs b/Collector/src/ThirdPartyCode/QuadTree.cs deleted file mode 100644 index 7f775d9..0000000 --- a/Collector/src/ThirdPartyCode/QuadTree.cs +++ /dev/null @@ -1,320 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -//Quadtree code -//https://github.com/futurechris/QuadTree - -namespace QuadTree -{ - - public class QuadTree - { - private static Stack _branchPool = new Stack(); - private static Stack _leafPool = new Stack(); - - private readonly Branch _root; - private readonly int _splitCount; - private readonly int _depthLimit; - private readonly Dictionary _leafLookup = new Dictionary(); - - - public QuadTree(int splitCount, int depthLimit, ref Quad region) - { - _splitCount = splitCount; - _depthLimit = depthLimit; - _root = CreateBranch(this, null, 0, ref region); - } - - public QuadTree(int splitCount, int depthLimit, Quad region) - : this(splitCount, depthLimit, ref region) - { - - } - - public QuadTree(int splitCount, int depthLimit, float x, float y, float width, float height) - : this(splitCount, depthLimit, new Quad(x, y, x + width, y + height)) - { - - } - - - public void Clear() - { - _root.Clear(); - _root.Tree = this; - _leafLookup.Clear(); - } - - - public static void ClearPools() - { - _branchPool = new Stack(); - _leafPool = new Stack(); - } - - - private void Insert(T value, ref Quad quad) - { - if (!_leafLookup.TryGetValue(value, out var leaf)) - { - leaf = CreateLeaf(value, ref quad); - _leafLookup.Add(value, leaf); - } - _root.Insert(leaf); - } - - public void Insert(T value, Quad quad) - { - Insert(value, ref quad); - } - - public void Insert(T value, float x, float y, float width, float height) - { - var quad = new Quad(x, y, x + width, y + height); - Insert(value, ref quad); - } - - private bool SearchArea(ref Quad quad, ref List values) - { - if (values != null) - values.Clear(); - else - values = new List(); - _root.SearchQuad(ref quad, values); - return values.Count > 0; - } - - public bool SearchArea(Quad quad, ref List values) - { - return SearchArea(ref quad, ref values); - } - - public bool SearchArea(float x, float y, float width, float height, ref List values) - { - var quad = new Quad(x, y, x + width, y + height); - return SearchArea(ref quad, ref values); - } - - public bool SearchPoint(float x, float y, ref List values) - { - if (values != null) - values.Clear(); - else - values = new List(); - _root.SearchPoint(x, y, values); - return values.Count > 0; - } - - public bool FindCollisions(T value, ref List values) - { - if (values != null) - values.Clear(); - else - values = new List(_leafLookup.Count); - - if (!_leafLookup.TryGetValue(value, out var leaf)) return false; - var branch = leaf.Branch; - - //Add the leaf's siblings (prevent it from colliding with itself) - if (branch.Leaves.Count > 0) - foreach (var t in branch.Leaves) - if (leaf != t && leaf.Quad.Intersects(ref t.Quad)) - values.Add(t.Value); - - //Add the branch's children - if (branch.Split) - for (var i = 0; i < 4; ++i) - if (branch.Branches[i] != null) - branch.Branches[i].SearchQuad(ref leaf.Quad, values); - - //Add all leaves back to the root - branch = branch.Parent; - while (branch != null) - { - if (branch.Leaves.Count > 0) - foreach (var t in branch.Leaves) - if (leaf.Quad.Intersects(ref t.Quad)) - values.Add(t.Value); - - branch = branch.Parent; - } - return false; - } - - public int CountBranches() - { - var count = 0; - CountBranches(_root, ref count); - return count; - } - - private static void CountBranches(Branch branch, ref int count) - { - ++count; - if (!branch.Split) return; - for (var i = 0; i < 4; ++i) - if (branch.Branches[i] != null) - CountBranches(branch.Branches[i], ref count); - } - - private static Branch CreateBranch(QuadTree tree, Branch parent, int branchDepth, ref Quad quad) - { - var branch = _branchPool.Count > 0 ? _branchPool.Pop() : new Branch(); - branch.Tree = tree; - branch.Parent = parent; - branch.Split = false; - branch.Depth = branchDepth; - var midX = quad.MinX + (quad.MaxX - quad.MinX) * 0.5f; - var midY = quad.MinY + (quad.MaxY - quad.MinY) * 0.5f; - branch.Quads[0].Set(quad.MinX, quad.MinY, midX, midY); - branch.Quads[1].Set(midX, quad.MinY, quad.MaxX, midY); - branch.Quads[2].Set(midX, midY, quad.MaxX, quad.MaxY); - branch.Quads[3].Set(quad.MinX, midY, midX, quad.MaxY); - return branch; - } - - private static Leaf CreateLeaf(T value, ref Quad quad) - { - var leaf = _leafPool.Count > 0 ? _leafPool.Pop() : new Leaf(); - leaf.Value = value; - leaf.Quad = quad; - return leaf; - } - - public class Branch - { - internal QuadTree Tree; - internal Branch Parent; - internal readonly Quad[] Quads = new Quad[4]; - internal readonly Branch[] Branches = new Branch[4]; - internal readonly List Leaves = new List(); - internal bool Split; - internal int Depth; - - internal void Clear() - { - Tree = null; - Parent = null; - Split = false; - - for (var i = 0; i < 4; ++i) - { - if (Branches[i] == null) continue; - _branchPool.Push(Branches[i]); - Branches[i].Clear(); - Branches[i] = null; - } - - foreach (var t in Leaves) - { - _leafPool.Push(t); - t.Branch = null; - t.Value = default; - } - - Leaves.Clear(); - } - - internal void Insert(Leaf leaf) - { - //If this branch is already split - if (Split) - { - for (var i = 0; i < 4; ++i) - { - if (!Quads[i].Contains(ref leaf.Quad)) continue; - Branches[i] ??= CreateBranch(Tree, this, Depth + 1, ref Quads[i]); - Branches[i].Insert(leaf); - return; - } - - Leaves.Add(leaf); - leaf.Branch = this; - } - else - { - //Add the leaf to this node - Leaves.Add(leaf); - leaf.Branch = this; - - //Once I have reached capacity, split the node - if (Leaves.Count >= Tree._splitCount && Depth < Tree._depthLimit) - { - Split = true; - } - } - } - - internal void SearchQuad(ref Quad quad, List values) - { - if (Leaves.Count > 0) - foreach (var t in Leaves) - if (quad.Intersects(ref t.Quad)) - values.Add(t.Value); - - for (var i = 0; i < 4; ++i) - if (Branches[i] != null) - Branches[i].SearchQuad(ref quad, values); - } - - internal void SearchPoint(float x, float y, List values) - { - if (Leaves.Count > 0) values.AddRange(from t in Leaves where t.Quad.Contains(x, y) select t.Value); - - for (var i = 0; i < 4; ++i) - if (Branches[i] != null) - Branches[i].SearchPoint(x, y, values); - } - } - - internal class Leaf - { - internal Branch Branch; - internal T Value; - internal Quad Quad; - } - } - - - public struct Quad - { - public float MinX; - public float MinY; - public float MaxX; - public float MaxY; - - public Quad(float minX, float minY, float maxX, float maxY) - { - MinX = minX; - MinY = minY; - MaxX = maxX; - MaxY = maxY; - } - - public void Set(float minX, float minY, float maxX, float maxY) - { - MinX = minX; - MinY = minY; - MaxX = maxX; - MaxY = maxY; - } - - - public bool Intersects(ref Quad other) - { - return MinX < other.MaxX && MinY < other.MaxY && MaxX > other.MinX && MaxY > other.MinY; - } - - public bool Contains(ref Quad other) - { - return other.MinX >= MinX && other.MinY >= MinY && other.MaxX <= MaxX && other.MaxY <= MaxY; - } - - public bool Contains(float x, float y) - { - return x > MinX && y > MinY && x < MaxX && y < MaxY; - } - } -} -