Esempio n. 1
0
  /**
   * Constructs an empty IndexedTriangleFanArray object using the specified parameters.
   *
   * @param vertexCount see {@link GeometryArray#GeometryArray(int,int)} for a description of this
   *     parameter.
   * @param vertexFormat see {@link GeometryArray#GeometryArray(int,int)} for a description of this
   *     parameter.
   * @param indexCount see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int)} for a
   *     description of this parameter.
   * @param stripIndexCounts see {@link
   *     IndexedGeometryStripArray#IndexedGeometryStripArray(int,int,int,int[])} for a description
   *     of this parameter.
   * @exception IllegalArgumentException if vertexCount is less than 1, or indexCount is less than
   *     3, or any element in the stripIndexCounts array is less than 3 ;<br>
   *     See {@link IndexedGeometryStripArray#IndexedGeometryStripArray(int,int,int,int[])} for more
   *     exceptions that can be thrown
   */
  public IndexedTriangleFanArray(
      int vertexCount, int vertexFormat, int indexCount, int[] stripIndexCounts) {

    super(vertexCount, vertexFormat, indexCount, stripIndexCounts);

    if (vertexCount < 1)
      throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray0"));

    if (indexCount < 3)
      throw new IllegalArgumentException(J3dI18N.getString("IndexedTriangleFanArray1"));
  }
  /**
   * Sets the transparency mode for this appearance component object.
   *
   * @param transparencyMode the transparency mode to be used, one of <code>NONE</code>, <code>
   *     FASTEST</code>, <code>NICEST</code>, <code>SCREEN_DOOR</code>, or <code>BLENDED</code>
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @exception IllegalArgumentException if <code>transparencyMode</code> is a value other than
   *     <code>NONE</code>, <code>FASTEST</code>, <code>NICEST</code>, <code>SCREEN_DOOR</code>, or
   *     <code>BLENDED</code>
   */
  public void setTransparencyMode(int transparencyMode) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_MODE_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes0"));

    if ((transparencyMode < FASTEST) || (transparencyMode > NONE)) {
      throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6"));
    }

    if (isLive())
      ((TransparencyAttributesRetained) this.retained).setTransparencyMode(transparencyMode);
    else ((TransparencyAttributesRetained) this.retained).initTransparencyMode(transparencyMode);
  }
Esempio n. 3
0
 /*
  * @exception IllegalSharingException if this NodeComponent is live and
  * the specified image is being used by a Canvas3D as an off-screen buffer.
  *
  * @exception IllegalSharingException if this NodeComponent is
  * being used by an immediate mode context and
  * the specified image is being used by a Canvas3D as an off-screen buffer.
  */
 void validateImageIllegalSharing(ImageComponent image) {
   // Do illegal sharing check
   if (image != null) {
     ImageComponentRetained imageRetained = (ImageComponentRetained) image.retained;
     NodeComponentRetained ncRetained = (NodeComponentRetained) this.retained;
     if (imageRetained.getUsedByOffScreen()) {
       if (isLive()) {
         throw new IllegalSharingException(J3dI18N.getString("NodeComponent2"));
       }
       if (ncRetained.getInImmCtx()) {
         throw new IllegalSharingException(J3dI18N.getString("NodeComponent3"));
       }
     }
   }
 }
Esempio n. 4
0
  /**
   * Gets this Light's current position and places it in the parameter specified.
   *
   * @param position the vector that will receive this node's position
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void getPosition(Point3f position) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_POSITION_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("PointLight2"));

    ((PointLightRetained) this.retained).getPosition(position);
  }
Esempio n. 5
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Retrieves the fog color.
   *
   * @param color the vector that will receive the current fog color
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void getColor(Color3f color) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_COLOR_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog2"));

    ((FogRetained) this.retained).getColor(color);
  }
  /**
   * Gets the destination blend function for this TransparencyAttributes object.
   *
   * @return the destination blend function.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @since Java 3D 1.2
   */
  public int getDstBlendFunction() {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_BLEND_FUNCTION_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes5"));

    return ((TransparencyAttributesRetained) this.retained).getDstBlendFunction();
  }
