|
|
|
@ -155,35 +155,35 @@ public class TangentBinormalGenerator { |
|
|
|
|
|
|
|
|
|
public static void generateParallel(Spatial scene, ExecutorService executor) { |
|
|
|
|
final Set<Mesh> meshes = new HashSet<Mesh>(); |
|
|
|
|
scene.breadthFirstTraversal(new SceneGraphVisitor(){ |
|
|
|
|
scene.breadthFirstTraversal(new SceneGraphVisitor() { |
|
|
|
|
@Override |
|
|
|
|
public void visit(Spatial spatial) { |
|
|
|
|
if ( spatial instanceof Geometry ) { |
|
|
|
|
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){ |
|
|
|
|
&& mesh.getBuffer(Type.Normal) != null) { |
|
|
|
|
meshes.add(mesh); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
List<Future<?>> futures = new ArrayList<Future<?>>(); |
|
|
|
|
for ( final Mesh m : meshes ) { |
|
|
|
|
for (final Mesh m : meshes) { |
|
|
|
|
futures.add(executor.submit(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
generate(m,true,false); |
|
|
|
|
generate(m, true, false); |
|
|
|
|
} |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
for ( Future<?> f : futures ) { |
|
|
|
|
for (Future<?> f : futures) { |
|
|
|
|
try { |
|
|
|
|
f.get(); |
|
|
|
|
} catch (Exception exc) { |
|
|
|
|
log.log(Level.WARNING,"Error while computing tangents",exc); |
|
|
|
|
log.log(Level.WARNING, "Error while computing tangents", exc); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|