本文整理汇总了Java中javax.media.j3d.TransformGroup.setPickable方法的典型用法代码示例。如果您正苦于以下问题:Java TransformGroup.setPickable方法的具体用法?Java TransformGroup.setPickable怎么用?Java TransformGroup.setPickable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.TransformGroup
的用法示例。
在下文中一共展示了TransformGroup.setPickable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNode
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Fuegt eine Node ein
*
* @param node
* Die Node
* @param x
* X-Koordinate
* @param y
* Y-Koordinate
* @param z
* Z-Achse absolut; positiv ist vom Boden Richtung Bot +
* Betrachter, negativ vom Boden weg vom Betrachter
* @param bg
* BranchGropu, in die das Objekt rein soll
*/
public void addNode(Node node, float x, float y, float z, BranchGroup bg) {
Transform3D translate = new Transform3D();
translate.set(new Vector3d(x, y, z));
TransformGroup tg = new TransformGroup(translate);
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg.addChild(node);
TransformGroup tgObject = new TransformGroup();
tgObject.addChild(tg);
tgObject.setCapability(Node.ENABLE_PICK_REPORTING);
tgObject.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tgObject.setPickable(true);
bg.addChild(tgObject);
}
示例2: setParcours
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Erzeugt einen Szenegraphen mit Boden und Grenzen der Roboterwelt
* @param parc Der Parcours
*/
private void setParcours(Parcours parc) {
parcours = parc;
// Hindernisse werden an die richtige Position geschoben
// Zuerst werden sie gemeinsam so verschoben, dass ihre Unterkante genau
// buendig mit der Unterkante des Bodens ist:
Transform3D translate = new Transform3D();
translate.set(new Vector3d(0d, 0d, 0.2d - PLAYGROUND_THICKNESS));
TransformGroup obstTG = new TransformGroup(translate);
obstTG.setCapability(Node.ENABLE_PICK_REPORTING);
obstTG.setPickable(true);
obstBG.addChild(obstTG);
obstTG.addChild(parc.getObstBG());
lightBG.addChild(parc.getLightBG());
bpsBG.addChild(parc.getBpsBG());
terrainBG.addChild(parc.getTerrainBG());
obstBG.setCapability(Node.ENABLE_PICK_REPORTING);
obstBG.setCapability(Node.ALLOW_PICKABLE_READ);
}
示例3: init
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Initialisiert die Welt
*/
private void init() {
// Die Wurzel des Ganzen:
scene = new BranchGroup();
scene.setName("World");
scene.setUserData(new String("World"));
Transform3D worldTransform = new Transform3D();
worldTransform.setTranslation(new Vector3f(0.0f, 0.0f, -2.0f));
worldTG = new TransformGroup(worldTransform);
worldTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
worldTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
worldTG.setCapability(Node.ENABLE_PICK_REPORTING);
worldTG.setCapability(Node.ALLOW_PICKABLE_READ);
worldTG.setCapability(Group.ALLOW_CHILDREN_EXTEND);
worldTG.setPickable(true);
scene.addChild(worldTG);
// Lichtquellen einfuegen
// Streulicht (ambient light)
BoundingSphere ambientLightBounds = new BoundingSphere(new Point3d(0d, 0d, 0d), 100d);
Color3f ambientLightColor = new Color3f(0.33f, 0.33f, 0.33f);
AmbientLight ambientLightNode = new AmbientLight(ambientLightColor);
ambientLightNode.setInfluencingBounds(ambientLightBounds);
ambientLightNode.setEnable(true);
worldTG.addChild(ambientLightNode);
// Die Branchgroup fuer die Lichtquellen
lightBG = new BranchGroup();
lightBG.setCapability(Node.ALLOW_PICKABLE_WRITE);
lightBG.setPickable(true);
worldTG.addChild(lightBG);
// Die Branchgroup fuer BPS (IR-Licht)
bpsBG = new BranchGroup();
bpsBG.setPickable(true);
worldTG.addChild(this.bpsBG);
// Die Branchgroup fuer den Boden
terrainBG = new BranchGroup();
terrainBG.setCapability(Node.ALLOW_PICKABLE_WRITE);
terrainBG.setPickable(true);
worldTG.addChild(terrainBG);
// Damit spaeter Bots hinzugefuegt werden koennen:
obstBG = new BranchGroup();
obstBG.setCapability(Group.ALLOW_CHILDREN_EXTEND);
obstBG.setCapability(BranchGroup.ALLOW_DETACH);
obstBG.setCapability(Group.ALLOW_CHILDREN_WRITE);
obstBG.setCapability(Node.ALLOW_PICKABLE_WRITE);
obstBG.setPickable(true);
worldTG.addChild(obstBG);
int tickrate = 0;
try {
tickrate = Integer.parseInt(Config.getValue("ctSimTickRate"));
} catch (NumberFormatException exc) {
// NOP
}
setSimStepIntervalInMs(tickrate);
}
示例4: manifestationAdded
import javax.media.j3d.TransformGroup; //导入方法依赖的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 );
}