Esempio n. 7
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Retrieves the Fog node's influencing bounding leaf.
   *
   * @return this Fog's influencing bounding leaf information
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public BoundingLeaf getInfluencingBoundingLeaf() {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog4"));

    return ((FogRetained) this.retained).getInfluencingBoundingLeaf();
  }
  /**
   * Retrieves this appearance's transparency.
   *
   * @return the appearance's transparency
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public float getTransparency() {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_VALUE_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes3"));

    return ((TransparencyAttributesRetained) this.retained).getTransparency();
  }
Esempio n. 9
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Retrieves the Group node at the specified index from this Fog node's list of scopes.
   *
   * @param index the index of the Group node to be returned.
   * @return the Group node at the specified index.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public Group getScope(int index) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_SCOPE_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog8"));

    return ((FogRetained) this.retained).getScope(index);
  }
Esempio n. 10
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Returns the number of nodes in this Fog node's list of scopes. If this number is 0, then the
   * list of scopes is empty and this Fog node has universe scope: all nodes within the region of
   * influence are affected by this Fog node.
   *
   * @return the number of nodes in this Fog node's list of scopes.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public int numScopes() {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_SCOPE_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog11"));

    return ((FogRetained) this.retained).numScopes();
  }
Esempio n. 11
0
  /**
   * Gets this Light's current attenuation values and places it in the parameter specified.
   *
   * @param attenuation the vector that will receive the attenuation values
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void getAttenuation(Point3f attenuation) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_ATTENUATION_READ))
        throw new CapabilityNotSetException(J3dI18N.getString("PointLight5"));

    ((PointLightRetained) this.retained).getAttenuation(attenuation);
  }
Esempio n. 12
0
  /**
   * Check if the geometry component of this shape node under path intersects with the pickRay.
   *
   * @return true if intersected else false. If return is true, dist contains the closest distance
   *     of intersection.
   * @exception IllegalArgumentException if <code>path</code> is invalid.
   */
  boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist) {

    int flags;
    PickInfo pickInfo = new PickInfo();

    Transform3D localToVworld = path.getTransform();
    if (localToVworld == null) {
      throw new IllegalArgumentException(J3dI18N.getString("Shape3DRetained3"));
    }
    pickInfo.setLocalToVWorldRef(localToVworld);

    Shape3D shape = (Shape3D) path.getObject();
    // Get the geometries for this shape only, since the compiled
    // geomtryList contains several shapes
    ArrayList glist = (ArrayList) geometryInfo.get(shape.id);

    // System.err.println("Shape3DCompileRetained.intersect() : ");
    if (dist == null) {
      // System.err.println("      no dist request ....");
      return intersect(pickInfo, pickShape, 0, glist);
    }

    flags = PickInfo.CLOSEST_DISTANCE;
    if (intersect(pickInfo, pickShape, flags, glist)) {
      dist[0] = pickInfo.getClosestDistance();
      return true;
    }

    return false;
  }
