I wanne change a existing mesh while its in use and after that I wanne safe the modified mesh 4 later work.
Atm i only wanne shift the positions of some vertices of a Box() mesh.
How can I do this??
Atm i stuck at “VertexBuffer vertices = buffer.get(0);” and I don’t see a way to get access to the position-floats.
[java]
package jme3.own;
import java.nio.Buffer;
import java.util.Iterator;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.VertexBuffer;
import com.jme3.scene.shape.Box;
import com.jme3.util.IntMap;
import com.jme3.util.IntMap.Entry;
public class MeshTest extends SimpleApplication {
@Override
public void simpleInitApp() {
guiNode.detachAllChildren();
viewPort.setBackgroundColor(ColorRGBA.Orange);
Box box1 = new Box(new Vector3f(1, -1, 1), 1, 1, 1);
Geometry blue = new Geometry(“Box”, box1);
Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
mat1.setColor(“m_Color”, ColorRGBA.Blue);
blue.setMaterial(mat1);
rootNode.attachChild(blue);
IntMap<VertexBuffer> buffer = box1.getBuffers();
for (Entry entry : buffer) {
System.out.println(entry.getValue());
}
VertexBuffer vertices = buffer.get(0);
System.out.println("vertices: "+vertices);
}
/**
-
@param args
*/
public static void main(String[] args) {
MeshTest test = new MeshTest();
test.setShowSettings(false);
test.start();
}
}
[/java]
Can u please show me the right way?