本文整理汇总了Java中javax.media.j3d.Canvas3D类的典型用法代码示例。如果您正苦于以下问题:Java Canvas3D类的具体用法?Java Canvas3D怎么用?Java Canvas3D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Canvas3D类属于javax.media.j3d包,在下文中一共展示了Canvas3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Points3DPanel
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public Points3DPanel(PointsShape ptsShape) {
setLayout(new BorderLayout());
setOpaque(false);
setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
canvas3D.setFocusable(true);
canvas3D.requestFocus(); // the canvas now has focus, so receives key
// events
su = new SimpleUniverse(canvas3D);
createSceneGraph(ptsShape);
initUserPosition(); // set user's viewpoint
orbitControls(canvas3D); // controls for moving the viewpoint
su.addBranchGraph(sceneBG);
}
示例2: createCanvas3D
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
/**
* Creates the Canvas3D to visualize the 3D World. Used only in the creation
* phase.
*/
private void createCanvas3D() {
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
// create canvas
canvas3d = new Canvas3D(config);
canvas3d.setDoubleBufferEnable(true);
// display j3d info
Map map = canvas3d.queryProperties();
System.out.println("doubleBufferAvailable = " + map.get("doubleBufferAvailable"));
System.out.println("sceneAntialiasingNumPasses = " + map.get("sceneAntialiasingNumPasses"));
System.out.println("sceneAntialiasingAvailable = " + map.get("sceneAntialiasingAvailable"));
System.out.println("texture3DAvailable = " + map.get("texture3DAvailable"));
}
示例3: calcRenderSize
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
/**
* Returns the number of pixels drawn in the current display
*/
@Override
public double calcRenderSize(ScreenSizeCalculator screenSize, Canvas3D canvas)
{
int rSize = 0;
double area = 0.0;
Node renderNode = root;
screenSize.setScreenXform(canvas, renderNode);
// TODO: modify ScreenSizeCalculator to take convex poly instead of
// quad
return area;
}
示例4: main
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public static void main(String input[])
{
VirtualUniverse vu = new VirtualUniverse();
GraphicsConfigTemplate3D tmpl = new GraphicsConfigTemplate3D();
GraphicsEnvironment env = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
GraphicsConfiguration config = device.getBestConfiguration(tmpl);
Canvas3D can = new Canvas3D(config);
Map m = can.queryProperties();
Vector<Object> owner = new Vector<Object>();
owner.addAll(m.keySet());
ZebraJTable table = new ZebraJTable();
}
示例5: MainApp
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
/** Creates a new instance of MainApp
* Create a simple scene and attach it to the virtual universe
*
*/
public MainApp(String[] args) {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
// SimpleUniverse is a Convenience Utility class
simpleU = new SimpleUniverse(canvas3D);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
simpleU.getViewingPlatform().setNominalViewingTransform();
BranchGroup scene = createSceneGraph(args.length > 0);
orbitControls(canvas3D);
simpleU.addBranchGraph(scene);
}
示例6: initView
import javax.media.j3d.Canvas3D; //导入依赖的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;
}
示例7: Points3DPanel
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public Points3DPanel(PointsShape ptsShape) {
setLayout(new BorderLayout());
setOpaque(false);
setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
canvas3D.setFocusable(true);
canvas3D.requestFocus(); // the canvas now has focus, so receives key
// events
su = new SimpleUniverse(canvas3D);
createSceneGraph(ptsShape);
initUserPosition(); // set user's viewpoint
orbitControls(canvas3D); // controls for moving the viewpoint
su.addBranchGraph(sceneBG);
}
示例8: createCanvas3D
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
/**
* Creates the Canvas3D to visualize the 3D World. Used only in the creation
* phase.
*/
private void createCanvas3D() {
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
// create canvas
canvas3d = new Canvas3D(config);
canvas3d.setDoubleBufferEnable(true);
// display j3d info
Map map = canvas3d.queryProperties();
System.out.println("doubleBufferAvailable = " + map.get("doubleBufferAvailable"));
System.out.println("sceneAntialiasingNumPasses = " + map.get("sceneAntialiasingNumPasses"));
System.out.println("sceneAntialiasingAvailable = " + map.get("sceneAntialiasingAvailable"));
System.out.println("texture3DAvailable = " + map.get("texture3DAvailable"));
}
示例9: doPreview
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
@Override
public void doPreview() {
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
canvas.setPreferredSize(new Dimension(CANVAS_PREFERRED_WIDTH, CANVAS_PREFERRED_HEIGHT));
BranchGroup scene = createSceneGraph();
this.universe = new SimpleUniverse(canvas);
// Move the camera back on the z-axis
Transform3D cameraTransform = new Transform3D();
TransformGroup viewPlatformGroup = this.universe.getViewingPlatform().getViewPlatformTransform();
cameraTransform.setTranslation(new Vector3f(0, 0, CAMERA_Z_POSITION));
viewPlatformGroup.setTransform(cameraTransform);
// Necessary to see the whole model
this.universe.getViewer().getView().setBackClipDistance(BACK_CLIP_DISTANCE);
this.universe.addBranchGraph(scene);
super.preview.setCanvas(canvas, true);
}
示例10: Main3D
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public Main3D() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例11: MainPanel
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public MainPanel() {
setPreferredSize(new Dimension(WIDTH, HEIGHT));
setLayout(new BorderLayout());
// 3D���f����`�悷��L�����p�X���쐬
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add(canvas3D, BorderLayout.CENTER);
canvas3D.setFocusable(true);
canvas3D.requestFocus();
// ���E���쐬
universe = new SimpleUniverse(canvas3D);
createSceneGraph(); // ���E�i�V�[���O���t�j���\�z
initUserPosition(); // ���[�U�̎��_��������
orbitControls(canvas3D); // �}�E�X����
universe.addBranchGraph(sceneBG);
}
示例12: Main
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public Main() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例13: Main
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public Main() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
Transform3D viewPlatformTransform = new Transform3D();
viewPlatformTransform.setTranslation(new Vector3d(0.0, 0.0, 10.0));
universe.getViewingPlatform().getViewPlatformTransform().setTransform(viewPlatformTransform);
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例14: CrystalBall
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public CrystalBall() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例15: RotatingCube
import javax.media.j3d.Canvas3D; //导入依赖的package包/类
public RotatingCube() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
SimpleUniverse universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
universe.addBranchGraph(scene);
}