Initial cleanup and refactor
This commit is contained in:
1
.git-submodules/spigot-docker-build-tools
Submodule
1
.git-submodules/spigot-docker-build-tools
Submodule
Submodule .git-submodules/spigot-docker-build-tools added at 0ed02463e7
10
.gitignore
vendored
10
.gitignore
vendored
@@ -2,12 +2,4 @@
|
||||
.project
|
||||
target
|
||||
.settings
|
||||
chunks
|
||||
new_chunks
|
||||
images
|
||||
chunk_models
|
||||
chunk_models_new
|
||||
chunks_test
|
||||
chunk_models_test
|
||||
facets
|
||||
polygons
|
||||
data
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule ".git-submodules/spigot-docker-build-tools"]
|
||||
path = .git-submodules/spigot-docker-build-tools
|
||||
url = https://git.048596.world/banana/spigot-docker-build-tools.git
|
||||
25
core/pom.xml
Normal file
25
core/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<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-core</artifactId>
|
||||
<version>0.0.1</version>
|
||||
|
||||
<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>
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -70,6 +71,9 @@ import com.aaaaahhhhhhh.bananapuncher714.mesh.region.RegionRule;
|
||||
*
|
||||
* The time complexity for the entire algorithm should be roughly O(n^2logn).
|
||||
*
|
||||
* To use this class, you can add your polygons then call meshify() which will return
|
||||
* a list of triangles.
|
||||
*
|
||||
* TODO Remove guaranteed checks or add some compile time thing to remove
|
||||
*
|
||||
* @author BananaPuncher714
|
||||
@@ -80,6 +84,10 @@ public class Mesh< T extends Region > {
|
||||
public static final double CROSS_TOLERANCE = Math.sin( ANGLE_TOLERANCE );
|
||||
|
||||
// Point to vertex map, to avoid duplicating vertices when inserting polygons
|
||||
// Not strictly necessary, since it is only used when adding polygons, and
|
||||
// vertices with the exact same point will end up getting merged anyways.
|
||||
// TODO Consider removing this, since it does require keeping track of vertices
|
||||
// that we may no longer care about and want removed.
|
||||
protected Map< Point, Vertex > vertexMap = new HashMap< Point, Vertex >();
|
||||
|
||||
// All points in the graph
|
||||
@@ -107,15 +115,34 @@ public class Mesh< T extends Region > {
|
||||
*
|
||||
* @param poly
|
||||
* @param rule
|
||||
*
|
||||
* @return The amount of points added
|
||||
*/
|
||||
public void addPolygon( final Polygon poly, final RegionRule< T > rule ) {
|
||||
public int addPolygon( final Polygon poly, final RegionRule< T > rule ) {
|
||||
// Remove consecutive points that are the same, to prevent zero edges
|
||||
final Deque< Point > points = new ArrayDeque< Point >();
|
||||
for ( int i = 0; i < poly.points.size(); ++i ) {
|
||||
final Point point = poly.points.get( i );
|
||||
|
||||
if ( points.isEmpty() || !points.getLast().equals( point ) ) {
|
||||
points.add( point );
|
||||
}
|
||||
}
|
||||
|
||||
// Check for the edge case where the last point is the same as the first
|
||||
if ( points.size() > 1 ) {
|
||||
if ( points.getFirst().equals( points.getLast() ) ) {
|
||||
points.removeLast();
|
||||
}
|
||||
}
|
||||
|
||||
// Is it at least a triangle?
|
||||
if ( poly.getPoints().size() < 3 ) {
|
||||
return;
|
||||
if ( points.size() < 3 ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HalfEdge edge = null;
|
||||
for ( final Point point : poly.getPoints() ) {
|
||||
for ( final Point point : points ) {
|
||||
if ( edge == null ) {
|
||||
edge = new HalfEdge();
|
||||
HalfEdge.splice( edge, edge.getSym() );
|
||||
@@ -127,9 +154,12 @@ public class Mesh< T extends Region > {
|
||||
final Vertex vertex = vertexMap.get( point );
|
||||
if ( vertex != null ) {
|
||||
HalfEdge.splice( edge.getPrev(), vertex.getEdge() );
|
||||
|
||||
edge.setOrigin( vertex );
|
||||
} else {
|
||||
edge.getOrigin().setPosition( new Vector2d( point ) );
|
||||
|
||||
vertexMap.put( point, edge.getOrigin() );
|
||||
vertices.add( edge.getOrigin() );
|
||||
}
|
||||
|
||||
@@ -138,6 +168,16 @@ public class Mesh< T extends Region > {
|
||||
|
||||
state = MeshState.DIRTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invariants:
|
||||
* - No vertices have the same x and y
|
||||
* - All edges have a winding rule
|
||||
* - All vertices are attached to a non-zero even number of edges
|
||||
* - No edges have length 0
|
||||
*/
|
||||
|
||||
return points.size();
|
||||
}
|
||||
|
||||
public boolean addPartitionHandler( final MeshPartitionEventHandler handler ) {
|
||||
@@ -358,8 +398,6 @@ public class Mesh< T extends Region > {
|
||||
// This set contains the non-redundant vertices.
|
||||
final Set< Vertex > scannedVertices = new HashSet< Vertex >();
|
||||
|
||||
// TODO Remove zero edges
|
||||
|
||||
while ( !vertexSet.isEmpty() ) {
|
||||
final Vertex vertex = vertexSet.pollFirst();
|
||||
final Vector2d pos = vertex.getPosition();
|
||||
@@ -484,6 +522,10 @@ public class Mesh< T extends Region > {
|
||||
// Update the list of vertices with our new updated list of vertices
|
||||
vertices = scannedVertices;
|
||||
|
||||
// Update the vertex map
|
||||
vertexMap.clear();
|
||||
vertices.forEach( v -> vertexMap.put( v.getPosition(), v ) );
|
||||
|
||||
/*
|
||||
* At this point, each vertex should be merged and moved to the
|
||||
* correct position, and all edges should be connected to the
|
||||
@@ -492,7 +534,7 @@ public class Mesh< T extends Region > {
|
||||
* Invariants:
|
||||
* - All vertices are at least VERTEX_TOLERANCE away from each other
|
||||
* - All vertices are at least VERTEX_TOLERANCE away from each other horizontally
|
||||
* - All vertices will not be moved after this
|
||||
* - No vertices will be moved after this
|
||||
* - No vertices have only 1 edge
|
||||
* - No vertices are within VERTEX_TOLERANCE of another edge which they are not part of
|
||||
* - No edges have length of 0
|
||||
14
install.sh
Normal file
14
install.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export REV="1.21.11"
|
||||
export M2_DIRECTORY="$M2_REPOSITORY"
|
||||
export BUILD_DIRECTORY="$ARTIFACT_DIRECTORY"
|
||||
export JAVA_VERSION="21"
|
||||
|
||||
REPOSITORY_DIR=$(dirname "$0")
|
||||
|
||||
cd "$REPOSITORY_DIR"
|
||||
|
||||
git submodule update --init --recursive --remote
|
||||
|
||||
./.git-submodules/spigot-docker-build-tools/run.sh mvn clean package
|
||||
253
plugin/dependency-reduced-pom.xml
Normal file
253
plugin/dependency-reduced-pom.xml
Normal file
@@ -0,0 +1,253 @@
|
||||
<?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-master</artifactId>
|
||||
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>mc-mesh-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</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>21</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>com.aaaaahhhhhhh.bananapuncher714.minietest.MeshingTest6</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.21.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jline</artifactId>
|
||||
<groupId>org.jline</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-iostreams</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>asm-commons</artifactId>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jcip-annotations</artifactId>
|
||||
<groupId>com.github.stephenc.jcip</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>msal4j</artifactId>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>authlib</artifactId>
|
||||
<groupId>com.mojang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>brigadier</artifactId>
|
||||
<groupId>com.mojang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>datafixerupper</artifactId>
|
||||
<groupId>com.mojang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jtracy</artifactId>
|
||||
<groupId>com.mojang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>com.mojang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>content-type</artifactId>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>lang-tag</artifactId>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>oauth2-oidc-sdk</artifactId>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-codec</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-codec-http</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-common</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-handler</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-resolver</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-transport-classes-epoll</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-transport-native-epoll</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-transport-native-epoll</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-transport-native-unix-common</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>fastutil</artifactId>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jna</artifactId>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jna-platform</artifactId>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>accessors-smart</artifactId>
|
||||
<groupId>net.minidev</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-smart</artifactId>
|
||||
<groupId>net.minidev</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jopt-simple</artifactId>
|
||||
<groupId>net.sf.jopt-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-slf4j2-impl</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>lz4-java</artifactId>
|
||||
<groupId>org.lz4</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<groupId>org.xerial</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<groupId>com.mysql</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>maven-resolver-provider</artifactId>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>maven-resolver-transport-http</artifactId>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
78
plugin/pom.xml
Normal file
78
plugin/pom.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<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-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.21.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.stephengold</groupId>
|
||||
<artifactId>Minie</artifactId>
|
||||
<version>9.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scijava</groupId>
|
||||
<artifactId>native-lib-loader</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
|
||||
<artifactId>mc-mesh-core</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>21</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.minietest.MeshingTest6</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -53,6 +53,9 @@ import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
|
||||
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
|
||||
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
|
||||
|
||||
/**
|
||||
* Chunk data meshing visualizer
|
||||
*/
|
||||
public class MeshingTest2 extends JPanel {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File CHUNK_DIR = new File( BASE, "chunks" );
|
||||
@@ -24,6 +24,9 @@ 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
|
||||
*/
|
||||
public class MeshingTest3 {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File CHUNK_DIR = new File( BASE, "chunks" );
|
||||
@@ -32,6 +32,9 @@ 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 chunk data to ply2 format
|
||||
*/
|
||||
public class MeshingTest4 {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File CHUNK_DIR = new File( BASE, "chunks" );
|
||||
@@ -27,6 +27,9 @@ 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 for facets
|
||||
*/
|
||||
public class MeshingTest5 {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File FACET_DIR = new File( BASE, "facets" );
|
||||
@@ -52,6 +52,9 @@ import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Facet;
|
||||
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.MeshBuilder;
|
||||
import com.aaaaahhhhhhh.bananapuncher714.minietest.objects.mesh.Plane;
|
||||
|
||||
/**
|
||||
* Facet meshing visualizer
|
||||
*/
|
||||
public class MeshingTest6 extends JPanel {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File FACET_DIR = new File( BASE, "facets" );
|
||||
@@ -18,6 +18,9 @@ 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;
|
||||
|
||||
/**
|
||||
* Mesh speed test for polygons
|
||||
*/
|
||||
public class MeshingTest7 {
|
||||
private static final File BASE = new File( System.getProperty( "user.dir" ) );
|
||||
private static final File POLYGON_DIR = new File( BASE, "polygons" );
|
||||
@@ -37,8 +37,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v1_21_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_21_R4.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_21_R6.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_21_R6.block.data.CraftBlockData;
|
||||
import org.bukkit.entity.BlockDisplay;
|
||||
import org.bukkit.entity.Display;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -24,11 +24,19 @@ import com.jme3.math.Vector3f;
|
||||
|
||||
public class ChunkMesh {
|
||||
// TODO Public for now while I figure out how to organize the stuff properly
|
||||
|
||||
// Hashcode of the current block's blockdata so we can check if it changed
|
||||
private int[] data;
|
||||
// The bounding boxes for each complex block, null if air or a cube
|
||||
private BoundingBox[][] boxes;
|
||||
// Stores which blocks are complex/simple/empty
|
||||
private BlockDataTypeSet blockTypes;
|
||||
// References to every point used by at least one planemesh
|
||||
public TreeSet< VectorReference > pointReferences = new TreeSet< VectorReference >();
|
||||
// Map of meshes to each plane
|
||||
// TODO Allow for non axis-aligned planes
|
||||
public Map< MinecraftPlane, PlaneMesh > planes = new TreeMap< MinecraftPlane, PlaneMesh >();
|
||||
// Bounding box of this mesh
|
||||
private Aabb box;
|
||||
|
||||
public ChunkMesh( BoundingBox box ) {
|
||||
@@ -117,6 +125,10 @@ public class ChunkMesh {
|
||||
}
|
||||
|
||||
public void writeTo( final BinaryWriter writer ) {
|
||||
// Gather all vectors and map them to indices
|
||||
|
||||
|
||||
|
||||
// Write the bounding box
|
||||
writer.write( box.minX );
|
||||
writer.write( box.minY );
|
||||
68
pom.xml
68
pom.xml
@@ -1,73 +1,33 @@
|
||||
<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">
|
||||
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>
|
||||
<groupId>com.aaaaahhhhhhh.bananapuncher714</groupId>
|
||||
<artifactId>MinieTest</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<artifactId>mc-mesh-master</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.21.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.stephengold</groupId>
|
||||
<artifactId>Minie</artifactId>
|
||||
<version>9.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scijava</groupId>
|
||||
<artifactId>native-lib-loader</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.earcut4j</groupId>
|
||||
<artifactId>earcut4j</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<modules>
|
||||
<module>plugin</module>
|
||||
<module>core</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>
|
||||
com.aaaaahhhhhhh.bananapuncher714.minietest.MinieTest
|
||||
</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
Reference in New Issue
Block a user