本文整理汇总了Java中javax.media.j3d.Shape3D.setCapability方法的典型用法代码示例。如果您正苦于以下问题:Java Shape3D.setCapability方法的具体用法?Java Shape3D.setCapability怎么用?Java Shape3D.setCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Shape3D
的用法示例。
在下文中一共展示了Shape3D.setCapability方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Object1d
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
/**
* créer la représentation d'un objet avec une géométrie de type linéaire.
* créer le lien entre la représentation et l'objet indispensable pour pouvoir
* effectuer des sélections
*
* @param feat l'entité dont la géométrie servira à créer la représentation et
* à laquelle sera attachée la représentation
* @param isClrd indique si une couleur unique sera appliquée ou non (si false
* une couleur différente par face)
* @param color couleur appliquée si isClrd == true
* @param coefOpacity coefficient d'opacité appliqué à l'objet
* @param isSolid propose un mode de représentation filaire (false) ou
* surfacique (true)
*/
public Object1d(IFeature feat, boolean isClrd, Color color,
double coefOpacity, boolean isSolid) {
super(feat, isClrd, color, coefOpacity, isSolid);
// Génère en fonction du cas la géométrie Java3D
LineStripArray geomInfo = null;
if (isClrd) {
geomInfo = this.geometryWithColor();
} else {
geomInfo = this.geometryWithOutColor();
}
if (geomInfo == null) {
Object1d.logger.warn(Messages.getString("Representation.RepNulle"));
return;
}
// Génère l'apparence et l'applique
Shape3D shapepleine = new Shape3D(geomInfo, this.generateAppearance(isClrd,
color, coefOpacity, isSolid));
// Autorisations sur la Shape3D
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
shapepleine.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
shapepleine.setCapability(Node.ALLOW_LOCALE_READ);
shapepleine.setCapability(Node.ALLOW_PICKABLE_READ);
shapepleine.setCapability(Node.ALLOW_PICKABLE_WRITE);
this.bGRep.addChild(shapepleine);
// Optimisation
this.bGRep.compile();
}
示例2: Object3d
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
/**
* créer la représentation d'un objet avec une géométrie de type solide. créer
* le lien entre la représentation et l'objet indispensable pour pouvoir
* effectuer des sélections
*
* @param feat l'entité dont la géométrie servira à créer la représentation et
* à laquelle sera attachée la représentation
* @param isClrd indique si une couleur unique sera appliquée ou non (si false
* une couleur différente par face)
* @param color couleur appliquée si isClrd == true
* @param coefOpacity coefficient d'opacité appliqué à l'objet
* @param isSolid propose un mode de représentation filaire (false) ou
* surfacique (true)
*/
public Object3d(IFeature feat, boolean isClrd, Color color,
double coefOpacity, boolean isSolid) {
// On crée le bg avec toutes les autorisations nécessaires
super(feat, isClrd, color, coefOpacity, isSolid);
// préparation de la géométrie Java3D
GeometryInfo geometryInfo = null;
if (isClrd) {
geometryInfo = this.geometryWithColor();
} else {
geometryInfo = this.geometryWithOutColor();
}
if (geometryInfo == null) {
Object3d.LOGGER.warn(Messages.getString("Representation.RepNulle"));
return;
}
// préparation de l'apparence
Appearance apparence = this.generateAppearance(isClrd, color, coefOpacity,
isSolid);
// Calcul de l'objet Shape3D
Shape3D shapepleine = new Shape3D(geometryInfo.getGeometryArray(),
apparence);
// Autorisations sur la Shape3D
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shapepleine.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
shapepleine.setCapability(Node.ALLOW_LOCALE_READ);
// Ajout au BgClone les elements transformes
this.bGRep.addChild(shapepleine);
// Optimisation
this.bGRep.compile();
}
示例3: Ground3D
import javax.media.j3d.Shape3D; //导入方法依赖的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);
}
示例4: createWallPartShape
import javax.media.j3d.Shape3D; //导入方法依赖的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;
}
示例5: createRoomPartShape
import javax.media.j3d.Shape3D; //导入方法依赖的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: SlicePlane3DRenderer
import javax.media.j3d.Shape3D; //导入方法依赖的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);
}
示例7: SlicePlaneRenderer
import javax.media.j3d.Shape3D; //导入方法依赖的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);
}
示例8: Object2d
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
/**
* créer la représentation d'un objet avec une géométrie de type solide. créer
* le lien entre la représentation et l'objet indispensable pour pouvoir
* effectuer des sélections
*
* @param feat l'entité dont la géométrie servira à créer la représentation et
* à laquelle sera attachée la représentation
* @param isClrd indique si une couleur unique sera appliquée ou non (si false
* une couleur différente par face)
* @param color couleur appliquée si isClrd == true
* @param coefOpacity coefficient d'opacité appliqué à l'objet
* @param isSolid propose un mode de représentation filaire (false) ou
* surfacique (true)
*/
public Object2d(IFeature feat, boolean isClrd, Color color,
double coefOpacity, boolean isSolid) {
super(feat, isClrd, color, coefOpacity, isSolid);
// On Génère la géométrie Java3D suivant le cas
GeometryInfo geometryInfo = null;
if (isClrd) {
geometryInfo = this.geometryWithColor();
} else {
geometryInfo = this.geometryWithOutColor();
}
if (geometryInfo == null) {
Object2d.logger.warn(Messages.getString("Representation.RepNulle"));
return;
}
// préparation de l'apparence
Appearance apparence = this.generateAppearance(isClrd, color, coefOpacity,
isSolid);
try {
// Calcul de l'objet Shape3D
Shape3D shapepleine = new Shape3D(geometryInfo.getGeometryArray(),
apparence);
// Autorisations sur la Shape3D
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shapepleine.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
shapepleine.setCapability(Node.ALLOW_LOCALE_READ);
// Ajout au BgClone les elements transformes
this.bGRep.addChild(shapepleine);
// Optimisation
this.bGRep.compile();
} catch (Exception e) {
Object2d.logger.error(e.getMessage());
}
}
示例9: TexturedSurface
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
/**
* Permet d'appliquer une texture générique à une entité
*
* @param feat L'entité utilisée pour Génèrer la représentation
* @param tex La texture que l'on souhaite appliquer
* @param imageLength la longueur que représente l'image dans le monde réel
* @param imageHeigth la hauteur que représente l'image dans le monde réel
*/
public TexturedSurface(IFeature feat, Texture2D tex, double imageLength,
double imageHeigth) {
// On créer le BranchGroup avec les autorisations ad hoc
super();
this.texture = tex;
this.feat = feat;
this.imageLength = imageLength;
this.imageHeigth = imageHeigth;
// préparation de la géométrie Java3D
GeometryInfo geometryInfo = null;
geometryInfo = Util.geometryWithTexture(feat.getGeom(), imageLength,
imageHeigth);
if (geometryInfo == null) {
TexturedSurface.logger
.warn(Messages.getString("Representation.RepNulle"));
return;
}
// préparation de l'apparence
Appearance apparence = this.generateAppearance();
// Calcul de l'objet Shape3D
Shape3D shapepleine = new Shape3D(geometryInfo.getGeometryArray(),
apparence);
// Autorisations sur la Shape3D
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shapepleine.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
shapepleine.setCapability(Node.ALLOW_LOCALE_READ);
// Ajout au BgClone les elements transformes
this.bGRep.addChild(shapepleine);
// Optimisation
this.bGRep.compile();
}
示例10: addAxons
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
private void addAxons(TransformGroup objRoot) {
ngView.outPrintln(" processing axons geometry\n");
task.setMyProgress(0.3f);
Appearance appearance = new Appearance();
/*
float width = 1.0f;
boolean antialias = false;
appearance.setLineAttributes(new LineAttributes(width, LineAttributes.PATTERN_SOLID, antialias));
*/
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.2f);
myTA.setTransparencyMode(TransparencyAttributes.NICEST);
appearance.setTransparencyAttributes(myTA);
axonsShape3D = new Shape3D();
//axonsShape3D.removeGeometry(0);
axonsShape3D.removeAllGeometries();
axonsShape3D.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
axonsShape3D.setAppearance(appearance);
int cAx = 0, totalNumberOfAxonalSegments;
totalNumberOfAxonalSegments = net.getTotalNumOfAxonalSegments();
//logger.debug("totalNumberOfAxonalSegments: " + totalNumberOfAxonalSegments);
for (Neuron neuron : net.getNeuronList()) {
if (!neuron.collide() && collide) {
continue;
}
Section firstSection = neuron.getAxon().getFirstSection();
if (firstSection != null) {
Section.Iterator secIterator = firstSection.getIterator();
while (secIterator.hasNext()) {
Section section = secIterator.next();
Section.SectionType secType = section.getSectionType();
for (Segment segment : section.getSegments()) {
Point3f segStart = new Point3f(segment.getStart());
segStart.scale(scale);
Point3f segEnd = new Point3f(segment.getEnd());
segEnd.scale(scale);
LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
la.setCoordinate(0, segStart);
la.setCoordinate(1, segEnd);
/* old color
la.setColor(0, new Color3f(0.25f, 0.41f, 0.88f));
la.setColor(1, new Color3f(0.25f, 0.41f, 0.88f));
*/
Color3f color;// = Utils3D.darkgreyblue;
if (secType == Section.SectionType.MYELINIZED) {
//color = Utils3D.darkgreyblue;
color = Utils3D.darkOrange;
} else {
//color = Utils3D.turquoise1;
color = Utils3D.darkSalmon;
}
la.setColor(0, color);
la.setColor(1, color);
//lineArrayList.add(la);
axonsShape3D.addGeometry(la);
cAx++;
if (totalNumberOfAxonalSegments > 0) {
task.setMyProgress(0.3f + cAx * 0.2f / totalNumberOfAxonalSegments);
}
}
}
}
}
objRoot.addChild(axonsShape3D);
}
示例11: addDendrites
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
private void addDendrites(TransformGroup objRoot) {
ngView.outPrintln(" processing dendrites geometry\n");
Appearance appearance = new Appearance();
//float width = 1.0f * scale;
//boolean antialias = true;
//appearance.setLineAttributes(new LineAttributes(width, LineAttributes.PATTERN_SOLID, antialias));
dendritesShape3D = new Shape3D();
dendritesShape3D.removeAllGeometries();
dendritesShape3D.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
//dendritesShape3D.removeGeometry(0);
//dendritesShape3D.setAppearance(appearance);
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.2f);
myTA.setTransparencyMode(TransparencyAttributes.NICEST);
appearance.setTransparencyAttributes(myTA);
dendritesShape3D.setAppearance(appearance);
int cDen = 0, totalNumberOfDenSegments;
totalNumberOfDenSegments = net.getTotalNumOfDenSegments();
//logger.info("total number of dendrite segments: " + totalNumberOfDenSegments);
task.setMyProgress(0.5f);
for (Neuron neuron : net.getNeuronList()) {
if (!neuron.collide() && collide) {
continue;
}
for (Dendrite dendrite : neuron.getDendrites()) {
Section firstSection = dendrite.getFirstSection();
if (firstSection != null) {
Section.Iterator secIterator = firstSection.getIterator();
while (secIterator.hasNext()) {
Section section = secIterator.next();
Section.SectionType secType = section.getSectionType();
for (Segment segment : section.getSegments()) {
Point3f segStart = new Point3f(segment.getStart());
segStart.scale(scale);
Point3f segEnd = new Point3f(segment.getEnd());
segEnd.scale(scale);
LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
la.setCoordinate(0, segStart);
la.setCoordinate(1, segEnd);
Color3f denColor = Utils3D.darkOliveGreen3;
if (secType != null) {
if (secType.equals(Section.SectionType.APICAL)) {
//logger.info("this is an apical section");
denColor = Utils3D.magenta;
} else if (secType.equals(Section.SectionType.BASAL)) {
//logger.info("this is a basal section");
//denColor = Utils3D.mediumSpringGreen;
denColor = Utils3D.yellow;
} else if (secType.equals(Section.SectionType.OBLIQUE)) {
//logger.info("this is an oblique section");
denColor = Utils3D.brown1;
}
}
la.setColor(0, denColor);
la.setColor(1, denColor);
//lineArrayList.add(la);
/* old color
la.setColor(0, new Color3f(0.93f, 0.87f, 0.51f));
la.setColor(1, new Color3f(0.93f, 0.87f, 0.51f));
*/
dendritesShape3D.addGeometry(la);
cDen++;
if (totalNumberOfDenSegments > 0 && !Float.isInfinite(totalNumberOfDenSegments)) {
task.setMyProgress(0.5f + cDen * 0.3f / totalNumberOfDenSegments);
}
}
}
}
}
}
objRoot.addChild(dendritesShape3D);
}
示例12: CtBotShape
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
/**
* @param baseColor Farbe
* @param appearanceEventSource ThreeDBot
*/
public CtBotShape(Color baseColor, ThreeDBot appearanceEventSource) {
// Kann kollidieren -- Gilt auch fuer alle Kinder im Szenegraph
setPickable(true);
// "Kann kollidieren" waehrend der Anzeige noch aenderbar (World
// ruft auf uns spaeter setPickable() auf)
setCapability(Node.ALLOW_PICKABLE_WRITE);
// Form bauen
rightCheek = buildRightCheek();
addChild(rightCheek);
// Linke Backe: Shape der rechten, um 180 Grad gedreht
leftCheek = (Shape3D)rightCheek.cloneNode(false);
TransformGroup g = new TransformGroup(z180aboutCenter());
g.addChild(leftCheek);
addChild(g);
// Mittelteil
middle = buildMiddle();
addChild(middle);
// Appearances waehrend der Anzeige aenderbar
rightCheek.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
leftCheek .setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
middle .setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
if (baseColor != null) {
setMiddleColor(baseColor);
setCheeksColor(baseColor);
}
if (appearanceEventSource != null) {
appearanceEventSource.addAppearanceListener(new Runnable1<Color>() {
public void run(Color newAppearance) {
setCheeksColor(newAppearance);
}
});
}
}
示例13: manifestationAdded
import javax.media.j3d.Shape3D; //导入方法依赖的package包/类
@Override
public void manifestationAdded( RenderedManifestation rm )
{
// int[] /* AlgebraicVector */location = rm.getManifestation().getLocation();
// if ( location == null )
// location = rm.getShape().getField().origin( 3 );
RealVector loc = rm .getLocation();
if ( loc == null )
loc = new RealVector( 0d, 0d, 0d );
Appearance appearance = mFactory .getAppearance( rm.getColor(), rm.getGlow() > 0f, rm.getTransparency() > 0f );
Geometry geom = mFactory .makeSolidGeometry( rm );
if ( logger .isLoggable( Level.FINEST )
&& rm .getManifestation() == null )
{
Direction orbit = rm .getShape() .getOrbit();
String shape = ( orbit == null )? "BALL" : orbit .getName() + " strut";
logger .finest( shape + " at " + loc );
}
// if we rendering wireframe, we're using absolute coordinates
if ( ( geom instanceof PointArray ) || ( geom instanceof LineArray ) )
// location = rm.getShape().getField().origin( 3 );
loc = new RealVector( 0d, 0d, 0d );
Shape3D solidPolyhedron = new Shape3D( geom );
solidPolyhedron .setCapability( Shape3D.ALLOW_APPEARANCE_WRITE );
solidPolyhedron .setAppearance( appearance );
solidPolyhedron .setUserData( rm );
// omit this if trying to pre-optimize with makeGeometryAt
Transform3D move = new Transform3D();
move.setTranslation( new Vector3d( loc.x, loc.y, loc.z ) );
TransformGroup tg = new TransformGroup( move );
tg.setCapability( Group.ALLOW_CHILDREN_EXTEND );
tg.setCapability( Group.ALLOW_CHILDREN_READ );
tg.setCapability( Group.ALLOW_CHILDREN_WRITE );
tg.setCapability( BranchGroup.ALLOW_DETACH );
tg.setCapability( Shape3D.ENABLE_PICK_REPORTING );
tg.setPickable( true );
tg.addChild( solidPolyhedron );
if ( drawOutlines ) {
geom = mFactory .makeOutlineGeometry( rm );
Shape3D outlinePolyhedron = new Shape3D( geom );
outlinePolyhedron .setAppearance( mFactory .getOutlineAppearance() );
tg .addChild( outlinePolyhedron );
}
// Create a Text2D leaf node, add it to the scene graph.
// Text2D text2D = new Text2D( " label", new Color3f( 0.9f, 1.0f,
// 0.0f),
// "Helvetica", 36, Font.ITALIC );
// text2D .setRectangleScaleFactor( 0.02f );
// text2D .getGeometry() .setCapability( Geometry .ALLOW_INTERSECT );
// OrientedShape3D os3D = new OrientedShape3D();
// os3D .setGeometry( text2D.getGeometry() );
// os3D .setAppearance( text2D.getAppearance() );
// os3D .setAlignmentMode( OrientedShape3D.ROTATE_ABOUT_POINT );
// tg .addChild( os3D );
BranchGroup group = new BranchGroup();
group.setCapability( Group.ALLOW_CHILDREN_EXTEND );
group.setCapability( Group.ALLOW_CHILDREN_READ );
group.setCapability( Group.ALLOW_CHILDREN_WRITE );
group.setCapability( Node.ENABLE_PICK_REPORTING );
group.setCapability( BranchGroup.ALLOW_DETACH );
group.addChild( tg );
mScene.addChild( group );
if ( this .isSticky )
rm.setGraphicsObject( group );
}