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


Java Appearance类代码示例

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


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

示例1: create3D

import javax.media.j3d.Appearance; //导入依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
	Appearance appear = new Appearance();

	material.setCapability(Material.ALLOW_COMPONENT_WRITE);
	material.setDiffuseColor(color);
	material.setSpecularColor(black);
	appear.setMaterial(material);
	int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;

	body = new Sphere(radius, flags, appear);

	// we must be able to change the pick flag of the agent
	body.setCapability(Node.ALLOW_PICKABLE_READ);
	body.setCapability(Node.ALLOW_PICKABLE_WRITE);
	body.setPickable(true);
	body.setCollidable(true);
	addChild(body);

	// Add bounds for interactions
	Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
	setBounds(bounds);

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

示例2: buildScene

import javax.media.j3d.Appearance; //导入依赖的package包/类
@Override
void buildScene(TransformGroup transformGroup) {
    transformGroup.addChild(getColorBackground(new Color(.905f, .905f, 0.95f)));
    Appearance appearance = new Appearance();
    Material mat = new Material();
    mat.setAmbientColor(0.5f, 0.5f, 0.5f);
    mat.setDiffuseColor(1.0f, 1.0f, 1.0f);
    mat.setEmissiveColor(0.0f, 0.0f, 0.0f);
    mat.setSpecularColor(1.0f, 1.0f, 1.0f);
    mat.setShininess(80.0f);
    appearance.setMaterial(mat);

    TransparencyAttributes ta = new TransparencyAttributes();
    ta.setTransparency(0.5f);
    ta.setTransparencyMode(TransparencyAttributes.BLENDED);
    appearance.setTransparencyAttributes(ta);

    transformGroup.addChild(new Box(0.6f, 0.5f, 0.4f, appearance));

    transformGroup.addChild(getPointLight(new Color(1.0f, 1.0f, 1.0f), new Point3f(2.0f, 2.0f, 2.0f)));
    transformGroup.addChild(getAmbientLight(new Color(0.1f, 0.1f, 0.1f)));
    transformGroup.setTransform(getTransform(new Vector3f(0.3f, 0.3f, 0.3f), 0.75, -1, Math.PI / 4.0d));
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:24,代码来源:LightningExample.java

示例3: createCompass

import javax.media.j3d.Appearance; //导入依赖的package包/类
public static Group createCompass() {
  Appearance ap = Compass.generateAppearance(Color.pink, 0.5, true);
  Cone c = new Cone(1f, 5f, ap);

  Transform3D tf = new Transform3D();
  tf.rotX(Math.PI / 2);

  Transform3D tf1 = new Transform3D();
  tf1.setTranslation(new Vector3d(10, 15, -40));

  TransformGroup tg = new TransformGroup(tf);
  tg.addChild(c);

  TransformGroup tg2 = new TransformGroup(tf1);
  tg2.addChild(tg);

  return tg2;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:19,代码来源:Compass.java

示例4: RepresentationTin

import javax.media.j3d.Appearance; //导入依赖的package包/类
public RepresentationTin(ITriangulatedSurface tin, Color[] colorShade,
    int method) {
  super();
  this.nbClasses = colorShade.length;
  Box3D b = new Box3D(tin.coord());
  this.zMin = b.getLLDP().getZ();
  this.zMax = b.getURDP().getZ();
  this.colorShade = toColor3f(colorShade);
  this.method = METHOD_LINEAR;
  this.tin = tin;
  GeometryInfo geoInfo = fromOrientableSToTriangleArray();

  Appearance app = new Appearance();

  ColoringAttributes at = new ColoringAttributes();
  at.setShadeModel(ColoringAttributes.NICEST);

  app.setColoringAttributes(at);

  this.bGRep.addChild(new Shape3D(geoInfo.getGeometryArray(), app));

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:23,代码来源:RepresentationTin.java

示例5: checkAppearancesName

import javax.media.j3d.Appearance; //导入依赖的package包/类
/** 
 * Ensures that all the appearance of the children shapes of the 
 * given <code>node</code> have a name.
 */
public void checkAppearancesName(Node node)
{
	// Search appearances used by node shapes keeping their enumeration order 
	Set<Appearance> appearances = new LinkedHashSet<Appearance>();
	searchMaterials(node, appearances);
	int i = 0;
	for (Appearance appearance : appearances)
	{
		try
		{
			if (appearance.getName() == null)
			{
				appearance.setName("Texture_" + ++i);
			}
		}
		catch (NoSuchMethodError ex)
		{
			// Don't support HomeMaterial with Java 3D < 1.4 where appearance name was added
			break;
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:27,代码来源:ModelManager.java

示例6: searchMaterials

import javax.media.j3d.Appearance; //导入依赖的package包/类
private void searchMaterials(Node node, Set<Appearance> appearances)
{
	if (node instanceof Group)
	{
		// Enumerate children
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			searchMaterials((Node) enumeration.nextElement(), appearances);
		}
	}
	else if (node instanceof Link)
	{
		searchMaterials(((Link) node).getSharedGroup(), appearances);
	}
	else if (node instanceof Shape3D)
	{
		Appearance appearance = ((Shape3D) node).getAppearance();
		if (appearance != null)
		{
			appearances.add(appearance);
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:25,代码来源:ModelManager.java

示例7: getTextureCoordinates

import javax.media.j3d.Appearance; //导入依赖的package包/类
/**
 * Returns a texture coordinates generator that wraps the given texture on front face.
 */
private TexCoordGeneration getTextureCoordinates(Appearance appearance, HomeTexture texture, Vector3f pieceSize,
		BoundingBox modelBounds)
{
	Point3d lower = new Point3d();
	modelBounds.getLower(lower);
	Point3d upper = new Point3d();
	modelBounds.getUpper(upper);
	float minimumSize = ModelManager.getInstance().getMinimumSize();
	float textureWidth = TextureManager.getInstance().getRotatedTextureWidth(texture);
	float textureHeight = TextureManager.getInstance().getRotatedTextureHeight(texture);
	float sx = pieceSize.x / (float) Math.max(upper.x - lower.x, minimumSize) / textureWidth;
	float sw = texture.isLeftToRightOriented() ? (float) -lower.x * sx : 0;
	float ty = pieceSize.y / (float) Math.max(upper.y - lower.y, minimumSize) / textureHeight;
	float tz = pieceSize.z / (float) Math.max(upper.z - lower.z, minimumSize) / textureHeight;
	float tw = texture.isLeftToRightOriented() ? (float) (-lower.y * ty + upper.z * tz) : 0;
	return new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR, TexCoordGeneration.TEXTURE_COORDINATE_2,
			new Vector4f(sx, 0, 0, sw), new Vector4f(0, ty, -tz, tw));
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:22,代码来源:HomePieceOfFurniture3D.java

示例8: parseMaterialStream

import javax.media.j3d.Appearance; //导入依赖的package包/类
/**
 * Parses a map of appearances parsed from the given stream. 
 */
private static Map<String, Appearance> parseMaterialStream(Reader reader, URL baseUrl, Boolean useCaches)
		throws IOException
{
	Map<String, Appearance> appearances = new HashMap<String, Appearance>();
	Appearance currentAppearance = null;
	StreamTokenizer tokenizer = createTokenizer(reader);
	while (tokenizer.nextToken() != StreamTokenizer.TT_EOF)
	{
		switch (tokenizer.ttype)
		{
			case StreamTokenizer.TT_WORD:
				currentAppearance = parseMaterialLine(tokenizer, appearances, currentAppearance, baseUrl,
						useCaches);
				break;
			case StreamTokenizer.TT_EOL:
				break;
			default:
				throw new IncorrectFormatException(
						"Unexpected token " + tokenizer.sval + " at row " + tokenizer.lineno());
		}
	}
	return appearances;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:27,代码来源:OBJLoader.java

示例9: create3D

import javax.media.j3d.Appearance; //导入依赖的package包/类
void create3D(float size) {
	super.create3D(true);
	// lamp body
	onColor = new Color3f(0.1f, 1f, 1f);
	offColor = new Color3f(0.3f, 0.3f, 0.3f);
	blinkColor = new Color3f(1f, 0.3f, 0.3f);
	Appearance appear = new Appearance();
	material = new Material();
	material.setAmbientColor(offColor);
	material.setDiffuseColor(offColor);
	material.setCapability(Material.ALLOW_COMPONENT_WRITE);
	material.setSpecularColor(offColor);
	material.setColorTarget(Material.DIFFUSE);
	appear.setMaterial(material);
	Node node = new com.sun.j3d.utils.geometry.Cylinder(size, size, appear);
	node.setCollidable(false);
	node.setPickable(false);
	addChild(node);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:20,代码来源:LampActuator.java

示例10: create3D

import javax.media.j3d.Appearance; //导入依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
	Appearance appear = new Appearance();

	material.setDiffuseColor(color);
	material.setSpecularColor(black);
	appear.setMaterial(material);
	int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;

	body = new Sphere(radius, flags, appear);

	// we must be able to change the pick flag of the agent
	body.setCapability(Node.ALLOW_PICKABLE_READ);
	body.setCapability(Node.ALLOW_PICKABLE_WRITE);
	body.setPickable(true);
	body.setCollidable(true);
	addChild(body);

	// Add bounds for interactions
	Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
	setBounds(bounds);

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

示例11: Segment3D

import javax.media.j3d.Appearance; //导入依赖的package包/类
public Segment3D() {
        super();
        Appearance ap = new Appearance();
        ColoringAttributes ca = new ColoringAttributes();
        ca.setColor(Utils3D.grey);
        ap.setColoringAttributes(ca);
        /*TransparencyAttributes myTA = new TransparencyAttributes();
        myTA.setTransparency(0.7f);
        myTA.setTransparencyMode(TransparencyAttributes.FASTEST);
        ap.setTransparencyAttributes(myTA);*/
//		render the Box as a wire frame
/*PolygonAttributes polyAttrbutes = new PolygonAttributes();
        polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
        polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
        ap.setPolygonAttributes(polyAttrbutes);*/
        setAppearance(ap);
    }
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:18,代码来源:Segment3D.java

示例12: Triangle3dCreator

import javax.media.j3d.Appearance; //导入依赖的package包/类
/**
     * Creates a new instance of Triangle3dCreator color the color of the
     * triangle
     */
    public Triangle3dCreator(Color3f color) {
        this.triangleColor = color;
        this.triangleAppearance = new Appearance();

        // ca werden nicht benoetigt
        // ColoringAttributes ca = new ColoringAttributes();
        // ca.setColor(triangleColor);
        // this.triangleAppearance.setColoringAttributes(ca);

        TransparencyAttributes ta = new TransparencyAttributes(TransparencyAttributes.FASTEST, 0.5f);
        this.triangleAppearance.setTransparencyAttributes(ta);

//		Material material = new Material();
//		material.setAmbientColor(color);
//		material.setShininess(0.5f);
//		material.setLightingEnable(true);
//		this.triangleAppearance.setMaterial(material);

        this.triangleContainer = new Shape3D();
        this.triangleContainer.setAppearance(triangleAppearance);
        triangleContainer.removeGeometry(0);
    }
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:27,代码来源:Triangle3dCreator.java

示例13: Triangle3dCreator

import javax.media.j3d.Appearance; //导入依赖的package包/类
/**
 * Creates a new instance of Triangle3dCreator color the color of the
 * triangle
 */
public Triangle3dCreator(Color3f color) {
    this.triangleColor = color;
    this.triangleAppearance = new Appearance();

    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(triangleColor);
    this.triangleAppearance.setColoringAttributes(ca);

    TransparencyAttributes ta = new TransparencyAttributes();
    ta.setTransparency(0.5f);
    this.triangleAppearance.setTransparencyAttributes(ta);

    this.triangleContainer = new Shape3D();
    triangleContainer.removeGeometry(0);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:20,代码来源:Triangle3dCreator.java

示例14: TorusSegment

import javax.media.j3d.Appearance; //导入依赖的package包/类
/** Create general torus segment. 
  * @param rmin        radius of inner torus' circle
  * @param rmax        radous of outer torus' circle
  * @param rtor        central radius
  * @param phimin      starting azimutal angle [deg]
  * @param phimax      ending   azimutal angle [deg]
  * @param granularity number of segments of curves approximations
  * @param appearance  object' Appearance
  * @preconditions phimin > 0 && phimin < 360
  * @preconditions phimax > 0 && phimax < 360
  * @preconditions phimin < phimax
  * @preconditions rmin < rmax 
  * @preconditions rtor < rmax 
  * @preconditions granularity > 1 */
public TorusSegment(double rmin,
                    double rmax,
                    double rtor,
                    double phimin,
                    double phimax,
                    int granularity,
                    Appearance appearance) {
  construct(rmin,
            rmax,
            rtor,
            phimin,
            phimax,
            granularity,
            appearance);
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:30,代码来源:TorusSegment.java

示例15: ConeSegment

import javax.media.j3d.Appearance; //导入依赖的package包/类
/** Create general cone segment.
  * @param rminm       inner radius at -z/2 
  * @param rminp       inner radius at +z/2 
  * @param rmaxm       outer radius at -z/2 
  * @param rmaxp       outer radius at +z/2 
  * @param l           length
  * @param phimin      starting azimutal angle [deg] 
  * @param phimax      ending   azimutal angle [deg]
  * @param granularity number of segments of curves approximations
  * @param appearance  object' Appearance 
  * @preconditions rminm < rmaxm
  * @preconditions rminp < rmaxp
  * @preconditions phimin > 0 && phimin < 360
  * @preconditions phimax > 0 && phimax < 360
  * @preconditions phimin < phimax
  * @preconditions granularity > 1 */
public ConeSegment(double rminm,
                   double rminp,
                   double rmaxm,
                   double rmaxp,
                   double l,
                   double phimin,
                   double phimax,
                   int granularity,
                   Appearance appearance) {
  construct(rminm,
            rminp,
            rmaxm,
            rmaxp,
            l,
            phimin,
            phimax,
            granularity,
            appearance);
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:36,代码来源:ConeSegment.java


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