本文整理汇总了Java中javax.media.j3d.LineAttributes类的典型用法代码示例。如果您正苦于以下问题:Java LineAttributes类的具体用法?Java LineAttributes怎么用?Java LineAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineAttributes类属于javax.media.j3d包,在下文中一共展示了LineAttributes类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Java3dFactory
import javax.media.j3d.LineAttributes; //导入依赖的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 ) );
}
示例2: setVersion
import javax.media.j3d.LineAttributes; //导入依赖的package包/类
/**
* Set the version of VRML that this node should represent. Different
* versions have different capabilities, even within the same node.
*
* @param major The major version number of this scene
* @param minor The minor version number of this scene
* @param isStatic true if this node is under a static group and won't
* change after the setup is finished
*/
public void setVersion(int major, int minor, boolean isStatic) {
super.setVersion(major, minor, isStatic);
if(isStatic)
return;
j3dAttribs.setCapability(LineAttributes.ALLOW_WIDTH_WRITE);
j3dAttribs.setCapability(LineAttributes.ALLOW_PATTERN_WRITE);
}
示例3: createLineTypes
import javax.media.j3d.LineAttributes; //导入依赖的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;
}
示例4: addKinectShape
import javax.media.j3d.LineAttributes; //导入依赖的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);
}
示例5: addKinectShape
import javax.media.j3d.LineAttributes; //导入依赖的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: setLineType
import javax.media.j3d.LineAttributes; //导入依赖的package包/类
/**
* Set the line type to the new value.
*
* @param value The new color value to check
* @throws InvalidFieldValueException One of the colour components are out
* of range
*/
protected void setLineType(int value)
throws InvalidFieldValueException {
super.setLineType(value);
switch(value) {
case 1:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_SOLID);
break;
case 2:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_DASH);
break;
case 3:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_DOT);
break;
case 4:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_DASH_DOT);
break;
case 5:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_USER_DEFINED);
j3dAttribs.setPatternMask(J3D_DASH_DOT_DOT);
break;
case 6:
System.out.println("J3D cannot handle this line style: 6");
break;
case 7:
j3dAttribs.setLinePattern(LineAttributes.PATTERN_USER_DEFINED);
j3dAttribs.setPatternMask(J3D_SINGLE_DOT);
break;
default:
System.out.println("J3D cannot handle this line style: " + value);
}
}
示例7: init
import javax.media.j3d.LineAttributes; //导入依赖的package包/类
/**
* Common initialisation routines for the Java3D code.
*/
private void init() {
j3dAttribs = new LineAttributes();
}
示例8: generateAppearanceLine
import javax.media.j3d.LineAttributes; //导入依赖的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;
}
示例9: generateAppearance
import javax.media.j3d.LineAttributes; //导入依赖的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;
}
示例10: getLineAttributes
import javax.media.j3d.LineAttributes; //导入依赖的package包/类
/**
* Returns a J3D LineAttributes node representation of the contents
*
* @return The line attributes.
*/
public LineAttributes getLineAttributes();
示例11: getLineAttributes
import javax.media.j3d.LineAttributes; //导入依赖的package包/类
/**
* Returns a J3D LineAttributes node representation of the contents
*
* @return The line attributes.
*/
public LineAttributes getLineAttributes() {
return j3dAttribs;
}