• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Background类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.media.j3d.Background的典型用法代码示例。如果您正苦于以下问题:Java Background类的具体用法?Java Background怎么用?Java Background使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Background类属于javax.media.j3d包,在下文中一共展示了Background类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createBackgroundNode

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Returns a new background node.  
 */
private Node createBackgroundNode(boolean listenToHomeUpdates, final boolean waitForLoading)
{
	final Appearance backgroundAppearance = new Appearance();
	ColoringAttributes backgroundColoringAttributes = new ColoringAttributes();
	backgroundAppearance.setColoringAttributes(backgroundColoringAttributes);
	// Allow background color and texture to change
	backgroundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
	backgroundAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
	backgroundColoringAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
	
	Geometry halfSphereGeometry = createHalfSphereGeometry(true);
	final Shape3D halfSphere = new Shape3D(halfSphereGeometry, backgroundAppearance);
	BranchGroup backgroundBranch = new BranchGroup();
	backgroundBranch.addChild(halfSphere);
	backgroundBranch.addChild(new Shape3D(createHalfSphereGeometry(false)));
	
	final Background background = new Background(backgroundBranch);
	updateBackgroundColorAndTexture(backgroundAppearance, this.home, waitForLoading);
	background.setImageScaleMode(Background.SCALE_FIT_ALL);
	background.setApplicationBounds(new BoundingBox(new Point3d(-1E7, -1E7, -1E7), new Point3d(1E7, 1E7, 1E7)));
	
	if (listenToHomeUpdates)
	{
		// Add a listener on sky color and texture properties change 
		this.skyColorListener = new PropertyChangeListener()
		{
			public void propertyChange(PropertyChangeEvent ev)
			{
				updateBackgroundColorAndTexture(backgroundAppearance, home, waitForLoading);
			}
		};
		this.home.getEnvironment().addPropertyChangeListener(HomeEnvironment.Property.SKY_COLOR,
				this.skyColorListener);
		this.home.getEnvironment().addPropertyChangeListener(HomeEnvironment.Property.SKY_TEXTURE,
				this.skyColorListener);
	}
	return background;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:42,代码来源:HomeComponent3D.java


示例2: createBackgroundNode

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Returns the background node.  
 */
private Node createBackgroundNode()
{
	Background background = new Background(new Color3f(0.9f, 0.9f, 0.9f));
	background.setCapability(Background.ALLOW_COLOR_WRITE);
	background.setApplicationBounds(new BoundingSphere(new Point3d(0, 0, 0), 100));
	return background;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:11,代码来源:ModelPreviewComponent.java


示例3: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
private void addBackground()
// A blue sky
{
	Background back = new Background();
	back.setApplicationBounds(bounds);
	// back.setColor(0.17f, 0.65f, 0.92f); // sky colour
	back.setColor(0.0f, 0.0f, 0.0f); // sky colour
	sceneBG.addChild(back);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:10,代码来源:Points3DPanel.java


示例4: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
private void addBackground(BranchGroup objRoot) {
    Background bg = new Background();
    bg.setApplicationBounds(bounds);
    //bg.setColor(ColorUtil.skyBlue1); // blue sky
    bg.setColor(Utils3D.black);    // black sky
    // bg.setColor(1.0f, 1.0f, 1.0f);    // white
    objRoot.addChild(bg);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:9,代码来源:NeuGenVisualization.java


示例5: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
private void addBackground()
// A blue sky
{
  Background back = new Background();
  back.setApplicationBounds(bounds);
  // back.setColor(0.17f, 0.65f, 0.92f); // sky colour
  back.setColor(0.0f, 0.0f, 0.0f); // sky colour
  sceneBG.addChild(back);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:10,代码来源:Points3DPanel.java


示例6: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * ���sceneBG�ɒlj�
 */
private void addBackground() {
    Background back = new Background();
    back.setApplicationBounds(bounds);
    back.setColor(0.17f, 0.65f, 0.92f); // �‚���
    sceneBG.addChild(back);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:10,代码来源:MainPanel.java


示例7: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * ���sceneBG�ɒlj�
 */
private void addBackground() {
    Background back = new Background();
    back.setApplicationBounds(bounds);
    back.setColor(0.0f, 0.0f, 0.5f); // �‚���
    sceneBG.addChild(back);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:10,代码来源:MainPanel.java


示例8: applyBackgroundImage

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Paste the default background image
 * @param root root of the 3d scene
 * @param schedulingBounds bounds
 */
private void applyBackgroundImage(BranchGroup root, BoundingSphere schedulingBounds) {
    ClassLoader cl = this.getClass().getClassLoader();
    java.net.URL u = cl.getResource("org/objectweb/proactive/examples/nbody/common/fondnbody3d.jpg");
    final Image backGround = getToolkit().getImage(u);
    TextureLoader starsTexture = new TextureLoader(backGround, this);

    Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    double hauteur = tailleEcran.getHeight();
    double largeur = tailleEcran.getWidth();
    Background stars = new Background(starsTexture.getScaledImage((int) largeur, (int) hauteur));
    //Background stars = new Background (starsTexture.getScaledImage(10000,10000));
    stars.setApplicationBounds(schedulingBounds);
    root.addChild(stars);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:20,代码来源:NBody3DFrame.java


示例9: createSceneGraph

import javax.media.j3d.Background; //导入依赖的package包/类
BranchGroup createSceneGraph() {
  // Create the root of the branch graph
  BranchGroup objRoot = new BranchGroup();

  // Create a TransformGroup to scale the scene down by 3.5x
  // TODO: move view platform instead of scene using orbit behavior
  TransformGroup objScale = new TransformGroup();
  Transform3D scaleTrans = new Transform3D();
  //scaleTrans.set(1 / 3.5f); // scale down by 3.5x
  objScale.setTransform(scaleTrans);
  objRoot.addChild(objScale);

  // Create a TransformGroup and initialize it to the
  // identity. Enable the TRANSFORM_WRITE capability so that
  // the mouse behaviors code can modify it at runtime. Add it to the
  // root of the subgraph.
  TransformGroup objTrans = new TransformGroup();
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  objScale.addChild(objTrans);

  // Add the primitives to the scene
  objTrans.addChild(createLineTypes());

  BoundingSphere bounds = new BoundingSphere(new Point3d(), 100.0);    
  Background bg = new Background(new Color3f(1.0f, 1.0f, 1.0f));
  bg.setApplicationBounds(bounds);
  objTrans.addChild(bg);

  // set up the mouse rotation behavior
  MouseRotate mr = new MouseRotate();
  mr.setTransformGroup(objTrans);
  mr.setSchedulingBounds(bounds);
  mr.setFactor(0.007);
  objTrans.addChild(mr);

  // Set up the ambient light
  Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
  AmbientLight ambientLightNode = new AmbientLight(ambientColor);
  ambientLightNode.setInfluencingBounds(bounds);
  objRoot.addChild(ambientLightNode);

  // Set up the directional lights
  Color3f light1Color = new Color3f(1.0f, 1.0f, 1.0f);
  Vector3f light1Direction = new Vector3f(0.0f, -0.2f, -1.0f);

  DirectionalLight light1 = new DirectionalLight(light1Color,
      light1Direction);
  light1.setInfluencingBounds(bounds);
  objRoot.addChild(light1);

  return objRoot;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:54,代码来源:LineTypes.java


示例10: getBackground3D

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Renvoie les paramètres de fond de carte
 */
public Background getBackground3D() {
  return this.background3D;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:7,代码来源:InterfaceMap3D.java


示例11: setBackground

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Sets the background color.
 */
public void setBackground(Color backgroundColor)
{
	super.setBackground(backgroundColor);
	((Background) this.sceneTree.getChild(1)).setColor(new Color3f(backgroundColor));
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:9,代码来源:ModelPreviewComponent.java


示例12: createIcon

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Returns an icon created and scaled from piece model content.
 */
private Icon createIcon(BranchGroup modelNode, float pieceWidth, float pieceDepth, float pieceHeight)
{
	// Add piece model scene to a normalized transform group
	Transform3D scaleTransform = new Transform3D();
	scaleTransform.setScale(new Vector3d(2 / pieceWidth, 2 / pieceHeight, 2 / pieceDepth));
	TransformGroup modelTransformGroup = new TransformGroup();
	modelTransformGroup.setTransform(scaleTransform);
	modelTransformGroup.addChild(modelNode);
	// Replace model textures by clones because Java 3D doesn't accept all the time 
	// to share textures between offscreen and onscreen environments 
	cloneTexture(modelNode, new IdentityHashMap<Texture, Texture>());
	
	BranchGroup model = new BranchGroup();
	model.setCapability(BranchGroup.ALLOW_DETACH);
	model.addChild(modelTransformGroup);
	sceneRoot.addChild(model);
	
	// Render scene with a white background
	Background background = (Background) sceneRoot.getChild(0);
	background.setColor(1, 1, 1);
	canvas3D.renderOffScreenBuffer();
	canvas3D.waitForOffScreenRendering();
	BufferedImage imageWithWhiteBackgound = canvas3D.getOffScreenBuffer().getImage();
	int[] imageWithWhiteBackgoundPixels = getImagePixels(imageWithWhiteBackgound);
	
	// Render scene with a black background
	background.setColor(0, 0, 0);
	canvas3D.renderOffScreenBuffer();
	canvas3D.waitForOffScreenRendering();
	BufferedImage imageWithBlackBackgound = canvas3D.getOffScreenBuffer().getImage();
	int[] imageWithBlackBackgoundPixels = getImagePixels(imageWithBlackBackgound);
	
	// Create an image with transparent pixels where model isn't drawn
	for (int i = 0; i < imageWithBlackBackgoundPixels.length; i++)
	{
		if (imageWithBlackBackgoundPixels[i] != imageWithWhiteBackgoundPixels[i]
				&& imageWithBlackBackgoundPixels[i] == 0xFF000000
				&& imageWithWhiteBackgoundPixels[i] == 0xFFFFFFFF)
		{
			imageWithWhiteBackgoundPixels[i] = 0;
		}
	}
	
	sceneRoot.removeChild(model);
	return new ImageIcon(Toolkit.getDefaultToolkit()
			.createImage(new MemoryImageSource(imageWithWhiteBackgound.getWidth(),
					imageWithWhiteBackgound.getHeight(), imageWithWhiteBackgoundPixels, 0,
					imageWithWhiteBackgound.getWidth())));
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:53,代码来源:PlanComponent.java


示例13: createSceneBranch

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Creates the branch for the visible content of the scenegraph. Used only
 * in the creation phase.
 */
private void createSceneBranch(EnvironmentDescription wd) {

	sceneBranch = new BranchGroup();
	sceneRot = new TransformGroup();
	sceneRot.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	sceneRot.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	sceneRot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
	// add transform
	sceneTrans = new TransformGroup();
	// allow transform access
	sceneTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	sceneTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	sceneTrans.setCapability(Group.ALLOW_CHILDREN_EXTEND);
	sceneBranch.addChild(sceneRot);
	sceneRot.addChild(sceneTrans);

	// bounds (lights,background, behaviors)
	BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), worldSize * 3);

	// background
	Color3f bgColor = wd.backgroundColor;
	Background bgNode = new Background(bgColor);
	bgNode.setApplicationBounds(bounds);
	sceneTrans.addChild(bgNode);

	// ambient light
	TransformGroup tga = new TransformGroup();
	AmbientLight ambientLight = new AmbientLight(wd.ambientLightColor);
	ambientLight.setInfluencingBounds(bounds);
	tga.addChild(ambientLight);
	sceneBranch.addChild(tga);

	// directional lights
	light1 = addLight(wd.light1Position, wd.light1Color);
	light2 = addLight(wd.light2Position, wd.light2Color);
	light1.setEnable(wd.light1IsOn);
	light2.setEnable(wd.light2IsOn);

	createFloor(wd);
	if (wd.hasAxis)
		createAxis();

	pickableSceneBranch = new BranchGroup();
	sceneTrans.addChild(pickableSceneBranch);
	pickableSceneBranch.setCapability(Group.ALLOW_CHILDREN_EXTEND);
	pickableSceneBranch.setCapability(BranchGroup.ALLOW_DETACH);
	pickableSceneBranch.setCapability(Group.ALLOW_CHILDREN_WRITE);

}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:54,代码来源:World.java


示例14: addBackground

import javax.media.j3d.Background; //导入依赖的package包/类
private void addBackground(BranchGroup objRoot) {
    Background background = new Background(backgroundColor);
    background.setApplicationBounds(boundingSphere);
    objRoot.addChild(background);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:6,代码来源:VRLDensityVisualization.java


示例15: createSceneGraph

import javax.media.j3d.Background; //导入依赖的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


示例16: createSceneBranch

import javax.media.j3d.Background; //导入依赖的package包/类
/**
 * Creates the branch for the visible content of the scenegraph. Used only in
 * the creation phase.
 */
private void createSceneBranch(EnvironmentDescription wd) {

  sceneBranch = new BranchGroup();
  sceneRot = new TransformGroup();
  sceneRot.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  sceneRot.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  sceneRot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
  // add transform
  sceneTrans = new TransformGroup();
  // allow transform access
  sceneTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  sceneTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  sceneTrans.setCapability(Group.ALLOW_CHILDREN_EXTEND);
  sceneBranch.addChild(sceneRot);
  sceneRot.addChild(sceneTrans);

  // bounds (lights,background, behaviors)
  BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), worldSize * 3);

  // background
  Color3f bgColor = wd.backgroundColor;
  Background bgNode = new Background(bgColor);
  bgNode.setApplicationBounds(bounds);
  sceneTrans.addChild(bgNode);

  // ambient light
  TransformGroup tga = new TransformGroup();
  AmbientLight ambientLight = new AmbientLight(wd.ambientLightColor);
  ambientLight.setInfluencingBounds(bounds);
  tga.addChild(ambientLight);
  sceneBranch.addChild(tga);

  // directional lights
  light1 = addLight(wd.light1Position, wd.light1Color);
  light2 = addLight(wd.light2Position, wd.light2Color);
  light1.setEnable(wd.light1IsOn);
  light2.setEnable(wd.light2IsOn);

  createFloor(wd);
  if (wd.hasAxis)
    createAxis();

  pickableSceneBranch = new BranchGroup();
  sceneTrans.addChild(pickableSceneBranch);
  pickableSceneBranch.setCapability(Group.ALLOW_CHILDREN_EXTEND);
  pickableSceneBranch.setCapability(BranchGroup.ALLOW_DETACH);
  pickableSceneBranch.setCapability(Group.ALLOW_CHILDREN_WRITE);

}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:54,代码来源:World.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Priority类代码示例发布时间:2022-05-22
下一篇:
Java Monitors类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap