本文整理汇总了Java中javax.media.j3d.View.attachViewPlatform方法的典型用法代码示例。如果您正苦于以下问题:Java View.attachViewPlatform方法的具体用法?Java View.attachViewPlatform怎么用?Java View.attachViewPlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.View
的用法示例。
在下文中一共展示了View.attachViewPlatform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import javax.media.j3d.View; //导入方法依赖的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;
}
示例2: createViewPlatform
import javax.media.j3d.View; //导入方法依赖的package包/类
void createViewPlatform() {
// viewplatform
viewPlatform = new ViewPlatform();
viewPlatform.setActivationRadius(100f);
viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
// view
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
view.setViewPolicy(View.SCREEN_VIEW);
view.attachViewPlatform(viewPlatform);
// physical body
PhysicalBody phyBody = new PhysicalBody();
view.setPhysicalBody(phyBody);
// physical environment
PhysicalEnvironment phyEnv = new PhysicalEnvironment();
view.setPhysicalEnvironment(phyEnv);
// ???? pas compris , pour l'antiliasing
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
// antialiasing
view.setSceneAntialiasingEnable(true);
/*
* to add a onscreen canvas canvas3d = new Canvas3D(config);
* view.addCanvas3D(canvas3d);
*/
// attach offscreen canvas to the view
offscreenCanvas3D = new OffScreenCanvas3D(config);
offscreenCanvas3D.getScreen3D().setSize(imageWidth, imageWidth);
offscreenCanvas3D.getScreen3D().setPhysicalScreenHeight(0.5);
offscreenCanvas3D.getScreen3D().setPhysicalScreenWidth(0.5);
view.addCanvas3D(offscreenCanvas3D);
addChild(viewPlatform);
// turn canvas in front of X axis
rotateY(-Math.PI / 2);
}
示例3: createViewPlatform
import javax.media.j3d.View; //导入方法依赖的package包/类
void createViewPlatform() {
// viewplatform
viewPlatform = new ViewPlatform();
viewPlatform.setActivationRadius(100f);
viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
// view
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
view.setViewPolicy(View.SCREEN_VIEW);
view.attachViewPlatform(viewPlatform);
// physical body
PhysicalBody phyBody = new PhysicalBody();
view.setPhysicalBody(phyBody);
// physical environment
PhysicalEnvironment phyEnv = new PhysicalEnvironment();
view.setPhysicalEnvironment(phyEnv);
// ???? pas compris , pour l'antiliasing
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
// antialiasing
view.setSceneAntialiasingEnable(true);
/*
* to add a onscreen canvas canvas3d = new Canvas3D(config);
* view.addCanvas3D(canvas3d);
*/
// attach offscreen canvas to the view
offscreenCanvas3D = new OffScreenCanvas3D(config);
offscreenCanvas3D.getScreen3D().setSize(imageWidth, imageWidth);
offscreenCanvas3D.getScreen3D().setPhysicalScreenHeight(0.5);
offscreenCanvas3D.getScreen3D().setPhysicalScreenWidth(0.5);
view.addCanvas3D(offscreenCanvas3D);
addChild(viewPlatform);
// turn canvas in front of X axis
rotateY(-Math.PI / 2);
}
示例4: createUniverse
import javax.media.j3d.View; //导入方法依赖的package包/类
/**
* Creates the universe to attach the scenegraph. Used only in the creation
* phase.
*
* @param ed
* the environment description.
*/
private void createUniverse(EnvironmentDescription ed) {
System.out.println("create Universe");
// show infos
Map map = VirtualUniverse.getProperties();
System.out.println("----------------------------------------");
System.out.println("j3d.version = " + map.get("j3d.version"));
System.out.println("j3d.vendor = " + map.get("j3d.vendor"));
System.out.println("j3d.specification.version = " + map.get("j3d.specification.version"));
System.out.println("j3d.specification.vendor = " + map.get("j3d.specification.vendor"));
System.out.println("j3d.renderer = " + map.get("j3d.renderer"));
System.out.println("J3DThreadPriority = " + VirtualUniverse.getJ3DThreadPriority());
System.out.println("----------------------------------------");
createCanvas3D();
createSceneBranch(ed);
universe = new VirtualUniverse();
Locale locale = new Locale(universe);
// Create and add VIEW branch
// locale->viewBranch->viewTransformGroup->viewPlatform
viewBranch = new BranchGroup();
viewTransformGroup = new TransformGroup();
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Transform3D t3d = new Transform3D();
t3d.setIdentity();
viewTransformGroup.setTransform(t3d);
viewBranch.addChild(viewTransformGroup);
// Creates View and viewplatform
viewPlatform = new ViewPlatform();
viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
viewPlatform.setActivationRadius(100);
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
view.setViewPolicy(View.SCREEN_VIEW);
view.setVisibilityPolicy(View.VISIBILITY_DRAW_ALL);
view.setFrontClipDistance(0.02);
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
template.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
/*
* GraphicsConfiguration config = GraphicsEnvironment
* .getLocalGraphicsEnvironment().getDefaultScreenDevice()
* .getBestConfiguration(template);
*/
// request antialiasing
view.setSceneAntialiasingEnable(true);
view.addCanvas3D(canvas3d);
PhysicalBody phyBody = new PhysicalBody();
PhysicalEnvironment phyEnv = new PhysicalEnvironment();
view.setPhysicalBody(phyBody);
view.setPhysicalEnvironment(phyEnv);
view.attachViewPlatform(viewPlatform);
viewTransformGroup.addChild(viewPlatform);
// Add both branch to the unique locale
locale.addBranchGraph(viewBranch);
locale.addBranchGraph(sceneBranch);
// Add mouse control in the canvas3d
mouseOrbiter = new MouseOrbiter(canvas3d, viewTransformGroup);
// sets initial viewpoint
changeViewPoint(ed.worldViewPoint, null);
}
示例5: createUniverse
import javax.media.j3d.View; //导入方法依赖的package包/类
/**
* Creates the universe to attach the scenegraph. Used only in the creation
* phase.
*
* @param ed
* the environment description.
*/
private void createUniverse(EnvironmentDescription ed) {
System.out.println("create Universe");
// show infos
Map map = VirtualUniverse.getProperties();
System.out.println("----------------------------------------");
System.out.println("j3d.version = " + map.get("j3d.version"));
System.out.println("j3d.vendor = " + map.get("j3d.vendor"));
System.out.println("j3d.specification.version = " + map.get("j3d.specification.version"));
System.out.println("j3d.specification.vendor = " + map.get("j3d.specification.vendor"));
System.out.println("j3d.renderer = " + map.get("j3d.renderer"));
System.out.println("J3DThreadPriority = " + VirtualUniverse.getJ3DThreadPriority());
System.out.println("----------------------------------------");
createCanvas3D();
createSceneBranch(ed);
universe = new VirtualUniverse();
Locale locale = new Locale(universe);
// Create and add VIEW branch
// locale->viewBranch->viewTransformGroup->viewPlatform
viewBranch = new BranchGroup();
viewTransformGroup = new TransformGroup();
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Transform3D t3d = new Transform3D();
t3d.setIdentity();
viewTransformGroup.setTransform(t3d);
viewBranch.addChild(viewTransformGroup);
// Creates View and viewplatform
viewPlatform = new ViewPlatform();
viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
viewPlatform.setActivationRadius(100);
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
view.setViewPolicy(View.SCREEN_VIEW);
view.setVisibilityPolicy(View.VISIBILITY_DRAW_ALL);
view.setFrontClipDistance(0.02);
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
template.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
/*
* GraphicsConfiguration config = GraphicsEnvironment
* .getLocalGraphicsEnvironment().getDefaultScreenDevice()
* .getBestConfiguration(template);
*/
// request antialiasing
view.setSceneAntialiasingEnable(true);
view.addCanvas3D(canvas3d);
PhysicalBody phyBody = new PhysicalBody();
PhysicalEnvironment phyEnv = new PhysicalEnvironment();
view.setPhysicalBody(phyBody);
view.setPhysicalEnvironment(phyEnv);
view.attachViewPlatform(viewPlatform);
viewTransformGroup.addChild(viewPlatform);
// Add both branch to the unique locale
locale.addBranchGraph(viewBranch);
locale.addBranchGraph(sceneBranch);
// Add mouse control in the canvas3d
mouseOrbiter = new MouseOrbiter(canvas3d, viewTransformGroup);
// sets initial viewpoint
changeViewPoint(ed.worldViewPoint, null);
}