Hi!
I have to convert a program from JME1 to JME2, that I haven't
written by myself. So unfortunately I don't have an in-depth
understanding of everything in the code.
When migrating, I ran into a couple of problems, mostly related to
Batches (TriangleBatch, getBatchCount, getBatch(n) etc.).
Right now I cannot compile my code under JME2. My first goal
is to make code that compiles.
Searching through the forum I found out that most of the TriangleBatch
were replaced by Geometry, but I still have some questions, where I
need to ask for your help.
Here we go. How do I replace sth like this:
- // JME1-Code
for (int i = 0; i < mesh.getBatchCount(); i++) {
mesh.getBatch(i).setEnabled(false);
mesh.getBatch(i).setHasDirtyVertices(true);
}
My guess for JME2: mesh.getBatchCount() -> mesh.getTriangleCount?
What about mesh.getBatch(i)?
- TriangleBatch batch = mesh.getBatch(0); // JME1
batch.setTextureCombineMode(TextureState.OFF);
My guess:
Geometry batch = mesh; //JME2
mesh.setTextureCombineMode(TextureCombineMode.Off);
- mesh.removeBatch(batchIndex); // JME1
- if (batch.getMode() != TriangleBatch.TRIANGLES) { … } //JME1
- com.jme.scene.Image image; // JME1
texture = new Texture();
texture.setImage(image);
Question here: I found out, there is TextureManager.loadTexture(java.awt.Image image, …),
is this what I'm supposed to use here? If so, is there a shortcut to convert from
com.jme.scene.Image to java.awt.Image?
Thanks a lot for any help,
Bernhard