Selaa lähdekoodia

An experiment - instead of hard limit function use modulo wrap-around for zone placement. Should be more logical and give zones more space.

DjWarmonger 9 vuotta sitten
vanhempi
sitoutus
fba1e86091
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      lib/rmg/CRmgTemplateZone.cpp

+ 6 - 1
lib/rmg/CRmgTemplateZone.cpp

@@ -354,7 +354,12 @@ float3 CRmgTemplateZone::getCenter() const
 void CRmgTemplateZone::setCenter(const float3 &f)
 {
 	//limit boundaries to (0,1) square
-	center = float3 (std::min(std::max(f.x, 0.f), 1.f), std::min(std::max(f.y, 0.f), 1.f), f.z);
+	//center = float3 (std::min(std::max(f.x, 0.f), 1.f), std::min(std::max(f.y, 0.f), 1.f), f.z);
+
+	//alternate solution - wrap zone around unitary square. If it doesn't fit on one side, will come out on the opposite side
+	center = f;
+	center.x = std::fmod(center.x, 1);
+	center.y = std::fmod(center.y, 1);
 }