Removed ViewContext.
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / gui / Avatar.java
index 6e4c5ec..8dae301 100755 (executable)
@@ -14,7 +14,7 @@ import eu.svjatoslav.sixth.e3d.geometry.Point3D;
 import static java.lang.Math.cos;
 import static java.lang.Math.sin;
 
-public class Avatar implements ViewUpdateListener {
+public class Avatar implements ViewRenderListener {
 
     public static final double SPEED_LIMIT = 30;
     /**
@@ -70,7 +70,7 @@ public class Avatar implements ViewUpdateListener {
     }
 
     @Override
-    public boolean beforeViewUpdate(final ViewContext viewContext, final int millisecondsSinceLastFrame) {
+    public boolean beforeRender(final ViewPanel viewPanel, final int millisecondsSinceLastFrame) {
 
         final Point3D locationBeforeUpdate = new Point3D(location);
         translateAvatarLocation(millisecondsSinceLastFrame);
@@ -84,8 +84,7 @@ public class Avatar implements ViewUpdateListener {
     }
 
     public void enforceSpeedLimit() {
-        final double currentSpeed = movementVector
-                .getDistanceTo(Point3D.ZERO);
+        final double currentSpeed = movementVector.getVectorLength();
 
         if (currentSpeed <= SPEED_LIMIT)
             return;
@@ -122,7 +121,7 @@ public class Avatar implements ViewUpdateListener {
     }
 
     public double getMovementSpeed() {
-        return movementVector.getDistanceTo(Point3D.ZERO);
+        return movementVector.getVectorLength();
     }
 
     private void applyFrictionToUserMovement(int millisecondsPassedSinceLastFrame) {