List of usage examples for javax.media.j3d TransparencyAttributes FASTEST
int FASTEST
To view the source code for javax.media.j3d TransparencyAttributes FASTEST.
Click Source Link
From source file:SimpleGeometry.java
PlatformGeometry createAimer() {
PlatformGeometry pg = new PlatformGeometry();
// This TransformGroup will be used by the MouseTranslate
// utiltiy to move the cylinder around the canvas. when the
// the user holds down mouse button 3.
TransformGroup moveTG = new TransformGroup();
moveTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
moveTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
MouseTranslate mouseT = new MouseTranslate(moveTG);
moveTG.addChild(mouseT);//from ww w . jav a 2s . co m
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
mouseT.setSchedulingBounds(bounds);
pg.addChild(moveTG);
// This TransformGroup is used to place the cylinder in the scene.
// The cylinder will be rotated 90 degrees so it will appear as
// a circle on the screen (could be made into a nice gun site...).
// The cylinder is also displaced a little in Z so it is in front
// of the viewer.
Transform3D xForm = new Transform3D();
xForm.rotX(Math.PI / 2.0);
xForm.setTranslation(new Vector3d(0.0, 0.0, -0.7));
TransformGroup placementTG = new TransformGroup(xForm);
moveTG.addChild(placementTG);
// Create the cylinder - make it thin and transparent.
Appearance cylinderAppearance = new Appearance();
TransparencyAttributes transAttrs = new TransparencyAttributes(TransparencyAttributes.FASTEST, 0.5f);
// cylinderAppearance.setTransparencyAttributes(transAttrs);
Cylinder aimer = new Cylinder(0.06f, 0.005f, 0, cylinderAppearance);
placementTG.addChild(aimer);
return pg;
}
From source file:AppearanceTest.java
public void onFASTEST() { getTransparencyAttributes().setTransparencyMode(TransparencyAttributes.FASTEST); }
From source file:AppearanceExplorer.java
TransparencyAttributesEditor(TransparencyAttributes init) {
transpAttr = init;/* www .j ava 2 s . c o m*/
transparency = transpAttr.getTransparency();
mode = transpAttr.getTransparencyMode();
srcBlendFunction = transpAttr.getSrcBlendFunction();
dstBlendFunction = transpAttr.getDstBlendFunction();
setLayout(new GridLayout(4, 1));
FloatLabelJSlider transparencySlider = new FloatLabelJSlider("Transparency", 0.1f, 0.0f, 1.0f,
transparency);
transparencySlider.setMajorTickSpacing(0.1f);
transparencySlider.setPaintTicks(true);
transparencySlider.addFloatListener(new FloatListener() {
public void floatChanged(FloatEvent e) {
transparency = e.getValue();
transpAttr.setTransparency(transparency);
}
});
add(transparencySlider);
String[] modeNames = { "NONE", "SCREEN_DOOR", "BLENDED", "NICEST", "FASTEST" };
int[] modeValues = { TransparencyAttributes.NONE, TransparencyAttributes.SCREEN_DOOR,
TransparencyAttributes.BLENDED, TransparencyAttributes.NICEST, TransparencyAttributes.FASTEST };
IntChooser modeChooser = new IntChooser("Mode:", modeNames, modeValues, mode);
modeChooser.addIntListener(new IntListener() {
public void intChanged(IntEvent event) {
mode = event.getValue();
transpAttr.setTransparencyMode(mode);
}
});
add(modeChooser);
String[] blendNames = { "BLEND_ZERO", "BLEND_ONE", "BLEND_SRC_ALPHA", "BLEND_ONE_MINUS_SRC_ALPHA" };
int[] blendValues = { TransparencyAttributes.BLEND_ZERO, TransparencyAttributes.BLEND_ONE,
TransparencyAttributes.BLEND_SRC_ALPHA, TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA, };
IntChooser srcBlendFunctionChooser = new IntChooser("Src Blend Func:", blendNames, blendValues,
srcBlendFunction);
srcBlendFunctionChooser.addIntListener(new IntListener() {
public void intChanged(IntEvent event) {
srcBlendFunction = event.getValue();
transpAttr.setSrcBlendFunction(srcBlendFunction);
}
});
add(srcBlendFunctionChooser);
IntChooser dstBlendFunctionChooser = new IntChooser("Dst Blend Func:", blendNames, blendValues,
dstBlendFunction);
dstBlendFunctionChooser.addIntListener(new IntListener() {
public void intChanged(IntEvent event) {
dstBlendFunction = event.getValue();
transpAttr.setDstBlendFunction(dstBlendFunction);
}
});
add(dstBlendFunctionChooser);
}