Offset support for blend.

This commit is contained in:
2023-10-11 16:50:52 -04:00
parent dadfc15d39
commit 280bd61e2a
3 changed files with 24 additions and 22 deletions
+17 -15
View File
@@ -288,8 +288,22 @@ public enum ZoneManager {
return localCoords;
}
public static Vector2f worldToZoneSpace(Vector3fImmutable worldVector,
Zone serverZone) {
public static Vector2f worldToZoneOffset(Vector3fImmutable worldLoc,
Zone serverZone) {
Vector2f localCoords;
Vector2f zoneOrigin;
zoneOrigin = new Vector2f(serverZone.getLoc().x, serverZone.getLoc().z);
localCoords = new Vector2f(worldLoc.x, worldLoc.z);
localCoords = localCoords.subtract(zoneOrigin);
return localCoords;
}
public static Vector2f worldToTerrainSpace(Vector3fImmutable worldLoc,
Zone serverZone) {
Vector2f localCoords;
Vector2f zoneOrigin;
@@ -301,7 +315,7 @@ public enum ZoneManager {
// Local coordinate in world space translated to an offset from the calculated zone origin.
localCoords = new Vector2f(worldVector.x, worldVector.z);
localCoords = new Vector2f(worldLoc.x, worldLoc.z);
localCoords = localCoords.subtract(zoneOrigin);
// TODO : Make sure this value does not go outside the zone's bounds.
@@ -311,18 +325,6 @@ public enum ZoneManager {
// Converts local zone coordinates to world coordinates
public static Vector3fImmutable localToWorld(Vector3fImmutable worldVector,
Zone serverZone) {
Vector3fImmutable worldCoords;
worldCoords = new Vector3fImmutable(worldVector.x + serverZone.absX,
worldVector.y + serverZone.absY, worldVector.z
+ serverZone.absZ);
return worldCoords;
}
/**
* Converts from local (relative to this building) to world.