feat(JOML): migrate DebugOverlay
*/
package org.terasology.rendering.nui.layers.ingame.metrics;
+import org.joml.Vector3f;
+import org.joml.Vector3i;
import org.terasology.config.Config;
import org.terasology.engine.Time;
import org.terasology.entitySystem.entity.EntityManager;
import org.terasology.input.cameraTarget.CameraTargetSystem;
import org.terasology.logic.players.LocalPlayer;
-import org.terasology.math.ChunkMath;
-import org.terasology.math.geom.Vector3f;
-import org.terasology.math.geom.Vector3i;
import org.terasology.monitoring.PerformanceMonitor;
+import org.terasology.nui.databinding.ReadOnlyBinding;
+import org.terasology.nui.widgets.UILabel;
import org.terasology.persistence.StorageManager;
import org.terasology.registry.In;
import org.terasology.rendering.nui.CoreScreenLayer;
-import org.terasology.nui.databinding.ReadOnlyBinding;
-import org.terasology.nui.widgets.UILabel;
import org.terasology.rendering.primitives.ChunkTessellator;
import org.terasology.world.WorldProvider;
+import org.terasology.world.chunks.Chunks;
import java.util.Locale;
@In
private DebugMetricsSystem debugMetricsSystem;
- private UILabel metricsLabel;
-
@In
private StorageManager storageManager;
+ private UILabel metricsLabel;
@Override
public void initialise() {
@@ -106,10 +105,10 @@ public String get() {
debugLine3.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
- Vector3f pos = localPlayer.getPosition();
- Vector3i chunkPos = ChunkMath.calcChunkPos((int) pos.x, (int) pos.y, (int) pos.z);
- Vector3f rotation = localPlayer.getViewDirection();
- Vector3f cameraPos = localPlayer.getViewPosition();
+ Vector3f pos = localPlayer.getPosition(new Vector3f());
+ Vector3i chunkPos = Chunks.toChunkPos(pos, new Vector3i());
+ Vector3f rotation = localPlayer.getViewDirection(new Vector3f());
+ Vector3f cameraPos = localPlayer.getViewPosition(new Vector3f());
return String.format(Locale.US, "Position: (%.2f, %.2f, %.2f), Chunk (%d, %d, %d), Eye (%.2f, %.2f, %.2f), Rot (%.2f, %.2f, %.2f)", pos.x, pos.y, pos.z,
chunkPos.x, chunkPos.y, chunkPos.z,
cameraPos.x, cameraPos.y, cameraPos.z,
@@ -223,6 +222,4 @@ public void toggleMetricsMode() {
MetricsMode mode = debugMetricsSystem.toggle();
PerformanceMonitor.setEnabled(mode.isPerformanceManagerMode());
}
-
-
}
