Move orientation incantation into Vertex.rotate

Everywhere that Vertex#rotate was called, the orientation was rotated by 180 degrees first.
This commit is contained in:
SomeoneWithAnInternetConnection
2018-02-01 19:18:39 -05:00
committed by Adam
parent e396f37926
commit f2cc543dc7
3 changed files with 14 additions and 16 deletions

View File

@@ -48,6 +48,14 @@ public class Vertex
*/
public Vertex rotate(int orientation)
{
// models are orientated north (1024) and there are 2048 angles total
orientation = (orientation + 1024) % 2048;
if (orientation == 0)
{
return this;
}
int sin = Perspective.SINE[orientation];
int cos = Perspective.COSINE[orientation];

View File

@@ -72,15 +72,11 @@ public abstract class RSPlayerMixin implements RSPlayer
int localX = getX();
int localY = getY();
// models are orientated north (1024) and there are 2048 angles total
int orientation = (getOrientation() + 1024) % 2048;
int orientation = getOrientation();
List<Triangle> triangles = model.getTriangles();
if (orientation != 0)
{
triangles = rotate(triangles, orientation);
}
triangles = rotate(triangles, orientation);
List<Polygon> polys = new ArrayList<Polygon>();
for (Triangle triangle : triangles)

View File

@@ -132,19 +132,13 @@ public abstract class TileObjectMixin implements TileObject
int localX = getX();
int localY = getY();
// models are orientated north (1024) and there are 2048 angles total
orientation = (orientation + 1024) % 2048;
List<Vertex> vertices = model.getVertices();
if (orientation != 0)
// rotate vertices
for (int i = 0; i < vertices.size(); ++i)
{
// rotate vertices
for (int i = 0; i < vertices.size(); ++i)
{
Vertex v = vertices.get(i);
vertices.set(i, v.rotate(orientation));
}
Vertex v = vertices.get(i);
vertices.set(i, v.rotate(orientation));
}
List<Point> points = new ArrayList<Point>();