Package org.osm2world.core.target.common.rendering

Examples of org.osm2world.core.target.common.rendering.Camera


    Point currentMousePoint = e.getPoint();
   
    float movementX = currentMousePoint.x - previousMousePoint.x;
    float movementY = currentMousePoint.y - previousMousePoint.y;
   
    Camera camera = renderOptions.camera;
   
    if (camera != null) {
 
      if (translationDrag) {
       
        camera.moveMapForward(movementY);
        camera.moveMapRight(movementX);
       
      } else if (rotationDrag) {
         
        /* view left/right */
        camera.rotateY(movementX/100);
       
        /* view up/down */
        camera.mapPitch(movementY/-100);
     
      } else if (movementDrag) {
       
        /* roll left/right */
        camera.roll(movementX/100);
       
        /* move up/down */
        camera.moveMapUp(movementY);
      }
    }
     
    previousMousePoint = currentMousePoint;
     
View Full Code Here


    zoom(e.getWheelRotation() < 0, 1);
  }

  private void zoom(boolean zoomIn, double scale) {
    Camera c = renderOptions.camera;
   
    if (c != null) {

      VectorXYZ toLookAt = c.getLookAt().subtract(c.getPos());
      VectorXYZ move = toLookAt.mult(scale * (zoomIn ? 0.2f : -0.25f));
      VectorXYZ newPos = c.getPos().add(move);

      c.setPos(newPos);
    }
  }
View Full Code Here

    MapData mapData = data.getConversionResults().getMapData();

    VectorXZ camLookAt = mapData.getCenter();

    renderOptions.camera = new Camera();
    renderOptions.camera.setCamera(camLookAt.x, 1000, camLookAt.z-1000,
                                       camLookAt.x, 0, camLookAt.z);
   
    renderOptions.projection = Defaults.PERSPECTIVE_PROJECTION;
View Full Code Here

   
    ImageExporter exporter = null;
   
    for (CLIArguments args : argumentsGroup.getCLIArgumentsList()) {
     
      Camera camera = null;
      Projection projection = null;
     
      if (args.isOviewTiles()) {
       
        camera = OrthoTilesUtil.cameraForTiles(
            results.getMapProjection(),
            args.getOviewTiles(),
            args.getOviewAngle(),
            args.getOviewFrom());
        projection = OrthoTilesUtil.projectionForTiles(
            results.getMapProjection(),
            args.getOviewTiles(),
            args.getOviewAngle(),
            args.getOviewFrom());
       
      } else if (args.isOviewBoundingBox()) {
       
        double angle = args.getOviewAngle();
        CardinalDirection from = args.getOviewFrom();
       
        Collection<VectorXZ> pointsXZ = new ArrayList<VectorXZ>();
        for (LatLonEle l : args.getOviewBoundingBox()) {
          pointsXZ.add(results.getMapProjection().calcPos(l.lat, l.lon));
        }
        AxisAlignedBoundingBoxXZ bounds =
          new AxisAlignedBoundingBoxXZ(pointsXZ);
             
        camera = OrthoTilesUtil.cameraForBounds(bounds, angle, from);
        projection = OrthoTilesUtil.projectionForBounds(bounds, angle, from);
       
      } else if (args.isPviewPos()) {
       
        MapProjection proj = results.getMapProjection();
       
        LatLonEle pos = args.getPviewPos();
        LatLonEle lookAt = args.getPviewLookat();
       
        camera = new Camera();
        VectorXYZ posV = proj.calcPos(pos.lat, pos.lon).xyz(pos.ele);
        VectorXYZ laV =  proj.calcPos(lookAt.lat, lookAt.lon).xyz(lookAt.ele);
        camera.setCamera(posV.x, posV.y, posV.z, laV.x, laV.y, laV.z);
       
        projection = new Projection(false,
            args.isPviewAspect() ? args.getPviewAspect() :
              (double)args.getResolution().x / args.getResolution().y,
              args.getPviewFovy(),
View Full Code Here

    try {

      /* create camera and perspective
         compensating for left- vs. right-handed coords */

      Camera povRayCamera = new Camera();
      povRayCamera.setCamera(
          renderOptions.camera.getPos().x,
          renderOptions.camera.getPos().y,
          renderOptions.camera.getPos().z,
          renderOptions.camera.getLookAt().x,
          renderOptions.camera.getLookAt().y,
View Full Code Here

  }
 
  @Override
  public void fillTarget(JOGLTarget target) {
       
    Camera orthoCam = OrthoTilesUtil.cameraForBounds(
        map.getDataBoundary(), 30, CardinalDirection.S);
   
    List<VectorXYZ> boundVertices = map.getDataBoundary().polygonXZ().xyz(0).getVertices();
    target.drawLineLoop(LINE_COLOR, 1, boundVertices);
    target.drawLineStrip(LINE_COLOR, 1, boundVertices.get(0), boundVertices.get(2));
    target.drawLineStrip(LINE_COLOR, 1, boundVertices.get(1), boundVertices.get(3));
   
    drawBoxAround(target, orthoCam.getPos(), POINT_COLOR, HALF_POINT_WIDTH);
    drawBoxAround(target, orthoCam.getLookAt(), POINT_COLOR, HALF_POINT_WIDTH);
   
    target.drawLineStrip(LINE_COLOR, 1, orthoCam.getPos(), orthoCam.getLookAt());
   
  }
View Full Code Here

TOP

Related Classes of org.osm2world.core.target.common.rendering.Camera

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.