Commit a0682250 authored by Human Gamer's avatar Human Gamer

Bounds Recalculation Now Optional as it is buggy right now

parent 371448e6
Pipeline #1869216 skipped
......@@ -1039,6 +1039,11 @@ public class Interior
this.surfaces[i].setTexGenIndex(this.texGenEQs.indexOf(texGen));
}
//this.recalculateBounds();
}
public void recalculateBounds()
{
Point3F min = new Point3F((float)1e10, (float)1e10, (float)1e10);
Point3F max = new Point3F((float)-1e10, (float)-1e10, (float)-1e10);
......@@ -1053,7 +1058,7 @@ public class Interior
int surfaceStart = hull.getSurfaceStart();
int surfaceCount = hull.getSurfaceCount();
System.out.println(surfaceStart + ": " + (surfaceStart + surfaceCount));
//System.out.println(surfaceStart + ": " + (surfaceStart + surfaceCount));
for (int j = surfaceStart; j < surfaceStart + surfaceCount; j++)
{
......
......@@ -534,6 +534,14 @@ public class InteriorResource
return false;
}
public void recalculateBounds()
{
for (Interior interior : this.detailLevels)
interior.recalculateBounds();
for (Interior interior : this.subObjects)
interior.recalculateBounds();
}
public List<Interior> getDetailLevels()
{
return this.detailLevels;
......
......@@ -95,7 +95,7 @@ public class DifInspector
DifInspector.this.testBuild();
}
});
fileMenu.add(testBuildMenu);
//fileMenu.add(testBuildMenu);
JMenuItem openMenu = new JMenuItem("Open DIF");
openMenu.addActionListener(new ActionListener() {
......@@ -300,6 +300,16 @@ public class DifInspector
});
editMenu.add(selectMenu);
JMenuItem boundsMenu = new JMenuItem("Recalculate Bounds");
boundsMenu.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
DifInspector.this.recalculateBounds();
}
});
editMenu.add(boundsMenu);
/*JMenuItem addMaterialMenu = new JMenuItem("Add Material");
addMaterialMenu.addActionListener(new ActionListener() {
@Override
......@@ -754,6 +764,22 @@ public class DifInspector
this.processInterior();
}
public void recalculateBounds()
{
if (this.interior == null)
{
JOptionPane.showMessageDialog(this.frame, "Operation Failed:\n" + "No Interior Loaded!");
return;
}
int result = JOptionPane.showConfirmDialog(this.frame, "This is highly experimental and may break collision!\n\nAre you sure you want to do this? (NO UNDO)", "Warning", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
System.out.println("Recalculating Bounds");
this.interior.recalculateBounds();
}
}
/*
* public void verify() { JFileChooser chooser = new JFileChooser();
* chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileFilter(new FileNameExtensionFilter(
......
......@@ -408,6 +408,12 @@ public class InteriorBuilder
System.out.println("Processing Data");
result.processData();
System.out.println("Preparing Data");
result.prepareData();
System.out.println("Recalculating Bounds");
result.recalculateBounds();
return result;
}
......
......@@ -54,7 +54,7 @@ public class OBJModel
token1 = Float.NaN;
else
token1 = Float.valueOf(tokens[1]);
if (tokens[2].equalsIgnoreCase("nan") || tokens[1].isEmpty())
if (tokens[2].equalsIgnoreCase("nan") || tokens[2].isEmpty())
token2 = Float.NaN;
else
token2 = Float.valueOf(tokens[2]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment