protected Shape3D createPointShape(Java3DParticlesGeometry pointShape) {
   int pointSize = 3;
   Appearance app = new Appearance();
   app.setCapability(app.ALLOW_POINT_ATTRIBUTES_READ);
   app.setCapability(app.ALLOW_POINT_ATTRIBUTES_WRITE);
   PointAttributes pattrib = new PointAttributes();
   pattrib.setPointSize(pointSize);
   app.setPointAttributes(pattrib);
   Shape3D pShape = new Shape3D(pointShape, app);
   pShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
   pShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
   return pShape;
 }
Example #2
0
  @Override
  protected Appearance createAppearance() {
    final Appearance appearance = new Appearance();
    appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
    appearance.setCapability(Appearance.ALLOW_LINE_ATTRIBUTES_READ);

    final PointAttributes pointAttrib = new PointAttributes();
    pointAttrib.setCapability(PointAttributes.ALLOW_ANTIALIASING_WRITE);
    pointAttrib.setCapability(PointAttributes.ALLOW_SIZE_WRITE);
    pointAttrib.setPointSize(pointsize);
    appearance.setPointAttributes(pointAttrib);

    final PolygonAttributes polyAttrib = new PolygonAttributes();
    polyAttrib.setCapability(PolygonAttributes.ALLOW_MODE_WRITE);
    polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_FILL);
    polyAttrib.setCullFace(PolygonAttributes.CULL_BACK);
    polyAttrib.setBackFaceNormalFlip(false);
    appearance.setPolygonAttributes(polyAttrib);

    final ColoringAttributes colorAttrib = new ColoringAttributes();
    colorAttrib.setShadeModel(ColoringAttributes.SHADE_GOURAUD);
    colorAttrib.setColor(color);
    appearance.setColoringAttributes(colorAttrib);

    final TransparencyAttributes tr = new TransparencyAttributes();
    final int mode =
        transparency == 0f ? TransparencyAttributes.NONE : TransparencyAttributes.FASTEST;
    tr.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
    tr.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
    tr.setTransparencyMode(mode);
    tr.setTransparency(transparency);
    appearance.setTransparencyAttributes(tr);

    final Material material = new Material();
    material.setCapability(Material.ALLOW_COMPONENT_WRITE);
    material.setAmbientColor(0.1f, 0.1f, 0.1f);
    material.setSpecularColor(0.1f, 0.1f, 0.1f);
    material.setDiffuseColor(0.1f, 0.1f, 0.1f);
    appearance.setMaterial(material);
    return appearance;
  }