Esempio n. 13
0
  /**
   * Sets the pixel array used to copy pixels to/from a Canvas3D. This is used when the type is
   * RASTER_COLOR or RASTER_COLOR_DEPTH.
   *
   * @param image the ImageComponent2D object containing the color data
   */
  final void setImage(ImageComponent2D img) {

    if ((img != null) && (img.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) {
      throw new IllegalArgumentException(J3dI18N.getString("Background14"));
    }

    TextureRetained oldTex = this.texture;
    if (source.isLive()) {
      if (this.texture != null) {
        this.texture.clearLive(refCount);
      }
    }

    // Issue 370: only hold the geomLock while calling initImage
    // (cannot hold it while sending a message).
    geomLock.getLock();
    initImage(img);
    geomLock.unLock();

    if (source.isLive()) {
      if (texture != null) {
        texture.setLive(inBackgroundGroup, refCount);
      }

      sendChangedMessage(
          (J3dThread.UPDATE_RENDER | J3dThread.UPDATE_RENDERING_ATTRIBUTES), oldTex, this.texture);
    }
  }
Esempio n. 14
0
  /**
   * Sets this appearance's transparency.
   *
   * @param transparency the appearance's transparency in the range [0.0, 1.0] with 0.0 being fully
   *     opaque and 1.0 being fully transparent
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setTransparency(float transparency) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_VALUE_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes2"));

    if (isLive()) ((TransparencyAttributesRetained) this.retained).setTransparency(transparency);
    else ((TransparencyAttributesRetained) this.retained).initTransparency(transparency);
  }
Esempio n. 15
0
  /**
   * Sets this Light's current attenuation values and places it in the parameter specified.
   *
   * @param constant the light's constant attenuation
   * @param linear the light's linear attenuation
   * @param quadratic the light's quadratic attenuation
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setAttenuation(float constant, float linear, float quadratic) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_ATTENUATION_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("PointLight3"));

    if (isLive()) ((PointLightRetained) this.retained).setAttenuation(constant, linear, quadratic);
    else ((PointLightRetained) this.retained).initAttenuation(constant, linear, quadratic);
  }
Esempio n. 16
0
  /**
   * Sets this Light's current attenuation values and places it in the parameter specified.
   *
   * @param attenuation the vector that will receive the attenuation values
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setAttenuation(Point3f attenuation) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_ATTENUATION_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("PointLight3"));

    if (isLive()) ((PointLightRetained) this.retained).setAttenuation(attenuation);
    else ((PointLightRetained) this.retained).initAttenuation(attenuation);
  }
Esempio n. 17
0
  /**
   * Set light position.
   *
   * @param x the new X position
   * @param y the new Y position
   * @param z the new Z position
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setPosition(float x, float y, float z) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_POSITION_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("PointLight1"));

    if (isLive()) ((PointLightRetained) this.retained).setPosition(x, y, z);
    else ((PointLightRetained) this.retained).initPosition(x, y, z);
  }
Esempio n. 18
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Removes all Group nodes from this Fog node's list of scopes. The Fog node will then have
   * universe scope: all nodes within the region of influence will be affected by this Fog node.
   *
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @exception RestrictedAccessException if any group node in this node's list of scopes is part of
   *     a compiled scene graph
   * @since Java 3D 1.3
   */
  public void removeAllScopes() {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_SCOPE_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog10"));

    if (isLive()) ((FogRetained) this.retained).removeAllScopes();
    else ((FogRetained) this.retained).initRemoveAllScopes();
  }
Esempio n. 19
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Appends the specified Group node to this Fog node's list of scopes. By default, Fog nodes are
   * scoped only by their influencing bounds. This allows them to be further scoped by a list of
   * nodes in the hierarchy.
   *
   * @param scope the Group node to be appended.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @exception RestrictedAccessException if the specified group node is part of a compiled scene
   *     graph
   */
  public void addScope(Group scope) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_SCOPE_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog12"));

    if (isLive()) ((FogRetained) this.retained).addScope(scope);
    else ((FogRetained) this.retained).initAddScope(scope);
  }
Esempio n. 20
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Sets the Fog's influencing region to the specified bounding leaf. When set to a value other
   * than null, this overrides the influencing bounds object.
   *
   * @param region the bounding leaf node used to specify the Fog node's new influencing region.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setInfluencingBoundingLeaf(BoundingLeaf region) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_INFLUENCING_BOUNDS_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog3"));

    if (isLive()) ((FogRetained) this.retained).setInfluencingBoundingLeaf(region);
    else ((FogRetained) this.retained).initInfluencingBoundingLeaf(region);
  }
Esempio n. 21
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Inserts the specified Group node into this Fog node's list of scopes at the specified index. By
   * default, Fog nodes are scoped only by their influencing bounds. This allows them to be further
   * scoped by a list of nodes in the hierarchy.
   *
   * @param scope the Group node to be inserted at the specified index.
   * @param index the index at which the Group node is inserted.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @exception RestrictedAccessException if the specified group node is part of a compiled scene
   *     graph
   */
  public void insertScope(Group scope, int index) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_SCOPE_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog9"));

    if (isLive()) ((FogRetained) this.retained).insertScope(scope, index);
    else ((FogRetained) this.retained).initInsertScope(scope, index);
  }
