diff --git a/Content/BP_BigIslandGenerator.uasset b/Content/BP_BigIslandGenerator.uasset index d53e840bb62e84d5836239eac0a1752579953d26..3387c51f0e9ada6dd7bb99a4d723daee6f7e543a 100644 GIT binary patch delta 64 zcmezMj`7z!#tD}M_DFs1KekTSdlJ_-%g@Od95+6aD%>nubdp(ufq{X6k%56h9K>K? TU|?lnU??dnP2GIAbS@(RgC7=m delta 45 zcmezMj`7z!#tD}M!h~{~`7ir;&6rcHv(_b1cH<+dLRLlw1_trXFADE6Z@yPLhY%V!X>bnBl}qF6)#*tP-aXFzksnC%$g@4!TRw3|Njk>=L?uK)=a)G&@Gz`4JB?U9R#JH z{{R0!e{#K`v|uSzgcC|8YRunH5m4P3=9VGEXPwhRoDFSu(=juWwA;dg{`K>AOKs7Q1{9RqUIS}6Mn zvZ7g{8k3_$1y~B5kaW%xwP0y=MG?@LtR*JE(&>pLm?dVx(&mdKpd~Ca`I(r2L=My< zCI$wEqad3Z7#NuRkrY~qTQD6DhkFC0Z=1M)L=6KZ*MPL}K+Sj?j--!ELPe|&NzpT? zqMxW{wMhtwH6SUghAO)s0k`s&gahlV|NsBLnJh24gMEV}*y73iB_%e0lPptYOqrZ( zEv}UU)%O*Y5~1vLC=E*~;H;lAd7ZVrAWS((1t^gtBUujOGB7Z-Kxro^T{xLh zSYoobjVxpRWL_@`e;%a$Fff2hDG(DB{UADhvb3EBWBOzlJ6pz-$xU`HVz4k|0Hv%jkQz|HPQGJj zAPAFEhKe?UgV)qvS+Wu;0#gAqzGpI{umWS%mz1ilt0uaj|C1oLuNG$(S;k zQCNia=l}ozi@~|=oV(WK<1QMEZIcx}AhHsSDKHsMY*rT`S#330(Jd3n>d7kZ0*on> zP2Ewfo4nXNa`F#%Y?jn{1TkhzzUX1XnF=?S&y$c7O5kc=doD&;Z^4){+0q-uYOqgB zVE&o>#~Yg?Kw+@PCkz}mAgdXLr6-&FdNLvfxFoEkhQ(k4)Cr(;FF?3m0Qw3xAD^7^1FlNud76a@eP delta 2199 zcmcb&iShX=#t9jWITJG-EqeGE82A|&7_JF1FeoxGFj(<3FuapsU|?imV3;P!z%Wme zfnl8_14Fs9Yg*SoM(;Vn7o@{CpYfUaC{E$FBm+ZoC<6-k|NsC09BYVKlLe*4CYLeZ zX8{=u=A32XXVGL}U;uHX^@9sb6N^%PQ;Rd4N;7j(Qi~Yoy_r`GQ_Qa)o>-DvAua|62C!bRb9B$mpFBA*LS*wg zJ~>9l)X5w9jVB3|Fjh`h6p&`D0g;m@2uMsmBA~!nHTkJPH)HYSLP2T9#>u^c(t^Fv z@ZyBhnUe*Dg(sg8EOoDaZ$*eF=uk2u=8XeVHL&+lM98@8UKR$G9oIBCnh_Jq%$&378G@! z{6<7Tv=geIgMoozEtI`&vY==>OR^IK!{kIyjmZkaER!8XH6~vW6<{o%{7^KVrP>oo zYJsrGrK|68Aw8@%w8jNX^gY0Y> zlP6EGb75?ryunU{v3c?t7|oIJt7jInuggQLde_YMM* zFwIbD23RUhn|#($WwMPU2V>e~S4S(b4hvCa)yOJ!7}F;Iax?;~(wH3TB!HsQ5o&nz zCCA3C)$Hcg)ERRGZ~xIpXeS&^b{@5!8wPghS36ic2g$_#5 z*!5~|YW$v^3Z9cI{J#oqWN=KL?Cg$dSHa{)mypS99vW!&fkd}?XfUQvzVBhenF6;> z#uJNcCckmzUkcijw16gSAXN~D0UYHJ$2A;|M{wJ=?1F>MTJr$4=i+Yw diff --git a/Content/BP_IslandMesh.uasset b/Content/BP_IslandMesh.uasset index b35158f2e0420d788184dae95dfef8ae949cc24e..3d3028cb9db15217153b459ed7ea400bb073fcf5 100644 GIT binary patch delta 4533 zcmezKo3ZI1M1{CoB|NsBrHa9ZLGBT=6zQ`mc=$D^aTg4|d(u`@7^97|R2MNkB=7Ly^ zm6PuaN>5%UxPoy4h{ZS=OirKtUqGDo=Kufy>}nsMUf+d|Teiza^; za%YU2Y%eUW84rzz2mk;7FMzUnpmYM1zW@LK|MJQ6g~bi;{r~^J3n~gzl?>(I{r~^} z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Ju-z2^y0Z#b_{2p1dbPR~>9jIhaJ`*dPD@|Az`eD3EzNlf7eg;E9PW&$U8KgO?0o z&oLGg<;B-=ATR!j^O$Ux!i(ggDOkN2K$iDZCf6nEm{dYt38EmuKveixOtwt2ASQe` z;gLW2e69p1N=$odvq zu1^*RFv+$CKtv-vhRi*4UAN8GT9;5fikzlv*+YJS&HD42rhXh`{$Y9^@(ae$R}p` z)^%a_ob0!Ul>|`-o3-Wv07ycQtpET3 diff --git a/Content/NoisyIslands.uasset b/Content/NoisyIslands.uasset new file mode 100644 index 0000000000000000000000000000000000000000..01bb9bfe1bec538683164f7e433d373d17a5b277 GIT binary patch literal 1231 zcmX@utTpfF|Ns9Jm>C#YnHa!;k%58XZN`QtFP)}*;l5?K$Z@xuo)iNELkbH611kdq zgI|7LDp(;e0|SEsBLjmX0|SG(nVY4NtFfhtrJK2dvyr8NvzwEvv!kVjk(rT&rKK@g zLmCqU1IUtVObiSx3=9k){xW8;6vH}Z1~A^o%)r2zB&0Smx!Y-7jnGQTuNF)o7lHJF zEM#F2Wng4jlQp3;+Yg_i+FK literal 0 HcmV?d00001 diff --git a/Content/PoissonMeshBuilder.uasset b/Content/PoissonMeshBuilder.uasset index 2244c04383320afe2c34962e515e041523bb75bd..7f85856413d3f188714ae50ca17c0085d9587a71 100644 GIT binary patch delta 406 zcmdnP*~&FRM`$_=0|P4q1A||FUMd3!@J_Tda4cnFU|?ckV0g;Jz`(-5zyRWJWd=zz zFzjW9;IqsO4E?2kReD!WInR@cUSW6EHIR`3qK|jt`cO$u76t}Jkl7G@VDkU}|No~? zmSrrr6JTIqaLO;uOGzxM3@%7a&df_^IJ08aV>Si`2Iri_;$nu9@`{N(3=9mOc_jfw z`30#(C6x?IFPnKuGB7Yq4rGy-ypM6RCCGIklmGtz|DPSiU|?VXxdOz5$^H5N|3AoB zkQhvkb8;7xG$ZHaWlYLqAWJ}U+zbp1nji)P1H*Kd$q$)SCNneZiGqYdqM!hA1Th#G z7!FK!W1h@@kQr>*lVxF^~fIC?TMFfcJNFzjSvU|?ZjU;yzunL*MF z3=^3lcp)7Ad4^~$KC#YnHa!;k%58XZN`QtFP)}*;l5?K$Z@xuo)iNELoy2k11kdq zgI|7LDp(;e0|SEsBLjmX0|SGji>sr#g{hH=skxJ>n}va;vx~EZv4y#Xk%^h1p_?mM zLjn^61IUsKObiSx3=9k){sLyO6vGN;1~A^i%)qeV>(PUZ!9I?i4%ZFVzm?evauG-$ z$U+tdQ3ghaMX7EK!VC-y+S;M6CfY%%IjM=osk$b5MurR^1q=*bKCZYFK$WcZaMjhB>_eG1*t_Pl?=a^-}@`Xz`y{p72<;M#FEq^1{tS` z`?wew7<>}*Qi78cb5a>ZUhF!-$-uzin_80Sl30?+@T6hOWO)32VLr;s!N9-}keHmE zn4Zc|?A{?Ni{Sg@Cnx4)Rwb5X=I8k(=B5@GBqpaa2$fWJ2p|-}O`fZ>Bo*XXh=U-G zD`p7Hv8V^d94JVkk<9S-|NsB&AOQvj26VYU|Ns97xep`_lLL7G#0O!R7>q`i1Emg- znt%WQ{|C`9%mZa`GcYh{LfN2rg);F{AbUUdVKC)fqr(8sutNXuxO&28ITEP!a@5f-o{0#0R+pl%zpyqKX($VFmz)3Hmbt literal 0 HcmV?d00001 diff --git a/Content/WaterData.uasset b/Content/WaterData.uasset deleted file mode 100644 index 6ae01a76994e522a4e1f06ca3e159d0b4fdffba0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1199 zcmX@utTpfF|Ns9Jm>C#YnHa!;k%58XZN`QtFP)}*;l5?K$Z@xuo)iNEg9{4-11kdq zgI|7LDp(;e0|SEsBLjmXNYdHK($&n+(!|xk(A>h%($dw*+1SF#+0f9@&Dg}r7_1?h ziGcxR$!R7A1{MYe1`vNXGgyjYF*5@gZ)Rp-;1XfK(=tiTecwa3cMR@|lR+*5=>u8F z!XV1P$gn8YjX{`!fk9h4)YU{gC^aWFu{c%NM9;{O0i=L|q07e=mjZ}=3=Eg`GMzx| zo6HOht3l2IaiIAB|Ns9%{snnWKOjG+GCe;pF~>Ktz&$lDwJ5P9zeqnku_U#~C9x!t zL3LHndl3c(2L0gVqRfI4edqk5)KLGVtkmQZh991~c5+B^Sj}QE`~EQ;WI~c>URi2U ziBDo)iep|1*an98c_%)BJnodApA%4&UyxcN99RdhNaFgfiEJ@{JU|;~d7i^dAx%uEo1BE8Y zP7wX~|NsB&AO-^i11Lg4OqkrC|NsAkyaN)0$$=aX;)5_u3`Qf%ff5Et&A;ahr!cZx! z6uOyM6+s0-W`X>M9NDO$znmEo!lkqf n1A}uk)Qw<@kpYy#z)S`P6gEf +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "IslandNoiseWater.h" + +bool UIslandNoiseWater::IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const +{ + FVector2D nVector = Mesh->r_pos(Point); + nVector.X /= HalfMeshSize.X; + nVector.Y /= HalfMeshSize.Y; + nVector = (nVector + Offset) * Shape.IslandFragmentation; + float n = UIslandMapUtils::FBMNoise(Shape.Amplitudes, nVector); + float distance = FMath::Max(FMath::Abs(nVector.X), FMath::Abs(nVector.Y)); + return n * distance * distance > WaterCutoff; +} diff --git a/Source/PolygonalMapGenerator/Private/IslandRadialWater.cpp b/Source/PolygonalMapGenerator/Private/IslandRadialWater.cpp new file mode 100644 index 0000000..2c84de1 --- /dev/null +++ b/Source/PolygonalMapGenerator/Private/IslandRadialWater.cpp @@ -0,0 +1,59 @@ +/* +* From http://www.redblobgames.com/maps/mapgen2/ +* Original work copyright 2017 Red Blob Games +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "IslandRadialWater.h" + +UIslandRadialWater::UIslandRadialWater() +{ + Bumps = 3; + StartAngle = 1.0f; + AngleOffset = 1.0f; + MinAngle = 0.5f; + LandScale = 1.25f; +} + +bool UIslandRadialWater::IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const +{ + FVector2D point = Mesh->r_pos(Point) - HalfMeshSize; + point.X = LandScale * 2.0f * (point.X / (HalfMeshSize.X * 2.0f)); + point.Y = LandScale * 2.0f * (point.Y / (HalfMeshSize.Y * 2.0f)); + // Get the angle of the point from the center of the island + float angle = FMath::Atan2(point.Y, point.X); + // Get the normalized length of whichever axis is longer + float length = 0.5f * (FMath::Max(FMath::Abs(point.X), FMath::Abs(point.Y)) + FVector2D::Distance(FVector2D::ZeroVector, point)); + // The inner radius has to be smaller than the length for this to be land + float innerRadius; + // The outer radius has to be larger than the length for this to be land + float outerRadius; + + if ((FMath::Abs(angle - (AngleOffset * PI)) < MinAngle + || FMath::Abs(angle - (AngleOffset * PI) + 2.0f * PI) < MinAngle + || FMath::Abs(angle - (AngleOffset * PI) - 2.0f * PI) < MinAngle)) + { + // Our angle is less than the minimum angle + innerRadius = 0.2f; + outerRadius = 0.2f; + } + else + { + innerRadius = 0.5f + 0.4f * FMath::Sin((StartAngle * PI) + Bumps * angle + FMath::Cos((Bumps + 3) * angle)); + outerRadius = 0.7f - 0.2f * FMath::Sin((StartAngle * PI) + Bumps * angle - FMath::Sin((Bumps + 2) * angle)); + } + + return !((length + WaterCutoff < innerRadius) || (length + WaterCutoff > innerRadius * Shape.IslandFragmentation && length + WaterCutoff < outerRadius)); +} \ No newline at end of file diff --git a/Source/PolygonalMapGenerator/Private/IslandRivers.cpp b/Source/PolygonalMapGenerator/Private/IslandRivers.cpp index ff9756d..d7c33d8 100644 --- a/Source/PolygonalMapGenerator/Private/IslandRivers.cpp +++ b/Source/PolygonalMapGenerator/Private/IslandRivers.cpp @@ -94,12 +94,6 @@ void UIslandRivers::AssignSideFlow_Implementation(TArray& s_flow, UTriang } processedSlopes.Add(t); - if (processedSlopes.Num() > 100) - { - UE_LOG(LogMapGen, Error, TEXT("Processed too many slopes!")); - return; - } - t = next_t; } } diff --git a/Source/PolygonalMapGenerator/Private/IslandSquareWater.cpp b/Source/PolygonalMapGenerator/Private/IslandSquareWater.cpp new file mode 100644 index 0000000..a5ff75d --- /dev/null +++ b/Source/PolygonalMapGenerator/Private/IslandSquareWater.cpp @@ -0,0 +1,24 @@ +/* +* From http://www.redblobgames.com/maps/mapgen2/ +* Original work copyright 2017 Red Blob Games +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "IslandSquareWater.h" + +bool UIslandSquareWater::IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const +{ + return true; +} diff --git a/Source/PolygonalMapGenerator/Private/IslandWater.cpp b/Source/PolygonalMapGenerator/Private/IslandWater.cpp index e10cbe8..8e9f791 100644 --- a/Source/PolygonalMapGenerator/Private/IslandWater.cpp +++ b/Source/PolygonalMapGenerator/Private/IslandWater.cpp @@ -84,6 +84,9 @@ void UIslandWater::AssignWater_Implementation(TArray& r_water, FRandomStre /* A region is water if the noise value is low */ r_water.Empty(Mesh->NumRegions); r_water.SetNumZeroed(Mesh->NumRegions); + + InitializeWater(r_water, Mesh, Rng); + FVector2D meshSize = Mesh->GetSize() * 0.5f; FVector2D offset = FVector2D(Rng.FRandRange(-meshSize.X, meshSize.X), Rng.FRandRange(-meshSize.Y, meshSize.Y)); for (FPointIndex r = 0; r < r_water.Num(); r++) @@ -94,13 +97,7 @@ void UIslandWater::AssignWater_Implementation(TArray& r_water, FRandomStre } else { - FVector2D nVector = Mesh->r_pos(r); - nVector.X /= meshSize.X; - nVector.Y /= meshSize.Y; - nVector = (nVector + offset) * Shape.IslandFragmentation; - float n = UIslandMapUtils::FBMNoise(Shape.Amplitudes, nVector); - float distance = FMath::Max(FMath::Abs(nVector.X), FMath::Abs(nVector.Y)); - r_water[r] = n * distance * distance > WaterCutoff; + r_water[r] = IsPointLand(r, Mesh, meshSize, offset, Shape); if (bInvertLandAndWater) { r_water[r] = !r_water[r]; @@ -124,6 +121,16 @@ void UIslandWater::AssignWater_Implementation(TArray& r_water, FRandomStre } } +void UIslandWater::InitializeWater_Implementation(TArray& r_water, UTriangleDualMesh* Mesh, FRandomStream& Rng) const +{ + // Empty +} + +bool UIslandWater::IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const +{ + return false; +} + void UIslandWater::assign_r_water(TArray& r_water, FRandomStream& Rng, UTriangleDualMesh* Mesh, const FIslandShape& Shape) const { AssignWater(r_water, Rng, Mesh, Shape); @@ -132,4 +139,4 @@ void UIslandWater::assign_r_water(TArray& r_water, FRandomStream& Rng, UTr void UIslandWater::assign_r_ocean(TArray& r_ocean, UTriangleDualMesh* Mesh, const TArray& r_water) const { AssignOcean(r_ocean, Mesh, r_water); -} \ No newline at end of file +} diff --git a/Source/PolygonalMapGenerator/Public/IslandNoiseWater.h b/Source/PolygonalMapGenerator/Public/IslandNoiseWater.h new file mode 100644 index 0000000..e7b0538 --- /dev/null +++ b/Source/PolygonalMapGenerator/Public/IslandNoiseWater.h @@ -0,0 +1,35 @@ +/* +* From http://www.redblobgames.com/maps/mapgen2/ +* Original work copyright 2017 Red Blob Games +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma once + +#include "CoreMinimal.h" +#include "IslandWater.h" +#include "IslandNoiseWater.generated.h" + +/** + * + */ +UCLASS() +class POLYGONALMAPGENERATOR_API UIslandNoiseWater : public UIslandWater +{ + GENERATED_BODY() + +protected: + virtual bool IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const override; +}; diff --git a/Source/PolygonalMapGenerator/Public/IslandRadialWater.h b/Source/PolygonalMapGenerator/Public/IslandRadialWater.h new file mode 100644 index 0000000..13de6e6 --- /dev/null +++ b/Source/PolygonalMapGenerator/Public/IslandRadialWater.h @@ -0,0 +1,52 @@ +/* +* From http://www.redblobgames.com/maps/mapgen2/ +* Original work copyright 2017 Red Blob Games +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma once + +#include "CoreMinimal.h" +#include "IslandWater.h" +#include "IslandRadialWater.generated.h" + +/** + * + */ +UCLASS() +class POLYGONALMAPGENERATOR_API UIslandRadialWater : public UIslandWater +{ + GENERATED_BODY() + +public: + // The number of sine waves which form bumps along the island. + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Bumps") + int32 Bumps; + // The start angle for the sin function, in radians. + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Angle") + float StartAngle; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Angle") + float AngleOffset; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Angle") + float MinAngle; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Angle") + float LandScale; + +public: + UIslandRadialWater(); + +protected: + virtual bool IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const override; +}; diff --git a/Source/PolygonalMapGenerator/Public/IslandSquareWater.h b/Source/PolygonalMapGenerator/Public/IslandSquareWater.h new file mode 100644 index 0000000..403ee5e --- /dev/null +++ b/Source/PolygonalMapGenerator/Public/IslandSquareWater.h @@ -0,0 +1,35 @@ +/* +* From http://www.redblobgames.com/maps/mapgen2/ +* Original work copyright 2017 Red Blob Games +* Unreal Engine 4 implementation copyright 2018 Jay Stevens +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma once + +#include "CoreMinimal.h" +#include "IslandWater.h" +#include "IslandSquareWater.generated.h" + +/** + * + */ +UCLASS() +class POLYGONALMAPGENERATOR_API UIslandSquareWater : public UIslandWater +{ + GENERATED_BODY() + +protected: + virtual bool IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const override; +}; diff --git a/Source/PolygonalMapGenerator/Public/IslandWater.h b/Source/PolygonalMapGenerator/Public/IslandWater.h index 045f958..53d9950 100644 --- a/Source/PolygonalMapGenerator/Public/IslandWater.h +++ b/Source/PolygonalMapGenerator/Public/IslandWater.h @@ -27,7 +27,7 @@ /** * A class which determines which areas on the island are land and which are water. */ -UCLASS(Blueprintable) +UCLASS(Abstract, Blueprintable) class POLYGONALMAPGENERATOR_API UIslandWater : public UDataAsset { GENERATED_BODY() @@ -47,6 +47,13 @@ public: protected: virtual void AssignOcean_Implementation(TArray& r_ocean, UTriangleDualMesh* Mesh, const TArray& r_water) const; virtual void AssignWater_Implementation(TArray& r_water, FRandomStream& Rng, UTriangleDualMesh* Mesh, const FIslandShape& Shape) const; + virtual bool IsPointLand_Implementation(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const; + virtual void InitializeWater_Implementation(TArray& r_water, UTriangleDualMesh* Mesh, FRandomStream& Rng) const; + + UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Procedural Generation|Island Generation|Water") + bool IsPointLand(FPointIndex Point, UTriangleDualMesh* Mesh, const FVector2D& HalfMeshSize, const FVector2D& Offset, const FIslandShape& Shape) const; + UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Procedural Generation|Island Generation|Water") + void InitializeWater(UPARAM(ref) TArray& r_water, UTriangleDualMesh* Mesh, UPARAM(ref) FRandomStream& Rng) const; public: UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Procedural Generation|Island Generation|Water")