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:
committed by
Adam
parent
e396f37926
commit
f2cc543dc7
@@ -48,6 +48,14 @@ public class Vertex
|
|||||||
*/
|
*/
|
||||||
public Vertex rotate(int orientation)
|
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 sin = Perspective.SINE[orientation];
|
||||||
int cos = Perspective.COSINE[orientation];
|
int cos = Perspective.COSINE[orientation];
|
||||||
|
|
||||||
|
|||||||
@@ -72,15 +72,11 @@ public abstract class RSPlayerMixin implements RSPlayer
|
|||||||
int localX = getX();
|
int localX = getX();
|
||||||
int localY = getY();
|
int localY = getY();
|
||||||
|
|
||||||
// models are orientated north (1024) and there are 2048 angles total
|
int orientation = getOrientation();
|
||||||
int orientation = (getOrientation() + 1024) % 2048;
|
|
||||||
|
|
||||||
List<Triangle> triangles = model.getTriangles();
|
List<Triangle> triangles = model.getTriangles();
|
||||||
|
|
||||||
if (orientation != 0)
|
triangles = rotate(triangles, orientation);
|
||||||
{
|
|
||||||
triangles = rotate(triangles, orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Polygon> polys = new ArrayList<Polygon>();
|
List<Polygon> polys = new ArrayList<Polygon>();
|
||||||
for (Triangle triangle : triangles)
|
for (Triangle triangle : triangles)
|
||||||
|
|||||||
@@ -132,19 +132,13 @@ public abstract class TileObjectMixin implements TileObject
|
|||||||
int localX = getX();
|
int localX = getX();
|
||||||
int localY = getY();
|
int localY = getY();
|
||||||
|
|
||||||
// models are orientated north (1024) and there are 2048 angles total
|
|
||||||
orientation = (orientation + 1024) % 2048;
|
|
||||||
|
|
||||||
List<Vertex> vertices = model.getVertices();
|
List<Vertex> vertices = model.getVertices();
|
||||||
|
|
||||||
if (orientation != 0)
|
// rotate vertices
|
||||||
|
for (int i = 0; i < vertices.size(); ++i)
|
||||||
{
|
{
|
||||||
// rotate vertices
|
Vertex v = vertices.get(i);
|
||||||
for (int i = 0; i < vertices.size(); ++i)
|
vertices.set(i, v.rotate(orientation));
|
||||||
{
|
|
||||||
Vertex v = vertices.get(i);
|
|
||||||
vertices.set(i, v.rotate(orientation));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Point> points = new ArrayList<Point>();
|
List<Point> points = new ArrayList<Point>();
|
||||||
|
|||||||
Reference in New Issue
Block a user