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


Java Appearance.setTexture方法代码示例

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


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

示例1: Ball

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
public Ball(double x, double y, double z, double vx, double vy, double vz) {
    position = new Vector3d(x, y, z);
    speed = new Vector3d(vx, vy, vz);

    // �ړ��”\
    this.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    this.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    app = new Appearance();
    app.setTexture(loadTexture("carpet.jpg"));

    // �{�[����lj�
    this.addChild(new Sphere(radius, Sphere.GENERATE_TEXTURE_COORDS, 100, app));

    move();
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:17,代码来源:Ball.java

示例2: setSelected

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
@Override
public void setSelected(boolean isSelected) {
  this.selected = isSelected;

  List<Shape3D> shapes = this.getShapes();
  int nbElem = shapes.size();

  for (int i = 0; i < nbElem; i++) {
    Appearance ap = shapes.get(i).getAppearance();

    if (isSelected) {

      ColoringAttributes ca = new ColoringAttributes();
      ca.setColor(new Color3f(ConstantRepresentation.selectionColor));
      ap.setColoringAttributes(ca);
      ap.setTexture(null);
      ap.setTextureAttributes(null);
    } else {

      ap.setTextureAttributes(new TextureAttributes());
      ap.setTexture(this.texture);

      shapes.get(i).getAppearance().setColoringAttributes(null);
      shapes.get(i).setAppearance(ap);
    }

  }

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

示例3: updateFilledWallSideAppearance

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

示例4: updateBackgroundColorAndTexture

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Updates<code>backgroundAppearance</code> color and texture from <code>home</code> sky color and texture.
 */
private void updateBackgroundColorAndTexture(final Appearance backgroundAppearance, Home home,
		boolean waitForLoading)
{
	Color3f skyColor = new Color3f(new Color(home.getEnvironment().getSkyColor()));
	backgroundAppearance.getColoringAttributes().setColor(skyColor);
	HomeTexture skyTexture = home.getEnvironment().getSkyTexture();
	if (skyTexture != null)
	{
		TextureManager textureManager = TextureManager.getInstance();
		if (waitForLoading)
		{
			// Don't share the background texture otherwise if might not be rendered correctly
			backgroundAppearance.setTexture(textureManager.loadTexture(skyTexture.getImage()));
		}
		else
		{
			textureManager.loadTexture(skyTexture.getImage(), waitForLoading, new TextureManager.TextureObserver()
			{
				public void textureUpdated(Texture texture)
				{
					// Use a copy of the texture in case it's used in an other universe
					backgroundAppearance.setTexture((Texture) texture.cloneNodeComponent(false));
				}
			});
		}
	}
	else
	{
		backgroundAppearance.setTexture(null);
	}
	
	clearPrintedImageCache();
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:37,代码来源:HomeComponent3D.java

示例5: updateRoomPartAppearance

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

示例6: 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

示例7: 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

示例8: createTerrain

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Create a java3d Shape for the terrain
 * @param inModel threedModel
 * @param inHelper terrain helper
 * @param inBaseImage base image for shape, or null for no image
 * @return Shape3D object
 */
private static Shape3D createTerrain(ThreeDModel inModel, TerrainHelper inHelper, GroutedImage inBaseImage)
{
	final int numNodes = inHelper.getGridSize();
	final int RESULT_SIZE = numNodes * (numNodes * 2 - 2);
	int[] stripData = inHelper.getStripLengths();

	// Get the scaled terrainTrack coordinates (or just heights) from the model
	final int nSquared = numNodes * numNodes;
	Point3d[] rawPoints = new Point3d[nSquared];
	for (int i=0; i<nSquared; i++)
	{
		double height = inModel.getScaledTerrainValue(i) * MODEL_SCALE_FACTOR;
		rawPoints[i] = new Point3d(inModel.getScaledTerrainHorizValue(i) * MODEL_SCALE_FACTOR,
			Math.max(height, 0.05), // make sure it's above the box
			-inModel.getScaledTerrainVertValue(i) * MODEL_SCALE_FACTOR);
	}

	GeometryInfo gi = new GeometryInfo(GeometryInfo.TRIANGLE_STRIP_ARRAY);
	gi.setCoordinates(inHelper.getTerrainCoordinates(rawPoints));
	gi.setStripCounts(stripData);

	Appearance tAppearance = new Appearance();
	if (inBaseImage != null)
	{
		gi.setTextureCoordinateParams(1,  2); // one coord set of two dimensions
		gi.setTextureCoordinates(0, inHelper.getTextureCoordinates());
		Texture mapImage = new TextureLoader(inBaseImage.getImage()).getTexture();
		tAppearance.setTexture(mapImage);
		TextureAttributes texAttr = new TextureAttributes();
		texAttr.setTextureMode(TextureAttributes.MODULATE);
		tAppearance.setTextureAttributes(texAttr);
	}
	else
	{
		Color3f[] colours = new Color3f[RESULT_SIZE];
		Color3f terrainColour = new Color3f(0.1f, 0.2f, 0.2f);
		for (int i=0; i<RESULT_SIZE; i++) {colours[i] = terrainColour;}
		gi.setColors(colours);
	}
	new NormalGenerator().generateNormals(gi);
	Material terrnMat = new Material(new Color3f(0.4f, 0.4f, 0.4f), // ambient colour
		new Color3f(0f, 0f, 0f), // emissive (none)
		new Color3f(0.8f, 0.8f, 0.8f), // diffuse
		new Color3f(0.2f, 0.2f, 0.2f), //specular
		30f); // shinyness
	tAppearance.setMaterial(terrnMat);
	return new Shape3D(gi.getGeometryArray(), tAppearance);
}
 
开发者ID:activityworkshop,项目名称:GpsPrune,代码行数:56,代码来源:Java3DWindow.java

示例9: extract

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
@Override
public void extract() throws Exception {
	/*
	 * Some models don't work at all (LIFT.CHR and ITEMS.CHR). They seem to
	 * be incomplete/garbage files that were probably included by mistake
	 */
	super.extract();
	int rootChunkDataSize = super.resourceBytes.length - 2 * DataReader.INT_SIZE;
	byte[] rootChunkData = new byte[rootChunkDataSize];
	System.arraycopy(super.resourceBytes, 2 * DataReader.INT_SIZE, rootChunkData, 0, rootChunkDataSize);
	AbstractChunk rootChunk = new Chunk0x8000(ROOT_CHUNK_ID, rootChunkData);
	rootChunk.readContents();
	Chunk0x7f01 textureOffsetsChunk = (Chunk0x7f01) rootChunk.getChunksById(TEXTURE_OFFSETS_CHUNK_ID).get(0);
	List<AbstractChunk> shapeChunks = rootChunk.getChunksById(SHAPE_CHUNK_ID);
	Chunk0x7f04 textureChunk = (Chunk0x7f04) rootChunk.getChunksById(TEXTURE_CHUNK_ID).get(0);
	Chunk0x7f05 shapePositionsChunk = (Chunk0x7f05) rootChunk.getChunksById(SHAPE_POSITIONS_CHUNK_ID).get(0);
	Chunk0x7f06 shapePositionIdsChunk = (Chunk0x7f06) rootChunk.getChunksById(SHAPE_POSITION_IDS_CHUNK_ID).get(0);
	shapePositionIdsChunk.mapPositions(shapePositionsChunk);
	List<Point3f> vertexList = new ArrayList<>();
	List<Integer> stripCountList = new ArrayList<>();
	List<TexCoord2f> texCoordList = new ArrayList<>();
	int[] textureOffsets = textureOffsetsChunk.getTextureOffsets();
	short[] texturePixelIndices = textureChunk.getTexturePixelIndices();
	int textureWidth = textureChunk.getWidth();
	int textureHeight = textureChunk.getHeight();
	for (AbstractChunk chunk : shapeChunks) {
		Chunk0x7f02 shape = (Chunk0x7f02) chunk;
		int shapeId = shape.getShapeId();
		Polygon[] polygons = shape.getPolygons();
		Point3f[] shapeVertices = shape.getVertices();
		for (Polygon polygon : polygons) {
			int textureOffsetIndex = polygon.getTextureOffsetIndex();
			int textureStartPixel = textureOffsets[textureOffsetIndex];
			polygon.setPixelSearchStart(textureStartPixel);
			polygon.setTexturePixelIndices(texturePixelIndices);
			polygon.setTextureWidth(textureWidth);
			polygon.decode();
			int[] vertexIndices = polygon.getShapeVertexIndices();
			// Going backwards, otherwise faces are inside out
			for (int i = vertexIndices.length - 1; i >= 0; i--) {
				Point3f vertex = (Point3f) shapeVertices[vertexIndices[i]].clone();
				vertex.add(shapePositionIdsChunk.getShapePosition(shapeId));
				vertexList.add(vertex);
			}
			Point[] relativeUVs = polygon.getRelativeUVs();
			for (int i = relativeUVs.length - 1; i >= 0; i--) {
				int texOriginX = textureStartPixel % textureWidth;
				int texOriginY = textureStartPixel / textureWidth;
				float u = (float) (relativeUVs[i].getX() + texOriginX);
				u /= textureWidth;
				float v = (float) (relativeUVs[i].getY() + texOriginY);
				// The UV 0,0 is at the bottom left
				v = textureHeight - v;
				v /= textureHeight;
				texCoordList.add(new TexCoord2f(u, v));
			}
			stripCountList.add(polygon.getVerticeCount());
		}
	}
	Point3f[] vertices = vertexList.toArray(new Point3f[vertexList.size()]);
	int[] stripCounts = stripCountList.stream().mapToInt(i -> i).toArray();
	TexCoord2f[] texCoords = texCoordList.toArray(new TexCoord2f[texCoordList.size()]);
	GeometryInfo geometryInfo = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
	geometryInfo.setCoordinates(vertices);
	geometryInfo.setStripCounts(stripCounts);
	geometryInfo.setTextureCoordinateParams(1, 2);
	geometryInfo.setTextureCoordinates(0, texCoords);
	Appearance appearence = new Appearance();
	TextureLoader textureLoader = new TextureLoader((BufferedImage) textureChunk.getTexture());
	appearence.setTexture(textureLoader.getTexture());
	NormalGenerator normalGenerator = new NormalGenerator();
	normalGenerator.generateNormals(geometryInfo);
	Stripifier stripifier = new Stripifier();
	stripifier.stripify(geometryInfo);
	GeometryArray geometryArray = geometryInfo.getGeometryArray();
	this.shape3d = new Shape3D(geometryArray);
	this.shape3d.setAppearance(appearence);
}
 
开发者ID:nerdouille,项目名称:silvie,代码行数:79,代码来源:CHRModel.java

示例10: generateAppearance

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Génère l'apparence de l'objet
 * 
 * @return
 */
private Appearance generateAppearance() {

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

  apparenceFinale.setTexture(this.texture);
  apparenceFinale.setTextureAttributes(new TextureAttributes());

  // Création des attributs du polygone
  PolygonAttributes pa = new PolygonAttributes();

  pa.setCullFace(PolygonAttributes.CULL_NONE);
  pa.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);

  pa.setBackFaceNormalFlip(false);

  // Association à l'apparence des attributs de géométrie et de material
  apparenceFinale.setPolygonAttributes(pa);

  return apparenceFinale;

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

示例11: generateAppearance

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Génère une apparence et gère le style en fonction du fait que c'est un mur
 * ou pas
 * 
 * @param isRoof indique si c'est un toit
 * @return
 */
private Appearance generateAppearance(boolean isRoof) {

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
  // Le toit influe sur la texture
  if (isRoof) {

    apparenceFinale.setTexture(this.roofTexture);
  } else {

    apparenceFinale.setTexture(this.wallTexture);
  }

  apparenceFinale.setTextureAttributes(new TextureAttributes());

  // Création des attributs du polygone
  PolygonAttributes pa = new PolygonAttributes();

  pa.setCullFace(PolygonAttributes.CULL_NONE);
  pa.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);

  pa.setBackFaceNormalFlip(false);

  // Association à l'apparence des attributs de géométrie et de material
  apparenceFinale.setPolygonAttributes(pa);

  return apparenceFinale;

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

示例12: generateAppearance

import javax.media.j3d.Appearance; //导入方法依赖的package包/类
/**
 * Génère l'apparence de l'objet de type texture d'un objet
 * 
 * @return
 */
private Appearance generateAppearance(Texture2D tex) {

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_ATTRIBUTES_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_TEXTURE_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);

  apparenceFinale.setTexture(tex);
  apparenceFinale.setTextureAttributes(new TextureAttributes());

  // Création des attributs du polygone
  PolygonAttributes pa = new PolygonAttributes();

  pa.setCullFace(PolygonAttributes.CULL_NONE);
  pa.setCapability(PolygonAttributes.ALLOW_CULL_FACE_WRITE);

  pa.setBackFaceNormalFlip(false);

  // Association à l'apparence des attributs de géométrie et de material
  apparenceFinale.setPolygonAttributes(pa);

  TransparencyAttributes t_attr = new TransparencyAttributes(
      TransparencyAttributes.NICEST, 0,
      TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA,
      TransparencyAttributes.BLEND_ONE_MINUS_SRC_ALPHA);
  apparenceFinale.setTransparencyAttributes(t_attr);

  return apparenceFinale;

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


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