/**
   * Send a routed value from this node to the given destination node. The route should use the
   * appropriate setValue() method of the destination node. It should not attempt to cast the node
   * up to a higher level. Routing should also follow the standard rules for the loop breaking and
   * other appropriate rules for the specification.
   *
   * @param time The time that this route occurred (not necessarily epoch time. Should be treated as
   *     a relative value only)
   * @param srcIndex The index of the field in this node that the value should be sent from
   * @param destNode The node reference that we will be sending the value to
   * @param destIndex The index of the field in the destination node that the value should be sent
   *     to.
   */
  public void sendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) {

    // Simple impl for now.  ignores time and looping. Note that for a
    // couple of the fields, if the array size is greater than the number
    // of components in it, we create a temporary array to send. This is
    // a negative hit, but it is very rare that someone will route out of
    // these fields, so we don't consider it to be a major impact compared
    // to the performance of having to reallocate the arrays every time
    // someone sets the values, which will happen much, much more often.

    try {
      switch (srcIndex) {
        case FIELD_BOUNDARY_COLOR:
          destNode.setValue(destIndex, vfBoundaryColor, 4);
          break;

        case FIELD_BOUNDARY_WIDTH:
          destNode.setValue(destIndex, vfBoundaryWidth);
          break;

        case FIELD_BOUNDARY_MODE_S:
          destNode.setValue(destIndex, vfBoundaryModeS);
          break;

        case FIELD_BOUNDARY_MODE_T:
          destNode.setValue(destIndex, vfBoundaryModeT);
          break;

        case FIELD_MAGNIFICATION_FILTER:
          destNode.setValue(destIndex, vfMagnificationFilter);
          break;

        case FIELD_MINIFICATION_FILTER:
          destNode.setValue(destIndex, vfMinificationFilter);
          break;

        case FIELD_GENERATE_MIPMAPS:
          destNode.setValue(destIndex, vfGenerateMipMaps);
          break;

        case FIELD_ANISOTROPIC_MODE:
          destNode.setValue(destIndex, vfAnisotropicMode);
          break;

        case FIELD_ANISOTROPIC_FILTER_DEGREE:
          destNode.setValue(destIndex, vfAnisotropicFilterDegree);
          break;

        default:
          super.sendRoute(time, srcIndex, destNode, destIndex);
      }
    } catch (InvalidFieldException ife) {
      System.err.println("sendRoute: No field!" + ife.getFieldName());
    } catch (InvalidFieldValueException ifve) {
      System.err.println("sendRoute: Invalid field Value: " + ifve.getMessage());
    }
  }
예제 #2
0
  /**
   * Send a routed value from this node to the given destination node. The route should use the
   * appropriate setValue() method of the destination node. It should not attempt to cast the node
   * up to a higher level. Routing should also follow the standard rules for the loop breaking and
   * other appropriate rules for the specification.
   *
   * @param time The time that this route occurred (not necessarily epoch time. Should be treated as
   *     a relative value only)
   * @param srcIndex The index of the field in this node that the value should be sent from
   * @param destNode The node reference that we will be sending the value to
   * @param destIndex The index of the field in the destination node that the value should be sent
   *     to.
   */
  public void sendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) {

    // Simple impl for now.  ignores time and looping

    try {
      switch (srcIndex) {
        case FIELD_NAME:
          destNode.setValue(destIndex, vfName);
          break;
        case FIELD_SHAPE:
          if (pShape != null) destNode.setValue(destIndex, pShape);
          else destNode.setValue(destIndex, vfShape);
          break;

        default:
          super.sendRoute(time, srcIndex, destNode, destIndex);
      }
    } catch (InvalidFieldException ife) {
      System.err.println("sendRoute: No field!" + ife.getFieldName());
    } catch (InvalidFieldValueException ifve) {
      System.err.println("sendRoute: Invalid fieldValue: " + ifve.getMessage());
    }
  }