Move each application to its own submodule

Removed JOML and Bukkit depednencies for the standalone applications
This commit is contained in:
2026-03-15 15:16:42 -04:00
parent ce8165417b
commit c2aa41fe58
33 changed files with 1204 additions and 177 deletions

17
application/pom.xml Normal file
View File

@@ -0,0 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-master</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>mc-mesh-application</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<modules>
<module>visualizer</module>
</modules>
</project>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-1</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshTest</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-1</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshTest</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.io.BufferedReader;
import java.io.File;
@@ -8,12 +8,11 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
public class MeshTest {
private static final File BASE = new File( System.getProperty( "user.dir" ) );
@@ -34,7 +33,7 @@ public class MeshTest {
private static void doStuff( File file ) {
String name = file.getName();
String[] split = name.split( "," );
ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
System.out.println( "Parsing chunk " + location );
@@ -105,14 +104,14 @@ public class MeshTest {
private static List< Facet > generateFacetsFor( AABB box ) {
List< Facet > facets = new ArrayList< Facet >();
Vector p1 = new Vector( box.xmin, box.ymin, box.zmin );
Vector p2 = new Vector( box.xmin, box.ymin, box.zmax );
Vector p3 = new Vector( box.xmin, box.ymax, box.zmin );
Vector p4 = new Vector( box.xmin, box.ymax, box.zmax );
Vector p5 = new Vector( box.xmax, box.ymin, box.zmin );
Vector p6 = new Vector( box.xmax, box.ymin, box.zmax );
Vector p7 = new Vector( box.xmax, box.ymax, box.zmin );
Vector p8 = new Vector( box.xmax, box.ymax, box.zmax );
Vector3d p1 = new Vector3d( box.xmin, box.ymin, box.zmin );
Vector3d p2 = new Vector3d( box.xmin, box.ymin, box.zmax );
Vector3d p3 = new Vector3d( box.xmin, box.ymax, box.zmin );
Vector3d p4 = new Vector3d( box.xmin, box.ymax, box.zmax );
Vector3d p5 = new Vector3d( box.xmax, box.ymin, box.zmin );
Vector3d p6 = new Vector3d( box.xmax, box.ymin, box.zmax );
Vector3d p7 = new Vector3d( box.xmax, box.ymax, box.zmin );
Vector3d p8 = new Vector3d( box.xmax, box.ymax, box.zmax );
{
Facet facet = new Facet();
@@ -120,7 +119,7 @@ public class MeshTest {
facet.points.add( p2 );
facet.points.add( p4 );
facet.points.add( p3 );
facet.normal = new Vector( -1, 0, 0 );
facet.normal = new Vector3d( -1, 0, 0 );
facets.add( facet );
}
@@ -130,7 +129,7 @@ public class MeshTest {
facet.points.add( p6 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 1, 0, 0 );
facet.normal = new Vector3d( 1, 0, 0 );
facets.add( facet );
}
@@ -140,7 +139,7 @@ public class MeshTest {
facet.points.add( p2 );
facet.points.add( p6 );
facet.points.add( p5 );
facet.normal = new Vector( 0, -1, 0 );
facet.normal = new Vector3d( 0, -1, 0 );
facets.add( facet );
}
@@ -150,7 +149,7 @@ public class MeshTest {
facet.points.add( p4 );
facet.points.add( p7 );
facet.points.add( p8 );
facet.normal = new Vector( 0, 1, 0 );
facet.normal = new Vector3d( 0, 1, 0 );
facets.add( facet );
}
@@ -160,7 +159,7 @@ public class MeshTest {
facet.points.add( p3 );
facet.points.add( p7 );
facet.points.add( p5 );
facet.normal = new Vector( 0, 0, -1 );
facet.normal = new Vector3d( 0, 0, -1 );
facets.add( facet );
}
@@ -170,7 +169,7 @@ public class MeshTest {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p6 );
facet.normal = new Vector( 0, 0, 1 );
facet.normal = new Vector3d( 0, 0, 1 );
facets.add( facet );
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-2</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest2</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-2</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest2</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -35,8 +35,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Chain;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh.MeshChainEventHandler;
@@ -48,10 +46,10 @@ import com.aaaaahhhhhhh.bananapuncher714.mesh.Vector2d;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple.GluWindingRule;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
/**
* Chunk data meshing visualizer
@@ -170,7 +168,7 @@ public class MeshingTest2 extends JPanel {
private static List< Plane > mesh( File file ) {
String name = file.getName();
String[] split = name.split( "," );
ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
System.out.println( "Parsing chunk " + location );
@@ -564,8 +562,8 @@ public class MeshingTest2 extends JPanel {
{
final Plane plane = new Plane();
plane.normal = new Vector( 0, 0, 1 );
plane.point = new Vector( 1, 0, 0 );
plane.normal = new Vector3d( 0, 0, 1 );
plane.point = new Vector3d( 1, 0, 0 );
// plane.polygons.add( new Polygon( Arrays.asList(
// new Point( 1, 0 ),
@@ -656,8 +654,8 @@ public class MeshingTest2 extends JPanel {
{
final Plane plane = new Plane();
plane.normal = new Vector( 0, 0, 1 );
plane.point = new Vector( 1, 0, 0 );
plane.normal = new Vector3d( 0, 0, 1 );
plane.point = new Vector3d( 1, 0, 0 );
plane.polygons.add( new Polygon( Arrays.asList(
new Point( 0, 0 ),
@@ -682,8 +680,8 @@ public class MeshingTest2 extends JPanel {
{
final Plane plane = new Plane();
plane.normal = new Vector( 0, 0, 1 );
plane.point = new Vector( 1, 0, 0 );
plane.normal = new Vector3d( 0, 0, 1 );
plane.point = new Vector3d( 1, 0, 0 );
plane.polygons.add( new Polygon( Arrays.asList(
new Point( 0, 0 ),
@@ -707,14 +705,14 @@ public class MeshingTest2 extends JPanel {
private static List< Facet > generateFacetsFor( AABB box ) {
List< Facet > facets = new ArrayList< Facet >();
Vector p1 = new Vector( box.xmin, box.ymin, box.zmin );
Vector p2 = new Vector( box.xmin, box.ymin, box.zmax );
Vector p3 = new Vector( box.xmin, box.ymax, box.zmin );
Vector p4 = new Vector( box.xmin, box.ymax, box.zmax );
Vector p5 = new Vector( box.xmax, box.ymin, box.zmin );
Vector p6 = new Vector( box.xmax, box.ymin, box.zmax );
Vector p7 = new Vector( box.xmax, box.ymax, box.zmin );
Vector p8 = new Vector( box.xmax, box.ymax, box.zmax );
Vector3d p1 = new Vector3d( box.xmin, box.ymin, box.zmin );
Vector3d p2 = new Vector3d( box.xmin, box.ymin, box.zmax );
Vector3d p3 = new Vector3d( box.xmin, box.ymax, box.zmin );
Vector3d p4 = new Vector3d( box.xmin, box.ymax, box.zmax );
Vector3d p5 = new Vector3d( box.xmax, box.ymin, box.zmin );
Vector3d p6 = new Vector3d( box.xmax, box.ymin, box.zmax );
Vector3d p7 = new Vector3d( box.xmax, box.ymax, box.zmin );
Vector3d p8 = new Vector3d( box.xmax, box.ymax, box.zmax );
{
Facet facet = new Facet();
@@ -722,7 +720,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p2 );
facet.points.add( p4 );
facet.points.add( p3 );
facet.normal = new Vector( -1, 0, 0 );
facet.normal = new Vector3d( -1, 0, 0 );
facets.add( facet );
}
@@ -732,7 +730,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p6 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 1, 0, 0 );
facet.normal = new Vector3d( 1, 0, 0 );
facets.add( facet );
}
@@ -742,7 +740,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p2 );
facet.points.add( p6 );
facet.points.add( p5 );
facet.normal = new Vector( 0, -1, 0 );
facet.normal = new Vector3d( 0, -1, 0 );
facets.add( facet );
}
@@ -752,7 +750,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 0, 1, 0 );
facet.normal = new Vector3d( 0, 1, 0 );
facets.add( facet );
}
@@ -762,7 +760,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p3 );
facet.points.add( p7 );
facet.points.add( p5 );
facet.normal = new Vector( 0, 0, -1 );
facet.normal = new Vector3d( 0, 0, -1 );
facets.add( facet );
}
@@ -772,7 +770,7 @@ public class MeshingTest2 extends JPanel {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p6 );
facet.normal = new Vector( 0, 0, 1 );
facet.normal = new Vector3d( 0, 0, 1 );
facets.add( facet );
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-3</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest3</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-3</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest3</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.io.BufferedReader;
import java.io.File;
@@ -11,18 +11,16 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Polygon;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple.GluWindingRule;
import com.aaaaahhhhhhh.bananapuncher714.minietest.MeshingTest2.AABB;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
/**
* Mesh speed test
@@ -113,7 +111,7 @@ public class MeshingTest3 {
private static List< Plane > mesh( File file, final StringBuilder stringBuilder ) {
String name = file.getName();
String[] split = name.split( "," );
ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
// First parse the file to get a list of all bounding boxes that we can use
List< AABB > boxes = new ArrayList< AABB >();
@@ -161,14 +159,14 @@ public class MeshingTest3 {
private static List< Facet > generateFacetsFor( AABB box ) {
List< Facet > facets = new ArrayList< Facet >();
Vector p1 = new Vector( box.xmin, box.ymin, box.zmin );
Vector p2 = new Vector( box.xmin, box.ymin, box.zmax );
Vector p3 = new Vector( box.xmin, box.ymax, box.zmin );
Vector p4 = new Vector( box.xmin, box.ymax, box.zmax );
Vector p5 = new Vector( box.xmax, box.ymin, box.zmin );
Vector p6 = new Vector( box.xmax, box.ymin, box.zmax );
Vector p7 = new Vector( box.xmax, box.ymax, box.zmin );
Vector p8 = new Vector( box.xmax, box.ymax, box.zmax );
Vector3d p1 = new Vector3d( box.xmin, box.ymin, box.zmin );
Vector3d p2 = new Vector3d( box.xmin, box.ymin, box.zmax );
Vector3d p3 = new Vector3d( box.xmin, box.ymax, box.zmin );
Vector3d p4 = new Vector3d( box.xmin, box.ymax, box.zmax );
Vector3d p5 = new Vector3d( box.xmax, box.ymin, box.zmin );
Vector3d p6 = new Vector3d( box.xmax, box.ymin, box.zmax );
Vector3d p7 = new Vector3d( box.xmax, box.ymax, box.zmin );
Vector3d p8 = new Vector3d( box.xmax, box.ymax, box.zmax );
{
Facet facet = new Facet();
@@ -176,7 +174,7 @@ public class MeshingTest3 {
facet.points.add( p2 );
facet.points.add( p4 );
facet.points.add( p3 );
facet.normal = new Vector( -1, 0, 0 );
facet.normal = new Vector3d( -1, 0, 0 );
facets.add( facet );
}
@@ -186,7 +184,7 @@ public class MeshingTest3 {
facet.points.add( p6 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 1, 0, 0 );
facet.normal = new Vector3d( 1, 0, 0 );
facets.add( facet );
}
@@ -196,7 +194,7 @@ public class MeshingTest3 {
facet.points.add( p2 );
facet.points.add( p6 );
facet.points.add( p5 );
facet.normal = new Vector( 0, -1, 0 );
facet.normal = new Vector3d( 0, -1, 0 );
facets.add( facet );
}
@@ -206,7 +204,7 @@ public class MeshingTest3 {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 0, 1, 0 );
facet.normal = new Vector3d( 0, 1, 0 );
facets.add( facet );
}
@@ -216,7 +214,7 @@ public class MeshingTest3 {
facet.points.add( p3 );
facet.points.add( p7 );
facet.points.add( p5 );
facet.normal = new Vector( 0, 0, -1 );
facet.normal = new Vector3d( 0, 0, -1 );
facets.add( facet );
}
@@ -226,10 +224,25 @@ public class MeshingTest3 {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p6 );
facet.normal = new Vector( 0, 0, 1 );
facet.normal = new Vector3d( 0, 0, 1 );
facets.add( facet );
}
return facets;
}
static class AABB {
double xmin, ymin, zmin;
double xmax, ymax, zmax;
AABB( double xmin, double ymin, double zmin, double xmax, double ymax, double zmax ) {
this.xmin = xmin;
this.ymax = ymin;
this.zmin = zmin;
this.xmax = xmax;
this.ymax = ymax;
this.zmax = zmax;
}
}
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-4</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest4</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-4</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest4</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.io.BufferedReader;
import java.io.File;
@@ -19,18 +19,16 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Polygon;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple.GluWindingRule;
import com.aaaaahhhhhhh.bananapuncher714.minietest.MeshingTest2.AABB;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
/**
* Mesh chunk data to ply2 format
@@ -98,7 +96,7 @@ public class MeshingTest4 {
List< VectorRef > refs = new ArrayList< VectorRef >();
}
Map< Vector, VectorRef > vertices = new HashMap< Vector, VectorRef >();
Map< Vector3d, VectorRef > vertices = new HashMap< Vector3d, VectorRef >();
Collection< Triangle > triangles = new HashSet< Triangle >();
// Convert each facet to a triangle
@@ -108,10 +106,10 @@ public class MeshingTest4 {
}
final Triangle triangle = new Triangle();
for ( final Vector vec : facet.points ) {
for ( final Vector3d vec : facet.points ) {
VectorRef ref = null;
for ( final Entry< Vector, VectorRef > entry : vertices.entrySet() ) {
final Vector existingVec = entry.getKey();
for ( final Entry< Vector3d, VectorRef > entry : vertices.entrySet() ) {
final Vector3d existingVec = entry.getKey();
if ( existingVec.distanceSquared( vec ) < 1e-8 ) {
ref = entry.getValue();
@@ -130,10 +128,10 @@ public class MeshingTest4 {
}
// Sort the vertices
final List< Entry< Vector, VectorRef > > sorted = new ArrayList< Entry< Vector, VectorRef > >( vertices.entrySet() );
final List< Entry< Vector3d, VectorRef > > sorted = new ArrayList< Entry< Vector3d, VectorRef > >( vertices.entrySet() );
Collections.sort( sorted, ( aEntry, bEntry ) -> {
final Vector a = aEntry.getKey();
final Vector b = bEntry.getKey();
final Vector3d a = aEntry.getKey();
final Vector3d b = bEntry.getKey();
final double xDiff = a.getX() - b.getX();
if ( xDiff == 0 ) {
@@ -162,10 +160,10 @@ public class MeshingTest4 {
// Write vertices
for ( int i = 0; i < sorted.size(); ++i ) {
final Entry< Vector, VectorRef > entry = sorted.get( i );
final Entry< Vector3d, VectorRef > entry = sorted.get( i );
entry.getValue().index = i;
final Vector vector = entry.getKey();
final Vector3d vector = entry.getKey();
writer.println( String.format( "%f %f %f", vector.getX(), vector.getY(), vector.getZ() ) );
}
@@ -233,7 +231,7 @@ public class MeshingTest4 {
private static List< Plane > mesh( File file, final StringBuilder stringBuilder ) {
String name = file.getName();
String[] split = name.split( "," );
ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
// First parse the file to get a list of all bounding boxes that we can use
List< AABB > boxes = new ArrayList< AABB >();
@@ -317,14 +315,14 @@ public class MeshingTest4 {
private static List< Facet > generateFacetsFor( AABB box ) {
List< Facet > facets = new ArrayList< Facet >();
Vector p1 = new Vector( box.xmin, box.ymin, box.zmin );
Vector p2 = new Vector( box.xmin, box.ymin, box.zmax );
Vector p3 = new Vector( box.xmin, box.ymax, box.zmin );
Vector p4 = new Vector( box.xmin, box.ymax, box.zmax );
Vector p5 = new Vector( box.xmax, box.ymin, box.zmin );
Vector p6 = new Vector( box.xmax, box.ymin, box.zmax );
Vector p7 = new Vector( box.xmax, box.ymax, box.zmin );
Vector p8 = new Vector( box.xmax, box.ymax, box.zmax );
Vector3d p1 = new Vector3d( box.xmin, box.ymin, box.zmin );
Vector3d p2 = new Vector3d( box.xmin, box.ymin, box.zmax );
Vector3d p3 = new Vector3d( box.xmin, box.ymax, box.zmin );
Vector3d p4 = new Vector3d( box.xmin, box.ymax, box.zmax );
Vector3d p5 = new Vector3d( box.xmax, box.ymin, box.zmin );
Vector3d p6 = new Vector3d( box.xmax, box.ymin, box.zmax );
Vector3d p7 = new Vector3d( box.xmax, box.ymax, box.zmin );
Vector3d p8 = new Vector3d( box.xmax, box.ymax, box.zmax );
{
Facet facet = new Facet();
@@ -332,7 +330,7 @@ public class MeshingTest4 {
facet.points.add( p2 );
facet.points.add( p4 );
facet.points.add( p3 );
facet.normal = new Vector( -1, 0, 0 );
facet.normal = new Vector3d( -1, 0, 0 );
facets.add( facet );
}
@@ -342,7 +340,7 @@ public class MeshingTest4 {
facet.points.add( p6 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 1, 0, 0 );
facet.normal = new Vector3d( 1, 0, 0 );
facets.add( facet );
}
@@ -352,7 +350,7 @@ public class MeshingTest4 {
facet.points.add( p2 );
facet.points.add( p6 );
facet.points.add( p5 );
facet.normal = new Vector( 0, -1, 0 );
facet.normal = new Vector3d( 0, -1, 0 );
facets.add( facet );
}
@@ -362,7 +360,7 @@ public class MeshingTest4 {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p7 );
facet.normal = new Vector( 0, 1, 0 );
facet.normal = new Vector3d( 0, 1, 0 );
facets.add( facet );
}
@@ -372,7 +370,7 @@ public class MeshingTest4 {
facet.points.add( p3 );
facet.points.add( p7 );
facet.points.add( p5 );
facet.normal = new Vector( 0, 0, -1 );
facet.normal = new Vector3d( 0, 0, -1 );
facets.add( facet );
}
@@ -382,11 +380,25 @@ public class MeshingTest4 {
facet.points.add( p4 );
facet.points.add( p8 );
facet.points.add( p6 );
facet.normal = new Vector( 0, 0, 1 );
facet.normal = new Vector3d( 0, 0, 1 );
facets.add( facet );
}
return facets;
}
static class AABB {
double xmin, ymin, zmin;
double xmax, ymax, zmax;
AABB( double xmin, double ymin, double zmin, double xmax, double ymax, double zmax ) {
this.xmin = xmin;
this.ymax = ymin;
this.zmin = zmin;
this.xmax = xmax;
this.ymax = ymax;
this.zmax = zmax;
}
}
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-5</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest5</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-5</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest5</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.io.BufferedReader;
import java.io.File;
@@ -15,17 +15,16 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Polygon;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple.GluWindingRule;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
/**
* Mesh speed test for facets
@@ -120,7 +119,7 @@ public class MeshingTest5 {
private static List< Plane > mesh( File file, final StringBuilder stringBuilder ) {
final String name = file.getName().substring( 0, file.getName().indexOf( '.' ) );
final String[] split = name.split( "," );
final ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
final Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
// First parse the file to get a list of all facets
final List< Facet > facets = new ArrayList< Facet >();
@@ -135,7 +134,7 @@ public class MeshingTest5 {
final double nz = Double.parseDouble( values[ 3 ] );
final Facet facet = new Facet();
facet.normal = new Vector( nx, ny, nz );
facet.normal = new Vector3d( nx, ny, nz );
int point = 0;
while ( point < facetCount && ( line = reader.readLine() ) != null ) {
@@ -144,7 +143,7 @@ public class MeshingTest5 {
final double px = Double.parseDouble( values2[ 0 ] );
final double py = Double.parseDouble( values2[ 1 ] );
final double pz = Double.parseDouble( values2[ 2 ] );
facet.points.add( new Vector( px, py, pz ) );
facet.points.add( new Vector3d( px, py, pz ) );
++point;
}
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-6</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest6</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-6</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest6</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -34,8 +34,6 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import org.bukkit.util.Vector;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Chain;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Mesh.MeshChainEventHandler;
@@ -47,10 +45,10 @@ import com.aaaaahhhhhhh.bananapuncher714.mesh.Vector2d;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionRuleWinding;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple;
import com.aaaaahhhhhhh.bananapuncher714.mesh.region.simple.RegionSimple.GluWindingRule;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.ChunkLocation;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Facet;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.MeshBuilder;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Plane;
import com.aaaaahhhhhhh.bananapuncher714.mesh.base.Vector3d;
/**
* Facet meshing visualizer
@@ -169,7 +167,7 @@ public class MeshingTest6 extends JPanel {
private static List< Plane > mesh( File file ) {
final String name = file.getName().substring( 0, file.getName().indexOf( '.' ) );
final String[] split = name.split( "," );
final ChunkLocation location = new ChunkLocation( split[ 0 ], Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
final Point location = new Point( Integer.parseInt( split[ 1 ] ), Integer.parseInt( split[ 2 ] ) );
System.out.println( "Parsing chunk " + location );
@@ -186,7 +184,7 @@ public class MeshingTest6 extends JPanel {
final double nz = Double.parseDouble( values[ 3 ] );
final Facet facet = new Facet();
facet.normal = new Vector( nx, ny, nz );
facet.normal = new Vector3d( nx, ny, nz );
int point = 0;
while ( point < facetCount && ( line = reader.readLine() ) != null ) {
@@ -195,7 +193,7 @@ public class MeshingTest6 extends JPanel {
final double px = Double.parseDouble( values2[ 0 ] );
final double py = Double.parseDouble( values2[ 1 ] );
final double pz = Double.parseDouble( values2[ 2 ] );
facet.points.add( new Vector( px, py, pz ) );
facet.points.add( new Vector3d( px, py, pz ) );
++point;
}
}
@@ -581,8 +579,8 @@ public class MeshingTest6 extends JPanel {
private static Plane getTestPlane() {
final Plane plane = new Plane();
plane.normal = new Vector( 0, 0, 1 );
plane.point = new Vector( 1, 0, 0 );
plane.normal = new Vector3d( 0, 0, 1 );
plane.point = new Vector3d( 1, 0, 0 );
// plane.polygons.add( new Polygon( Arrays.asList(
// new Point( 1, 0 ),

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mc-mesh-application-visualizer-test-7</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest7</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer-test-7</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.aaaaahhhhhhh.bananapuncher714.mesh.test.MeshingTest7</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,4 +1,4 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest;
package com.aaaaahhhhhhh.bananapuncher714.mesh.test;
import java.io.BufferedReader;
import java.io.File;

View File

@@ -0,0 +1,23 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-application</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>mc-mesh-application-visualizer</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<modules>
<module>Test1</module>
<module>Test2</module>
<module>Test3</module>
<module>Test4</module>
<module>Test5</module>
<module>Test6</module>
<module>Test7</module>
</modules>
</project>

34
base/pom.xml Normal file
View File

@@ -0,0 +1,34 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-master</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>mc-mesh-base</artifactId>
<version>0.0.1</version>
<dependencies>
<dependency>
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
<artifactId>mc-mesh-core</artifactId>
<version>0.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,9 @@
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
import java.util.ArrayList;
import java.util.List;
public class Facet {
public Vector3d normal;
public List< Vector3d > points = new ArrayList< Vector3d >();
}

View File

@@ -1,11 +1,9 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh;
import org.bukkit.util.Vector;
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
public class LineSegment {
public Vector point1, point2;
public Vector3d point1, point2;
public LineSegment( Vector point1, Vector point2 ) {
public LineSegment( Vector3d point1, Vector3d point2 ) {
if ( point1.getX() < point2.getX() ) {
this.point1 = point1;
this.point2 = point2;
@@ -39,7 +37,7 @@ public class LineSegment {
return point1.distance( point2 );
}
public Vector getVector() {
return point2.clone().subtract( point1 );
public Vector3d getVector() {
return new Vector3d( point2 ).subtract( point1 );
}
}

View File

@@ -0,0 +1,19 @@
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
public class Matrix3d {
protected Vector3d[] rows = new Vector3d[ 3 ];
public Matrix3d( Vector3d col1, Vector3d col2, Vector3d col3 ) {
rows[ 0 ] = new Vector3d( col1.getX(), col2.getX(), col3.getX() );
rows[ 1 ] = new Vector3d( col1.getY(), col2.getY(), col3.getY() );
rows[ 2 ] = new Vector3d( col1.getZ(), col2.getZ(), col3.getZ() );
}
public Matrix3d transpose() {
return new Matrix3d(
rows[ 0 ],
rows[ 1 ],
rows[ 2 ]
);
}
}

View File

@@ -1,11 +1,9 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh;
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.bukkit.util.Vector;
public class MeshBuilder {
public List< Plane > planes = new ArrayList< Plane >();
@@ -19,7 +17,7 @@ public class MeshBuilder {
Plane plane = new Plane();
plane.normal = facet.normal;
Optional< Vector > ref = facet.points.stream().filter( v -> v.lengthSquared() > 0.001 && Math.abs( v.clone().normalize().dot( facet.normal ) ) < .999999 ).findAny();
Optional< Vector3d > ref = facet.points.stream().filter( v -> v.lengthSquared() > 0.001 && Math.abs( new Vector3d( v ).normalize().dot( facet.normal ) ) < .999999 ).findAny();
if ( ref.isPresent() ) {
plane.point = ref.get();
}

View File

@@ -1,20 +1,16 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh;
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.util.Vector;
import org.joml.Matrix3d;
import org.joml.Vector3d;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Point;
import com.aaaaahhhhhhh.bananapuncher714.mesh.Polygon;
public class Plane {
public Vector normal;
public Vector point;
public Vector3d normal;
public Vector3d point;
public double distance;
private boolean set = false;
@@ -28,21 +24,17 @@ public class Plane {
final Matrix3d mat = getProjectionMatrix();
List< Point > polygon = new ArrayList< Point >();
for ( Vector p : facet.points ) {
double t = point.clone().subtract( p ).dot( normal );
Vector i = normal.clone().multiply( t ).add( p );
for ( Vector3d p : facet.points ) {
double t = new Vector3d( point ).subtract( p ).dot( normal );
Vector3d r = new Vector3d( normal ).multiply( t ).add( p ).multiply( mat );
Vector3d v = new Vector3d( i.getX(), i.getY(), i.getZ() );
Vector3d r = v.mul( mat );
polygon.add( new Point( r.x(), r.y() ) );
polygon.add( new Point( r.getX(), r.getY() ) );
if ( !set ) {
distance = r.z();
distance = r.getZ();
set = true;
} else if ( Math.abs( r.z() - distance ) > 1e-7 ) {
} else if ( Math.abs( r.getZ() - distance ) > 1e-7 ) {
throw new IllegalStateException( "Bad point in facet!" );
}
}
@@ -50,12 +42,12 @@ public class Plane {
polygons.add( new Polygon( polygon ) );
}
public Vector convert( final Point p ) {
public Vector3d convert( final Point p ) {
final Vector3d plane = new Vector3d( p.getX(), p.getY(), distance );
final Vector3d res = plane.mul( getInverseProjectionMatrix() );
final Vector3d res = plane.multiply( getInverseProjectionMatrix() );
return new Vector( res.x(), res.y(), res.z() );
return res;
}
public Facet convert( final Polygon polygon ) {
@@ -73,14 +65,13 @@ public class Plane {
return polygons.parallelStream().map( this::convert ).collect( Collectors.toSet() );
}
public boolean matches( Vector normal, Vector point ) {
return Math.abs( this.normal.dot( normal ) ) > 0.99 && Math.abs( this.point.clone().subtract( point ).dot( normal ) ) < 0.01;
public boolean matches( Vector3d normal, Vector3d point ) {
return Math.abs( this.normal.dot( normal ) ) > 0.99 && Math.abs( new Vector3d( this.point ).subtract( point ).dot( normal ) ) < 0.01;
}
private Matrix3d getProjectionMatrix() {
if ( mat == null ) {
final Vector basis1 = normal.clone().multiply( point.clone().multiply( -1 ).dot( normal ) ).add( point ).normalize();
final Vector3d b1 = new Vector3d( basis1.getX(), basis1.getY(), basis1.getZ() );
final Vector3d b1 = new Vector3d( normal ).multiply( new Vector3d( point ).multiply( -1 ).dot( normal ) ).add( point ).normalize();
final Vector3d b3 = new Vector3d( normal.getX(), normal.getY(), normal.getZ() );
final Vector3d b2 = new Vector3d( b1 ).cross( b3 ).normalize();
mat = new Matrix3d( b1, b2, b3 ).transpose();

View File

@@ -0,0 +1,138 @@
package com.aaaaahhhhhhh.bananapuncher714.mesh.base;
public class Vector3d {
private double x, y, z;
public Vector3d( double x, double y, double z ) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector3d( Vector3d copy ) {
this.x = copy.x;
this.y = copy.y;
this.z = copy.z;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
public void setX( double x ) {
this.x = x;
}
public void setY( double y ) {
this.y = y;
}
public void setZ( double z ) {
this.z = z;
}
public double dot( Vector3d o ) {
return x * o.x + y * o.y + z * o.z;
}
public Vector3d cross( Vector3d o ) {
return new Vector3d(
y * o.z - o.y * z,
z * o.x - o.z * x,
x * o.y - o.x * y
);
}
public double length() {
return Math.sqrt( lengthSquared() );
}
public double lengthSquared() {
return dot( this );
}
public Vector3d normalize() {
double length = length();
x /= length;
y /= length;
z /= length;
return this;
}
public Vector3d multiply( Matrix3d mat ) {
return new Vector3d(
dot( mat.rows[ 0 ] ),
dot( mat.rows[ 1 ] ),
dot( mat.rows[ 2 ] )
);
}
public Vector3d multiply( double v ) {
x *= v;
y *= v;
z *= v;
return this;
}
public Vector3d add( double v ) {
x += v;
y += v;
z += v;
return this;
}
public Vector3d add( Vector3d o ) {
x += o.x;
y += o.y;
z += o.z;
return this;
}
public Vector3d subtract( Vector3d o ) {
x -= o.x;
y -= o.y;
z -= o.z;
return this;
}
public double distance( Vector3d o ) {
return new Vector3d( this ).subtract( o ).length();
}
public double distanceSquared( Vector3d o ) {
return new Vector3d( this ).subtract( o ).lengthSquared();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(x);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(y);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(z);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public String toString() {
return "Vector3d{x=" + x + ",y=" + y + ",z=" + z + "}";
}
}

View File

@@ -1,11 +0,0 @@
package com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.util.Vector;
public class Facet {
public Vector normal;
public List< Vector > points = new ArrayList< Vector >();
}

View File

@@ -2,7 +2,6 @@ package com.aaaaahhhhhhh.bananapuncher714.minietest.util;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
/**
* Big/little endian binary writer

View File

@@ -9,8 +9,10 @@
<packaging>pom</packaging>
<modules>
<module>plugin</module>
<!-- <module>plugin</module> -->
<module>core</module>
<module>base</module>
<module>application</module>
</modules>
<build>