示例#1
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
  }
示例#2
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]);
      }
    }
  }
示例#3
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);
    }
  }
示例#4
0
 /** @param bsas */
 public DummyTextureSource() {
   im = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
   tex = new Texture2D(Texture.BASE_LEVEL, Texture.RGB, im.getWidth(), im.getHeight());
   tex.setImage(0, new ImageComponent2D(ImageComponent.FORMAT_RGB, im));
 }