use of net.runelite.api.Model in project runelite by runelite.
the class RSPlayerMixin method getPolygons.
@Inject
@Override
public Polygon[] getPolygons() {
Model model = getModel();
if (model == null) {
return null;
}
int localX = getX();
int localY = getY();
int orientation = getOrientation();
List<Triangle> triangles = model.getTriangles();
triangles = rotate(triangles, orientation);
List<Polygon> polys = new ArrayList<Polygon>();
for (Triangle triangle : triangles) {
Vertex vx = triangle.getA();
Vertex vy = triangle.getB();
Vertex vz = triangle.getC();
Point x = Perspective.worldToCanvas(client, localX - vx.getX(), localY - vx.getZ(), -vx.getY());
Point y = Perspective.worldToCanvas(client, localX - vy.getX(), localY - vy.getZ(), -vy.getY());
Point z = Perspective.worldToCanvas(client, localX - vz.getX(), localY - vz.getZ(), -vz.getY());
int[] xx = { x.getX(), y.getX(), z.getX() };
int[] yy = { x.getY(), y.getY(), z.getY() };
polys.add(new Polygon(xx, yy, 3));
}
return polys.toArray(new Polygon[polys.size()]);
}
use of net.runelite.api.Model in project runelite by runelite.
the class RSDecorativeObjectMixin method getModel.
@Inject
private RSModel getModel() {
RSRenderable renderable = getRenderable();
if (renderable == null) {
return null;
}
RSModel model;
if (renderable instanceof Model) {
model = (RSModel) renderable;
} else {
model = renderable.getModel();
}
return model;
}
Aggregations