Package com.sun.j3d.utils.geometry

Examples of com.sun.j3d.utils.geometry.Primitive


        public void actionPerformed(ActionEvent e) {
            PrimitiveDialog d=new PrimitiveDialog(
                    javax.swing.SwingUtilities.getWindowAncestor( getNode().getTree()),
                    getLocation(),
                    _primitiveClass, _title);
            Primitive n=d.getResult();
            if(n!=null){
                GroupNode gn=(GroupNode)getNode();
                gn.addChild(n);
                AddEdit ae=new AddEdit(gn, n, null);
View Full Code Here



  //Specification of the action to be carried out when an object is picked.
  public void updateScene(int xpos, int ypos)
  {
    Primitive pickedShape = null;
    pickCanvas.setShapeLocation(xpos,ypos);
    PickResult pResult = pickCanvas.pickClosest();
    if (pResult != null)
    {
      pickedShape = (Primitive) pResult.getNode(PickResult.PRIMITIVE);
    }

    if (pickedShape != null)
    {
      System.out.println("The object "+pickedShape.getUserData()+" has been selected.");
    }
    else
    {
      System.out.println("No object has been selected.");
    }
View Full Code Here

  }


  public void updateScene(int xpos, int ypos)
  {
    Primitive pickedShape = null;
    pickCanvas.setShapeLocation(xpos,ypos);
    PickResult pResult = pickCanvas.pickClosest();
    if (pResult != null)
    {
      pickedShape = (Primitive) pResult.getNode(PickResult.PRIMITIVE);
    }

    if (pickedShape != null)
    {
      if (pickedShape.getUserData()=="box")
      {
        //The cube has been picked. The starting time of its rotation
        //must be set to now.
        alphas[0].setStartTime(System.currentTimeMillis()-alphas[0].getTriggerTime());
      }
      else
      {
        if (pickedShape.getUserData()=="sphere")
        {
          //The cube has been picked. The correct transformation
          //(shrinking or growing) should be chosen. The starting time of
          //the corresponding transformation must be set to now.
          if (shrink)
View Full Code Here

      pickCanvas.setShapeLocation(e);
      PickResult result = pickCanvas.pickClosest();
        if (result == null) {
          System.out.println("Nothing picked");
        } else {
          Primitive p = (Primitive)result.getNode(PickResult.PRIMITIVE);
          Shape3D s = (Shape3D)result.getNode(PickResult.SHAPE3D);
         
          //*******************************************************************************
          //   This code will get you a reference to the sphere clicked on
          //   notice that it now prints out which sphere you clicked on
View Full Code Here

    }
   
    public void updateScene(int xpos, int ypos) {
      System.err.println("update scene ");
        PickResult pickResult = null;
        Primitive shape = null;

        pickCanvas.setShapeLocation(xpos, ypos);
        pickResult = pickCanvas.pickClosest();
       
        if (pickResult != null) {
           
            shape = (Primitive) pickResult.getNode(PickResult.PRIMITIVE);
            if(shape != null) {
               
                firePropertyChange("PeakSelected",
                        oldShape,
                        shape);
                oldShape = shape;
                setTransformGroup((TransformGroup)shape.getParent());
                changeTranslation(xpos,ypos);
            }
        }
    }  
View Full Code Here

    private static final char BANNER = 'B';
    private static final char LIGHT = 'L';

    private static TransformGroup makeObstacle(int x, int z,
            Appearance appearance) {
        final Primitive obstruction = new Box(RADIUS, HEIGHT / 2, RADIUS,
                Primitive.GENERATE_TEXTURE_COORDS | Primitive.GENERATE_NORMALS,
                appearance);
        final Vector3d position = new Vector3d(x, HEIGHT / 2, z);
        final Transform3D transform = Transforms.translation(position);
        final TransformGroup transformGroup = new TransformGroup(transform);
View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.geometry.Primitive

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.