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


Java BranchGroup.addChild方法代码示例

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


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

示例1: generateRepresentation

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static BranchGroup generateRepresentation(IGeometry geom,
    List<CG_AbstractSurfaceData> lCGA) {

  if (geom instanceof GM_MultiSolid<?>) {

    return CG_StylePreparator.generateRepresentation(
        (GM_MultiSolid<GM_Solid>) geom, lCGA);
  } else if (geom instanceof GM_Solid) {
    return CG_StylePreparator.generateRepresentation((GM_Solid) geom, lCGA);
  } else if (geom instanceof GM_MultiSurface<?>) {
    return CG_StylePreparator.generateRepresentation(
        (GM_MultiSurface<GM_OrientableSurface>) geom, lCGA);

  } else if (geom instanceof GM_OrientableSurface) {

    BranchGroup bg = new BranchGroup();
    bg.addChild(CG_StylePreparator.generateRepresentation(
        (GM_OrientableSurface) geom, lCGA));

    return bg;

  }
  return null;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:26,代码来源:CG_StylePreparator.java

示例2: createSceneTree

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * Returns a new scene tree root.
 */
private BranchGroup createSceneTree(boolean displayShadowOnFloor, boolean listenToHomeUpdates,
		boolean waitForLoading)
{
	BranchGroup root = new BranchGroup();
	// Build scene tree
	root.addChild(createHomeTree(displayShadowOnFloor, listenToHomeUpdates, waitForLoading));
	root.addChild(createBackgroundNode(listenToHomeUpdates, waitForLoading));
	Node groundNode = createGroundNode(-0.5E7f, -0.5E7f, 1E7f, 1E7f, listenToHomeUpdates, waitForLoading);
	root.addChild(groundNode);
	
	this.defaultLights = createLights(groundNode, listenToHomeUpdates);
	for (Light light : this.defaultLights)
	{
		root.addChild(light);
	}
	
	return root;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:22,代码来源:HomeComponent3D.java

示例3: J3dTest

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
public J3dTest(){  
  // 创建一个虚拟空间  
    SimpleUniverse universe = new SimpleUniverse();  
    // 创建一个用来包含对象的数据结构  
    BranchGroup group = new BranchGroup();  
     
    // 创建一个球并把它加入到group中  
    Sphere sphere = new Sphere(0.5f); // 小球的半径为0.5米  
    group.addChild(sphere);  
     
    Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);  
    // 设置光线的颜色  
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);  
    // 设置光线的作用范围  
    Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);  
    // 设置光线的方向  
    DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);  
    // 指定颜色和方向,产生单向光源  
    light1.setInfluencingBounds(bounds);  
    // 把光线的作用范围加入光源中  
    group.addChild(light1);  
    // 将光源加入group组,安放观察点  
    universe.getViewingPlatform().setNominalViewingTransform();  
    // 把group加入到虚拟空间中  
    universe.addBranchGraph(group);  
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:27,代码来源:J3dTest.java

示例4: initView

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

