Package javax.media.j3d

Examples of javax.media.j3d.View


    viewPlatformTransform.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
   
    Viewer viewer = new Viewer(new Canvas3D [0]);
    SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);
   
    View view = viewer.getView();
    // Update field of view from current camera
    updateView(view, this.home.getCamera(), this.home.getTopCamera() == this.home.getCamera());
   
    // Update point of view from current camera
    updateViewPlatformTransform(viewPlatformTransform, this.home.getCamera(), false);
View Full Code Here


   */
  public BufferedImage getOffScreenImage(int width, int height) {
    List<Selectable> selectedItems = this.home.getSelectedItems();
    SimpleUniverse offScreenImageUniverse = null;
    try {
      View view;
      if (this.offscreenUniverse == null) {
        offScreenImageUniverse = createUniverse(this.displayShadowOnFloor, false, true);
        view = offScreenImageUniverse.getViewer().getView();
        // Replace textures by clones because Java 3D doesn't accept all the time
        // to share textures between offscreen and onscreen environments
View Full Code Here

    // Reuse same physical body and environment
    PhysicalBody physicalBody = this.universe.getViewer().getPhysicalBody();
    PhysicalEnvironment physicalEnvironment = this.universe.getViewer().getPhysicalEnvironment();
   
    // Create a view associated with canvas3D
    View view = new View();
    view.setPhysicalBody(physicalBody);
    view.setPhysicalEnvironment(physicalEnvironment);
    view.setProjectionPolicy(projectionPolicy);
    // Create a viewing platform and attach it to view and universe locale
    ViewingPlatform viewingPlatform = new ViewingPlatform();
    viewingPlatform.setUniverse(this.universe);
    this.universe.getLocale().addBranchGraph(
        (BranchGroup)viewingPlatform.getViewPlatformTransform().getParent());
    view.attachViewPlatform(viewingPlatform.getViewPlatform());

    // Set user point of view depending on yaw and pitch angles
    updateViewPlatformTransform(viewingPlatform.getViewPlatformTransform(), yaw, pitch, scale);
    return view;
  }
View Full Code Here

     * Create transformation chain and mouse behaviors for a "human player" perspective
     */
    @Override
    protected void setup() {
        MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup();
        View view = universe.getViewer().getView();
        view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
        view.setScreenScalePolicy(View.SCALE_SCREEN_SIZE);

        TransformGroup rotateTrans = mtg.getTransformGroup(1);
        Transform3D rtrans = new Transform3D();
        rtrans.rotX(-Math.PI/2);
        rotateTrans.setTransform(rtrans);
View Full Code Here

        universe = new SimpleUniverse(this, ViewTransform.MAX_TRANSFORMS);
        ViewingPlatform vp = universe.getViewingPlatform();

        vp.setNominalViewingTransform();
        View v = universe.getViewer().getView();
        v.setMinimumFrameCycleTime(40); // 40ms = 25 FPS
        v.setSceneAntialiasingEnable(false);
        v.setBackClipDistance(1000 * BoardModel.HEX_DIAMETER);
        v.setBackClipPolicy(View.VIRTUAL_EYE);
        v.setFrontClipDistance(BoardModel.HEX_DIAMETER / 3);
        v.setFrontClipPolicy(View.VIRTUAL_EYE);
        v.setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);

        tileManager = new TileTextureManager(this, game);

        cursors = new BranchGroup();
        cursors.setPickable(false);
View Full Code Here

        panTrans.setTransform(ptrans);
    }

    @Override
    void zoom(int steps) {
        View view = universe.getViewer().getView();

        double scale = view.getScreenScale();

        scale *= Math.pow(1.5, steps);

        view.setScreenScale(scale);

        // seems like this is needed to counter too much J3D optimization
        TransformGroup panTrans = universe.getViewingPlatform().getMultiTransformGroup().getTransformGroup(1);
        Transform3D ptrans = new Transform3D();
        panTrans.getTransform(ptrans);
View Full Code Here

    }

    @Override
    void reset() {
        MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup();
        View view = universe.getViewer().getView();
        view.setScreenScale(.001);

        TransformGroup rotateTrans = mtg.getTransformGroup(2);
        Transform3D rtrans = new Transform3D();
        rtrans.rotX(-Math.PI/2);
        rotateTrans.setTransform(rtrans);
View Full Code Here

     * Create transformation chain and mouse behaviors for a top-down map perspective
     */
    @Override
    protected void setup() {
        MultiTransformGroup mtg = universe.getViewingPlatform().getMultiTransformGroup();
        View view = universe.getViewer().getView();

        view.setProjectionPolicy(View.PARALLEL_PROJECTION);
        view.setScreenScalePolicy(View.SCALE_EXPLICIT);
        view.setScreenScale(.001);

        TransformGroup panTrans = mtg.getTransformGroup(1);
        Transform3D ptrans = new Transform3D();
        ptrans.rotX(Math.PI/2);
        panTrans.setTransform(ptrans);
View Full Code Here

    ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
    simpUniv.getViewingPlatform().setViewPlatformBehavior(ob);


    //The View of the SimpleUniverse.
    View v = simpUniv.getViewer().getView();
    //The angle of view is reduced to 30 degrees.
    v.setFieldOfView(Math.PI/6);
    //The back clipping plane is shifted closer to the viewer.
    v.setBackClipDistance(0.345);
    //The front clipping plane is shifted away from the viewer.
    v.setFrontClipDistance(0.33);


    //Show the canvas/window.
    setTitle("Static scene with elementary objects badly clipped");
    setSize(700,700);
View Full Code Here

     
      createSceneGraph();
      parent.compile();
      simpleU.addBranchGraph(parent);
     
      View view = simpleU.getViewer().getView();
      view.setBackClipDistance(100);
      view.setFieldOfView(0.6*Math.PI);

  }
 
View Full Code Here

TOP

Related Classes of javax.media.j3d.View

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.