Browse Source

load mesh data and structure meshes

mesh-colliders
FatBoy-DOTC 10 months ago
parent
commit
3c432a5c9e
  1. 14
      src/engine/collisionEngine/Mesh.java
  2. 79
      src/engine/devcmd/cmds/ColliderCmd.java
  3. 1
      src/engine/gameManager/DevCmdManager.java

14
src/engine/collisionEngine/Mesh.java

@ -15,13 +15,13 @@ public class Mesh { @@ -15,13 +15,13 @@ public class Mesh {
public int parentUUID;
public MeshData meshData;
private int meshID;
private Rectangle2D.Float bounds;
private ArrayList<MeshTriangle> triangles;
private Vector3f mesh_loc;
private Vector3f mesh_ref;
private Vector3f mesh_end;
private float mesh_maxY;
private float mesh_minY;
public Rectangle2D.Float bounds;
public ArrayList<MeshTriangle> triangles;
public Vector3f mesh_loc;
public Vector3f mesh_ref;
public Vector3f mesh_end;
public float mesh_maxY;
public float mesh_minY;
public Mesh(MeshData data, int parentUUID){
this.meshData = data;

79
src/engine/devcmd/cmds/ColliderCmd.java

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.BuildingGroup;
import engine.Enum.GameObjectType;
import engine.Enum.TargetColor;
import engine.collisionEngine.Mesh;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.BuildingManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import engine.util.StringUtils;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author
*/
public class ColliderCmd extends AbstractDevCmd {
public ColliderCmd() {
super("collider");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
// Arg Count Check
if (words.length != 1) {
this.sendUsage(pc);
return;
}
if (pc == null) {
return;
}
String newline = "\r\n ";
String output = "----------Collider Information----------" + newline;
if(target.getObjectType().equals(GameObjectType.Building) == false)
throwbackInfo(pc, "You Must Select A Building");
Building building = (Building)target;
output += "Mesh Count: " + ((Building) target).buildingMeshes.size() + newline;
for(Mesh mesh : building.buildingMeshes){
output += "------------------------------" + newline;
output += "Mesh ID: " + mesh.meshData.meshID + newline;
output += "Mesh Tri Count: " + mesh.triangles.size() + newline;
output += "Mesh Bounds: " + mesh.bounds + newline;
output += "Mesh Min/Max: " + mesh.mesh_minY + " / " + mesh.mesh_maxY + newline;
output += "Location Inside: " + mesh.bounds.contains(pc.loc.x,pc.loc.z * -1) + newline;
output += "------------------------------" + newline;
}
throwbackInfo(pc, output);
}
@Override
protected String _getHelpString() {
return "Gets information on an Object.";
}
@Override
protected String _getUsageString() {
return "' /info targetID'";
}
}

1
src/engine/gameManager/DevCmdManager.java

@ -58,6 +58,7 @@ public enum DevCmdManager { @@ -58,6 +58,7 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new PrintResistsCmd());
DevCmdManager.registerDevCmd(new PrintLocationCmd());
DevCmdManager.registerDevCmd(new InfoCmd());
DevCmdManager.registerDevCmd(new ColliderCmd());
DevCmdManager.registerDevCmd(new aiInfoCmd());
DevCmdManager.registerDevCmd(new SimulateBootyCmd());
DevCmdManager.registerDevCmd(new GetHeightCmd());

Loading…
Cancel
Save