本文整理汇总了Java中javax.media.j3d.TransformGroup.setCapability方法的典型用法代码示例。如果您正苦于以下问题:Java TransformGroup.setCapability方法的具体用法?Java TransformGroup.setCapability怎么用?Java TransformGroup.setCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.TransformGroup
的用法示例。
在下文中一共展示了TransformGroup.setCapability方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initView
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
private static BranchGroup initView( View view, TransformGroup trans, Canvas3D canvas )
{
ViewPlatform vp = new ViewPlatform();
trans .setCapability( TransformGroup .ALLOW_TRANSFORM_WRITE );
BranchGroup bg = new BranchGroup();
bg .addChild( trans );
trans .addChild( vp );
view .addCanvas3D( canvas );
view .setPhysicalBody( new PhysicalBody() );
view .setPhysicalEnvironment( new PhysicalEnvironment() );
view .attachViewPlatform( vp );
view .setFrontClipPolicy( View.VIRTUAL_EYE );
view .setBackClipPolicy( View.VIRTUAL_EYE );
view .setScreenScalePolicy( View .SCALE_EXPLICIT );
return bg;
}
示例4: createSceneGraph
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Creates a scene graph for the 3D model, translates the model on the
* y-axis by {@code MODEL_Y_POSITION} and sets the rotation.
*
* @return a BranchGroup for the 3D model.
*/
private BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRoot.addChild(objTrans);
// Move the shape down on the y-axis
TransformGroup moveDownGroup = new TransformGroup();
Transform3D moveDownTrans = new Transform3D();
moveDownTrans.setTranslation(new Vector3f(0, MODEL_Y_POSITION, 0));
moveDownGroup.setTransform(moveDownTrans);
objTrans.addChild(moveDownGroup);
moveDownGroup.addChild(this.shape3d);
// Rotate the shape
Transform3D yAxis = new Transform3D();
Alpha rotationAlpha = new Alpha(-1, ROTATION_ALPHA_DURATION);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0, (float) Math.PI * 2.0f);
BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), ROTATOR_SPHERE_RADIUS);
rotator.setSchedulingBounds(bounds);
objRoot.addChild(rotator);
objRoot.compile();
return objRoot;
}
示例5: createHeadlight
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
protected void createHeadlight( )
{
final Color3f lightColor = new Color3f( 0.9f , 0.9f , 0.9f );
final DirectionalLight light = new DirectionalLight( );
light.setCapability( Light.ALLOW_STATE_WRITE );
light.setColor( lightColor );
final BoundingSphere worldBounds = new BoundingSphere( new Point3d( 0.0 , 0.0 , 0.0 ) , 100000.0 ); // Center, Extent
light.setInfluencingBounds( worldBounds );
m_headlight = light;
final BranchGroup bg = new BranchGroup( );
m_lightGroup = new TransformGroup( );
m_lightGroup.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
bg.addChild( m_lightGroup );
m_lightGroup.addChild( m_headlight );
m_transformGroup.addChild( bg );
}
示例6: createPlaneteTraces
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Called to create ghosts of the body
* Ghost are the ancien position of a body
* (slows down the java3D tree creation)
* @param root where to add these ghost
* @param i body to be ghosted
* @param a appearance of the ghosts
*/
private void createPlaneteTraces(BranchGroup root, int i, Appearance a) {
for (int j = 0; j < (this.MAX_HISTO_SIZE - 1); j++) {
// Trace Transformation Group
TransformGroup traceGroup = new TransformGroup();
traceGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
this.tracesGroup[i][j] = traceGroup;
// Trace Transformation (place and direction)
Transform3D traceTransformation = new Transform3D();
this.tracesTransformation[i][j] = traceTransformation;
// Cylinder representing a segment
//Cylinder(float radius, float height, Appearance ap)
Sphere ghost = new Sphere(0.005f, a);
//Assembling group
traceGroup.addChild(ghost);
//traceGroup.setTransform(traceTransformation);
root.addChild(traceGroup);
}
}
示例7: createUniverse
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Returns a new 3D universe that displays <code>home</code> objects.
*/
private SimpleUniverse createUniverse(boolean displayShadowOnFloor, boolean listenToHomeUpdates,
boolean waitForLoading)
{
// Create a universe bound to no canvas 3D
ViewingPlatform viewingPlatform = new ViewingPlatform();
// Add an interpolator to view transform to get smooth transition
TransformGroup viewPlatformTransform = viewingPlatform.getViewPlatformTransform();
CameraInterpolator cameraInterpolator = new CameraInterpolator(viewPlatformTransform);
cameraInterpolator.setSchedulingBounds(new BoundingSphere(new Point3d(), 1E7));
viewPlatformTransform.addChild(cameraInterpolator);
viewPlatformTransform.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
Viewer viewer = new Viewer(new Canvas3D[0]);
SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);
View view = viewer.getView();
view.setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);
// Update field of view from current camera
updateView(view, this.home.getCamera(), this.home.getTopCamera() == this.home.getCamera());
// Update point of view from current camera
updateViewPlatformTransform(viewPlatformTransform, this.home.getCamera(), false);
// Add camera listeners to update later point of view from camera
if (listenToHomeUpdates)
{
addCameraListeners(view, viewPlatformTransform);
}
// Link scene matching home to universe
universe.addBranchGraph(createSceneTree(displayShadowOnFloor, listenToHomeUpdates, waitForLoading));
return universe;
}
示例8: createModelTree
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Returns the root of model tree.
*/
private Node createModelTree()
{
TransformGroup modelTransformGroup = new TransformGroup();
// Allow transform group to have new children
modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_READ);
modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_WRITE);
modelTransformGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
// Allow the change of the transformation that sets model size and position
modelTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
return modelTransformGroup;
}
示例9: rotateNode
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public TransformGroup rotateNode(Node n) {
Transform3D transRot = new Transform3D();
TransformGroup tg = new TransformGroup();
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
tg.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
Vector3f cross2 = new Vector3f(1.0f, 0.0f, 0.0f);
transRot.setRotation(new AxisAngle4f(cross2, (float) Math.toRadians(90)));
tg.setTransform(transRot);
return tg;
}
示例10: CanvasPickInfoListener
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public CanvasPickInfoListener() {
Appearance app = new Appearance();
Material mat = new Material();
mat.setAmbientColor(Utils3D.green);
mat.setSpecularColor(Utils3D.skyblue);
mat.setDiffuseColor(Utils3D.darkBlue);
//a,e,d,s
app.setMaterial(mat);
//greenlook.setMaterial(new Material(objColor, Utils3D.black, objColor, Utils3D.white, 128.0f));
sphere = new Sphere(0.004f, Primitive.GENERATE_NORMALS, 100, app);
sphere.setPickable(false);
t3d = new Transform3D();
sphTrans = new TransformGroup(t3d);
//sphTrans = new TransformGroup();
sphTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
sphTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// Add sphere, transform
sphTrans.addChild(sphere);
sceneBG.addChild(sphTrans);
pickCanvas = new PickCanvas(canvas3D, sceneBG);
pickCanvas.setTolerance(3.5f);
pickCanvas.setMode(PickInfo.PICK_GEOMETRY);
pickCanvas.setFlags(PickInfo.LOCAL_TO_VWORLD | PickInfo.CLOSEST_GEOM_INFO | PickInfo.NODE);
}
示例11: createSceneGraph
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* �V�[�����\�z����
* @return BG
*/
public BranchGroup createSceneGraph() {
BranchGroup bg = new BranchGroup();
// ��]�pTG
TransformGroup spinTG = new TransformGroup();
spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// ��]�^��
Alpha rotationAlpha = new Alpha(-1, 4000);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,
spinTG);
// �͈͂��w��
BoundingSphere bounds = new BoundingSphere();
rotator.setSchedulingBounds(bounds);
spinTG.addChild(rotator);
// �g���C�t�H�[�X
Triforce triforce = new Triforce();
spinTG.addChild(triforce.getBG()); // spinTG�ɒlj��I
bg.addChild(spinTG);
return bg;
}
示例12: createSceneGraph
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public BranchGroup createSceneGraph() {
BranchGroup bg = new BranchGroup();
// �L���[�u���X����
Transform3D rotate = new Transform3D();
Transform3D tempRotate = new Transform3D();
rotate.rotX(Math.PI / 4.0);
tempRotate.rotY(Math.PI / 4.0);
rotate.mul(tempRotate);
TransformGroup rotateTG = new TransformGroup(rotate);
// �L���[�u����]����
TransformGroup spinTG = new TransformGroup();
spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// �J���[�L���[�u���쐬����spinTG�ɒlj�
ColorCube cube = new ColorCube(0.4);
spinTG.addChild(cube);
// ��]�^��
Alpha rotationAlpha = new Alpha(-1, 4000);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, spinTG);
// �͈͂��w��
BoundingSphere bounds = new BoundingSphere();
rotator.setSchedulingBounds(bounds);
spinTG.addChild(rotator);
rotateTG.addChild(spinTG);
bg.addChild(rotateTG);
return bg;
}
示例13: createPlanete
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Create a group componsed of a sphere and different transform group + a hostname label
* @param root where adding the "sphere group" in 3D scene
* @param i body to represent
* @param a appearance of the sphere which represent the body
*/
private void createPlanete(BranchGroup root, int i, Appearance a) {
// Creation of the Root Animation Node of the planet
TransformGroup planeteAnimationGroup = new TransformGroup();
planeteAnimationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
translationsGroup[i] = planeteAnimationGroup;
// Allow to Translate the Node of the planet
Transform3D translationPlanete = new Transform3D();
translations[i] = translationPlanete;
// Creating floating hostname label near the planet
BranchGroup lGroup = new BranchGroup();
lGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
lGroup.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
lGroup.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
labels[i] = lGroup;
// Rotation of the planet on itself
TransformGroup planeteRotationGroup = new TransformGroup();
planeteRotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Alpha planeteRotationAlpha = new Alpha(-1, 4000);
RotationInterpolator rotator = new RotationInterpolator(planeteRotationAlpha, planeteRotationGroup);
rotator.setSchedulingBounds(new BoundingSphere(new Point3d(0, 0, 0), 999999999));
planetesScalingGroup[i] = planeteRotationGroup;
// Allow to change the Scale of the sphere representing the planet
Transform3D planeteScaling = new Transform3D();
planeteRotationGroup.setTransform(planeteScaling);
planetesScaling[i] = planeteScaling;
// Creation of the sphere representing the planete
Sphere planete = new Sphere(0.01f, Sphere.GENERATE_NORMALS, 80, a);
// Assembling java3D nodes
planeteRotationGroup.addChild(planete);
planeteAnimationGroup.addChild(lGroup);
planeteAnimationGroup.addChild(planeteRotationGroup);
root.addChild(planeteAnimationGroup);
}
示例14: enableMouseNavigation
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
/**
* Create a TransformGroup where it is possible to navigate through using the mouse.
* Move
* <li>+ Left Click : Rotate</li>
* <li>+ Right Click: Translate</li>
* <li>+ Left Click + Right Click: Zoom In/Out</li>
*
* MouseWheel:
* <li>Zoom In/out</li>
* @param root First Branch Group of the 3D scene
* @param bounds bounds of the scene
* @return return a Transform Group when navigation with mouse is possible
*/
private TransformGroup enableMouseNavigation(BranchGroup root, BoundingSphere bounds) {
TransformGroup manipulator = new TransformGroup();
manipulator.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// Rotation a la souris
MouseRotate rotateBehavior = new MouseRotate();
rotateBehavior.setTransformGroup(manipulator);
rotateBehavior.setSchedulingBounds(bounds);
manipulator.addChild(rotateBehavior);
// Translation
MouseTranslate translateBehavior = new MouseTranslate();
translateBehavior.setTransformGroup(manipulator);
translateBehavior.setSchedulingBounds(bounds);
manipulator.addChild(translateBehavior);
// Zoom Molette
MouseWheelZoom wheelZoomBehavior = new MouseWheelZoom();
wheelZoomBehavior.setTransformGroup(manipulator);
wheelZoomBehavior.setSchedulingBounds(bounds);
manipulator.addChild(wheelZoomBehavior);
// Zoom Souris
MouseZoom zoomBehavior = new MouseZoom();
zoomBehavior.setTransformGroup(manipulator);
zoomBehavior.setSchedulingBounds(bounds);
manipulator.addChild(zoomBehavior);
root.addChild(manipulator);
return manipulator;
}
示例15: KinematicObject
import javax.media.j3d.TransformGroup; //导入方法依赖的package包/类
public KinematicObject(World world) {
super(world);
rotation.setIdentity();
transformGroup = new TransformGroup();
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
transform = new Transform3D();
transformGroup.setTransform(transform);
branchGroup = new BranchGroup();
branchGroup.addChild(transformGroup);
}