Package engine

Examples of engine.Vec3f


    String[] temp,ftemp;
    for(int i=0; i<file.size();i++){
      if(file.get(i).length() > 0){
        if(file.get(i).startsWith("v ")){
          temp = file.get(i).split("\\s+");
          this.obj_vertices.addElement(new Vec3f(Float.parseFloat(temp[1]),Float.parseFloat(temp[2]),Float.parseFloat(temp[3])));
          //System.out.println(temp[1]);
        }
        else if(file.get(i).startsWith("vt ")){
          temp = file.get(i).split("\\s+");
          this.obj_texcoords.addElement(new Vec2f(Float.parseFloat(temp[1]),Float.parseFloat(temp[2])));
        }
        else if(file.get(i).startsWith("vn ")){
          temp = file.get(i).split("\\s+");
          this.obj_normals.addElement(new Vec3f(Float.parseFloat(temp[1]),Float.parseFloat(temp[2]),Float.parseFloat(temp[3])));
        }
        else if(file.get(i).startsWith("f ")){
          temp = file.get(i).split("\\s+");
          this.tri_vertcount += temp.length-3;
          Vector<Face> fvect = new Vector<Face>();
View Full Code Here


        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};
   
    seekers = new Vector<>();
    for(int i=0; i<this.seekerCount; i++){
      seekers.add(new Seeker());
      seekers.lastElement().spawn(new Vec3f((float)Math.random()*30-15,0,(float)Math.random()*30-15), (float)Math.random()*40+15, seekerFovs[(int)(Math.random()*3)]);
    }
   
    seekerHits = new Vector<>();
   
    streets = new Streets(loadMaterial("street.mat"),4,0.5f);
View Full Code Here

    mat = material;
    nodes = new Vector<>();
    vOffset = 0f;
   
    if(type == 0) {
      nodes.add(new Vec3f(0, 0, 0));
      for(int i=0;i<32;i++){
        nodes.add(new Vec3f(nodes.lastElement().x+1f, 0, nodes.lastElement().z+(float)Math.sin((float)i/5f)*0.3f));
      }
      float x,z;
      x = nodes.lastElement().x;
      z = nodes.lastElement().z;
     
      for(int i=0;i<22;i++){
        nodes.add(new Vec3f(
          x+(float)Math.sin(((float)i)/10f)*8f+1f,
          0,
          z-(float)Math.cos(((float)i)/10f)*8f+8f
        ));
      }
      x = nodes.lastElement().x-0.5f;
      z = nodes.lastElement().z;
      for(int i=0;i<64;i++){
        nodes.add(new Vec3f(x-i/2f, 0, z+(float)Math.sin((float)i/8f+0.15f)*6f));
      }
    }
    else if(type == 1){
      for(int i=0;i<70;i++){
        nodes.add(new Vec3f((float)Math.sin(((float)i)/10f)*8f, 0,(float)Math.cos(((float)i)/10f)*8f));
      }
    }
    else if(type == 2){
      Vector<Vec3f> tnodes = new Vector<>();
      float x,z,c;
      tnodes.add(new Vec3f(0,0,0));
      tnodes.add(new Vec3f(1,0,10));
      tnodes.add(new Vec3f(20,0,10));
      tnodes.add(new Vec3f(20,0,25));
     
      for(int i=1;i<tnodes.size();i++){
        x = tnodes.get(i).x - tnodes.get(i-1).x;
        z = tnodes.get(i).z - tnodes.get(i-1).z;
        c = (float)Math.sqrt(x*x+z*z);
        for(float r=0;r<c;r++){
          //nodes.add(new Vec3f(tnodes.get(i-1).x+(x/r)*(float)Math.sin(0.31415*r), 0, tnodes.get(i-1).z+(z/r)*(float)Math.cos(0.31415*r)));
          nodes.add(new Vec3f(tnodes.get(i-1).x+(x/c*r), 0, tnodes.get(i-1).z+(z/c*r)));
        }
      }
    }
    else if(type == 3){
      nodes.add(new Vec3f(0,0,0));
      nodes.add(new Vec3f(1,0,10));
      nodes.add(new Vec3f(20,0,10));
      nodes.add(new Vec3f(20,0,25));
    }
    else if(type == 4){
      float radx=0f,rady=0f,offsetx=0f,offsety;
      nodes.add(new Vec3f(0, 0, 0));
      for(int i=0;i<100;i++){
        offsetx = (float)Math.random()/8f;
        offsety = (float)Math.random()/8f;

        for(int r=0;r<10;r++){
          nodes.add(new Vec3f(nodes.lastElement().x+(float)Math.sin(radx)*2f, i/100f, nodes.lastElement().z+(float)Math.cos(rady)*2f));
          radx += offsetx;
          rady += offsety;
        }
      }
    }
    else if(type == 5){
      for(int i=0;i<10;i++){
        nodes.add(new Vec3f(i, 0, 0));
       
      }
      float x = nodes.lastElement().x;
      for(int r=0;r<10;r++){
        nodes.add(new Vec3f(x, 0, r+1));
      }
   
    }
    /*
    nodes.add(new Vec3f(0, 0, -20));
View Full Code Here

      ARBMultitexture.glActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB);
      glBindTexture(GL_TEXTURE_2D, mat.texture0.texture.getTextureID());
    }
   
    glBegin(GL_TRIANGLES);
    Vec3f before = nodes.firstElement(),node;
    float rad0,rad1,t[][],v0=0f,v1=-0.0f,v00=0f,v01=0f,d;
    t = new float[6][2];
    for(int i=1;i<nodes.size()-1;i++){

      node = this.nodes.get(i);
View Full Code Here

  public StarField(){
    stars = new Vector<>();
    stars_colours = new Vector<>();
    stars_lum = new Vector<>();
    colour_list = new Vector<>();
    colour_list.add(new Vec3f(0f,0.4f,1f));
    colour_list.add(new Vec3f(0.2f,0.6f,1f));
    colour_list.add(new Vec3f(0.8f,1f,1f));
    colour_list.add(new Vec3f(1f,0.85f,0.6f));
    colour_list.add(new Vec3f(1f,0.8f,0.2f));
    colour_list.add(new Vec3f(1f,0.2f,0f));
    colour_list.add(new Vec3f(1f,0f,0f));
   
    Vector<String> list;
    list = readFile("starlist.txt");
   
    String[] temp;
    for(int i=0; i<list.size(); i++){
      temp = list.get(i).split("\\s+");
     
      if(Float.parseFloat(temp[1]) < 200f)
        continue;
     
      stars.add(new Vec3f(Float.parseFloat(temp[0])*10,Float.parseFloat(temp[1]),Float.parseFloat(temp[2])*10));
      stars_colours.add(Integer.parseInt(temp[4]));
      stars_lum.add(Float.parseFloat(temp[3])/60f);
    }
  }
 
View Full Code Here

    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);
   
    //light.move(100f, 10f, 100f);
    light.setPos((7+1)*250f,10f,(7+2.5f)*250-500);
    //camera.setPos(new Vec3f((7+1)*250f-125,500f,(7+2.5f)*250));
    camera.setPos(this.walls.getLightPos());
    camera.move(0f, 3f, 2f);
    camera.setRot(new Vec3f(15,0,0));
  }
View Full Code Here

  private Vec3f size;
  float vertice[] = new float[8];
 
  public Chunk(){
    super(null);
    center_draw = new Vec3f(0.0f,0.0f,0.0f);
    center_fresh = new Vec3f(0.0f,0.0f,0.0f);
    size = new Vec3f(0.0f,0.0f,0.0f);
    bounds_fresh = new float[6];
    bounds_draw = new float[6];
    rotMatrix = new float[3][3];
    VBOid = -1;
    drawable = false;
View Full Code Here

  private String filepath;
  private float shininess;
  private Vec3f specular;
 
  public Material create(String path){
    this.color = new Vec3f(1.0f,1.0f,1.0f);
    this.filepath = path;
   
    this.texture_alpha = new Vector<>();
    this.texture_alpha.add(1.0f);
    this.texture_alpha.add(1.0f);
   
    this.shininess = 25f;
    this.specular = new Vec3f(1f,1f,1f);
   
    this.shader_enabled = false;
    this.tex_blend = false;
    this.cull_face = true;
   
View Full Code Here

      }
    }
  }
 
  public Vec3f getLightPos(){
    return new Vec3f(this.currentCellx*this.gridSize*10f+this.gridSize*5.1f, 5f, this.currentCellz*this.gridSize*10f+this.gridSize*5.1f);
  }
 
View Full Code Here

  /** The World has been generated. It is made of the Entities it had when rebuild() was last called. */
  public static final int READY = 2;
 
  public World(String name){
    worldName = name;
    center = new Vec3f();
    buildStatus = 0;
    chunks = new HashMap<>();
    processedEntities = new HashMap<>();
    materialgroups = new HashMap<>();
    materialgroupsFresh = new HashMap<>();
View Full Code Here

TOP

Related Classes of engine.Vec3f

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.