コード例 #1
0
  /**
   * Copies all of the field values from the passed nodes into our own node.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException The node is not a compatible node
   */
  public void copy(VRMLNodeType node) {
    checkNodeType(node);

    try {
      int index;
      VRMLFieldData field;

      super.copy((VRMLTimeControlledNodeType) node);

      index = node.getFieldIndex("loop");
      field = node.getFieldValue(index);
      setLoop(field.booleanValue);

      index = node.getFieldIndex("repeatS");
      field = node.getFieldValue(index);
      vfRepeatS = field.booleanValue;

      index = node.getFieldIndex("repeatT");
      field = node.getFieldValue(index);
      vfRepeatT = field.booleanValue;

      index = node.getFieldIndex("speed");
      field = node.getFieldValue(index);
      setSpeed(field.floatValue);

      index = node.getFieldIndex("url");
      field = node.getFieldValue(index);
      setUrl(field.stringArrayValue, field.numElements);

    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #2
0
  /**
   * Set the fields of the sensor node that has the fields set based on the fields of the passed in
   * node. This will not copy any children nodes, only the local fields.
   *
   * @param node The sensor node to copy info from
   */
  protected void copy(VRMLPickingSensorNodeType node) {

    super.copy(node);

    try {
      int index = node.getFieldIndex("sortOrder");
      VRMLFieldData field = node.getFieldValue(index);
      vfSortOrder = field.stringValue;

      Integer i = (Integer) sortTypeMap.get(vfSortOrder);
      sortType = i.intValue();

      index = node.getFieldIndex("sortOrder");
      field = node.getFieldValue(index);
      vfIntersectionType = field.stringValue;

      i = (Integer) sortTypeMap.get(vfIntersectionType);
      intersectionType = i.intValue();

      index = node.getFieldIndex("objectType");
      field = node.getFieldValue(index);

      if (field.numElements != 0) {
        vfObjectType = new String[field.numElements];
        System.arraycopy(field.stringArrayValue, 0, vfObjectType, 0, field.numElements);
      }

    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #3
0
  /**
   * Construct a new instance of this node based on the details from the given node. If the node is
   * not the same type, an exception will be thrown.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException Incorrect Node Type
   */
  protected BaseTextureProperties(VRMLNodeType node) {
    this();

    checkNodeType(node);

    try {
      int index = node.getFieldIndex("boundaryColor");
      VRMLFieldData field = node.getFieldValue(index);

      vfBoundaryColor[0] = field.floatArrayValue[0];
      vfBoundaryColor[1] = field.floatArrayValue[1];
      vfBoundaryColor[2] = field.floatArrayValue[2];
      vfBoundaryColor[3] = field.floatArrayValue[3];

      index = node.getFieldIndex("boundaryWidth");
      field = node.getFieldValue(index);
      vfBoundaryWidth = field.intValue;

      index = node.getFieldIndex("boundaryModeS");
      field = node.getFieldValue(index);
      vfBoundaryModeS = field.stringValue;

      index = node.getFieldIndex("boundaryModeT");
      field = node.getFieldValue(index);
      vfBoundaryModeT = field.stringValue;

      index = node.getFieldIndex("minificationFilter");
      field = node.getFieldValue(index);
      vfMinificationFilter = field.stringValue;

      index = node.getFieldIndex("maxificationFilter");
      field = node.getFieldValue(index);
      vfMinificationFilter = field.stringValue;

      index = node.getFieldIndex("generateMipMaps");
      field = node.getFieldValue(index);
      vfGenerateMipMaps = field.booleanValue;

      index = node.getFieldIndex("anisotropicMode");
      field = node.getFieldValue(index);
      vfAnisotropicMode = field.stringValue;

      index = node.getFieldIndex("anisotropicFilterDegree");
      field = node.getFieldValue(index);
      vfAnisotropicFilterDegree = field.floatValue;

    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #4
0
  /**
   * Construct a new instance of this node based on the details from the given node. If the node is
   * not a group node, an exception will be thrown. It does not copy the children nodes, just this
   * node.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException The node is not a Group node
   */
  public J3DTransform(VRMLNodeType node) {
    this();

    checkNodeType(node);

    copy((VRMLGroupingNodeType) node);

    try {
      int index = node.getFieldIndex("center");
      VRMLFieldData field = node.getFieldValue(index);

      vfCenter[0] = field.floatArrayValue[0];
      vfCenter[1] = field.floatArrayValue[1];
      vfCenter[2] = field.floatArrayValue[2];

      index = node.getFieldIndex("rotation");
      field = node.getFieldValue(index);

      vfRotation[0] = field.floatArrayValue[0];
      vfRotation[1] = field.floatArrayValue[1];
      vfRotation[2] = field.floatArrayValue[2];
      vfRotation[3] = field.floatArrayValue[3];

      index = node.getFieldIndex("scale");
      field = node.getFieldValue(index);

      vfScale[0] = field.floatArrayValue[0];
      vfScale[1] = field.floatArrayValue[1];
      vfScale[2] = field.floatArrayValue[2];

      index = node.getFieldIndex("scaleOrientation");
      field = node.getFieldValue(index);

      vfScaleOrientation[0] = field.floatArrayValue[0];
      vfScaleOrientation[1] = field.floatArrayValue[1];
      vfScaleOrientation[2] = field.floatArrayValue[2];
      vfScaleOrientation[3] = field.floatArrayValue[3];

      index = node.getFieldIndex("translation");
      field = node.getFieldValue(index);

      vfTranslation[0] = field.floatArrayValue[0];
      vfTranslation[1] = field.floatArrayValue[1];
      vfTranslation[2] = field.floatArrayValue[2];
    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #5
0
  /**
   * Construct a new instance of this node based on the details from the given node. If the node is
   * not a group node, an exception will be thrown.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException The node is not a Group node
   */
  public BaseCADFace(VRMLNodeType node) {
    this();

    checkNodeType(node);

    try {

      int index = node.getFieldIndex("name");
      VRMLFieldData field = node.getFieldValue(index);

      field = node.getFieldValue(index);
      vfName = field.stringValue;
    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #6
0
  /**
   * Construct a new instance of this node based on the details from the given node. If the node is
   * not the same type, an exception will be thrown.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException The node is not the same type
   */
  public BaseSphereSensor(VRMLNodeType node) {
    this();

    checkNodeType(node);

    copy((VRMLDragSensorNodeType) node);

    try {
      int index = node.getFieldIndex("offset");
      VRMLFieldData field = node.getFieldValue(index);

      vfOffset[0] = field.floatArrayValue[0];
      vfOffset[1] = field.floatArrayValue[1];
      vfOffset[2] = field.floatArrayValue[2];
      vfOffset[3] = field.floatArrayValue[3];

    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }
コード例 #7
0
  /**
   * Construct a new instance of this node based on the details from the given node. If the node is
   * not the same type, an exception will be thrown.
   *
   * @param node The node to copy
   * @throws IllegalArgumentException Incorrect Node Type
   */
  protected BaseMultiTexture(VRMLNodeType node) {
    this();

    checkNodeType(node);

    try {
      int index = node.getFieldIndex("mode");
      VRMLFieldData field = node.getFieldValue(index);
      if (field.numElements != 0) {
        vfMode = new String[field.numElements];
        System.arraycopy(field.stringArrayValue, 0, vfMode, 0, field.numElements);
      }

      index = node.getFieldIndex("function");
      field = node.getFieldValue(index);
      if (field.numElements != 0) {
        vfFunction = new String[field.numElements];
        System.arraycopy(field.stringArrayValue, 0, vfFunction, 0, field.numElements);
      }

      index = node.getFieldIndex("source");
      field = node.getFieldValue(index);
      if (field.numElements != 0) {
        vfSource = new String[field.numElements];
        System.arraycopy(field.stringArrayValue, 0, vfSource, 0, field.numElements);
      }

      index = node.getFieldIndex("color");
      field = node.getFieldValue(index);
      vfColor[0] = field.floatArrayValue[0];
      vfColor[1] = field.floatArrayValue[1];
      vfColor[2] = field.floatArrayValue[2];

      index = node.getFieldIndex("alpha");
      field = node.getFieldValue(index);
      vfAlpha = field.floatValue;

    } catch (VRMLException ve) {
      throw new IllegalArgumentException(ve.getMessage());
    }
  }