MikktspaceTangentGenerator generate(Mesh)?

Hello. Is there a reason why MikktspaceTangentGenerator doesn’t have a generate(Mesh)?

Is it because it’s incomplete or other reasons?

I’m assuming you could just replace generate(Spatial) with:

 public static void generate(Spatial s){
	if(s instanceof Node){
		Node n = (Node)s;
		for (Spatial child : n.getChildren()) {
			generate(child);
		}
	} else if (s instanceof Geometry){
		generate(((Geometry)s).getMesh());
	}
}

public static void generate(Mesh m) {
	MikkTSpaceImpl context = new MikkTSpaceImpl(m);
	if(!genTangSpaceDefault(context)){
		Logger.getLogger(MikktspaceTangentGenerator.class.getName()).log(Level.SEVERE, "Failed to generate tangents for geometry " + g.getName());
	}	
}

Well if you feel like making a PR you’re welcome

1 Like