Package engine

Examples of engine.Entity


    light.move(0f, 3f, 0f);
    loadModel("chamfer_box.obj").setDefaultMaterial(loadMaterial("box_normal.mat"));
    loadModel("plane.obj").setDefaultMaterial(loadMaterial("plane.mat"));
 
    Material cubebox = loadMaterial("box_cubemap.mat");
    box = new Entity();
    box.setModel(loadModel("chamfer_box.obj"));
    box.setMaterial(cubebox);
    box.setPos(0,3,0);
    box.setScale(3f);
   
    stars = new Vector<>();
    starPoints = new Vector<>();
    float sinx,cosz,rany,seed,rot;
    for(int x=0; x<100; x++){
      //  stars.add(new Entity());
      //  stars.lastElement().setModel(loadModel("1x1plane.obj"));
        rany = (float)(Math.random()*100);
        seed = (float)(Math.random()*2*3.141);
        //rot = (float)(360f*(seed/(2*3.141)));
        sinx = (float)Math.sin(seed)*200*((100-rany)/100);
        cosz = (float)Math.cos(seed)*200*((100-rany)/100);
        starPoints.add(new Vec3f(sinx, rany+110, cosz));
      //  stars.lastElement().setPos(sinx, rany+100, cosz);
      //  stars.lastElement().setRot(0, rot/2, 0);
    }
   
    skybox = new Entity();
    skybox.setScale(3000f);
    skybox.setModel(loadModel("skybox.obj"));
   
    target = new Entity();
    target.setModel(loadModel("drake.obj"));
    //target.setMaterial(tilebox);
    target.setScale(5f);
    target.setPos(0,0f,0);
   
    floor = new Entity();
    floor.setModel(loadModel("plane.obj"));
    floor.setScale(10f);
   
    float seekerFovs[] = {30,60,90};
   
View Full Code Here


  private float viewRange;
  private double viewAngle,phase,turnAngle,yVariance;
  private boolean canSeeTarget;
 
  public Seeker(){
    entity = new Entity();
    entity.setModel(loadModel("chamfer_box.obj"));
    canSeeTarget = false;
    viewRange = 10f;
    viewAngle =  Math.toRadians(45f/2f);
    phase = Math.random()*2;
 
View Full Code Here

    loadModel("tile_wall2_pylon.obj").setDefaultMaterial(loadMaterial("tile_wall2.mat"));
   
    this.clock = new Clock(500);
    this.light = new Light(0);
   
    skybox = new Entity();
    skybox.setScale(30f);
    skybox.setModel(loadModel("skybox.obj"));
   
    this.lightbulb = new Entity();
    this.lightbulb.setModel(loadModel("bulb.obj"));
    this.lightbulb_offset = new Vec3f(0,0,0);
   
    this.walls = new WallGen(32, 25, 100000);
   
View Full Code Here

            this.grid[curGx][curGz] = new Grid(curGx*10,curGz*10);
            this.grid[curGx][curGz].addEntity();
            this.grid[curGx][curGz].back().setModel(loadModel("tile_floor.obj"));
            this.world[wx][wz].addEntity(this.grid[curGx][curGz].back());
            if(Math.random() < 0.05){
              Entity sphere = new Entity();
              sphere.setModel(loadModel("rope.obj"));
              this.world[wx][wz].addEntity(this.grid[curGx][curGz].addEntity(sphere));
            }
            sweep = this.genWallType(this.get8Sweep(curGx, curGz));
            if(sweep[0] == 0){
              this.world[wx][wz].addEntity(this.grid[curGx][curGz].addEntity(this.addWall(sweep[1],0)));
View Full Code Here

      }
    }
  }
 
  private Entity addWall(int rot, int mesh){
    Entity ent = new Entity();
    ObjModel model;
    switch(mesh){
      case 0:
        model = loadModel("tile_wall2.obj");
        break;
      case 1:
        model = loadModel("tile_wall2_corner_0.obj");
        break;
      case 2:
        model = loadModel("tile_wall2_corner_1.obj");
        break;
      case 3:
        model = loadModel("tile_wall2_corner_2.obj");
        break;
      case 4:
        model = loadModel("tile_wall2_pylon.obj");
        break;
      default:
        model = loadModel("tile_wall2.obj");
    }
    ent.setModel(model);
    ent.setRot(0, 90f*rot, 0);
    return ent;
  }
View Full Code Here

    this.entities.add(ent);
    return ent;
  }
 
  public void addEntity(){
    this.entities.add(new Entity());
    this.back().setPos(this.x, 0f, this.z);
  }
View Full Code Here

    ByteBuffer buffer = ByteBuffer.wrap(actual);
    buffer.position((modelPaths.length+materialPaths.length)*2);
   
    for(Vector<Entity> group:this.materialgroupsFresh.values()){
      for (int x = 0; x < group.size(); x++) {
        Entity ent = group.get(x);
        buffer.putFloat(ent.getPos().x);
        buffer.putFloat(ent.getPos().y);
        buffer.putFloat(ent.getPos().z);
        buffer.putFloat(ent.getRot().y);
       
        buffer.putInt(this.modelList.indexOf(ent.model));
        buffer.putInt(matIndex);
      }
      matIndex++;
View Full Code Here

      }
      byte[] bulk = new byte[dis.available()];
      dis.read(bulk);
      ByteBuffer entities = ByteBuffer.wrap(bulk);
      for(int i=0;i<bulk.length;i=i+24){
        Entity ent = new Entity();
        ent.setPos(entities.getFloat(),entities.getFloat(),entities.getFloat());
        ent.setRot(0f, entities.getFloat(), 0f);
       
        ent.setModel((ObjModel)models.get(entities.getInt()));
        ent.setMaterial((Material)materials.get(materials.size()-1-entities.getInt()));
       
        this.addEntity(ent);
      }
      /*
      while (true){
View Full Code Here

TOP

Related Classes of engine.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.