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

Java RenderingAttributes类代码示例

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

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



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

示例1: DebugVector

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
public DebugVector( Point3f location , Vector3f extent , Color3f color )
{
	ColoringAttributes ca = new ColoringAttributes( );
	ca.setCapability( ColoringAttributes.ALLOW_COLOR_WRITE );
	RenderingAttributes ra = new RenderingAttributes( );
	ra.setCapability( RenderingAttributes.ALLOW_VISIBLE_WRITE );
	TransparencyAttributes ta = new TransparencyAttributes( );
	ta.setTransparency( 0.3f );
	Appearance app = new Appearance( );
	app.setColoringAttributes( ca );
	app.setCapability( Appearance.ALLOW_COLORING_ATTRIBUTES_READ );
	app.setRenderingAttributes( ra );
	app.setCapability( Appearance.ALLOW_RENDERING_ATTRIBUTES_READ );
	shape.setAppearance( app );
	shape.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
	shape.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE );
	
	setVector( location , extent );
	setColor( color );
	
	addChild( shape );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:23,代码来源:DebugVector.java


示例2: maskAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
public static Appearance maskAppearance( )
{
	final Appearance app = new Appearance( );
	
	final TransparencyAttributes ta = new TransparencyAttributes( );
	ta.setTransparencyMode( TransparencyAttributes.BLENDED );
	ta.setSrcBlendFunction( TransparencyAttributes.BLEND_ZERO );
	ta.setDstBlendFunction( TransparencyAttributes.BLEND_ONE );
	app.setTransparencyAttributes( ta );
	
	final ColoringAttributes ca = new ColoringAttributes( );
	ca.setColor( new Color3f( 0 , 0 , 0 ) );
	app.setColoringAttributes( ca );
	
	final RenderingAttributes ra = new RenderingAttributes( );
	ra.setDepthBufferWriteEnable( true );
	app.setRenderingAttributes( ra );
	
	return app;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:21,代码来源:J3DUtils.java


示例3: getVertexCount

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Returns the total count of vertices in all geometries.
 */
private int getVertexCount(Node node)
{
	int count = 0;
	if (node instanceof Group)
	{
		// Enumerate all children
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			count += getVertexCount((Node) enumeration.nextElement());
		}
	}
	else if (node instanceof Link)
	{
		count = getVertexCount(((Link) node).getSharedGroup());
	}
	else if (node instanceof Shape3D)
	{
		Shape3D shape = (Shape3D) node;
		Appearance appearance = shape.getAppearance();
		RenderingAttributes renderingAttributes = appearance != null ? appearance.getRenderingAttributes() : null;
		if (renderingAttributes == null || renderingAttributes.getVisible())
		{
			for (int i = 0, n = shape.numGeometries(); i < n; i++)
			{
				Geometry geometry = shape.getGeometry(i);
				if (geometry instanceof GeometryArray)
				{
					count += ((GeometryArray) geometry).getVertexCount();
				}
			}
		}
	}
	return count;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:39,代码来源:ModelManager.java


示例4: createWallPartShape

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Returns a new wall part shape with no geometry  
 * and a default appearance with a white material.
 */
private Node createWallPartShape(boolean outline)
{
	Shape3D wallShape = new Shape3D();
	// Allow wall shape to change its geometry
	wallShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
	wallShape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
	wallShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
	
	Appearance wallAppearance = new Appearance();
	wallShape.setAppearance(wallAppearance);
	wallAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
	TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
	transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
	transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
	wallAppearance.setTransparencyAttributes(transparencyAttributes);
	wallAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
	RenderingAttributes renderingAttributes = new RenderingAttributes();
	renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
	wallAppearance.setRenderingAttributes(renderingAttributes);
	
	if (outline)
	{
		wallAppearance.setColoringAttributes(Object3DBranch.OUTLINE_COLORING_ATTRIBUTES);
		wallAppearance.setPolygonAttributes(Object3DBranch.OUTLINE_POLYGON_ATTRIBUTES);
		wallAppearance.setLineAttributes(Object3DBranch.OUTLINE_LINE_ATTRIBUTES);
	}
	else
	{
		wallAppearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
		wallAppearance.setMaterial(DEFAULT_MATERIAL);
		wallAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
		wallAppearance.setCapability(Appearance.ALLOW_TEXTURE_READ);
		// Mix texture and wall color
		wallAppearance.setTextureAttributes(MODULATE_TEXTURE_ATTRIBUTES);
	}
	return wallShape;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:42,代码来源:Wall3D.java


示例5: updateFilledWallSideAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Sets filled wall side appearance with its color, texture, transparency and visibility.
 */
private void updateFilledWallSideAppearance(final Appearance wallSideAppearance, final HomeTexture wallSideTexture,
		boolean waitTextureLoadingEnd, Integer wallSideColor, float shininess)
{
	if (wallSideTexture == null)
	{
		wallSideAppearance.setMaterial(getMaterial(wallSideColor, wallSideColor, shininess));
		wallSideAppearance.setTexture(null);
	}
	else
	{
		// Update material and texture of wall side
		wallSideAppearance.setMaterial(getMaterial(DEFAULT_COLOR, DEFAULT_AMBIENT_COLOR, shininess));
		final TextureManager textureManager = TextureManager.getInstance();
		textureManager.loadTexture(wallSideTexture.getImage(), wallSideTexture.getAngle(), waitTextureLoadingEnd,
				new TextureManager.TextureObserver()
				{
					public void textureUpdated(Texture texture)
					{
						wallSideAppearance.setTexture(getHomeTextureClone(texture, home));
					}
				});
	}
	// Update wall side transparency
	float wallsAlpha = this.home.getEnvironment().getWallsAlpha();
	TransparencyAttributes transparencyAttributes = wallSideAppearance.getTransparencyAttributes();
	transparencyAttributes.setTransparency(wallsAlpha);
	// If walls alpha is equal to zero, turn off transparency to get better results 
	transparencyAttributes
			.setTransparencyMode(wallsAlpha == 0 ? TransparencyAttributes.NONE : TransparencyAttributes.NICEST);
	// Update wall side visibility
	RenderingAttributes renderingAttributes = wallSideAppearance.getRenderingAttributes();
	HomeEnvironment.DrawingMode drawingMode = this.home.getEnvironment().getDrawingMode();
	renderingAttributes.setVisible(drawingMode == null || drawingMode == HomeEnvironment.DrawingMode.FILL
			|| drawingMode == HomeEnvironment.DrawingMode.FILL_AND_OUTLINE);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:39,代码来源:Wall3D.java


示例6: updateOutlineWallSideAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Sets outline wall side visibility.
 */
private void updateOutlineWallSideAppearance(final Appearance wallSideAppearance)
{
	// Update wall side visibility
	RenderingAttributes renderingAttributes = wallSideAppearance.getRenderingAttributes();
	HomeEnvironment.DrawingMode drawingMode = this.home.getEnvironment().getDrawingMode();
	renderingAttributes.setVisible(drawingMode == HomeEnvironment.DrawingMode.OUTLINE
			|| drawingMode == HomeEnvironment.DrawingMode.FILL_AND_OUTLINE);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:12,代码来源:Wall3D.java


示例7: setOutlineAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Sets the outline appearance on all the children of <code>node</code>.
 */
private void setOutlineAppearance(Node node)
{
	if (node instanceof Group)
	{
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			setOutlineAppearance((Node) enumeration.nextElement());
		}
	}
	else if (node instanceof Link)
	{
		setOutlineAppearance(((Link) node).getSharedGroup());
	}
	else if (node instanceof Shape3D)
	{
		Appearance outlineAppearance = new Appearance();
		((Shape3D) node).setAppearance(outlineAppearance);
		outlineAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
		RenderingAttributes renderingAttributes = new RenderingAttributes();
		renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
		outlineAppearance.setRenderingAttributes(renderingAttributes);
		outlineAppearance.setColoringAttributes(Object3DBranch.OUTLINE_COLORING_ATTRIBUTES);
		outlineAppearance.setPolygonAttributes(Object3DBranch.OUTLINE_POLYGON_ATTRIBUTES);
		outlineAppearance.setLineAttributes(Object3DBranch.OUTLINE_LINE_ATTRIBUTES);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:31,代码来源:HomePieceOfFurniture3D.java


示例8: createRoomPartShape

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Returns a new room part shape with no geometry  
 * and a default appearance with a white material.
 */
private Node createRoomPartShape()
{
	Shape3D roomShape = new Shape3D();
	// Allow room shape to change its geometry
	roomShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
	roomShape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
	roomShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
	
	Appearance roomAppearance = new Appearance();
	roomShape.setAppearance(roomAppearance);
	roomAppearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
	TransparencyAttributes transparencyAttributes = new TransparencyAttributes();
	transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
	transparencyAttributes.setCapability(TransparencyAttributes.ALLOW_MODE_WRITE);
	roomAppearance.setTransparencyAttributes(transparencyAttributes);
	roomAppearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
	RenderingAttributes renderingAttributes = new RenderingAttributes();
	renderingAttributes.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
	roomAppearance.setRenderingAttributes(renderingAttributes);
	roomAppearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
	roomAppearance.setMaterial(DEFAULT_MATERIAL);
	roomAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
	roomAppearance.setCapability(Appearance.ALLOW_TEXTURE_READ);
	// Mix texture and room color
	roomAppearance.setTextureAttributes(MODULATE_TEXTURE_ATTRIBUTES);
	
	return roomShape;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:33,代码来源:Room3D.java


示例9: SlicePlaneRenderer

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
public SlicePlaneRenderer(View view, Context context, Volume vol)
{
	super(view, context, vol);
	volRefPtAttr = (CoordAttr) context.getAttr("Vol Ref Pt");

	root = new BranchGroup();

	// subclasses add the slice geometry to root

	borderSwitch = new Switch(Switch.CHILD_ALL);
	borderSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);

	RenderingAttributes ra = new RenderingAttributes();
	ra.setDepthBufferEnable(true);
	ColoringAttributes bclr = new ColoringAttributes(0.4f, 0.4f, 0.4f,
			ColoringAttributes.SHADE_FLAT);
	Appearance ba = new Appearance();
	ba.setColoringAttributes(bclr);
	ba.setRenderingAttributes(ra);

	borderShape = new Shape3D(null, ba);
	borderShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);

	borderSwitch.addChild(borderShape);

	root.addChild(borderSwitch);

	root.setCapability(BranchGroup.ALLOW_DETACH);
	root.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:31,代码来源:SlicePlaneRenderer.java


示例10: debugAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
public static Appearance debugAppearance( Color4f color )
{
	final Appearance result = new Appearance( );
	setColor( result , color , false );
	setDepthTestFunction( result , RenderingAttributes.ALWAYS );
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:8,代码来源:J3DUtils.java


示例11: isVisible

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
public static boolean isVisible( Appearance app )
{
	final RenderingAttributes ra = app.getRenderingAttributes( );
	if( ra == null )
	{
		return true;
	}
	return ra.getVisible( );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:10,代码来源:J3DUtils.java


示例12: updateRoomPartAppearance

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
/**
 * Sets room part appearance with its color, texture and visibility.
 */
private void updateRoomPartAppearance(final Appearance roomPartAppearance, final HomeTexture roomPartTexture,
		boolean waitTextureLoadingEnd, Integer roomPartColor, float shininess, boolean visible,
		boolean ignoreTransparency)
{
	if (roomPartTexture == null)
	{
		roomPartAppearance.setMaterial(getMaterial(roomPartColor, roomPartColor, shininess));
		roomPartAppearance.setTexture(null);
	}
	else
	{
		// Update material and texture of room part
		roomPartAppearance.setMaterial(getMaterial(DEFAULT_COLOR, DEFAULT_AMBIENT_COLOR, shininess));
		final TextureManager textureManager = TextureManager.getInstance();
		textureManager.loadTexture(roomPartTexture.getImage(), roomPartTexture.getAngle(), waitTextureLoadingEnd,
				new TextureManager.TextureObserver()
				{
					public void textureUpdated(Texture texture)
					{
						texture = getHomeTextureClone(texture, home);
						if (roomPartAppearance.getTexture() != texture)
						{
							roomPartAppearance.setTexture(texture);
						}
					}
				});
	}
	if (!ignoreTransparency)
	{
		// Update room part transparency
		float upperRoomsAlpha = this.home.getEnvironment().getWallsAlpha();
		TransparencyAttributes transparencyAttributes = roomPartAppearance.getTransparencyAttributes();
		transparencyAttributes.setTransparency(upperRoomsAlpha);
		// If alpha is equal to zero, turn off transparency to get better results 
		transparencyAttributes.setTransparencyMode(
				upperRoomsAlpha == 0 ? TransparencyAttributes.NONE : TransparencyAttributes.NICEST);
	}
	// Update room part visibility
	RenderingAttributes renderingAttributes = roomPartAppearance.getRenderingAttributes();
	renderingAttributes.setVisible(visible);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:45,代码来源:Room3D.java


示例13: setup

import javax.media.j3d.RenderingAttributes; //导入依赖的package包/类
private void setup()
{
	// Can be used to make coordSys smaller TODO: specify in constructor
	Transform3D coordTrans = new Transform3D();
	coordTrans.setTranslation(translation);
	coordTrans.setScale(scale);
	setTransform(coordTrans);

	RenderingAttributes ra = new RenderingAttributes();
	ra.setDepthBufferEnable(true);

	LineArray xGeom = new LineArray(10, GeometryArray.COORDINATES);
	setupArrow(plusX, plusY, plusZ);
	xGeom.setCoordinates(0, line);
	ColoringAttributes xColoringAttributes = new ColoringAttributes(1.0f,
			0.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
	Appearance xAppearance = new Appearance();
	xAppearance.setColoringAttributes(xColoringAttributes);
	xAppearance.setRenderingAttributes(ra);
	Shape3D xShape = new Shape3D(xGeom, xAppearance);
	addChild(xShape);

	LineArray yGeom = new LineArray(10, GeometryArray.COORDINATES);
	setupArrow(plusY, plusX, plusZ);
	yGeom.setCoordinates(0, line);
	ColoringAttributes yColoringAttributes = new ColoringAttributes(0.0f,
			1.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
	Appearance yAppearance = new Appearance();
	yAppearance.setColoringAttributes(yColoringAttributes);
	yAppearance.setRenderingAttributes(ra);
	Shape3D yShape = new Shape3D(yGeom, yAppearance);
	addChild(yShape);

	LineArray zGeom = new LineArray(10, GeometryArray.COORDINATES);
	setupArrow(plusZ, plusX, plusY);
	zGeom.setCoordinates(0, line);
	ColoringAttributes zColoringAttributes = new ColoringAttributes(0.0f,
			0.0f, 1.0f, ColoringAttributes.SHADE_FLAT);
	Appearance zAppearance = new Appearance();
	zAppearance.setColoringAttributes(zColoringAttributes);
	zAppearance.setRenderingAttributes(ra);
	Shape3D zShape = new Shape3D(zGeom, zAppearance);
	addChild(zShape);

}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:46,代码来源:CoordSys.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Gist类代码示例发布时间:2022-05-22
下一篇:
Java LabelLayer类代码示例发布时间: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