Package com.jme3.math

Examples of com.jme3.math.Vector3f


    for (int i = 0; i < samples; i++) {
      float x = FastMath.cos(angle) + center.x;
      float y = FastMath.sin(angle) + center.y;
      int base = i*2;
      int indicesBase = i*6;
      vertices[base] = new Vector3f(x * radius, y * radius, center.z);
      vertices[base+1] = new Vector3f(x * (radius-width), y * (radius-width), center.z);
      texCoord[base] = new Vector2f(x * radius, y * radius);
      texCoord[base+1] = new Vector2f(x * (radius-width), y * (radius-width));
     
      indices[indicesBase] = base;
      indices[indicesBase+1] = calc(base+1);
View Full Code Here


  }

  @Override
  public void onCamLocationChange(Vector3f camLoaction) {
   
        Vector3f newDirection = new Vector3f();
        Vector3f newUp = new Vector3f();
        Vector3f newLeft = new Vector3f();
       
        newDirection.set(camLoaction).subtractLocal(getLocalTranslation()).normalizeLocal();

        newUp.set(Vector3f.UNIT_Y);
       

        newLeft.set(newUp).crossLocal(newDirection).normalizeLocal();
        if (newLeft.equals(Vector3f.ZERO)) {
            if (newDirection.x != 0) {
                newLeft.set(newDirection.y, -newDirection.x, 0f);
            } else {
                newLeft.set(0f, newDirection.z, -newDirection.y);
            }
        }

        newUp.set(newDirection).crossLocal(newLeft).normalizeLocal();
       
View Full Code Here

    for (int i = 0; i <= samples; i++) {
      float x = FastMath.cos(angle);
      float z = FastMath.sin(angle);
      int verticesBase = i+1;
      int indicesBase = (i-1)*3;
      vertices[verticesBase] = new Vector3f((x * radius) + ref.x, ref.y, (z * radius) + ref.z);
      texCoord[verticesBase] = new Vector2f(1-rw+(z * rw), (x * 0.5f) + 0.5f);
      if (lastPoint > 0) {
        indices[indicesBase] = 0;
        indices[indicesBase+1] = verticesBase;
        indices[indicesBase+2] = lastPoint;
      }
      lastPoint = verticesBase;
      angle += rate;
    }
   
    // right center
    ref.z = radius-width/2f;
    int base2 = samples+2;
    vertices[base2] = ref.clone();
   
   
    texCoord[base2] = new Vector2f(rw, 0.5f);
    angle = FastMath.PI;
    lastPoint = 0;
   
    // draw right half circle
    for (int i = 0; i <= samples; i++) {
      float x = FastMath.cos(angle);
      float z = FastMath.sin(angle);
      int verticesBase = i+samples+3;
      int indicesBase = (i+samples)*3;
      vertices[verticesBase] = new Vector3f((x * radius) + ref.x, ref.y, (z * radius) + ref.z);
      texCoord[verticesBase] = new Vector2f(rw + (z * rw), (x * 0.5f) + 0.5f);
      System.out.println(texCoord[verticesBase]);
      if (lastPoint > 0) {
        indices[indicesBase] = base2;
        indices[indicesBase+1] = verticesBase;
View Full Code Here

 
  public void update(float tpf) {
    if (!isFinished()) {
      updateTimer(tpf);
      float p = getProgress();
      Vector3f tar = target.getLocalTranslation();
      Vector3f route = tar.subtract(start);
      route.multLocal(p);
      Vector3f newPos = start.add(route);
      position.setLocalTranslation(newPos);
    }
  }
View Full Code Here

        // init Camera --------------------------------
       
        cam = new Camera(settings.getWidth(), settings.getHeight());

        cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f);
        cam.setLocation(new Vector3f(0f, 0f, 10f));
        cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
       

        renderManager = new RenderManager(renderer);
        //Remy - 09/14/2010 setted the timer in the renderManager
        renderManager.setTimer(timer);
View Full Code Here

  }
 
  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
   
    test = new Planet(app.getAssetManager(), "Earth", "Textures/Planets/Earth/Earth.jpg", "Textures/Planets/Clouds/Cloud1.jpg", 60, new Vector3f(600, 0, 0), true, null);
    mapNode.attachChild(test);
   
    Planet test2 = new Planet(app.getAssetManager(), "Uriel", "Textures/Planets/Uriel/Uriel.jpg", null, 60, new Vector3f(0, 0, 600), false, null);
    mapNode.attachChild(test2);
   
    Planet test3 = new Planet(app.getAssetManager(), "Dominion", "Textures/Planets/Dominion/Dominion.jpg", null, 60, new Vector3f(-600, 0, 0), true, new Vector3f(0.4f, 0.6f, 0.7f));
    mapNode.attachChild(test3);
   
   
    /*
    Planet perun = new Planet("Perun", "perun2.jpg", 60);
View Full Code Here

              // clean destroy audio environemt
              ar.cleanup();
                stop();
            } else if (name.equals("SIMPLEAPP_CameraPos")) {
                if (cam != null) {
                    Vector3f loc = cam.getLocation();
                    Quaternion rot = cam.getRotation();
                    System.out.println("Camera Position: ("
                            + loc.x + ", " + loc.y + ", " + loc.z + ")");
                    System.out.println("Camera Rotation: " + rot);
                    System.out.println("Camera Direction: " + cam.getDirection());
View Full Code Here

        flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
        flame.setParticlesPerSec(0);
        flame.setGravity(-5f);
        flame.setLowLife(1f);
        flame.setHighLife(1f);
        flame.setInitialVelocity(new Vector3f(0, 7, 0));
        flame.setVelocityVariation(1f);
        flame.setImagesX(2);
        flame.setImagesY(2);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
View Full Code Here

    app.start();
  }

  @Override
  public void simpleInitApp() {
        cam.setLocation(new Vector3f(3, 3, 3));
        cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

        //rootNode.attachChild(loadLetter("A"));
       
        rootNode.attachChild(loadWord("HGFEBCA"));
View Full Code Here

        // create offscreen framebuffer
        FrameBuffer offBuffer = new FrameBuffer(1024, 256, 1);

        //setup framebuffer's cam
        offCamera.setFrustumPerspective(45f, 4f, 1f, 1000f);
        offCamera.setLocation(new Vector3f(0f, 0f, -5f));
        offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

        //setup framebuffer's texture
        Texture2D offTex = new Texture2D(1024, 256, Format.RGBA8);
        offTex.setMinFilter(Texture.MinFilter.Trilinear);
        offTex.setMagFilter(Texture.MagFilter.Bilinear);
View Full Code Here

TOP

Related Classes of com.jme3.math.Vector3f

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.