Esempio n. 22
0
File: Fog.java Progetto: miho/ExtJ3D
  /**
   * Sets the fog color to the specified color.
   *
   * @param r the red component of the fog color
   * @param g the green component of the fog color
   * @param b the blue component of the fog color
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   */
  public void setColor(float r, float g, float b) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_COLOR_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("Fog0"));

    if (isLive()) ((FogRetained) this.retained).setColor(r, g, b);
    else ((FogRetained) this.retained).initColor(r, g, b);
  }
Esempio n. 23
0
  /**
   * Copies all NodeComponent information from <code>originalNode</code> into the current node. This
   * method is called from the <code>cloneNode</code> method which is, in turn, called by the <code>
   * cloneTree</code> method.
   *
   * <p>
   *
   * @param originalNode the original node to duplicate.
   * @param forceDuplicate when set to <code>true</code>, causes the <code>duplicateOnCloneTree
   *     </code> flag to be ignored. When <code>false</code>, the value of each node's <code>
   *     duplicateOnCloneTree</code> variable determines whether NodeComponent data is duplicated or
   *     copied.
   * @see Group#cloneNode
   * @see Node#duplicateNode
   * @see Node#cloneTree
   * @see NodeComponent#setDuplicateOnCloneTree
   */
  void duplicateAttributes(NodeComponent originalNode, boolean forceDuplicate) {

    if (forceDuplicate && originalNode.isCompiled()) {
      throw new RestrictedAccessException(J3dI18N.getString("NodeComponent1"));
    }

    super.duplicateSceneGraphObject(originalNode);
    setDuplicateOnCloneTree(originalNode.getDuplicateOnCloneTree());
  }
Esempio n. 24
0
  /**
   * Sets the destination blend function used in blended transparency and antialiasing operations.
   * The destination function specifies the factor that is multiplied by the destination color; this
   * value is added to the product of the source factor and the source color. The default
   * destination blend function is <code>BLEND_ONE_MINUS_SRC_ALPHA</code>.
   *
   * @param blendFunction the blend function to be used for the destination color, one of <code>
   *     BLEND_ZERO</code>, <code>BLEND_ONE</code>, <code>BLEND_SRC_ALPHA</code>, <code>
   *     BLEND_ONE_MINUS_SRC_ALPHA</code>, <code>BLEND_SRC_COLOR</code>, or <code>
   *     BLEND_ONE_MINUS_SRC_COLOR</code>.
   * @exception CapabilityNotSetException if appropriate capability is not set and this object is
   *     part of live or compiled scene graph
   * @exception IllegalArgumentException if <code>blendFunction</code> is a value other than one of
   *     the supported functions listed above.
   * @since Java 3D 1.2
   */
  public void setDstBlendFunction(int blendFunction) {
    if (isLiveOrCompiled())
      if (!this.getCapability(ALLOW_BLEND_FUNCTION_WRITE))
        throw new CapabilityNotSetException(J3dI18N.getString("TransparencyAttributes4"));

    switch (blendFunction) {
      case BLEND_ZERO:
      case BLEND_ONE:
      case BLEND_SRC_ALPHA:
      case BLEND_ONE_MINUS_SRC_ALPHA:
      case BLEND_SRC_COLOR:
      case BLEND_ONE_MINUS_SRC_COLOR:
        break;
      default:
        throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes8"));
    }

    if (isLive())
      ((TransparencyAttributesRetained) this.retained).setDstBlendFunction(blendFunction);
    else ((TransparencyAttributesRetained) this.retained).initDstBlendFunction(blendFunction);
  }
