Example #1
0
  @Override
  public void copyObject(Object3D obj) {
    if (!(obj instanceof Blob)) return;

    Blob o = (Blob) obj;

    charges = new ArrayList<Charge>(o.charges);

    cachedBounds = null;
    cachedWire = null;

    for (int i = 0; i < PROPERTIES.length; i++) setPropertyValue(i, o.getPropertyValue(i));
  }
Example #2
0
  public Blob(DataInputStream in, Scene theScene) throws IOException, InvalidObjectException {
    super(in, theScene);

    int version = in.readInt();
    if (version != VERSION) {
      throw new InvalidObjectException("Unsupported object version: " + version);
    }

    // Hardness.
    setPropertyValue(0, in.readDouble());

    // setNamePositive.
    int len = in.readInt();
    byte[] str = new byte[len];
    in.readFully(str);
    setPropertyValue(1, new String(str));

    // setNameNegative.
    len = in.readInt();
    str = new byte[len];
    in.readFully(str);
    setPropertyValue(2, new String(str));
  }