Package com.jme3.scene

Examples of com.jme3.scene.CameraNode


            aspect = ((Number) structure.getFieldValue("lens")).floatValue();
        } else {
            aspect = ((Number) structure.getFieldValue("ortho_scale")).floatValue();
        }
        camera.setFrustumPerspective(aspect, camera.getWidth() / camera.getHeight(), clipsta, clipend);
        return new CameraNode(null, camera);
    }
View Full Code Here


            // XXX: Most likely, it is in radians..
            fov = fov * FastMath.RAD_TO_DEG;
        }
        camera.setFrustumPerspective(fov, (float)DEFAULT_CAM_WIDTH / DEFAULT_CAM_HEIGHT, 1, 1000);
       
        cameraNode = new CameraNode(attribs.getValue("name"), camera);
        cameraNode.setControlDir(ControlDirection.SpatialToCamera);
       
        node.attachChild(cameraNode);
        node = null;
    }
View Full Code Here

    }

  @Override
  public void internalLoadSceneObject()
    {
    sceneObject = new CameraNode(cameraType.toString(), camera);
    sceneObject.setControlDir(ControlDirection.SpatialToCamera);

    if (cameraType.equals(CameraType.FirstPerson))
      sceneObject.setCullHint(CullHint.Always);
    else if (cameraType.equals(CameraType.ThirdPerson)) sceneObject.setCullHint(CullHint.Always);
View Full Code Here

        Camera cam = defaultCamera.clone();
        cam.setViewPort(0f, 0.5f, 0.5f, 1.0f);
        cam.setFrustumFar(500);
        cam.update();
       
        CameraNode camNode = new CameraNode("camera", cam);
        camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
        camNode.rotate((float) Math.PI / 2, (float) Math.PI, 0);
        camNode.move(-6, -50 / 2 + 15 / 2, 8 + 3);
        head.attachChild(camNode);

        Node actuator = createActuatorAssmNode("actuator");
        actuator.move(8, -50 / 2 + 25 / 2, 4 + 3);
        head.attachChild(actuator);
View Full Code Here

  public ColorRGBA getGroundColor() {
    return groundColor;
  }

  public void worldInitialized() {
    CameraNode camNode = world.getPlayer().getCameraNode();
    Camera c = camNode.getCamera();
    float width = Math.abs(c.getFrustumRight() - c.getFrustumLeft());
    float height = Math.abs(c.getFrustumTop() - c.getFrustumBottom());
    float distance = c.getFrustumFar();
    float scale = distance / c.getFrustumNear();
    distance = distance * (255f / 256f);
    width *= scale;
    height *= scale;
    geom = new Geometry("SkyPlane", new Quad(width, height));
    geom.setLocalRotation(Quaternion.DIRECTION_Z.opposite());
    geom.setLocalTranslation(c.getDirection().mult(-distance).add(new Vector3f(-width / 2, height / 2, 0)));
    geom.setMaterial(mat);
    camNode.attachChild(geom);
  }
View Full Code Here

    player.setUserObject(this);
    walkAngle = incarn.getStartAngle();

    hector.getHectorNode().addControl(player);

    camNode = new CameraNode("PlayerCam", cam);
    camNode.setControlDir(ControlDirection.SpatialToCamera);
    camNode.setLocalTranslation(Vector3f.ZERO);
    camNode.lookAt(Vector3f.UNIT_Z, Vector3f.UNIT_Y);
    hector.getHeadNode().attachChild(camNode);
View Full Code Here

    chaseCam.setMinVerticalRotation(-FastMath.PI / 2);

    boolean pov = false;
    if (pov) {
      chaseCam.setEnabled(false);
      camNode = new CameraNode("Camera Node", cam);
      camNode.setControlDir(ControlDirection.SpatialToCamera);
      camNode.setLocalTranslation(new Vector3f(0, 0, 0));
      camNode.lookAt(new Vector3f(0, 0, 1), Vector3f.UNIT_Y);
      headNode.attachChild(camNode);
    }
View Full Code Here

    }

    @Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat.setColor("m_Color", ColorRGBA.Blue);
        geom.setMaterial(mat);

        rootNode.attachChild(geom);
    }
View Full Code Here

        if (model == null) {
          assetLogger.modelFinished();
          logger.log(Level.SEVERE, "Couldn't load model "+path);
          return null;
        }
        Geometry modelGeom = (Geometry) model.getChild(0);

        try {
          // trows an Exception if lod is not supported
          modelGeom.setLodLevel(0);

          LodControl control = new LodControl();
          modelGeom.addControl(control);
        } catch (Exception e) {}
        assetLogger.modelFinished();
        camNode.detachAllChildren();
        camNode.attachChild(model);
        return null;
View Full Code Here

  public void simpleInitApp() {
    Sphere atmoSphere = new Sphere(48, 48, radius, false, true);
    mat = new Material(assetManager, "MatDefs/SimpleAtmoshere.j3md");
   
    mat.setFloat("radius", radius);
    atmo = new Geometry("atmo_Planet", atmoSphere);
   
    Vector3f pos = new Vector3f(5,0,0);
    atmo.setLocalTranslation(pos);
    mat.setVector3("v3Center", pos);
   
   
    atmo.setMaterial(mat);
      rootNode.attachChild(atmo);
     
      Sphere planetSphere = new Sphere(48, 48, radius * 0.8f);
      Material planteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      planteMat.setColor("Color", ColorRGBA.Green);
      Geometry planet = new Geometry("geo_Planet", planetSphere);
      planet.setLocalTranslation(pos);
      planet.setMaterial(planteMat);
      rootNode.attachChild(planet);
     
     
     
  }
View Full Code Here

TOP

Related Classes of com.jme3.scene.CameraNode

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.