shape
This commit is contained in:
@@ -19,6 +19,7 @@ import engine.objects.*;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RegionCmd extends AbstractDevCmd {
|
public class RegionCmd extends AbstractDevCmd {
|
||||||
@@ -64,9 +65,9 @@ public class RegionCmd extends AbstractDevCmd {
|
|||||||
//}
|
//}
|
||||||
if( building != null){
|
if( building != null){
|
||||||
boolean pointBlocked = false;
|
boolean pointBlocked = false;
|
||||||
for(Area area : building.meshes){
|
for(Path2D.Float area : building.meshes){
|
||||||
Vector3fImmutable pos = ((AbstractCharacter)target).loc;
|
Vector3fImmutable pos = ((AbstractCharacter)target).loc;
|
||||||
if(area.contains(new Point((int) pos.x, (int) pos.z))){
|
if(area.contains(pos.x, pos.z)){
|
||||||
pointBlocked = true;
|
pointBlocked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -984,16 +984,17 @@ public enum BuildingManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(building.meshUUID == 24000){
|
|
||||||
int i = 0;
|
|
||||||
}
|
|
||||||
for (ArrayList<Vector2f> meshEntry : convexHullList) {
|
for (ArrayList<Vector2f> meshEntry : convexHullList) {
|
||||||
Polygon poly = new Polygon();
|
Path2D.Float meshBound = new Path2D.Float();
|
||||||
|
Vector3fImmutable start = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(meshEntry.get(0).x,building.loc.y,meshEntry.get(0).y),building.loc,building.getRot().getRotation());
|
||||||
|
meshBound.moveTo(start.x,start.z);
|
||||||
for (Vector2f vect : meshEntry) {
|
for (Vector2f vect : meshEntry) {
|
||||||
Vector3fImmutable rotationPoint = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(vect.x + building.loc.x, 0, vect.y + building.loc.z), building.loc, building.getRot().getRotation());
|
Vector3fImmutable pos = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(vect.x,building.loc.y,vect.y),building.loc,building.getRot().getRotation());
|
||||||
poly.addPoint((int) rotationPoint.x, (int) rotationPoint.z);
|
meshBound.lineTo(pos.x,pos.z);
|
||||||
}
|
}
|
||||||
building.meshes.add(new Area(poly));
|
meshBound.lineTo(start.x,start.z);
|
||||||
|
meshBound.closePath();
|
||||||
|
building.meshes.add(meshBound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import engine.server.MBServerStatics;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -100,7 +101,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
private ConcurrentHashMap<Integer, Condemned> condemned;
|
private ConcurrentHashMap<Integer, Condemned> condemned;
|
||||||
private ArrayList<Building> children = null;
|
private ArrayList<Building> children = null;
|
||||||
|
|
||||||
public ArrayList<Area> meshes;
|
public ArrayList<Path2D.Float> meshes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
|
|||||||
Reference in New Issue
Block a user