protected void writeConstructorParams(DataOutput out) throws IOException {
   super.writeConstructorParams(out);
   out.writeInt(((ImageComponent) node).getFormat());
   out.writeInt(((ImageComponent) node).getHeight());
   out.writeInt(((ImageComponent) node).getWidth());
   out.writeBoolean(((ImageComponent) node).isByReference());
   out.writeBoolean(((ImageComponent) node).isYUp());
 }
 protected void readConstructorParams(DataInput in) throws IOException {
   super.readConstructorParams(in);
   format = in.readInt();
   height = in.readInt();
   width = in.readInt();
   byReference = in.readBoolean();
   yUp = in.readBoolean();
 }
Example #3
0
 public void writeConstructorParams(DataOutput out) throws IOException {
   super.writeConstructorParams(out);
   out.writeInt(((Texture) node).getMipMapMode());
   out.writeInt(((Texture) node).getWidth());
   out.writeInt(((Texture) node).getHeight());
   out.writeInt(((Texture) node).getFormat());
   out.writeInt(((Texture) node).getBoundaryWidth());
 }
Example #4
0
  @Override
  public void writeConstructorParams(DataOutput out) throws IOException {
    super.writeConstructorParams(out);

    // issue 483: init the node
    Font3D font3D = (Font3D) node;
    font = font3D.getFont();

    out.writeUTF(font.getFontName());
    out.writeInt(font.getStyle());
    out.writeInt(font.getSize());
    out.writeDouble(font3D.getTessellationTolerance());

    // issue 483
    extrudePath = new FontExtrusion();
    font3D.getFontExtrusion(extrudePath);
    if (extrudePath.getExtrusionShape() == null) {
      extrudePath = null;
    }

    if (extrudePath != null) {
      Shape shape = extrudePath.getExtrusionShape();
      if (shape != null) {
        PathIterator shapePath = shape.getPathIterator(null);
        float[] coords = new float[6];
        int segType;
        int points;
        while (!(shapePath.isDone())) {
          // Get type of current path segment and associated
          // coordinates
          segType = shapePath.currentSegment(coords);
          out.writeInt(segType);

          // Write out relevant coordinates
          points = 0;
          if (segType == PathIterator.SEG_MOVETO) points = 1;
          else if (segType == PathIterator.SEG_LINETO) points = 1;
          else if (segType == PathIterator.SEG_QUADTO) points = 2;
          else if (segType == PathIterator.SEG_CUBICTO) points = 3;

          for (int i = 0; i < points; i++) {
            out.writeFloat(coords[i * 2 + 0]);
            out.writeFloat(coords[i * 2 + 1]);
          }

          // Next segment
          if (!(shapePath.isDone())) shapePath.next();
        }
      }
      // Flag for end of path definition
      out.writeInt(Integer.MIN_VALUE);
      out.writeDouble(extrudePath.getTessellationTolerance());

    } else {
      out.writeInt(Integer.MIN_VALUE);
    }
  }
Example #5
0
  public void readConstructorParams(DataInput in) throws IOException {
    super.readConstructorParams(in);

    mipMapMode = in.readInt();
    width = in.readInt();
    height = in.readInt();
    format = in.readInt();
    boundaryWidth = in.readInt();
  }
Example #6
0
  public void buildGraph() {
    if (!(node instanceof TextureCubeMap)) {
      for (int i = 0; i < imageComponents.length; i++) {
        ((Texture) node)
            .setImage(i, (ImageComponent) control.getSymbolTable().getJ3dNode(imageComponents[i]));
      }
    }

    super.buildGraph(); // Must be last call in method
  }
