|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2009-2019 jMonkeyEngine
|
|
|
+ * Copyright (c) 2009-2021 jMonkeyEngine
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -79,7 +79,7 @@ public class TangentBinormalGenerator {
|
|
|
public final Vector3f position;
|
|
|
public final Vector3f normal;
|
|
|
public final Vector2f texCoord;
|
|
|
- public final ArrayList<Integer> indices = new ArrayList<Integer>();
|
|
|
+ public final ArrayList<Integer> indices = new ArrayList<>();
|
|
|
|
|
|
public VertexInfo(Vector3f position, Vector3f normal, Vector2f texCoord) {
|
|
|
this.position = position;
|
|
@@ -91,7 +91,7 @@ public class TangentBinormalGenerator {
|
|
|
/** Collects all the triangle data for one vertex.
|
|
|
*/
|
|
|
private static class VertexData {
|
|
|
- public final ArrayList<TriangleData> triangles = new ArrayList<TriangleData>();
|
|
|
+ public final ArrayList<TriangleData> triangles = new ArrayList<>();
|
|
|
|
|
|
public VertexData() { }
|
|
|
}
|
|
@@ -118,7 +118,7 @@ public class TangentBinormalGenerator {
|
|
|
}
|
|
|
|
|
|
private static List<VertexData> initVertexData(int size) {
|
|
|
- List<VertexData> vertices = new ArrayList<VertexData>(size);
|
|
|
+ List<VertexData> vertices = new ArrayList<>(size);
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
vertices.add(new VertexData());
|
|
|
}
|
|
@@ -152,7 +152,7 @@ public class TangentBinormalGenerator {
|
|
|
}
|
|
|
|
|
|
public static void generateParallel(Spatial scene, ExecutorService executor) {
|
|
|
- final Set<Mesh> meshes = new HashSet<Mesh>();
|
|
|
+ final Set<Mesh> meshes = new HashSet<>();
|
|
|
scene.breadthFirstTraversal(new SceneGraphVisitor() {
|
|
|
@Override
|
|
|
public void visit(Spatial spatial) {
|
|
@@ -168,7 +168,7 @@ public class TangentBinormalGenerator {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- List<Future<?>> futures = new ArrayList<Future<?>>();
|
|
|
+ List<Future<?>> futures = new ArrayList<>();
|
|
|
for (final Mesh m : meshes) {
|
|
|
futures.add(executor.submit(new Runnable() {
|
|
|
@Override
|
|
@@ -269,8 +269,8 @@ public class TangentBinormalGenerator {
|
|
|
//add another splitRotated boolean
|
|
|
private static List<VertexData> splitVertices(Mesh mesh, List<VertexData> vertexData, boolean splitMirorred) {
|
|
|
int nbVertices = mesh.getBuffer(Type.Position).getNumElements();
|
|
|
- List<VertexData> newVertices = new ArrayList<VertexData>();
|
|
|
- Map<Integer, Integer> indiceMap = new HashMap<Integer, Integer>();
|
|
|
+ List<VertexData> newVertices = new ArrayList<>();
|
|
|
+ Map<Integer, Integer> indiceMap = new HashMap<>();
|
|
|
FloatBuffer normalBuffer = mesh.getFloatBuffer(Type.Normal);
|
|
|
|
|
|
for (int i = 0; i < vertexData.size(); i++) {
|
|
@@ -278,8 +278,8 @@ public class TangentBinormalGenerator {
|
|
|
Vector3f givenNormal = new Vector3f();
|
|
|
populateFromBuffer(givenNormal, normalBuffer, i);
|
|
|
|
|
|
- ArrayList<TriangleData> trianglesUp = new ArrayList<TriangleData>();
|
|
|
- ArrayList<TriangleData> trianglesDown = new ArrayList<TriangleData>();
|
|
|
+ ArrayList<TriangleData> trianglesUp = new ArrayList<>();
|
|
|
+ ArrayList<TriangleData> trianglesDown = new ArrayList<>();
|
|
|
for (int j = 0; j < triangles.size(); j++) {
|
|
|
TriangleData triangleData = triangles.get(j);
|
|
|
if(parity(givenNormal, triangleData.normal) > 0){
|
|
@@ -625,7 +625,7 @@ public class TangentBinormalGenerator {
|
|
|
}
|
|
|
|
|
|
private static ArrayList<VertexInfo> linkVertices(Mesh mesh, boolean splitMirrored) {
|
|
|
- ArrayList<VertexInfo> vertexMap = new ArrayList<VertexInfo>();
|
|
|
+ ArrayList<VertexInfo> vertexMap = new ArrayList<>();
|
|
|
|
|
|
FloatBuffer vertexBuffer = mesh.getFloatBuffer(Type.Position);
|
|
|
FloatBuffer normalBuffer = mesh.getFloatBuffer(Type.Normal);
|