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


Java Appearance.getPolygonAttributes方法代码示例

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


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

示例1: setBackFaceNormalFlip

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Sets whether all <code>Shape3D</code> children nodes of <code>node</code> should have 
 * their normal flipped or not.
 * Caution !!! Should be executed only once per instance 
 * @param backFaceNormalFlip <code>true</code> if normals should be flipped.
 */
private void setBackFaceNormalFlip(Node node, boolean backFaceNormalFlip)
{
	if (node instanceof Group)
	{
		// Set back face normal flip of all children
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			setBackFaceNormalFlip((Node) enumeration.nextElement(), backFaceNormalFlip);
		}
	}
	else if (node instanceof Link)
	{
		setBackFaceNormalFlip(((Link) node).getSharedGroup(), backFaceNormalFlip);
	}
	else if (node instanceof Shape3D)
	{
		Appearance appearance = ((Shape3D) node).getAppearance();
		if (appearance == null)
		{
			appearance = createAppearanceWithChangeCapabilities();
			((Shape3D) node).setAppearance(appearance);
		}
		PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
		if (polygonAttributes == null)
		{
			polygonAttributes = createPolygonAttributesWithChangeCapabilities();
			appearance.setPolygonAttributes(polygonAttributes);
		}
		
		// Change back face normal flip
		polygonAttributes.setBackFaceNormalFlip(
				backFaceNormalFlip ^ polygonAttributes.getCullFace() == PolygonAttributes.CULL_FRONT);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:42,代码来源:HomePieceOfFurniture3D.java

示例2: setAppearanceCapabilities

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private void setAppearanceCapabilities(Appearance appearance)
{
	// Allow future material and rendering attributes changes
	appearance.setCapability(Appearance.ALLOW_MATERIAL_READ);
	appearance.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
	Material material = appearance.getMaterial();
	if (material != null)
	{
		material.setCapability(Material.ALLOW_COMPONENT_READ);
	}
	appearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_READ);
	appearance.setCapability(Appearance.ALLOW_RENDERING_ATTRIBUTES_WRITE);
	appearance.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
	appearance.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);
	appearance.setCapability(Appearance.ALLOW_TEXGEN_READ);
	appearance.setCapability(Appearance.ALLOW_TEXGEN_WRITE);
	appearance.setCapability(Appearance.ALLOW_TEXTURE_READ);
	appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
	appearance.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
	appearance.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);
	appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_READ);
	appearance.setCapability(Appearance.ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE);
	PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
	if (polygonAttributes != null)
	{
		polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_READ);
		polygonAttributes.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);
		polygonAttributes.setCapability(PolygonAttributes.ALLOW_NORMAL_FLIP_READ);
		polygonAttributes.setCapability(PolygonAttributes.ALLOW_NORMAL_FLIP_WRITE);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:32,代码来源:HomePieceOfFurniture3D.java

示例3: DefaultMaterialAndTexture

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public DefaultMaterialAndTexture(Appearance appearance)
{
	this.material = appearance.getMaterial();
	this.transparencyAttributes = appearance.getTransparencyAttributes();
	this.polygonAttributes = appearance.getPolygonAttributes();
	this.texCoordGeneration = appearance.getTexCoordGeneration();
	this.texture = appearance.getTexture();
	this.textureAttributes = appearance.getTextureAttributes();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:10,代码来源:HomePieceOfFurniture3D.java

示例4: setCullFace

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Sets the cull face of all <code>Shape3D</code> children nodes of <code>node</code>.
 * @param cullFace <code>PolygonAttributes.CULL_FRONT</code> or <code>PolygonAttributes.CULL_BACK</code>
 */
private void setCullFace(Node node, boolean mirrored, boolean backFaceShown)
{
	if (node instanceof Group)
	{
		// Set cull face of all children
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			setCullFace((Node) enumeration.nextElement(), mirrored, backFaceShown);
		}
	}
	else if (node instanceof Link)
	{
		setCullFace(((Link) node).getSharedGroup(), mirrored, backFaceShown);
	}
	else if (node instanceof Shape3D)
	{
		Appearance appearance = ((Shape3D) node).getAppearance();
		if (appearance == null)
		{
			appearance = createAppearanceWithChangeCapabilities();
			((Shape3D) node).setAppearance(appearance);
		}
		PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
		if (polygonAttributes == null)
		{
			polygonAttributes = createPolygonAttributesWithChangeCapabilities();
			appearance.setPolygonAttributes(polygonAttributes);
		}
		
		// Change cull face 
		try
		{
			int cullFace = polygonAttributes.getCullFace();
			if (cullFace != PolygonAttributes.CULL_NONE)
			{
				Integer defaultCullFace = (Integer) polygonAttributes.getUserData();
				if (defaultCullFace == null)
				{
					polygonAttributes.setUserData(defaultCullFace = cullFace);
				}
				polygonAttributes
						.setCullFace((mirrored ^ backFaceShown ^ defaultCullFace == PolygonAttributes.CULL_FRONT)
								? PolygonAttributes.CULL_FRONT : PolygonAttributes.CULL_BACK);
			}
		}
		catch (CapabilityNotSetException ex)
		{
			// Shouldn't happen since capability is set but happens though with Java 3D 1.3
			ex.printStackTrace();
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:58,代码来源:HomePieceOfFurniture3D.java


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