Esempio n. 25
0
  /** assign a name to this node when it is made live. */
  @Override
  void setLive(SetLiveState s) {

    super.doSetLive(s);

    if (inBackgroundGroup) {
      throw new IllegalSceneGraphException(J3dI18N.getString("LinkRetained0"));
    }

    if (nodeId == null) {
      nodeId = universe.getNodeId();
    }

    if (sharedGroup != null) {
      this.sharedGroup.parents.add(this);
      HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys);
      HashKey oldKeys[] = s.keys;
      s.keys = newKeys;
      s.inSharedGroup = true;
      if (visited) {
        throw new SceneGraphCycleException(J3dI18N.getString("LinkRetained1"));
      }
      visited = true;
      try {
        this.sharedGroup.setLive(s);
      } catch (SceneGraphCycleException e) {
        throw e;
      } finally {
        visited = false;
      }

      s.inSharedGroup = inSharedGroup;
      s.keys = oldKeys;

      localBounds.setWithLock(this.sharedGroup.localBounds);
    }

    super.markAsLive();
  }
Esempio n. 26
0
  /**
   * Construct TransparencyAttributes object with specified values.
   *
   * @param tMode the transparency mode
   * @param tVal the transparency value
   * @param srcBlendFunction the blend function to be used for the source color, one of <code>
   *     BLEND_ZERO</code>, <code>BLEND_ONE</code>, <code>BLEND_SRC_ALPHA</code>, <code>
   *     BLEND_ONE_MINUS_SRC_ALPHA</code>, <code>BLEND_DST_COLOR</code>, or <code>
   *     BLEND_ONE_MINUS_DST_COLOR</code>.
   * @param dstBlendFunction the blend function to be used for the destination color, one of <code>
   *     BLEND_ZERO</code>, <code>BLEND_ONE</code>, <code>BLEND_SRC_ALPHA</code>, <code>
   *     BLEND_ONE_MINUS_SRC_ALPHA</code>, <code>BLEND_SRC_COLOR</code>, or <code>
   *     BLEND_ONE_MINUS_SRC_COLOR</code>.
   * @exception IllegalArgumentException if <code>tMode</code> is a value other than <code>NONE
   *     </code>, <code>FASTEST</code>, <code>NICEST</code>, <code>SCREEN_DOOR</code>, or <code>
   *     BLENDED</code>
   * @exception IllegalArgumentException if <code>srcBlendFunction</code> or <code>dstBlendFunction
   *     </code> is a value other than one of the supported functions listed above.
   * @since Java 3D 1.2
   */
  public TransparencyAttributes(int tMode, float tVal, int srcBlendFunction, int dstBlendFunction) {
    if ((tMode < FASTEST) || (tMode > NONE)) {
      throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes6"));
    }

    switch (srcBlendFunction) {
      case BLEND_ZERO:
      case BLEND_ONE:
      case BLEND_SRC_ALPHA:
      case BLEND_ONE_MINUS_SRC_ALPHA:
      case BLEND_DST_COLOR:
      case BLEND_ONE_MINUS_DST_COLOR:
        break;
      default:
        throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes7"));
    }

    switch (dstBlendFunction) {
      case BLEND_ZERO:
      case BLEND_ONE:
      case BLEND_SRC_ALPHA:
      case BLEND_ONE_MINUS_SRC_ALPHA:
      case BLEND_SRC_COLOR:
      case BLEND_ONE_MINUS_SRC_COLOR:
        break;
      default:
        throw new IllegalArgumentException(J3dI18N.getString("TransparencyAttributes8"));
    }

    // set default read capabilities
    setDefaultReadCapabilities(readCapabilities);

    ((TransparencyAttributesRetained) this.retained).initTransparencyMode(tMode);
    ((TransparencyAttributesRetained) this.retained).initTransparency(tVal);
    ((TransparencyAttributesRetained) this.retained).initSrcBlendFunction(srcBlendFunction);
    ((TransparencyAttributesRetained) this.retained).initDstBlendFunction(dstBlendFunction);
  }
