Removed sorting when triangulating

Properly determine the insertion edge when triangulation to avoid having to sort each vertex later
Synchronize the plane viewer to prevent incorrect index saving when switching planes too quickly
Use the shape instead of collision shape for summoned physics objects
This commit is contained in:
2025-05-24 22:04:20 -04:00
parent 9fcab219af
commit 83e3b9443b
4 changed files with 103 additions and 50 deletions

View File

@@ -11,7 +11,6 @@ import java.util.List;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Polygon;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
@@ -31,7 +30,8 @@ public class MeshingTest3 {
System.out.println( "Found " + CHUNK_DIR.list().length + " files" );
for ( int i = 0; i < CHUNK_DIR.listFiles().length; ++i ) {
final File file = CHUNK_DIR.listFiles()[ i ];
System.out.println( "Meshing " + file + "\t" + ( i + 1 ) + "/" + CHUNK_DIR.listFiles().length );
System.out.println( ( i + 1 ) + "/" + CHUNK_DIR.listFiles().length + ":\tMeshing " + file );
long start = System.currentTimeMillis();
final List< Plane > planes = mesh( file );
planes.parallelStream().forEach( p -> {
try {
@@ -42,15 +42,19 @@ public class MeshingTest3 {
System.exit( 1 );
}
} );
long time = System.currentTimeMillis() - start;
System.out.println( "\tTook " + time + "ms" );
}
// final List< Plane > planes = mesh( new File( CHUNK_DIR, "world,-4,-6" ) ); // 123
// final List< Plane > planes = mesh( new File( CHUNK_DIR, "world,-1,-1" ) ); // 123
// for ( int i = 0; i < planes.size(); ++i ) {
// System.out.println( "Meshing plane " + i );
// process( planes.get( i ) );
// }
// process( planes.get( 177 ) );
// process( planes.get( 20 ) );
} else {
System.err.println( "No such directory exists: " + CHUNK_DIR );
}
@@ -74,7 +78,7 @@ public class MeshingTest3 {
String[] split = name.split( "," );
ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
System.out.println( "Parsing chunk " + location );
System.out.println( "\tParsing chunk " + location );
// First parse the file to get a list of all bounding boxes that we can use
List< AABB > boxes = new ArrayList< AABB >();
@@ -100,7 +104,7 @@ public class MeshingTest3 {
return null;
}
System.out.println( "Found " + boxes.size() + " boxes" );
System.out.println( "\tFound " + boxes.size() + " boxes" );
// Now that we have a bunch of bounding boxes, do whatever
MeshBuilder builder = new MeshBuilder();