本文整理汇总了Java中javax.media.j3d.Appearance.setRenderingAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java Appearance.setRenderingAttributes方法的具体用法?Java Appearance.setRenderingAttributes怎么用?Java Appearance.setRenderingAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Appearance
的用法示例。
在下文中一共展示了Appearance.setRenderingAttributes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DebugVector
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public DebugVector( Point3f location , Vector3f extent , Color3f color )
{
ColoringAttributes ca = new ColoringAttributes( );
ca.setCapability( ColoringAttributes.ALLOW_COLOR_WRITE );
RenderingAttributes ra = new RenderingAttributes( );
ra.setCapability( RenderingAttributes.ALLOW_VISIBLE_WRITE );
TransparencyAttributes ta = new TransparencyAttributes( );
ta.setTransparency( 0.3f );
Appearance app = new Appearance( );
app.setColoringAttributes( ca );
app.setCapability( Appearance.ALLOW_COLORING_ATTRIBUTES_READ );
app.setRenderingAttributes( ra );
app.setCapability( Appearance.ALLOW_RENDERING_ATTRIBUTES_READ );
shape.setAppearance( app );
shape.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
shape.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE );
setVector( location , extent );
setColor( color );
addChild( shape );
}
示例2: 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;
}
示例3: 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;
}
示例4: setOutlineAppearance
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Sets the outline appearance on all the children of <code>node</code>.
*/
private void setOutlineAppearance(Node node)
{
if (node instanceof Group)
{
Enumeration<?> enumeration = ((Group) node).getAllChildren();
while (enumeration.hasMoreElements())
{
setOutlineAppearance((Node) enumeration.nextElement());
}
}
else if (node instanceof Link)
{
setOutlineAppearance(((Link) node).getSharedGroup());
}
else if (node instanceof Shape3D)
{
Appearance outlineAppearance = new Appearance();
((Shape3D) node).setAppearance(outlineAppearance);
outlineAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
RenderingAttributes renderingAttributes = new RenderingAttributes();
renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
outlineAppearance.setRenderingAttributes(renderingAttributes);
outlineAppearance.setColoringAttributes(Object3DBranch.OUTLINE_COLORING_ATTRIBUTES);
outlineAppearance.setPolygonAttributes(Object3DBranch.OUTLINE_POLYGON_ATTRIBUTES);
outlineAppearance.setLineAttributes(Object3DBranch.OUTLINE_LINE_ATTRIBUTES);
}
}
示例5: 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;
}
示例6: SlicePlaneRenderer
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public SlicePlaneRenderer(View view, Context context, Volume vol)
{
super(view, context, vol);
volRefPtAttr = (CoordAttr) context.getAttr("Vol Ref Pt");
root = new BranchGroup();
// subclasses add the slice geometry to root
borderSwitch = new Switch(Switch.CHILD_ALL);
borderSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);
RenderingAttributes ra = new RenderingAttributes();
ra.setDepthBufferEnable(true);
ColoringAttributes bclr = new ColoringAttributes(0.4f, 0.4f, 0.4f,
ColoringAttributes.SHADE_FLAT);
Appearance ba = new Appearance();
ba.setColoringAttributes(bclr);
ba.setRenderingAttributes(ra);
borderShape = new Shape3D(null, ba);
borderShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
borderSwitch.addChild(borderShape);
root.addChild(borderSwitch);
root.setCapability(BranchGroup.ALLOW_DETACH);
root.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
示例7: setup
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private void setup()
{
// Can be used to make coordSys smaller TODO: specify in constructor
Transform3D coordTrans = new Transform3D();
coordTrans.setTranslation(translation);
coordTrans.setScale(scale);
setTransform(coordTrans);
RenderingAttributes ra = new RenderingAttributes();
ra.setDepthBufferEnable(true);
LineArray xGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusX, plusY, plusZ);
xGeom.setCoordinates(0, line);
ColoringAttributes xColoringAttributes = new ColoringAttributes(1.0f,
0.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
Appearance xAppearance = new Appearance();
xAppearance.setColoringAttributes(xColoringAttributes);
xAppearance.setRenderingAttributes(ra);
Shape3D xShape = new Shape3D(xGeom, xAppearance);
addChild(xShape);
LineArray yGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusY, plusX, plusZ);
yGeom.setCoordinates(0, line);
ColoringAttributes yColoringAttributes = new ColoringAttributes(0.0f,
1.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
Appearance yAppearance = new Appearance();
yAppearance.setColoringAttributes(yColoringAttributes);
yAppearance.setRenderingAttributes(ra);
Shape3D yShape = new Shape3D(yGeom, yAppearance);
addChild(yShape);
LineArray zGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusZ, plusX, plusY);
zGeom.setCoordinates(0, line);
ColoringAttributes zColoringAttributes = new ColoringAttributes(0.0f,
0.0f, 1.0f, ColoringAttributes.SHADE_FLAT);
Appearance zAppearance = new Appearance();
zAppearance.setColoringAttributes(zColoringAttributes);
zAppearance.setRenderingAttributes(ra);
Shape3D zShape = new Shape3D(zGeom, zAppearance);
addChild(zShape);
}
示例8: outputShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private void outputShape(OrderedGroup triGroup, int orderDir, TexCoordGeneration tg, Texture2D texture, int numPts, Point3d[] pts, Color4f[] colrs)
{
count[0] = numPts;
TriangleFanArray pgonGeo = new TriangleFanArray(numPts,
GeometryArray.COORDINATES | GeometryArray.COLOR_4, count);
pgonGeo.setCoordinates(0, pts, 0, numPts);
pgonGeo.setColors(0, colrs, 0, numPts);
Appearance appearance = new Appearance();
if (texture != null)
{
appearance.setTextureAttributes(texAttr);
appearance.setTexture(texture);
}
appearance.setMaterial(m);
appearance.setColoringAttributes(clr);
appearance.setTransparencyAttributes(trans);
appearance.setPolygonAttributes(p);
appearance.setTexCoordGeneration(tg);
appearance.setRenderingAttributes(r);
Shape3D shape = new Shape3D(pgonGeo, appearance);
Node child = shape;
if (outputLines)
{
Group shapeGroup = new Group();
shapeGroup.addChild(shape);
count[0] = numPts + 1;
pts[numPts] = pts[0];
LineStripArray lineGeo = new LineStripArray(numPts + 1,
GeometryArray.COORDINATES, count);
lineGeo.setCoordinates(0, pts, 0, numPts + 1);
Appearance lineAppearance = new Appearance();
Shape3D lineShape = new Shape3D(lineGeo, lineAppearance);
shapeGroup.addChild(lineShape);
child = shapeGroup;
}
if (verbose)
{
System.out.println("shape is " + child);
}
if (orderDir == FRONT)
{
triGroup.insertChild(child, 0);
} else
{
triGroup.addChild(child);
}
}