Advertisement
Guest User

EntityItem2D

a guest
Sep 7th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. [...]
  2.  
  3. public class EntityItem2D {
  4.  
  5.     [...]
  6.  
  7.     public EntityItem2D(String fileName, float posX, float posZ, int offsetX, int offsetZ) {
  8.         Quad quad = new Quad(1, 1, false);
  9.             Material mat = ResourceManager.createMaterial("Common/MatDefs/Misc/Unshaded.j3md");
  10.             Texture2D texture = (Texture2D) ResourceManager.loadTexture("Textures/" + fileName);
  11.             mat.setTexture("ColorMap", texture);
  12.             mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
  13.             geom = new Geometry("Quad", quad);
  14.             geom.setMaterial(mat);
  15.             geom.setLocalScale(texture.getImage().getWidth() * CameraController.UNITS_PER_PIXEL, texture.getImage().getHeight() * CameraController.UNITS_PER_PIXEL, 1f);
  16.             geom.setLocalTranslation(offsetX, 0, offsetZ);
  17.             geom.setQueueBucket(Bucket.Transparent);
  18.             geom.addControl(new BillboardControl());
  19.        
  20.             node = new Node("ItemTest");
  21.             node.setLocalTranslation(posX * MapChunk.TILE_UNITS, 0, posZ * MapChunk.TILE_UNITS);
  22.             node.attachChild(geom);
  23.     }
  24.  
  25.     [...]
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement