当前位置: 首页>>代码示例>>Java>>正文


Java BranchGroup.compile方法代码示例

本文整理汇总了Java中javax.media.j3d.BranchGroup.compile方法的典型用法代码示例。如果您正苦于以下问题:Java BranchGroup.compile方法的具体用法?Java BranchGroup.compile怎么用?Java BranchGroup.compile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.j3d.BranchGroup的用法示例。


在下文中一共展示了BranchGroup.compile方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的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;
}
 
开发者ID:nerdouille,项目名称:silvie,代码行数:29,代码来源:ModelPreviewer.java

示例2: Main3D

import javax.media.j3d.BranchGroup; //导入方法依赖的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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:Main3D.java

示例3: Main

import javax.media.j3d.BranchGroup; //导入方法依赖的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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:Main.java

示例4: Main

import javax.media.j3d.BranchGroup; //导入方法依赖的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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:24,代码来源:Main.java

示例5: CrystalBall

import javax.media.j3d.BranchGroup; //导入方法依赖的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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:CrystalBall.java

示例6: RotatingCube

import javax.media.j3d.BranchGroup; //导入方法依赖的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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:18,代码来源:RotatingCube.java

示例7: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * ���E���\�z
 */
private void createSceneGraph() {
    // sceneBG�ɂ��낢��ڑ����邱�ƂŐ��E���\�������
    sceneBG = new BranchGroup();
    // ���E�͈̔́i�����Ȃǂ̋y�Ԕ͈́j
    bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUND_SIZE);

    lightScene(); // ������sceneBG�ɒlj�
    addBackground(); // ���sceneBG�ɒlj�

    // ���W����lj�
    Axis axis = new Axis();
    sceneBG.addChild(axis.getBG());

    sceneBG.compile();
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:19,代码来源:MainPanel.java

示例8: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * initialize the scene
 * 
 * @param ptsShape
 */
private void createSceneGraph(PointsShape ptsShape) {
	sceneBG = new BranchGroup(); // global?
	bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUNDSIZE);

	lightScene(); // add the lights
	addBackground(); // add the sky
	// sceneBG.addChild(new CheckerFloor().getBG()); // add the floor

	addPointsShape(ptsShape);
	addKinectShape();

	sceneBG.compile(); // fix the scene
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:19,代码来源:Points3DPanel.java

示例9: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * initialize the scene
 * 
 * @param ptsShape
 */
private void createSceneGraph(PointsShape ptsShape) {
  sceneBG = new BranchGroup(); // global?
  bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUNDSIZE);

  lightScene(); // add the lights
  addBackground(); // add the sky
  // sceneBG.addChild(new CheckerFloor().getBG()); // add the floor

  addPointsShape(ptsShape);
  addKinectShape();

  sceneBG.compile(); // fix the scene
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:19,代码来源:Points3DPanel.java

示例10: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * ���E���\�z
 */
private void createSceneGraph() {
    // sceneBG�ɂ��낢��ڑ����邱�ƂŐ��E���\�������
    sceneBG = new BranchGroup();
    // ���E�͈̔́i�����Ȃǂ̋y�Ԕ͈́j
    bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUND_SIZE);

    lightScene(); // ������sceneBG�ɒlj�
    addBackground(); // ���sceneBG�ɒlj�
    addSphere(); // ����lj�

    sceneBG.compile();
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:16,代码来源:MainPanel.java

示例11: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * ���E���\�z
 */
private void createSceneGraph() {
    // sceneBG�ɂ��낢��ڑ����邱�ƂŐ��E���\�������
    sceneBG = new BranchGroup();
    // ���E�͈̔́i�����Ȃǂ̋y�Ԕ͈́j
    bounds = new BoundingSphere(new Point3d(0, 0, 0), BOUND_SIZE);

    lightScene(); // ������sceneBG�ɒlj�
    addBackground(); // ���sceneBG�ɒlj�
    
    Floor floor = new Floor();
    sceneBG.addChild(floor.getBG());

    sceneBG.compile();
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:18,代码来源:MainPanel.java

示例12: writeLabel

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * Used to write a text next to the sphere representing a body
 * @param i the body identification
 * @param label the text to write
 */
private void writeLabel(int i, String label, double diameter) {
    labels[i].removeAllChildren();

    if (label.compareTo("") != 0) {
        // Creating
        BranchGroup bg = new BranchGroup();
        bg.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
        bg.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
        bg.setCapability(BranchGroup.ALLOW_DETACH);

        // Translating & scaling
        TransformGroup labelGroup = new TransformGroup();
        Transform3D scaling = new Transform3D();
        scaling.setTranslation(new Vector3d(0.01 + ((0.005 * diameter) / MASS_RATIO),
            0.01 + ((0.005 * diameter) / MASS_RATIO), 0.0));
        //scaling.setTranslation(new Vector3d(0.15,0.15,0.0));
        scaling.setScale(0.5);
        labelGroup.setTransform(scaling);

        // Assembling and creating the text2D
        labelGroup.addChild(new Text2D(label, new Color3f(1.0f, 1.0f, 1.0f), "Arial", 14, Font.PLAIN));
        bg.addChild(labelGroup);
        bg.compile();

        labels[i].addChild(bg);
    }
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:33,代码来源:NBody3DFrame.java

示例13: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
public BranchGroup createSceneGraph(boolean wireFrame) {

        int VOV_L = 42; // dimensions of volume of voxels 50
        int VOV_W = 42;
        int VOV_H = 42;

        BranchGroup contentRoot = new BranchGroup();
        ColorUtil.addCoordinateSphereAxesToSceneGraph(contentRoot, 0.01f);

        VolumeOfVoxels vv = new VolumeOfVoxels(VOV_L, VOV_W, VOV_H);
        vv.fillVolumeOfSphere(true);

        /* Simple visualization by triangles */

        Vector<Triangle> triangleVector = new Vector<Triangle>();
        Util.triangulation(vv.getVoxelsValueAsFloatArray(), VOV_L, VOV_W, VOV_H, triangleVector);
        Triangle3dCreator triangleCreator = new Triangle3dCreator(ColorUtil.grey);

        for (Triangle t : triangleVector) {
            triangleCreator.addTriangleToContainer(
                    t.getP1AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H),
                    t.getP2AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H),
                    t.getP3AsScaledPoint3f(1.0f / VOV_L, 1.0f / VOV_W, 1.0f / VOV_H));
            //t.printData();
        }
        contentRoot.addChild(triangleCreator.getTriangleContainer());


        /* Simple visualization by boxes */
        Material mat = new Material();
        mat.setEmissiveColor(ColorUtil.red);
        Cube3dCreator cubeCreator = new Cube3dCreator(0.05f, 0.05f, 0.05f, mat, 0.0f);
        // vv.addAllTagedVoxelsToContainer(cubeCreator);
        contentRoot.addChild(cubeCreator.getCubeContainer());

        /* For cube testing */
        contentRoot.addChild(cubeCreator.getCubeAsShapeOfQuadArrays(0.1f, 0.1f, 0.1f));
        contentRoot.addChild(cubeCreator.getCubeAsBox(0.15f, 0.15f, 0.15f));

        Background background = new Background(new ImageComponent2D(ImageComponent2D.FORMAT_RGB,
                ColorUtil.createColoredGradientImage(FrameWidth, FrameHeight)));
        background.setApplicationBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0));
        contentRoot.addChild(background);

        contentRoot.compile();
        return contentRoot;
    }
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:48,代码来源:MainApp.java

示例14: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
private BranchGroup createSceneGraph() {
	BranchGroup objRoot = new BranchGroup();
	
	//Set up node for rotating the surface based on mouse drags
	TransformGroup objTransform = new TransformGroup();
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	
	//Set up node for translating and scaling the surface
	TransformGroup surfaceTranslate = new TransformGroup();
	TransformGroup surfaceScale = new TransformGroup();
	surfaceTranslate.setBoundsAutoCompute(true);
	surfaceScale.setBoundsAutoCompute(true);
	
	surfaceTranslate.addChild(new Surface(_organism, 32, 32));
	BoundingSphere bSphere = new BoundingSphere(surfaceTranslate.getBounds());
	Point3d center = new Point3d();
	bSphere.getCenter(center);
	double radius = bSphere.getRadius();
	
	Matrix3d rotate = new Matrix3d();
	rotate.setIdentity();
	Vector3d translate = new Vector3d(center);
	translate.negate();
	double scale = 1/radius;
	
	surfaceTranslate.setTransform(new Transform3D(rotate,translate,1.0));
	surfaceScale.setTransform(new Transform3D(rotate,new Vector3d(),scale));
	surfaceScale.addChild(surfaceTranslate);
	
	//random rotation
	Transform3D rotX = new Transform3D();
	Transform3D rotY = new Transform3D();
	Transform3D rotZ = new Transform3D();
	rotX.rotX(2*Math.PI*Math.random());
	rotY.rotY(2*Math.PI*Math.random());
	rotZ.rotZ(2*Math.PI*Math.random());
	
	rotX.mul(rotY);
	rotX.mul(rotZ);
	
	TransformGroup randRot = new TransformGroup(rotX);
	randRot.addChild(surfaceScale);
	
	//Add nodes to root tree
	objTransform.addChild(randRot);
	objRoot.addChild(objTransform);
	
	//Set up lights
	DirectionalLight dirLight = 
		new DirectionalLight(new Color3f(.9f,.9f,.9f),new Vector3f(0,0,-1));
	dirLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(dirLight);
	
	AmbientLight ambLight = new AmbientLight(new Color3f(.3f,.3f,.3f));
	ambLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(ambLight);
	
	//Set up mouse interactions
	MouseRotate myMouseRotate = new MouseRotate();
	myMouseRotate.setTransformGroup(objTransform);
	myMouseRotate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseRotate);
    
	MouseZoom myMouseZoom = new MouseZoom();
	myMouseZoom.setTransformGroup(objTransform);
	myMouseZoom.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseZoom);
	
	MouseTranslate myMouseTranslate = new MouseTranslate();
	myMouseTranslate.setTransformGroup(objTransform);
	myMouseTranslate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseTranslate);
	
    objRoot.compile();
    
	return objRoot;
}
 
开发者ID:wolfmanstout,项目名称:jene,代码行数:79,代码来源:SurfacePanel.java


注:本文中的javax.media.j3d.BranchGroup.compile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。