Quote from: EgonOlsen on October 12, 2016, 02:01:34 PM
In that case, you either have to split the objects by texture in your editor or use the PolygonManager to obtain (and set) all of them on each single polygon.
I try to do this:
public Truck3dObject(Object3D obj) {
super(obj);
textureMap = new HashMap<>();
final PolygonManager polygonManager = obj.getPolygonManager();
int i = 0;
try {
while (polygonManager.getPolygonTexture(i) != -1) {
textureMap.put(i, polygonManager.getPolygonTexture(i));
i++;
}
} catch (RuntimeException e) {
}
}
public void applyDefaultTexture() {
Iterator it = textureMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
this.getPolygonManager().setPolygonTexture((Integer)pair.getKey(), (Integer) pair.getValue());
}
}
}
In constructor I save all object textures in hashmap, and in applyDefault try to restore it. But nothing happens, object still displays with "new" texture.
For "highlighting" object I use next method:
if(color == YELLOW) {
model.setTexture("yellow")
}
Edit: Found the issue.
this.getPolygonManager().setPolygonTexture((Integer)pair.getKey(), (Integer) pair.getValue()); not worked because I used model.strip().
Now it works!
Thank you, Egon!