Esempio n. 27
0
  /**
   * Sets the SharedGroup reference.
   *
   * @param sharedGroup the SharedGroup node
   */
  void setSharedGroup(SharedGroup sharedGroup) {
    // Note that it is possible that the sharedGroup pass
    // in already link to another link and live.
    HashKey newKeys[] = null;
    boolean abort = false;

    if (source.isLive()) {
      // bug 4370407: if sharedGroup is a parent, then don't do anything
      if (sharedGroup != null) {
        synchronized (universe.sceneGraphLock) {
          NodeRetained pa;
          for (pa = parent; pa != null; pa = pa.parent) {
            if (pa == (NodeRetained) sharedGroup.retained) {
              abort = true;
              throw new SceneGraphCycleException(J3dI18N.getString("LinkRetained1"));
            }
          }
        }
        if (abort) return;
      }

      newKeys = getNewKeys(locale.nodeId, localToVworldKeys);

      if (this.sharedGroup != null) {
        ((GroupRetained) parent).checkClearLive(this.sharedGroup, newKeys, true, null, 0, 0, this);
        this.sharedGroup.parents.remove(this);
      }
    }

    if (sharedGroup != null) {
      this.sharedGroup = (SharedGroupRetained) sharedGroup.retained;
    } else {
      this.sharedGroup = null;
    }

    if (source.isLive() && (sharedGroup != null)) {

      this.sharedGroup.parents.add(this);
      visited = true;
      try {
        int ci = ((GroupRetained) parent).indexOfChild((Node) this.sharedGroup.source);
        ((GroupRetained) parent).checkSetLive(this.sharedGroup, ci, newKeys, true, null, 0, this);
      } catch (SceneGraphCycleException e) {
        throw e;
      } finally {
        visited = false;
      }
    }
  }
  void setLive(SetLiveState s) {
    if (inBackgroundGroup) {
      throw new IllegalSceneGraphException(J3dI18N.getString("ViewSpecificGroup3"));
    }

    s.inViewSpecificGroup = true;
    ArrayList savedViewList = s.viewLists;
    if (s.changedViewGroup == null) {
      s.changedViewGroup = new ArrayList();
      s.changedViewList = new ArrayList();
      s.keyList = new int[10];
      s.viewScopedNodeList = new ArrayList();
      s.scopedNodesViewList = new ArrayList();
    }
    super.setLive(s);
    s.viewLists = savedViewList;
  }
  /**
   * Sets the transform component of this TransformGroup to the value of the passed transform.
   *
   * @param t1 the transform to be copied
   */
  void setTransform(Transform3D t1) {
    J3dMessage tchangeMessage = null;
    int i, j;
    Transform3D trans = null;

    if (staticTransform != null) {
      // this writeable transformGroup has a static transform
      // merged into this node

      trans = new Transform3D(staticTransform.transform);
      trans.mul(t1);

      transform.setWithLock(trans);

    } else {
      trans = new Transform3D(t1);
      transform.setWithLock(t1);
    }

    if (transformChange != null) {
      notifyConditions();
    }

    if (source.isLive()) {

      if (aboveAViewPlatform && !t1.isCongruent()) {
        throw new BadTransformException(J3dI18N.getString("ViewPlatformRetained0"));
      }

      tchangeMessage = new J3dMessage();
      tchangeMessage.type = J3dMessage.TRANSFORM_CHANGED;
      tchangeMessage.threads = targetThreads;
      tchangeMessage.args[1] = this;
      tchangeMessage.args[2] = trans;

      tchangeMessage.universe = universe;
      // System.err.println("TransformGroupRetained --- TRANSFORM_CHANGED " + this);
      VirtualUniverse.mc.processMessage(tchangeMessage);
    }
    dirtyBoundsCache();
  }
Esempio n. 30
0
 /**
  * Sets the values of all buttons for this SensorRead object.
  *
  * @param values array contining the new buttons for this SensorRead
  * @exception ArrayIndexOutOfBoundsException if this object has 0 buttons or if values.length is
  *     less than the number of buttons in this object.
  */
 public void setButtons(int[] values) {
   if (numButtons == 0) throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("SensorRead1"));
   else if (values.length < numButtons)
     throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("SensorRead0"));
   System.arraycopy(values, 0, buttonValues, 0, numButtons);
 }