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


Java Appearance.setTexCoordGeneration方法代码示例

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


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

示例1: restoreDefaultTextureCoordinatesGeneration

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Restores default texture coordinates generation of the given <code>appearance</code>.
 */
private void restoreDefaultTextureCoordinatesGeneration(Appearance appearance)
{
	DefaultMaterialAndTexture defaultMaterialAndTexture = (DefaultMaterialAndTexture) appearance.getUserData();
	if (defaultMaterialAndTexture != null)
	{
		appearance.setTexCoordGeneration(defaultMaterialAndTexture.getTexCoordGeneration());
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:12,代码来源:HomePieceOfFurniture3D.java

示例2: outputShape

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
private void outputShape(OrderedGroup triGroup, int orderDir, TexCoordGeneration tg, Texture2D texture, int numPts, Point3d[] pts, Color4f[] colrs)
{

	count[0] = numPts;
	TriangleFanArray pgonGeo = new TriangleFanArray(numPts,
			GeometryArray.COORDINATES | GeometryArray.COLOR_4, count);
	pgonGeo.setCoordinates(0, pts, 0, numPts);
	pgonGeo.setColors(0, colrs, 0, numPts);

	Appearance appearance = new Appearance();
	if (texture != null)
	{
		appearance.setTextureAttributes(texAttr);
		appearance.setTexture(texture);
	}
	appearance.setMaterial(m);
	appearance.setColoringAttributes(clr);
	appearance.setTransparencyAttributes(trans);
	appearance.setPolygonAttributes(p);
	appearance.setTexCoordGeneration(tg);
	appearance.setRenderingAttributes(r);
	Shape3D shape = new Shape3D(pgonGeo, appearance);

	Node child = shape;

	if (outputLines)
	{
		Group shapeGroup = new Group();
		shapeGroup.addChild(shape);
		count[0] = numPts + 1;
		pts[numPts] = pts[0];
		LineStripArray lineGeo = new LineStripArray(numPts + 1,
				GeometryArray.COORDINATES, count);
		lineGeo.setCoordinates(0, pts, 0, numPts + 1);
		Appearance lineAppearance = new Appearance();
		Shape3D lineShape = new Shape3D(lineGeo, lineAppearance);
		shapeGroup.addChild(lineShape);
		child = shapeGroup;
	}

	if (verbose)
	{
		System.out.println("shape is " + child);
	}

	if (orderDir == FRONT)
	{
		triGroup.insertChild(child, 0);
	} else
	{
		triGroup.addChild(child);
	}
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:54,代码来源:SlicePlane2DRenderer.java

示例3: addAppearance

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Erzeugt eine Appearnace und fuegt die der Liste hinzu

 * @param item
 *            Der Key, iunter dem diese Apperance abgelegt wird
 * @param colors
 *            HashMap mit je Farbtyp und ASCII-Represenation der Farbe
 * @param textureFile
 *            Der Name des Texture-Files
 * @param clone
 *            Referenz auf einen schon bestehenden Eintrag, der geclonet
 *            werden soll
 */
@SuppressWarnings( { "unchecked", "boxing" })
private void addAppearance(char item, HashMap colors, String textureFile, String clone) {
	if (clone != null) {
		appearances.put(item, appearances.get(clone.toCharArray()[0]));
		return;
	}

	Appearance appearance = new Appearance();

	if (colors != null) {
		Material mat = new Material();

		Iterator it = colors.keySet().iterator();
		while (it.hasNext()) {
			String colorType = (String) it.next();
			String colorName = (String) colors.get(colorType);

			if (colorType.equals("ambient")) {
				mat.setAmbientColor(new Color3f(Color.decode(colorName)));
			}
			if (colorType.equals("diffuse")) {
				mat.setDiffuseColor(new Color3f(Color.decode(colorName)));
			}
			if (colorType.equals("specular")) {
				mat.setSpecularColor(new Color3f(Color.decode(colorName)));
			}
			if (colorType.equals("emmissive")) {
				mat.setEmissiveColor(new Color3f(Color.decode(colorName)));
			}
		}
		appearance.setMaterial(mat);
	}

	if (textureFile != null) {
		TexCoordGeneration tcg = new TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR, TexCoordGeneration.TEXTURE_COORDINATE_3, new Vector4f(1.0f, 
			1.0f, 0.0f, 0.0f), new Vector4f(0.0f, 1.0f, 1.0f, 0.0f), new Vector4f(1.0f, 0.0f, 1.0f, 0.0f));
		appearance.setTexCoordGeneration(tcg);

		try {
			TextureLoader loader = new TextureLoader(ClassLoader.getSystemResource(textureFile), null);
			Texture2D texture = (Texture2D) loader.getTexture();
			texture.setBoundaryModeS(Texture.WRAP);
			texture.setBoundaryModeT(Texture.WRAP);

			// mache die Textur lesbar
			texture.setCapability(Texture.ALLOW_IMAGE_READ);
			ImageComponent[] imgs = texture.getImages();
			for (int i = 0; i < imgs.length; i++) {
				imgs[i].setCapability(ImageComponent.ALLOW_IMAGE_READ);
			}

			appearance.setTexture(texture);
			appearance.setCapability(Appearance.ALLOW_TEXTURE_READ);

		} catch (Exception e) {
			lg.warn(e, "Probleme beim Laden der Texturdatei '%s'", textureFile);
		}
	}

	appearances.put(item, appearance);
}
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:75,代码来源:ParcoursLoader.java


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