yeah it did make sense but it did not make a difference…
alle of my code
package test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.URL;
import jmetest.TutorialGuide.HelloModelLoading;
import com.jme.app.SimpleGame;
import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.scene.Geometry;
import com.jme.scene.Node;
import com.jme.scene.Skybox;
import com.jme.scene.model.XMLparser.JmeBinaryReader;
import com.jme.scene.shape.Box;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;
import com.jmex.physics.PhysicsObject;
import com.jmex.physics.PhysicsWorld;
/**
* @author oliver
*Feb 10, 2005
*/
public class SceneBox extends SimpleGame{
Skybox skybox;
public static void main(String[] args) {
SceneBox app = new SceneBox();
app.setDialogBehaviour(SceneBox.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleInitGame() {
PhysicsWorld.create();
// Here we tell the PhysicsWorld how many times per second we would like to
// update it. It'll make the PhysicsWorlds internal timer govern the frequency
// of update calls, thus obtaining frame rate independance. We set it to
// 100 updates per second - the default is no restriction.
PhysicsWorld.getInstance().setUpdateRate(100);
// Here we tell the PhysicsWorld how much should change with each update.
// A bigger value = faster animation. A step size of 2/UPS (updates/sec)
// seem to give a rather nice simulation/result.
PhysicsWorld.getInstance().setStepSize(2/100f);
//Load skybox
skybox = new Skybox("universe",300,300,300);
URL sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax0.png");
Texture westT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax1.png");
Texture northT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax2.png");
Texture eastT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax3.png");
Texture southT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax4.png");
Texture downT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
sbloader = SceneBox.class.getClassLoader().getResource("data/galaxy/galax5.png");
Texture upT = TextureManager.loadTexture(sbloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
skybox.setTexture(Skybox.DOWN,downT);
skybox.setTexture(Skybox.UP,upT);
skybox.setTexture(Skybox.NORTH,northT);
skybox.setTexture(Skybox.EAST,eastT);
skybox.setTexture(Skybox.WEST,westT);
skybox.setTexture(Skybox.SOUTH,southT);
rootNode.attachChild(skybox);
rootNode.setForceView(true);
//load a model
// Point to a URL of my model
URL model=HelloModelLoading.class.getClassLoader().getResource("data/model/ship/shuttle.jme");
URL textureloader=HelloModelLoading.class.getClassLoader().getResource("data/texture/ship/shuttle-1.png");
Texture modelT = TextureManager.loadTexture(textureloader,Texture.MM_LINEAR,Texture.FM_LINEAR,true);
// This byte array will hold my .jme file
ByteArrayOutputStream BO=new ByteArrayOutputStream();
// This will read the .jme format and convert it into a scene graph
JmeBinaryReader jbr=new JmeBinaryReader();
try {
// Tell the binary reader to use bounding boxes instead of bounding spheres
jbr.setProperty("bound","box");
// Load the binary .jme format into a scene graph
Node maggie=jbr.loadBinaryFormat(model.openStream());
maggie.getChild(0).updateGeometricState(0, true);
TextureState bgts = display.getRenderer().createTextureState();
bgts.setTexture(modelT);
bgts.setEnabled(true);
maggie.setRenderState(bgts);
maggie.setLocalScale(10f);
Box bounds = (Box) maggie.getChild(0).getWorldBound();
bounds.setLocalTranslation(maggie.getLocalTranslation());
bounds.setLocalRotation(maggie.getLocalRotation());
// Put her on the scene graph
rootNode.attachChild(maggie);
PhysicsObject shipObj = new PhysicsObject(bounds,10);
PhysicsWorld.getInstance().addObject(shipObj);
}catch (IOException e) { // Just in case anything happens
System.out.println("Damn exceptions!" + e);
e.printStackTrace();
System.exit(0);
}
// Creates the box that makes out the floor.
Box floor = new Box("Floor", new Vector3f(0,-40,0), 50, 1, 50);
// In order to add it to the PhysicsWorld we need to create a PhysicsObject
// from it. Note that we don't pass a mass in the constructor. This makes it
// static.
PhysicsObject floorObj = new PhysicsObject(floor);
PhysicsWorld.getInstance().addObject(floorObj);
rootNode.attachChild(floor);
}
/**
* Gets called on application ending.
*/
protected void cleanup() {
super.cleanup();
// Before ending your application you should always clean up the PhysicsWorld.
PhysicsWorld.getInstance().cleanup();
}
/**
* Gets called every frame.
*/
protected void simpleUpdate() {
// We must call this method in order to make the simulation step forward. It doesn't
// matter how many times per second we make the call, as long as we have a
// FPS >= the updaterate we've given the PhysicsWorld. This is because of the
// PhysicsWorlds internal timer, that govern the frequency of actual updates.
PhysicsWorld.getInstance().update();
}
}