Package javax.media.j3d

Examples of javax.media.j3d.TransparencyAttributes


        @Override
        public void setPropertyValue(Integer value) {
            if(_object.getTransparencyAttributes()==null){
                boolean forced2=forceCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
                _object.setTransparencyAttributes(new TransparencyAttributes());
                if(forced2) restoreCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
            }
            boolean forced = forceCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
            _object.getTransparencyAttributes().setTransparencyMode(value);
            if (forced)
View Full Code Here


        @Override
        public void setPropertyValue(Float value) {
            if(_object.getTransparencyAttributes()==null){
                boolean forced2=forceCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
                _object.setTransparencyAttributes(new TransparencyAttributes());
                if(forced2) restoreCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
            }
            boolean forced=forceCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
            _object.getTransparencyAttributes().setTransparency(value);
            if(forced) restoreCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
View Full Code Here

          float transparency = parseNumber(tokenizer);
          if (currentAppearance != null) {
            if (transparency >= 1) {
              currentAppearance.setTransparencyAttributes(null);
            } else {
              currentAppearance.setTransparencyAttributes(new TransparencyAttributes(
                  TransparencyAttributes.NICEST, 1f - Math.max(0f, transparency)));
            }
          }
        }
      } else {
View Full Code Here

    wallShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);

    Appearance wallAppearance = new Appearance();
    wallShape.setAppearance(wallAppearance);
    wallAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
    TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
    transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
    transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
    wallAppearance.setTransparencyAttributes(transparencyAttributes);
    wallAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
    RenderingAttributes renderingAttributes = new RenderingAttributes();
    renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
    wallAppearance.setRenderingAttributes(renderingAttributes);
View Full Code Here

              }
            });
    }
    // Update wall side transparency
    float wallsAlpha = this.home.getEnvironment().getWallsAlpha();
    TransparencyAttributes transparencyAttributes = wallSideAppearance.getTransparencyAttributes();
    transparencyAttributes.setTransparency(wallsAlpha);
    // If walls alpha is equal to zero, turn off transparency to get better results
    transparencyAttributes.setTransparencyMode(wallsAlpha == 0
        ? TransparencyAttributes.NONE
        : TransparencyAttributes.NICEST);     
    // Update wall side visibility
    RenderingAttributes renderingAttributes = wallSideAppearance.getRenderingAttributes();
    HomeEnvironment.DrawingMode drawingMode = this.home.getEnvironment().getDrawingMode();
View Full Code Here

      geometryInfo.setStripCounts(stripCountsArray);
      Shape3D shadow = new Shape3D(geometryInfo.getIndexedGeometryArray());
      Appearance shadowAppearance = new Appearance();
      shadowAppearance.setColoringAttributes(new ColoringAttributes(new Color3f(), ColoringAttributes.SHADE_FLAT));
      shadowAppearance.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST, 0.7f));
      shadow.setAppearance(shadowAppearance);   
      homeRoot.addChild(shadow);
    }
  }
View Full Code Here

            writer.write("Ka " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
            writer.write("Kd " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
            writer.write("Ks " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
          }
        }
        TransparencyAttributes transparency = appearance.getTransparencyAttributes();
        if (transparency != null) {
          if (!(material instanceof OBJMaterial)) {
            writer.write("Ni 1\n");
          }
          writer.write("d " + format(1f - transparency.getTransparency()) + "\n");
        }
        Texture texture = appearance.getTexture();
        if (texture != null) {
          writer.write("map_Kd " + this.textures.get(texture).getName() + "\n");
        }
View Full Code Here

              }
            }
          }
        }
        // Compare transparency
        TransparencyAttributes transparency1 = this.appearance.getTransparencyAttributes();
        TransparencyAttributes transparency2 = appearance2.getTransparencyAttributes();
        if ((transparency1 == null) ^ (transparency2 == null)) {
          return false;
        } else if (transparency1 != transparency2) {
          if (transparency1.getTransparency() != transparency2.getTransparency()) {
            return false;
          }
        }
        // Compare texture
        Texture texture1 = this.appearance.getTexture();
View Full Code Here

        code += color.hashCode();
        material.getSpecularColor(color);
        code += color.hashCode();
        code += Float.floatToIntBits(material.getShininess());
      }
      TransparencyAttributes transparency = this.appearance.getTransparencyAttributes();
      if (transparency != null) {
        code += Float.floatToIntBits(transparency.getTransparency());
      }
      Texture texture = this.appearance.getTexture();
      if (texture != null) {
        code += texture.getImage(0).hashCode();
      }
View Full Code Here

        } else {
          transparencyValue = 0;
        }
        Appearance appearance = this.effectAppearances.get(this.effectId);
        if (transparencyValue > 0) {
          appearance.setTransparencyAttributes(new TransparencyAttributes(
              TransparencyAttributes.NICEST, transparencyValue)); // 0 means opaque in Java 3D
        } else {
          // Set default color if it doesn't exist yet
          Color3f black = new Color3f();
          if (appearance.getMaterial() == null) {
View Full Code Here

TOP

Related Classes of javax.media.j3d.TransparencyAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.