Package com.ngt.jopenmetaverse.shared.types

Examples of com.ngt.jopenmetaverse.shared.types.Vector3


          }

          public void Pan(float deltaX, float deltaY)
          {
              Manual = true;
              Vector3 direction = Vector3.subtract(getPosition(), getFocalPoint());
              direction.normalize();
              Vector3 vy = Vector3.modulus(direction, Vector3.UnitZ);
              Vector3 vx = Vector3.modulus(vy, direction);
              Vector3 vxy = Vector3.multiply(vx, deltaY).add(Vector3.multiply(vy, deltaX));
              getPosition().add(vxy);
              getFocalPoint().add(vxy);
          }
View Full Code Here


          }

          public void Rotate(float delta, boolean horizontal)
          {
              Manual = true;
              Vector3 direction = Vector3.subtract(getPosition(), getFocalPoint());
              if (horizontal)
              {
//                  Position = FocalPoint + direction * new Quaternion(0f, 0f, (float)Math.Sin(delta), (float)Math.Cos(delta));
                  setPosition(Vector3.add(getFocalPoint(),Vector3.multiply(direction, new Quaternion(0f, 0f, (float)Math.sin(delta), (float)Math.cos(delta)))));
              }
View Full Code Here

    //        }

    if (getBasePrim().ParentID == 0)
    {
      // We are the root prim, return our interpolated position
      RenderPosition = new Vector3(InterpolatedPosition);
      RenderRotation = new Quaternion(InterpolatedRotation);
      return;
    }
    else
    {
      RenderPosition = new Vector3(RHelp.InvalidPosition);
      RenderRotation = new Quaternion(Quaternion.Identity);

      // Not root, find our parent
      SceneObject p = getParentSceneObject();
      if (p == null)
      {
        System.out.println("Parent Primitive is null...");
        return;
      }

      // If we don't know parent position, recursively find out
      if (!p.PositionCalculated)
      {
        p.calPrimPosAndRot(cameraRenderPosition);
        p.DistanceSquared = Vector3.distanceSquared(cameraRenderPosition, p.RenderPosition);
        p.PositionCalculated = true;
      }

      Vector3 parentPos = new Vector3(p.RenderPosition);
      Quaternion parentRot = new Quaternion(p.RenderRotation);

      if (p instanceof RenderPrimitive)
      {
        // Child prim (our parent is another prim here)
        RenderPosition = Vector3.add(parentPos, Vector3.multiply(InterpolatedPosition, parentRot));
        RenderRotation = Quaternion.multiply(parentRot, InterpolatedRotation);
      }
      else if (p instanceof RenderAvatar)
      {
        //TODO only for debug
        RenderPosition = new Vector3(p.RenderPosition);
        RenderRotation = new Quaternion(p.RenderRotation);
        //TODO implement
        //                // Calculating position and rotation of the root prim of an attachment here
        //                // (our parent is an avatar here)
        //                RenderAvatar parentav = (RenderAvatar)p;
View Full Code Here

    return new Vector2(v.x, v.y);
  }

  public static Vector3 OMVVector3(org.lwjgl.util.vector.Vector3f v)
  {
    return new Vector3(v.x, v.y, v.z);
  }
View Full Code Here

        }

        public static float turbulence3(float x, float y, float z, float freq)
        {
            float t;
            Vector3 vec = new Vector3();

            for (t = 0f; freq >= 1f; freq *= 0.5f)
            {
                vec.X = freq * x;
                vec.Y = freq * y;
 
View Full Code Here

    {
      RenderPrimitive r = renderPrimitives.get(0);
      translateX = -1* r.getBasePrim().Position.X;
      translateY = -1* r.getBasePrim().Position.Y;
      translateZ = -1* r.getBasePrim().Position.Z;
      r.RenderPosition = new Vector3(r.getBasePrim().Position);
      r.RenderRotation = new Quaternion(0, 0, 0, 1);
      System.out.println(String.format("Pos %s Rot %s", r.RenderPosition.toString(),
          r.RenderRotation.toString()));
    }
   
View Full Code Here

//        System.out.println("After Step Prim ID " + renderPrimitive.getBasePrim().LocalID + " Resultant Rotation: " + renderPrimitive.getBasePrim().Rotation.toString());
//        System.out.println("Calculated Pos: " + renderPrimitive.InterpolatedPosition.toString()
//            + " Rot: " + renderPrimitive.InterpolatedRotation.toString());
       
       
        renderPrimitive.calPrimPosAndRot(new Vector3(0, 0, 0));
       
//        System.out.println("After Calculation " + renderPrimitive.getBasePrim().LocalID + " Resultant Rotation: " + renderPrimitive.getBasePrim().Rotation.toString());
//        System.out.println("Calculated Pos: " + renderPrimitive.RenderPosition.toString()
//            + " Rot: " + renderPrimitive.RenderRotation.toString());
       
View Full Code Here

//        Camera.Position = camPos;
//        Camera.FocalPoint = myself.RenderPosition + new Vector3(5, 0, 0) * client.self.Movement.BodyRotation;
   
       

        Vector3 camPos = Vector3.add(client.self.getSimPosition(), Vector3.multiply(new Vector3(-4, 0, 1), client.self.Movement.BodyRotation));
        camera.setPosition(camPos);
        camera.setFocalPoint(Vector3.add(client.self.getSimPosition(), Vector3.multiply(new Vector3(5, 0, 0), client.self.Movement.BodyRotation)));
       
        client.self.Movement.SendUpdate(false);
//   
//    else if(keycode == Keyboard.KEY_W)
//      translateY += 1;
View Full Code Here

   }

  public void initCamera()
  {
      this.camera = new Camera();
          Vector3 camPos = Vector3.add(client.self.getSimPosition(),
              Vector3.multiply(new Vector3(-4, 0, 1), client.self.Movement.BodyRotation));
         
          camera.setPosition(camPos);
      System.out.println(String.format("Initial Camera Position %s Sim Pos %s ", camPos.toString(), client.self.getSimPosition().toString()));
          camera.setFocalPoint(Vector3.add(client.self.getSimPosition(), Vector3.multiply(new Vector3(5, 0, 0), client.self.Movement.BodyRotation)));
          camera.Zoom = 1.0f;
          //TODO need to set it following properly. Actually it means upto how far objects should be rendered
          camera.Far = 100;
  }
View Full Code Here

        if (!renderTerrain.Initialized)
          renderTerrain.Initialize();
       
    renderTerrain.Render(renderingContext);
   
    Vector3 myPos = camera.getPosition();
       
//    verify();
   
    System.out.println("Going to Print Primitives...");
//    System.out.println("pendingRenderingPrims size " + pendingRenderingPrims.size());
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.Vector3

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.