No, not this kind of parallel
To add TangentBinormalGenerator:
public static void generateParallel(Spatial scene, ExecutorService executor) {
final Set<Mesh> meshes = new HashSet<Mesh>();
scene.breadthFirstTraversal(new SceneGraphVisitor(){
@Override
public void visit(Spatial spatial) {
if ( spatial instanceof Geometry ) {
Geometry geom = (Geometry) spatial;
Mesh mesh = geom.getMesh();
// Check to ensure mesh has texcoords and normals before generating
if (mesh.getBuffer(Type.TexCoord) != null
&& mesh.getBuffer(Type.Normal) != null){
meshes.add(mesh);
}
}
}
});
List<Future<?>> futures = new ArrayList<Future<?>>();
for ( final Mesh m : meshes ) {
futures.add(executor.submit(new Runnable() {
@Override
public void run() {
generate(m,true,false);
}
}));
}
for ( Future<?> f : futures ) {
try {
f.get();
} catch (Exception exc) {
log.log(Level.WARNING,"Error while computing tangents",exc);
}
}
}
Pass Executors.newFixedThreadPool(Runtime.runtime.availableProcessors) (of course stored in some variable for reuse) and enjoy faster generation.
In theory, we could have all the fancy combinations of flags here, but this is left as exercise for the reader