示例5: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
public BranchGroup createSceneGraph() {
    BranchGroup objRoot = new BranchGroup();
    /*
    mover = moveBack(1.0d);
    spinner = createSpinner();
    objRoot.addChild(mover);
    mover.addChild(spinner);
     *
     */
    spinner = createSpinner();
    objRoot.addChild(spinner);

    addNeurons(spinner);
    addRegion(spinner);
    //spinner.addChild(makeSpin(spinner));
    //setLightingNet(mover);
    setLightingNet(spinner);
    addBackground(objRoot);
    addKeyNavigator(objRoot);
    return objRoot;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:22,代码来源:NeuGenVisualization.java

示例6: addNode

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

示例7: CheckerFloor

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
public CheckerFloor()
// create tiles, add origin marker, then the axes labels
{
  ArrayList<Point3f> blueCoords = new ArrayList<Point3f>();
  ArrayList<Point3f> greenCoords = new ArrayList<Point3f>();
  floorBG = new BranchGroup();

  boolean isBlue;
  for (int z = -FLOOR_LEN / 2; z <= (FLOOR_LEN / 2) - 1; z++) {
    isBlue = (z % 2 == 0) ? true : false; // set colour for new row
    for (int x = -FLOOR_LEN / 2; x <= (FLOOR_LEN / 2) - 1; x++) {
      if (isBlue)
        createCoords(x, z, blueCoords);
      else
        createCoords(x, z, greenCoords);
      isBlue = !isBlue;
    }
  }
  floorBG.addChild(new ColouredTiles(blueCoords, blue));
  floorBG.addChild(new ColouredTiles(greenCoords, green));

  addOriginMarker();
  labelAxes();
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:25,代码来源:CheckerFloor.java

示例8: 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

示例9: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * �V�[�����\�z����
 * 
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // �����ŃV�[�����쐬����

    // ���ˉ��{�[����lj�
    Ball ball = new Ball(0, 0, 0, 0.05, 0.02, -0.03);
    BallBehavior ballBehavior = new BallBehavior(ball, 50);
    bg.addChild(ball);
    bg.addChild(ballBehavior);

    // ����lj�
    bg.addChild(createBox());

    // ������lj�
    bg.addChild(createAmbientLight());
    bg.addChild(createDirectionalLight());

    return bg;
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:26,代码来源:Main.java

示例10: Floor

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
public Floor() {
    floorBG = new BranchGroup();

    Appearance app = new Appearance();
    
    // ��
    Material mat = new Material();
    mat.setAmbientColor(new Color3f(1.0f, 1.0f, 0.0f));  // ���F
    mat.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
    app.setMaterial(mat);

    // �����쐬
    Box floor = new Box(10.0f, 0.001f, 10.0f, app);

    floorBG.addChild(floor);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:17,代码来源:Floor.java

示例11: createSceneGraph

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * �V�[�����\�z����
 * 
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // �����ŃV�[�����쐬����

    // �{�[����lj�
    Ball ball = new Ball(0, 20.0, 0);
    BallBehavior ballBehavior = new BallBehavior(ball, 20);
    bg.addChild(ball);
    bg.addChild(ballBehavior);

    // ����lj�
    bg.addChild(createFloor());

    // ������lj�
    bg.addChild(createAmbientLight());
    bg.addChild(createDirectionalLight());
    
    return bg;
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:26,代码来源:Main.java

示例12: 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

示例13: createHeadlight

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

示例14: addAmbientLight

import javax.media.j3d.BranchGroup; //导入方法依赖的package包/类
/**
 * Add 3 directional lights (a primary and 2 secondary) to increase 3D sensation
 * @param root where to add the lights
 * @param bounds bounds
 */
private void addAmbientLight(BranchGroup root, BoundingSphere bounds) {
    // Lumiere principale
    Color3f lightColor1 = new Color3f(1.0f, 1.0f, 1.0f);
    Vector3f lightDirection1 = new Vector3f(2.0f, -3.0f, -6.0f);
    DirectionalLight light1 = new DirectionalLight(lightColor1, lightDirection1);
    light1.setInfluencingBounds(bounds);
    root.addChild(light1);

    // Lumiere de support 1
    Color3f lightColor2 = new Color3f(0.25f, 0.25f, 0.25f);
    Vector3f lightDirection2 = new Vector3f(-2.0f, 3.0f, 6.0f);
    DirectionalLight light2 = new DirectionalLight(lightColor2, lightDirection2);
    light2.setInfluencingBounds(bounds);
    root.addChild(light2);

    // Lumiere de support 2
    Color3f lightColor3 = new Color3f(0.3f, 0.3f, 0.3f);
    Vector3f lightDirection3 = new Vector3f(2.0f, -3.0f, 6.0f);
    DirectionalLight light3 = new DirectionalLight(lightColor3, lightDirection3);
    light3.setInfluencingBounds(bounds);
    root.addChild(light3);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:28,代码来源:NBody3DFrame.java

示例15: createPlaneteTraces

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


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