Example #7
0
  public void readObject(DataInput in) throws IOException {
    super.readObject(in);
    Texture attr = (Texture) node;
    attr.setBoundaryColor(control.readColor4f(in));
    attr.setBoundaryModeS(in.readInt());
    attr.setBoundaryModeT(in.readInt());
    attr.setEnable(in.readBoolean());

    imageComponents = new int[in.readInt()];
    for (int i = 0; i < imageComponents.length; i++) imageComponents[i] = in.readInt();

    int mag = in.readInt();
    try {
      attr.setMagFilter(mag);
    } catch (IllegalArgumentException e) {
      // The OpenFLT loader sets erroneous values for
      // mag filter which will cause an exception with
      // Java3D 1.3, handle this gracefully....
      if (mag == Texture.MULTI_LEVEL_LINEAR) attr.setMagFilter(Texture.BASE_LEVEL_LINEAR);
      else if (mag == Texture.MULTI_LEVEL_POINT) attr.setMagFilter(Texture.BASE_LEVEL_POINT);
      else attr.setMagFilter(Texture.FASTEST);
    }

    attr.setMinFilter(in.readInt());

    attr.setBaseLevel(in.readInt());
    attr.setMaximumLevel(in.readInt());
    attr.setMinimumLOD(in.readFloat());
    attr.setMaximumLOD(in.readFloat());
    attr.setLodOffset(control.readPoint3f(in));
    attr.setAnisotropicFilterMode(in.readInt());
    attr.setAnisotropicFilterDegree(in.readFloat());

    int points = in.readInt();
    if (points > 0) {
      float[] lod = new float[points];
      float[] pts = new float[points];
      for (int i = 0; i < points; i++) {
        lod[i] = in.readFloat();
        pts[i] = in.readFloat();
      }
      attr.setSharpenTextureFunc(lod, pts);
    }

    points = in.readInt();
    if (points >= 4) {
      float[] weights = new float[points];
      for (int i = 0; i < points; i++) {
        weights[i] = in.readFloat();
      }
      attr.setFilter4Func(weights);
    }
  }
Example #8
0
  public void writeObject(DataOutput out) throws IOException {
    super.writeObject(out);
    Texture attr = (Texture) node;
    Color4f clr = new Color4f();
    attr.getBoundaryColor(clr);
    control.writeColor4f(out, clr);
    out.writeInt(attr.getBoundaryModeS());
    out.writeInt(attr.getBoundaryModeT());
    out.writeBoolean(attr.getEnable());

    out.writeInt(imageComponents.length);
    for (int i = 0; i < imageComponents.length; i++) out.writeInt(imageComponents[i]);

    out.writeInt(attr.getMagFilter());
    out.writeInt(attr.getMinFilter());
    out.writeInt(attr.getBaseLevel());
    out.writeInt(attr.getMaximumLevel());
    out.writeFloat(attr.getMinimumLOD());
    out.writeFloat(attr.getMaximumLOD());

    Point3f lodOffset = new Point3f();
    attr.getLodOffset(lodOffset);
    control.writePoint3f(out, lodOffset);

    out.writeInt(attr.getAnisotropicFilterMode());
    out.writeFloat(attr.getAnisotropicFilterDegree());

    int points = attr.getSharpenTextureFuncPointsCount();
    out.writeInt(points);
    if (points > 0) {
      float[] lod = new float[points];
      float[] pts = new float[points];
      attr.getSharpenTextureFunc(lod, pts);
      for (int i = 0; i < points; i++) {
        out.writeFloat(lod[i]);
        out.writeFloat(pts[i]);
      }
    }

    points = attr.getFilter4FuncPointsCount();
    out.writeInt(points);
    if (points >= 4) {
      float[] weights = new float[points];
      attr.getFilter4Func(weights);
      for (int i = 0; i < points; i++) {
        out.writeFloat(weights[i]);
      }
    }
  }
Example #9
0
  @Override
  public void readConstructorParams(DataInput in) throws IOException {
    super.readConstructorParams(in);

    String fontName = in.readUTF();
    int style = in.readInt();
    int size = in.readInt();
    font = new Font(fontName, style, size);

    tesselationTolerance = in.readDouble();

    GeneralPath shape = null;
    int segType = in.readInt();
    while (segType != Integer.MIN_VALUE) {
      if (shape == null) shape = new GeneralPath();

      if (segType == PathIterator.SEG_MOVETO) {
        shape.moveTo(in.readFloat(), in.readFloat());
      } else if (segType == PathIterator.SEG_LINETO) {
        shape.lineTo(in.readFloat(), in.readFloat());
      } else if (segType == PathIterator.SEG_QUADTO) {
        shape.quadTo(in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat());
      } else if (segType == PathIterator.SEG_CUBICTO) {
        shape.curveTo(
            in.readFloat(),
            in.readFloat(),
            in.readFloat(),
            in.readFloat(),
            in.readFloat(),
            in.readFloat());
      } else if (segType == PathIterator.SEG_CLOSE) {
        shape.closePath();
      }

      segType = in.readInt();
    }
    if (shape != null) extrudePath = new FontExtrusion(shape, in.readDouble());
    else extrudePath = null;
  }