Package javax.vecmath

Examples of javax.vecmath.Matrix4f


        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 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) {
View Full Code Here


    float dy = (float)(newY-pos2DY)/wsize;
    pos2DX = newX;
    pos2DY = newY;
    AxisAngle4f aa = new AxisAngle4f(view, (dx-dy) * (float)Math.PI);
   
    Matrix4f mat = new Matrix4f();
    mat.setIdentity();
    mat.setRotation(aa);
    mat.mul(rot);
    rot = mat;
    applyTransform();
  }
View Full Code Here

  public Object clone() throws CloneNotSupportedException{
    TransformDataXith3d res=(TransformDataXith3d)super.clone();
    res.trans=new Transform3D();
    res.v3=new Vector3f();
    res.m3=new Matrix3f();
    res.m4=new Matrix4f();
    res.q=new Quat4f();   
    return res;
  }
View Full Code Here

        // avoids cumulative rounding errors
        // This should avoid "non-congruent transform above view transform"
        // exception
        _transform.setAutoNormalize(true);
        _tempTransform = new Transform3D();
        _zoom = new Matrix4f();
        _zoom.setIdentity();
        _rot = new Matrix4f();
        _rot.setIdentity();
        _trans = new Matrix4f();
        _trans.setIdentity();
        _drotX = new Matrix4f();
        _drotY = new Matrix4f();
        _vtrans = new Vector3f();
        _zoomFactor = 0.f;
        _scaleFactor = 1.f;
        _eyeDistance = 2.f;
        _transFactorX = 0.f;
View Full Code Here

        float dx = (float) (newX - _pos2DX) / _wsize;
        float dy = (float) (newY - _pos2DY) / _wsize;
        _pos2DX = newX;
        _pos2DY = newY;
        AxisAngle4f aa = new AxisAngle4f(view, (dx - dy) * (float) Math.PI);
        Matrix4f mat = new Matrix4f();
        mat.setIdentity();
        mat.setRotation(aa);
        mat.mul(_rot);
        _rot = mat;
        applyTransform();
    }
View Full Code Here

        _viewingPlatform.getViewPlatformTransform().setTransform(_transform);
    }
   
    public Object clone() throws CloneNotSupportedException{
        ViewTransform res=(ViewTransform)super.clone();
        res._zoom=new Matrix4f(_zoom);
        res._rot=new Matrix4f(_rot);
        res._drotX=new Matrix4f(_drotX);
        res._drotY=new Matrix4f(_drotY);
        res._trans=new Matrix4f(_trans);
        res._vtrans=new Vector3f(_vtrans);

        res._transform = new Transform3D();
        res._transform.setAutoNormalize(true);
        res._tempTransform = new Transform3D();
View Full Code Here

  public Object clone() throws CloneNotSupportedException{
    TransformDataJava3d res=(TransformDataJava3d)super.clone();
    res.trans=new Transform3D();
    res.v3=new Vector3d();
    res.m3=new Matrix3f();
    res.m4=new Matrix4f();
    res.q=new Quat4f();
    return res;
  }
View Full Code Here

        ConstraintSolver solver = new SequentialImpulseConstraintSolver();
        dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
        dynamicsWorld.setGravity(new Vector3f(0, -10 /* m/s2 */, 0));
        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f /* m */);
        CollisionShape ballShape = new SphereShape(3.0f);
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(
                new Quat4f(0, 0, 0, 1),
                new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
        groundBodyConstructionInfo.restitution = 0.25f;
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
View Full Code Here

            controlBall.activate(true);
            controlBall.applyCentralForce(force);
        }
        if (createNewShape) {
            CollisionShape shape = new SphereShape(3.0f);
            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1)));
            Vector3f inertia = new Vector3f();
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1.0f, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody body = new RigidBody(constructionInfo);
View Full Code Here

        PhysicsSphere(Vector4f colour, Vector3f position, DynamicsWorld physicsWorld, float mass, float radius, int slices, int stacks) {
            this.colour = colour;
            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
View Full Code Here

TOP

Related Classes of javax.vecmath.Matrix4f

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.