Advertisement
Guest User

Untitled

a guest
Jun 24th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1.  
  2. import com.jme3.app.SimpleApplication;
  3. import com.jme3.light.DirectionalLight;
  4. import com.jme3.material.Material;
  5. import com.jme3.math.Quaternion;
  6. import com.jme3.math.Vector3f;
  7. import com.jme3.scene.Geometry;
  8. import com.jme3.scene.Node;
  9. import com.jme3.scene.control.LodControl;
  10.  
  11. public class TestLodClone extends SimpleApplication {
  12.  
  13.     public static void main(String[] args) {
  14.         TestLodClone app = new TestLodClone();
  15.         app.start();
  16.     }
  17.  
  18.     public void simpleInitApp() {
  19.         DirectionalLight dl = new DirectionalLight();
  20.         dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
  21.         rootNode.addLight(dl);
  22.  
  23.         Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.mesh.xml");
  24.         Geometry teapot = (Geometry) teapotNode.getChild(0);
  25.  
  26.         Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  27.         mat.setFloat("Shininess", 16f);
  28.         mat.setBoolean("VertexLighting", true);
  29.         teapot.setMaterial(mat);
  30.        
  31.         teapot.addControl(new LodControl());
  32.        
  33.         rootNode.attachChild(teapot.clone());
  34.        
  35.         cam.setLocation(new Vector3f(-1.0748308f, 1.35778f, -1.5380064f));
  36.         cam.setRotation(new Quaternion(0.18343268f, 0.34531063f, -0.069015436f, 0.9177962f));
  37.  
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement