/**
  * Return the enabled boolean value.
  *
  * @return The enabled boolean value.
  */
 public boolean getEnabled() {
   if (enabled == null) {
     enabled = (SFBool) getField("enabled");
   }
   return (enabled.getValue());
 }
 /**
  * Set the enabled field.
  *
  * @param val The boolean to set.
  */
 public void setEnabled(boolean val) {
   if (enabled == null) {
     enabled = (SFBool) getField("enabled");
   }
   enabled.setValue(val);
 }
Пример #3
0
 /**
  * Return the isActive boolean value.
  *
  * @return The isActive boolean value.
  */
 public boolean getIsActive() {
   if (isActive == null) {
     isActive = (SFBool) getField("isActive");
   }
   return (isActive.getValue());
 }
Пример #4
0
  /**
   * Create geometry for horizontal segments
   *
   * @param offset Should we offset vertically
   * @param offsetField A full SFVec3f that we only use the height off for offset
   */
  private X3DNode[] createSegmentGeom(
      X3DExecutionContext mainScene,
      X3DNode appearance,
      MFInt32 geomIndicesField,
      MFNode geometryField,
      MFFloat heightField,
      MFVec3f startField,
      MFVec3f endField,
      boolean offset,
      MFFloat offsetField,
      int vertices,
      int shapesToCreate,
      int panelsPerShape,
      boolean sRepeatPerMeter,
      boolean tRepeatPerMeter,
      float sMeterMult,
      float tMeterMult) {

    float[] post_coord;
    float[] post_normal;
    float[] post_texCoord;
    int[] post_index;
    X3DNode[] ret_val = new X3DNode[shapesToCreate];
    int shape_idx = 0;
    float[] start = new float[3];
    float[] end = new float[3];
    int num = 0;

    float sRepeat;
    float tRepeat;

    for (int n = 0; n < shapesToCreate; n++) {

      int[] index = new int[2 * 3 * vertices];
      float[] point = new float[4 * 3 * vertices];
      float[] tc = new float[4 * 2 * vertices];
      int iidx = 0;
      int pidx = 0;
      int tidx = 0;
      float height;
      float offsetVal = 0;

      // Panel Shape
      X3DNode panel_shape = mainScene.createNode("Shape");
      SFNode shape_appearance = (SFNode) (panel_shape.getField("appearance"));
      shape_appearance.setValue(appearance);

      SFNode shape_geometry = (SFNode) (panel_shape.getField("geometry"));
      X3DNode its = mainScene.createNode("IndexedTriangleSet");
      SFBool its_solid = (SFBool) its.getField("solid");
      its_solid.setValue(false);

      X3DNode coord = mainScene.createNode("Coordinate");
      SFNode its_coord = (SFNode) (its.getField("coord"));
      MFVec3f point_field = (MFVec3f) coord.getField("point");
      X3DNode normal = mainScene.createNode("Normal");
      SFNode its_normal = (SFNode) (its.getField("normal"));
      X3DNode texcoord = mainScene.createNode("TextureCoordinate");
      SFNode its_texcoord = (SFNode) (its.getField("texCoord"));
      MFVec2f tcpoint_field = (MFVec2f) texcoord.getField("point");
      MFInt32 its_index = (MFInt32) (its.getField("index"));

      for (int i = 0; i < panelsPerShape; i++) {

        startField.get1Value(num, start);
        endField.get1Value(num, end);
        height = heightField.get1Value(num);

        if (sRepeatPerMeter) {
          // calculate the length of the panel from start to end
          float x_delta = end[0] - start[0];
          float y_delta = end[1] - start[1];
          float z_delta = end[2] - start[2];
          float length =
              (float) Math.sqrt(x_delta * x_delta + y_delta * y_delta + z_delta * z_delta);
          // the s repeat factor is the length, in meters
          sRepeat = length * sMeterMult;
        } else {
          // the s repeat factor is 1 per panel
          sRepeat = 1.0f;
        }

        if (tRepeatPerMeter) {
          // the t repeat factor is the height, in meters
          tRepeat = height * tMeterMult;
        } else {
          // the t repeat factor is 1 per panel
          tRepeat = 1.0f;
        }
        // System.out.println( "sRepeat = "+ sRepeat +", tRepeat = "+ tRepeat );
        if (offset) {
          offsetVal = offsetField.get1Value(num);
        }

        num++;

        index[iidx++] = i * 4;
        index[iidx++] = i * 4 + 1;
        index[iidx++] = i * 4 + 2;
        index[iidx++] = i * 4 + 1;
        index[iidx++] = i * 4 + 3;
        index[iidx++] = i * 4 + 2;

        point[pidx++] = start[0];
        point[pidx++] = offsetVal + height + start[1];
        point[pidx++] = start[2];

        point[pidx++] = start[0];
        point[pidx++] = offsetVal + 0 + start[1];
        point[pidx++] = start[2];

        point[pidx++] = end[0];
        point[pidx++] = offsetVal + height + end[1];
        point[pidx++] = end[2];

        point[pidx++] = end[0];
        point[pidx++] = offsetVal + 0 + end[1];
        point[pidx++] = end[2];

        tc[tidx++] = 0;
        tc[tidx++] = 0;
        tc[tidx++] = 0;
        tc[tidx++] = tRepeat;
        tc[tidx++] = sRepeat;
        tc[tidx++] = 0;
        tc[tidx++] = sRepeat;
        tc[tidx++] = tRepeat;
      }

      // System.out.println("Points: " + java.util.Arrays.toString(point));
      // System.out.println("Index: " + java.util.Arrays.toString(index));
      // System.out.println("TexCoord: " + java.util.Arrays.toString(tc));

      if (CREATE_PANELS) {
        point_field.setValue(point.length / 3, point);
        tcpoint_field.setValue(tc.length / 2, tc);
        its_coord.setValue(coord);
        its_texcoord.setValue(texcoord);
        its_index.setValue(index.length, index);

        shape_geometry.setValue(its);
      }

      // System.out.println("Placing panel at: " + shape_idx);

      ret_val[shape_idx++] = panel_shape;
    }

    return ret_val;
  }
Пример #5
0
 /**
  * Return the altKey boolean value.
  *
  * @return The altKey boolean value.
  */
 public boolean getAltKey() {
   if (altKey == null) {
     altKey = (SFBool) getField("altKey");
   }
   return (altKey.getValue());
 }
Пример #6
0
 /**
  * Return the controlKey boolean value.
  *
  * @return The controlKey boolean value.
  */
 public boolean getControlKey() {
   if (controlKey == null) {
     controlKey = (SFBool) getField("controlKey");
   }
   return (controlKey.getValue());
 }
Пример #7
0
 /**
  * Return the shiftKey boolean value.
  *
  * @return The shiftKey boolean value.
  */
 public boolean getShiftKey() {
   if (shiftKey == null) {
     shiftKey = (SFBool) getField("shiftKey");
   }
   return (shiftKey.getValue());
 }
 /**
  * Set the set_bind field.
  *
  * @param val The boolean to set.
  */
 public void setBind(boolean val) {
   if (set_bind == null) {
     set_bind = (SFBool) getField("set_bind");
   }
   set_bind.setValue(val);
 }
 /**
  * Return the isBound boolean value.
  *
  * @return The isBound boolean value.
  */
 public boolean getIsBound() {
   if (isBound == null) {
     isBound = (SFBool) getField("isBound");
   }
   return (isBound.getValue());
 }