Package javax.vecmath

Examples of javax.vecmath.Vector3f


      Matrix4f tmp = new Matrix4f(rot);
      tmp.invert();
      transform.mul(tmp);

      DirectionalLight light = scene.getLights()[mode];
      Vector3f direction = light.getDirection();
      transform.transform(direction);
      light.setDirection(direction);
      scene.showLightVector(direction.x,direction.y,direction.z);
     
      // update pos, don't move view
          pos2DX = newX;
          pos2DY = newY;
          peerWindow.repaint();
          return;
    }

    // rotate all lights together with view
    if (scene!=null) {
     
      float dx=(float)(newX-pos2DX)/wsize;
      float dy=(float)(newY-pos2DY)/wsize;
          drotX.rotX(-dy * 2 * (float)Math.PI);
      drotY.rotY(-dx * 2 * (float)Math.PI);
     
      Matrix4f transform = new Matrix4f(rot);
      transform.mul(drotX);
      transform.mul(drotY);
      Matrix4f tmp = new Matrix4f(rot);
      tmp.invert();
      transform.mul(tmp);

      DirectionalLight[] lights = scene.getLights();
      for (int i=0; i<lights.length; ++i) {
        Vector3f direction = lights[i].getDirection();
        transform.transform(direction);
        lights[i].setDirection(direction);
      }
      // don't update pos for super implementation call

View Full Code Here


      Matrix4f tmp = new Matrix4f(rot);
      tmp.invert();
      transform.mul(tmp);

      DirectionalLight light = scene.getLights()[lightRotationMode];
      Vector3f direction = new Vector3f();
      light.getDirection(direction);
      transform.transform(direction);
      light.setDirection(direction);
      // this calls detach/attach => more flicker
      //scene.showLightVector(direction.x,direction.y,direction.z);
     
      // update pos, don't move view
          pos2DX = newX;
          pos2DY = newY;
          peerWindow.repaint();
          return;
    }

    // rotate all lights together with view
    if (scene!=null) {
     
      float dx=(float)(newX-pos2DX)/wsize;
      float dy=(float)(newY-pos2DY)/wsize;
      if (inverse) {
        dx = -dx;
        dy = -dy;
      }
          drotX.rotX(dy * 2 * (float)Math.PI);
      drotY.rotY(dx * 2 * (float)Math.PI);
     
      Matrix4f transform = new Matrix4f(rot);
      transform.mul(drotX);
      transform.mul(drotY);
      Matrix4f tmp = new Matrix4f(rot);
      tmp.invert();
      transform.mul(tmp);

      DirectionalLight[] lights = scene.getLights();
      Vector3f direction = new Vector3f();
      for (int i=0; i<lights.length; ++i) {
        lights[i].getDirection(direction);
        transform.transform(direction);
        lights[i].setDirection(direction);
      }
View Full Code Here

          synchronized (Frame3DJava3D.this) {
            accuCopy = accumulator;
            accumulator = 0;
            zoomAccumulator = null;
          }
          Vector3f view = new Vector3f(0,0,-1);
          rot.transform(view);
          float scale = (float)Math.pow(2.0, Math.abs(accuCopy))*getSceneSize()/200.0f;
          if (accuCopy<0) scale = -scale;
          view.scale(scale);
          trans.m03 += view.x;
          trans.m13 += view.y;
          trans.m23 += view.z;
          applyTransform();
        }
View Full Code Here

    float dx=(float)(newX-pos2DX)/wsize;
    float dy=-(float)(newY-pos2DY)/wsize;
    pos2DX = newX;
    pos2DY = newY;

    Vector3f viewX = new Vector3f(1,0,0);
    rot.transform(viewX);
    viewX.scale(dx/5.0f);
    Vector3f viewY = new Vector3f(0,1,0);
    rot.transform(viewY);
    viewY.scale(dy/5.0f);
    trans.m03 += viewX.x + viewY.x;
    trans.m13 += viewX.y + viewY.y;
    trans.m23 += viewX.z + viewY.z;
    applyTransform();
  }
View Full Code Here

      super.translate2D(newX, newY);
      return;
    }
   
    // rotation around view vector
    Vector3f view = new Vector3f(0,0,-1);
    rot.transform(view);
    float dx = (float)(newX-pos2DX)/wsize;
    float dy = (float)(newY-pos2DY)/wsize;
    pos2DX = newX;
    pos2DY = newY;
View Full Code Here

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
          // TODO : position lights around the object
            lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setEnable(true);
View Full Code Here

    }
   
  public void doAction(Object action) {
    if (action.toString().startsWith("Rotate Light ")) {
      lightRotationMode = Integer.parseInt(action.toString().substring("Rotate Light ".length())) - 1;
      Vector3f direction = new Vector3f();
      lights[lightRotationMode].getDirection(direction);
      showLightVector(direction.x,direction.y,direction.z);
   
    }else if (action.equals("Rotate View")) {
      lightRotationMode = -1;
View Full Code Here

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
          // TODO : position lights around the object
            lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_READ);
            lights[i].setCapabilityIsFrequent(DirectionalLight.ALLOW_DIRECTION_WRITE);
            lights[i].setEnable(true);
View Full Code Here

       
        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
          // TODO : position lights around the object
            lights[i] = new DirectionalLight(true,new Color3f(1.0f,1.0f,1.0f),new Vector3f(-1,-1,-1));
          rootGroup.addChild(lights[i]);
        }
       
        rootGroup.addChild(branchgroup);
        locale.addBranchGraph(rootGroup);
View Full Code Here

  }
   
  public void doAction(Object action) {
    if (action.toString().startsWith("Rotate Light ")) {
      lightRotationMode = Integer.parseInt(action.toString().substring("Rotate Light ".length())) - 1;
      Vector3f direction = lights[lightRotationMode].getDirection();
      showLightVector(direction.x,direction.y,direction.z);
      if (isVisible()) frame.getView().renderOnce();
    }
    if (action.equals("Rotate View")) {
      lightRotationMode = -1;
View Full Code Here

TOP

Related Classes of javax.vecmath.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.