本文整理汇总了Java中javax.media.j3d.Appearance.setTransparencyAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java Appearance.setTransparencyAttributes方法的具体用法?Java Appearance.setTransparencyAttributes怎么用?Java Appearance.setTransparencyAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Appearance
的用法示例。
在下文中一共展示了Appearance.setTransparencyAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildScene
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
@Override
void buildScene(TransformGroup transformGroup) {
transformGroup.addChild(getColorBackground(new Color(.905f, .905f, 0.95f)));
Appearance appearance = new Appearance();
Material mat = new Material();
mat.setAmbientColor(0.5f, 0.5f, 0.5f);
mat.setDiffuseColor(1.0f, 1.0f, 1.0f);
mat.setEmissiveColor(0.0f, 0.0f, 0.0f);
mat.setSpecularColor(1.0f, 1.0f, 1.0f);
mat.setShininess(80.0f);
appearance.setMaterial(mat);
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparency(0.5f);
ta.setTransparencyMode(TransparencyAttributes.BLENDED);
appearance.setTransparencyAttributes(ta);
transformGroup.addChild(new Box(0.6f, 0.5f, 0.4f, appearance));
transformGroup.addChild(getPointLight(new Color(1.0f, 1.0f, 1.0f), new Point3f(2.0f, 2.0f, 2.0f)));
transformGroup.addChild(getAmbientLight(new Color(0.1f, 0.1f, 0.1f)));
transformGroup.setTransform(getTransform(new Vector3f(0.3f, 0.3f, 0.3f), 0.75, -1, Math.PI / 4.0d));
}
示例2: makeAppearance
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private Appearance makeAppearance( Material material, Color4f color, boolean transparent )
{
Appearance appearance = new Appearance();
appearance .setMaterial( material );
appearance .setCapability( Appearance .ALLOW_MATERIAL_READ );
appearance .setCapability( Appearance .ALLOW_MATERIAL_WRITE );
material .setLightingEnable( true );
Color3f justColor = new Color3f( color .x, color.y, color.z );
appearance .setColoringAttributes( new ColoringAttributes( justColor, ColoringAttributes .SHADE_FLAT ) );
if ( transparent || color.w < 1.0f ) {
TransparencyAttributes ta = new TransparencyAttributes();
ta .setTransparencyMode( TransparencyAttributes .BLENDED );
float alpha = transparent? ( PREVIEW_TRANSPARENCY * color.w ) : color.w;
ta .setTransparency( PREVIEW_TRANSPARENCY );
appearance .setTransparencyAttributes( ta );
}
return appearance;
}
示例3: createBox
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private Box createBox() {
// ��
Appearance app = new Appearance();
Material mat = new Material();
mat.setAmbientColor(new Color3f(0.0f, 0.0f, 1.0f));
mat.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
app.setMaterial(mat);
// �����ɂ���
TransparencyAttributes transAttr = new TransparencyAttributes(
TransparencyAttributes.BLENDED, 0.5f);
app.setTransparencyAttributes(transAttr);
Box box = new Box(0.5f, 0.5f, 0.5f, app);
return box;
}
示例4: Ball
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public Ball(double x, double y, double z) {
position = new Vector3d(x, y, z);
velocity = new Vector3d(0, 0, 0);
acceleration = new Vector3d(0, -0.01, 0); // �����x�͈��
// �ړ��\
this.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
this.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
app = new Appearance();
Material mat = new Material();
mat.setAmbientColor(new Color3f(0.0f, 0.0f, 1.0f));
mat.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
app.setMaterial(mat);
TransparencyAttributes transAttr = new TransparencyAttributes(
TransparencyAttributes.BLENDED, 0.2f);
app.setTransparencyAttributes(transAttr);
// �{�[����lj�
this.addChild(new Sphere(radius, Sphere.GENERATE_NORMALS, 100, app));
move();
}
示例5: maskAppearance
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public static Appearance maskAppearance( )
{
final Appearance app = new Appearance( );
final TransparencyAttributes ta = new TransparencyAttributes( );
ta.setTransparencyMode( TransparencyAttributes.BLENDED );
ta.setSrcBlendFunction( TransparencyAttributes.BLEND_ZERO );
ta.setDstBlendFunction( TransparencyAttributes.BLEND_ONE );
app.setTransparencyAttributes( ta );
final ColoringAttributes ca = new ColoringAttributes( );
ca.setColor( new Color3f( 0 , 0 , 0 ) );
app.setColoringAttributes( ca );
final RenderingAttributes ra = new RenderingAttributes( );
ra.setDepthBufferWriteEnable( true );
app.setRenderingAttributes( ra );
return app;
}
示例6: Ground3D
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Creates a 3D ground for the given <code>home</code>.
*/
public Ground3D(Home home, float originX, float originY, float width, float depth, boolean waitTextureLoadingEnd)
{
setUserData(home);
this.originX = originX;
this.originY = originY;
this.width = width;
this.depth = depth;
Appearance groundAppearance = new Appearance();
groundAppearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
groundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
TextureAttributes textureAttributes = new TextureAttributes();
textureAttributes.setTextureMode(TextureAttributes.MODULATE);
groundAppearance.setTextureAttributes(textureAttributes);
groundAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
groundAppearance.setTransparencyAttributes(transparencyAttributes);
final Shape3D groundShape = new Shape3D();
groundShape.setAppearance(groundAppearance);
groundShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
groundShape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
groundShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
setCapability(ALLOW_CHILDREN_READ);
addChild(groundShape);
update(waitTextureLoadingEnd);
}
示例7: createWallPartShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Returns a new wall part shape with no geometry
* and a default appearance with a white material.
*/
private Node createWallPartShape(boolean outline)
{
Shape3D wallShape = new Shape3D();
// Allow wall shape to change its geometry
wallShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
wallShape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
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);
if (outline)
{
wallAppearance.setColoringAttributes(Object3DBranch.OUTLINE_COLORING_ATTRIBUTES);
wallAppearance.setPolygonAttributes(Object3DBranch.OUTLINE_POLYGON_ATTRIBUTES);
wallAppearance.setLineAttributes(Object3DBranch.OUTLINE_LINE_ATTRIBUTES);
}
else
{
wallAppearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
wallAppearance.setMaterial(DEFAULT_MATERIAL);
wallAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
wallAppearance.setCapability(Appearance.ALLOW_TEXTURE_READ);
// Mix texture and wall color
wallAppearance.setTextureAttributes(MODULATE_TEXTURE_ATTRIBUTES);
}
return wallShape;
}
示例8: createRoomPartShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Returns a new room part shape with no geometry
* and a default appearance with a white material.
*/
private Node createRoomPartShape()
{
Shape3D roomShape = new Shape3D();
// Allow room shape to change its geometry
roomShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
roomShape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
roomShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
Appearance roomAppearance = new Appearance();
roomShape.setAppearance(roomAppearance);
roomAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
roomAppearance.setTransparencyAttributes(transparencyAttributes);
roomAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
RenderingAttributes renderingAttributes = new RenderingAttributes();
renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
roomAppearance.setRenderingAttributes(renderingAttributes);
roomAppearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
roomAppearance.setMaterial(DEFAULT_MATERIAL);
roomAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
roomAppearance.setCapability(Appearance.ALLOW_TEXTURE_READ);
// Mix texture and room color
roomAppearance.setTextureAttributes(MODULATE_TEXTURE_ATTRIBUTES);
return roomShape;
}
示例9: PointsShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public PointsShape() {
// BY_REFERENCE PointArray storing coordinates and colors
cloud = new PointArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
mesh = new TriangleArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(TransparencyAttributes.NICEST);
ta.setTransparency(0.0f);
PointAttributes pointAttributes = new PointAttributes();
pointAttributes.setPointSize(2.83f);
pointAttributes.setCapability(PointAttributes.ALLOW_SIZE_WRITE);
Appearance a = new Appearance();
a.setPointAttributes(pointAttributes);
a.setTransparencyAttributes(ta);
// the data structure can be read and written at run time
cloud.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
cloud.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
mesh.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
mesh.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
sem = new Semaphore(0);
// create PointsShape geometry and appearance
createGeometry();
createAppearance();
// setAppearance(a);
}
示例10: SlicePlane3DRenderer
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public SlicePlane3DRenderer(View view, Context context, Volume vol)
{
super(view, context, vol);
texVol = new Texture3DVolume(context, vol);
TransparencyAttributes transAttr = new TransparencyAttributes();
transAttr.setTransparencyMode(TransparencyAttributes.BLENDED);
texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
texAttr.setCapability(TextureAttributes.ALLOW_COLOR_TABLE_WRITE);
Material m = new Material();
m.setLightingEnable(false);
PolygonAttributes p = new PolygonAttributes();
p.setCullFace(PolygonAttributes.CULL_NONE);
p.setPolygonOffset(1.0f);
p.setPolygonOffsetFactor(1.0f);
appearance = new Appearance();
appearance.setMaterial(m);
appearance.setTextureAttributes(texAttr);
appearance.setTransparencyAttributes(transAttr);
appearance.setPolygonAttributes(p);
appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
appearance.setCapability(Appearance.ALLOW_TEXGEN_WRITE);
shape = new Shape3D(null, appearance);
shape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
root.addChild(shape);
}
示例11: CorticalColumn
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public CorticalColumn(float scale) {
super();
this.scale = scale;
Region.Param.ColumnParam par = Region.Param.getInstance().getColumnParam();
lengthX = par.getLength() * scale;
widthY = par.getWidth() * scale;
layer1 = par.getLayer1() * scale;
layer23 = par.getLayer23() * scale;
layer4 = par.getLayer4() * scale;
layer5A = par.getLayer5A() * scale;
layer5B = par.getLayer5B() * scale;
layer6 = par.getLayer6() * scale;
heightZ = par.getHeight() * scale;
Appearance ap = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(Utils3D.grey);
ap.setColoringAttributes(ca);
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.7f);
myTA.setTransparencyMode(TransparencyAttributes.NICEST);
ap.setTransparencyAttributes(myTA);
//render the Box as a wire frame
PolygonAttributes polyAttrbutes = new PolygonAttributes();
polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
ap.setPolygonAttributes(polyAttrbutes);
setAppearance(ap);
}
示例12: addText3D
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public static void addText3D(TransformGroup bg, String text, Vector3f vPos, float scale, Color3f color) {
Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), text);
Shape3D text3dShape3d = new Shape3D(text3d);
Appearance appearance = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(color);
appearance.setColoringAttributes(ca);
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.3f);
myTA.setTransparencyMode(TransparencyAttributes.NICEST);
appearance.setTransparencyAttributes(myTA);
text3dShape3d.setAppearance(appearance);
TransformGroup tg = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.rotX(Math.PI / 2);
t3d.setTranslation(vPos);
t3d.setScale(scale * 15.0f);
tg.setTransform(t3d);
tg.addChild(text3dShape3d);
bg.addChild(tg);
}
示例13: RegionCA1
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public RegionCA1(float scale) {
super();
this.scale = scale;
Region.Param.CA1Param regPar = Region.Param.getInstance().getCa1Param();
lengthX = regPar.getLength() * scale;
widthY = regPar.getWidth() * scale;
stratumOriens = regPar.getStratumOriens() * scale;
stratumPyramidale = regPar.getStratumPyramidale() * scale;
stratumRadiatum = regPar.getStratumRadiatum() * scale;
stratumLacunosum = regPar.getStratumLacunosum() * scale;
heightZ = regPar.getHeight() * scale;
Appearance ap = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(Utils3D.grey);
ap.setColoringAttributes(ca);
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.7f);
myTA.setTransparencyMode(TransparencyAttributes.FASTEST);
ap.setTransparencyAttributes(myTA);
//render the Box as a wire frame
PolygonAttributes polyAttrbutes = new PolygonAttributes();
polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
ap.setPolygonAttributes(polyAttrbutes);
setAppearance(ap);
}
示例14: PointsShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public PointsShape() {
// BY_REFERENCE PointArray storing coordinates and colors
cloud = new PointArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
mesh = new TriangleArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(TransparencyAttributes.NICEST);
ta.setTransparency(0.0f);
PointAttributes pointAttributes = new PointAttributes();
pointAttributes.setPointSize(2.83f);
pointAttributes.setCapability(PointAttributes.ALLOW_SIZE_WRITE);
Appearance a = new Appearance();
a.setPointAttributes(pointAttributes);
a.setTransparencyAttributes(ta);
// the data structure can be read and written at run time
cloud.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
cloud.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
mesh.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
mesh.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
sem = new Semaphore(0);
// create PointsShape geometry and appearance
createGeometry();
createAppearance();
// setAppearance(a);
}
示例15: create
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public Appearance create() {
Appearance appearance = new Appearance();
Color3f color3f = createColor();
Material material = new Material(color3f, new Color3f(0f, 0f, 0f), color3f, color3f, 10f);
material.setLightingEnable(true);
appearance.setMaterial(material);
TransparencyAttributes transparency = createTransparency();
if (transparency != null) {
appearance.setTransparencyAttributes(transparency);
}
return appearance;
}