本文整理汇总了Java中javax.media.j3d.Appearance.setLineAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java Appearance.setLineAttributes方法的具体用法?Java Appearance.setLineAttributes怎么用?Java Appearance.setLineAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Appearance
的用法示例。
在下文中一共展示了Appearance.setLineAttributes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: Java3dFactory
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public Java3dFactory( Colors colors, Boolean useEmissiveColor )
{
mHasEmissiveColor = useEmissiveColor .booleanValue();
mAppearances = new Appearances( colors, mHasEmissiveColor );
outlines = new Appearance();
PolygonAttributes wirePa = new PolygonAttributes( PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK, -10f );
outlines .setPolygonAttributes( wirePa );
LineAttributes lineAtts = new LineAttributes( 1, LineAttributes .PATTERN_SOLID, true );
outlines .setLineAttributes( lineAtts );
outlines .setColoringAttributes( new ColoringAttributes( new Color3f( Color.BLACK ), ColoringAttributes .SHADE_FLAT ) );
}
示例4: createLineTypes
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
Group createLineTypes() {
Group lineGroup = new Group();
Appearance app = new Appearance();
ColoringAttributes ca = new ColoringAttributes(black,
ColoringAttributes.SHADE_FLAT);
app.setColoringAttributes(ca);
// Plain line
Point3f[] plaPts = new Point3f[2];
plaPts[0] = new Point3f(-0.9f, -0.7f, 0.0f);
plaPts[1] = new Point3f(-0.5f, 0.7f, 0.0f);
LineArray pla = new LineArray(2, LineArray.COORDINATES);
pla.setCoordinates(0, plaPts);
Shape3D plShape = new Shape3D(pla, app);
lineGroup.addChild(plShape);
// line pattern dot
Point3f[] dotPts = new Point3f[2];
dotPts[0] = new Point3f(-0.4f, -0.7f, 0.0f);
dotPts[1] = new Point3f(-0.0f, 0.7f, 0.0f);
LineArray dot = new LineArray(2, LineArray.COORDINATES);
dot.setCoordinates(0, dotPts);
LineAttributes dotLa = new LineAttributes();
dotLa.setLineWidth(2.0f);
dotLa.setLinePattern(LineAttributes.PATTERN_DOT);
Appearance dotApp = new Appearance();
dotApp.setLineAttributes(dotLa);
dotApp.setColoringAttributes(ca);
Shape3D dotShape = new Shape3D(dot, dotApp);
lineGroup.addChild(dotShape);
// line pattern dash
Point3f[] dashPts = new Point3f[2];
dashPts[0] = new Point3f(-0.0f, -0.7f, 0.0f);
dashPts[1] = new Point3f(0.4f, 0.7f, 0.0f);
LineArray dash = new LineArray(2, LineArray.COORDINATES);
dash.setCoordinates(0, dashPts);
LineAttributes dashLa = new LineAttributes();
dashLa.setLineWidth(4.0f);
dashLa.setLinePattern(LineAttributes.PATTERN_DASH);
Appearance dashApp = new Appearance();
dashApp.setLineAttributes(dashLa);
dashApp.setColoringAttributes(ca);
Shape3D dashShape = new Shape3D(dash, dashApp);
lineGroup.addChild(dashShape);
// line pattern dot-dash
Point3f[] dotDashPts = new Point3f[2];
dotDashPts[0] = new Point3f(0.5f, -0.7f, 0.0f);
dotDashPts[1] = new Point3f(0.9f, 0.7f, 0.0f);
LineArray dotDash = new LineArray(2, LineArray.COORDINATES);
dotDash.setCoordinates(0, dotDashPts);
LineAttributes dotDashLa = new LineAttributes();
dotDashLa.setLineWidth(4.0f);
dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH_DOT);
Appearance dotDashApp = new Appearance();
dotDashApp.setLineAttributes(dotDashLa);
dotDashApp.setColoringAttributes(ca);
Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
lineGroup.addChild(dotDashShape);
return lineGroup;
}
示例5: addKinectShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public void addKinectShape() {
// create an appearance
Appearance ap = new Appearance();
// render as a wireframe
PolygonAttributes polyAttrbutes = new PolygonAttributes();
polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
ap.setPolygonAttributes(polyAttrbutes);
Box kinect = new Box(0.6f, 0.1f, 0.2f, ap);
// scale and move start position to (-4,0,0) // change later
TransformGroup posnTG = new TransformGroup();
Transform3D t3d = new Transform3D();
// t3d.setScale(0.5);
t3d.setTranslation(new Vector3d(0f, 2.4f, 6.0f));
posnTG.setTransform(t3d);
posnTG.addChild(kinect);
Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
// line pattern dot-dash
ColoringAttributes ca = new ColoringAttributes(red, ColoringAttributes.NICEST);
Point3f[] dotDashPts = new Point3f[2];
dotDashPts[0] = new Point3f(0.0f, 0.0f, 0.0f);
dotDashPts[1] = new Point3f(4.9f, 4.7f, -5.0f);
LineArray dotDash = new LineArray(2, GeometryArray.COORDINATES);
dotDash.setCoordinates(0, dotDashPts);
LineAttributes dotDashLa = new LineAttributes();
dotDashLa.setLineWidth(4.0f);
dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH);
Appearance dotDashApp = new Appearance();
dotDashApp.setLineAttributes(dotDashLa);
dotDashApp.setColoringAttributes(ca);
Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
posnTG.addChild(dotDashShape);
// Shape3D pyramid = createPyramid();
// posnTG.addChild(pyramid);
sceneBG.addChild(posnTG);
}
示例6: addKinectShape
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public void addKinectShape() {
// create an appearance
Appearance ap = new Appearance();
// render as a wireframe
PolygonAttributes polyAttrbutes = new PolygonAttributes();
polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
ap.setPolygonAttributes(polyAttrbutes);
Box kinect = new Box(0.6f, 0.1f, 0.2f, ap);
// scale and move start position to (-4,0,0) // change later
TransformGroup posnTG = new TransformGroup();
Transform3D t3d = new Transform3D();
// t3d.setScale(0.5);
t3d.setTranslation(new Vector3d(0f, 2.4f, 6.0f));
posnTG.setTransform(t3d);
posnTG.addChild(kinect);
Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
// line pattern dot-dash
ColoringAttributes ca = new ColoringAttributes(red, ColoringAttributes.NICEST);
Point3f[] dotDashPts = new Point3f[2];
dotDashPts[0] = new Point3f(0.0f, 0.0f, 0.0f);
dotDashPts[1] = new Point3f(4.9f, 4.7f, -5.0f);
LineArray dotDash = new LineArray(2, GeometryArray.COORDINATES);
dotDash.setCoordinates(0, dotDashPts);
LineAttributes dotDashLa = new LineAttributes();
dotDashLa.setLineWidth(4.0f);
dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH);
Appearance dotDashApp = new Appearance();
dotDashApp.setLineAttributes(dotDashLa);
dotDashApp.setColoringAttributes(ca);
Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
posnTG.addChild(dotDashShape);
// Shape3D pyramid = createPyramid();
// posnTG.addChild(pyramid);
sceneBG.addChild(posnTG);
}
示例7: generateAppearanceLine
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Methode pour l'apparence des lignes
*/
private Appearance generateAppearanceLine(boolean isClrd, Color color,
double coefOpacity, boolean isSolid) {
// Création de l'apparence
Appearance apparenceFinale = new Appearance();
// Autorisations pour l'apparence
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
// Autorisations pour le material
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
// Autorisations pour le material
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
// Association à l'apparence des attributs de géométrie et de material
// Création des attributs du polygone
LineAttributes lp = new LineAttributes();
lp.setLineAntialiasingEnable(true);
lp.setLineWidth(this.widthEdge);
if (isSolid) {
lp.setLinePattern(LineAttributes.PATTERN_SOLID);
} else {
lp.setLinePattern(LineAttributes.PATTERN_DASH);
}
apparenceFinale.setLineAttributes(lp);
if (isClrd) {
// Création du material (gestion des couleurs et de l'affichage)
Material material = new Material();
material.setAmbientColor(new Color3f(color));
material.setDiffuseColor(new Color3f(color));
material.setEmissiveColor(new Color3f(color));
material.setLightingEnable(true);
material.setSpecularColor(new Color3f(color));
material.setShininess(1);
apparenceFinale.setMaterial(material);
}
if (coefOpacity != 1) {
TransparencyAttributes t_attr =
new TransparencyAttributes(TransparencyAttributes.FASTEST,
(float) (1 - coefOpacity));
apparenceFinale.setTransparencyAttributes(t_attr);
}
// Association à l'apparence des attributs de géométrie et de material
return apparenceFinale;
}
示例8: generateAppearance
import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
* Methode pour l'apparence des triangles pleins
*/
private Appearance generateAppearance(boolean isClrd, Color color,
double coefOpacite, boolean isSolid) {
this.isColored = isClrd;
this.opacity = coefOpacite;
this.isSolid = isSolid;
// Création de l'apparence
Appearance apparenceFinale = new Appearance();
// Autorisations pour l'apparence
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
// Autorisations pour le material
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
// Autorisations pour le material
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
// Association à l'apparence des attributs de géométrie et de material
// Création des attributs du polygone
LineAttributes lp = new LineAttributes();
lp.setLineAntialiasingEnable(true);
lp.setLineWidth(Object1d.width);
if (isSolid) {
lp.setLinePattern(LineAttributes.PATTERN_SOLID);
} else {
lp.setLinePattern(LineAttributes.PATTERN_DASH);
}
apparenceFinale.setLineAttributes(lp);
if (isClrd) {
// Création du material (gestion des couleurs et de l'affichage)
Material material = new Material();
material.setAmbientColor(0.2f, 0.2f, 0.2f);
material.setDiffuseColor(new Color3f(color));
material.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
material.setShininess(128);
apparenceFinale.setMaterial(material);
}
if (coefOpacite != 1) {
TransparencyAttributes t_attr =
new TransparencyAttributes(TransparencyAttributes.BLENDED,
(float) coefOpacite,
TransparencyAttributes.BLEND_SRC_ALPHA,
TransparencyAttributes.BLENDED);
apparenceFinale.setTransparencyAttributes(t_attr);
}
// Association à l'apparence des attributs de géométrie et de material
return apparenceFinale;
}