private final boolean prepareForInstancing(final Spatial spatial) {
boolean skipRenderQueue = false;
if (spatial instanceof Mesh) {
final Mesh mesh = (Mesh) spatial;
final InstancingManager instancing = mesh.getMeshData().getInstancingManager();
// Only one instance needs to be added to the render queue
if (instancing != null) {
skipRenderQueue = instancing.isAddedToRenderQueue();
instancing.registerMesh(mesh);
}
}
return skipRenderQueue;
}