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


Java GeometryInfo.QUAD_ARRAY属性代码示例

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


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

示例1: addCoordinates

/** Adds geometry from <code>GeometryInfo.QUAD_ARRAY</code>
  * coordinates. */
protected GeometryInfo addCoordinates(Point3d[] coordinates) {
  GeometryInfo geometryInfo = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
  geometryInfo.setCoordinates(coordinates);
  _normalGenerator.generateNormals(geometryInfo);
  if (_first) {
    setGeometry(geometryInfo.getGeometryArray());
    _first = false;
    }
  else {
    addGeometry(geometryInfo.getGeometryArray());
    }
  return geometryInfo;
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:15,代码来源:Solid.java

示例2: getBody

private Shape3D getBody(Point3f[] pointArr) {
    GeometryInfo ginfo = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
    ginfo.setCoordinates(pointArr);
    NormalGenerator n = new NormalGenerator();
    n.generateNormals(ginfo);

    QuadArray quadArray = (QuadArray) ginfo.getGeometryArray();

    return new Shape3D(quadArray);
}
 
开发者ID:sleepyprof,项目名称:Fractal,代码行数:10,代码来源:Fractal3DPictureView.java

示例3: addAreaSidesGeometry

/**
 * Adds to ground shape the geometry matching the given area sides.
 */
private void addAreaSidesGeometry(Shape3D groundShape, HomeTexture groundTexture, float[][] areaPoints,
		float elevation, float sideHeight)
{
	Point3f[] geometryCoords = new Point3f[areaPoints.length * 4];
	TexCoord2f[] geometryTextureCoords = groundTexture != null ? new TexCoord2f[geometryCoords.length] : null;
	float textureWidth;
	float textureHeight;
	if (groundTexture != null)
	{
		textureWidth = TextureManager.getInstance().getRotatedTextureWidth(groundTexture);
		textureHeight = TextureManager.getInstance().getRotatedTextureHeight(groundTexture);
	}
	else
	{
		textureWidth = 0;
		textureHeight = 0;
	}
	for (int i = 0, j = 0; i < areaPoints.length; i++)
	{
		float[] point = areaPoints[i];
		float[] nextPoint = areaPoints[i < areaPoints.length - 1 ? i + 1 : 0];
		geometryCoords[j++] = new Point3f(point[0], elevation, point[1]);
		geometryCoords[j++] = new Point3f(point[0], elevation + sideHeight, point[1]);
		geometryCoords[j++] = new Point3f(nextPoint[0], elevation + sideHeight, nextPoint[1]);
		geometryCoords[j++] = new Point3f(nextPoint[0], elevation, nextPoint[1]);
		if (groundTexture != null)
		{
			float distance = (float) Point2D.distance(point[0], point[1], nextPoint[0], nextPoint[1]);
			geometryTextureCoords[j - 4] = new TexCoord2f(point[0] / textureWidth, elevation / textureHeight);
			geometryTextureCoords[j - 3] = new TexCoord2f(point[0] / textureWidth,
					(elevation + sideHeight) / textureHeight);
			geometryTextureCoords[j - 2] = new TexCoord2f((point[0] - distance) / textureWidth,
					(elevation + sideHeight) / textureHeight);
			geometryTextureCoords[j - 1] = new TexCoord2f((point[0] - distance) / textureWidth,
					elevation / textureHeight);
		}
	}
	
	GeometryInfo geometryInfo = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
	geometryInfo.setCoordinates(geometryCoords);
	if (groundTexture != null)
	{
		geometryInfo.setTextureCoordinateParams(1, 2);
		geometryInfo.setTextureCoordinates(0, geometryTextureCoords);
	}
	new NormalGenerator(0).generateNormals(geometryInfo);
	groundShape.addGeometry(geometryInfo.getIndexedGeometryArray());
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:51,代码来源:Ground3D.java

示例4: createHalfSphereGeometry

/**
 * Returns a half sphere oriented inward and with texture ordinates 
 * that spread along an hemisphere. 
 */
private Geometry createHalfSphereGeometry(boolean top)
{
	final int divisionCount = 48;
	Point3f[] coords = new Point3f[divisionCount * divisionCount];
	TexCoord2f[] textureCoords = top ? new TexCoord2f[divisionCount * divisionCount] : null;
	Color3f[] colors = top ? null : new Color3f[divisionCount * divisionCount];
	for (int i = 0, k = 0; i < divisionCount; i++)
	{
		double alpha = i * 2 * Math.PI / divisionCount;
		float cosAlpha = (float) Math.cos(alpha);
		float sinAlpha = (float) Math.sin(alpha);
		double nextAlpha = (i + 1) * 2 * Math.PI / divisionCount;
		float cosNextAlpha = (float) Math.cos(nextAlpha);
		float sinNextAlpha = (float) Math.sin(nextAlpha);
		for (int j = 0; j < divisionCount / 4; j++)
		{
			double beta = 2 * j * Math.PI / divisionCount;
			float cosBeta = (float) Math.cos(beta);
			float sinBeta = (float) Math.sin(beta);
			// Correct the bottom of the hemisphere to avoid seeing a bottom hemisphere at the horizon
			float y = j != 0 ? (top ? sinBeta : -sinBeta) : -0.01f;
			double nextBeta = 2 * (j + 1) * Math.PI / divisionCount;
			if (!top)
			{
				nextBeta = -nextBeta;
			}
			float cosNextBeta = (float) Math.cos(nextBeta);
			float sinNextBeta = (float) Math.sin(nextBeta);
			if (top)
			{
				coords[k] = new Point3f(cosAlpha * cosBeta, y, sinAlpha * cosBeta);
				textureCoords[k++] = new TexCoord2f((float) i / divisionCount, sinBeta);
				
				coords[k] = new Point3f(cosNextAlpha * cosBeta, y, sinNextAlpha * cosBeta);
				textureCoords[k++] = new TexCoord2f((float) (i + 1) / divisionCount, sinBeta);
				
				coords[k] = new Point3f(cosNextAlpha * cosNextBeta, sinNextBeta, sinNextAlpha * cosNextBeta);
				textureCoords[k++] = new TexCoord2f((float) (i + 1) / divisionCount, sinNextBeta);
				
				coords[k] = new Point3f(cosAlpha * cosNextBeta, sinNextBeta, sinAlpha * cosNextBeta);
				textureCoords[k++] = new TexCoord2f((float) i / divisionCount, sinNextBeta);
			}
			else
			{
				coords[k] = new Point3f(cosAlpha * cosBeta, y, sinAlpha * cosBeta);
				float color1 = .9f + y * .5f;
				colors[k++] = new Color3f(color1, color1, color1);
				
				coords[k] = new Point3f(cosAlpha * cosNextBeta, sinNextBeta, sinAlpha * cosNextBeta);
				float color2 = .9f + sinNextBeta * .5f;
				colors[k++] = new Color3f(color2, color2, color2);
				
				coords[k] = new Point3f(cosNextAlpha * cosNextBeta, sinNextBeta, sinNextAlpha * cosNextBeta);
				colors[k++] = new Color3f(color2, color2, color2);
				
				coords[k] = new Point3f(cosNextAlpha * cosBeta, y, sinNextAlpha * cosBeta);
				colors[k++] = new Color3f(color1, color1, color1);
			}
		}
	}
	
	GeometryInfo geometryInfo = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
	geometryInfo.setCoordinates(coords);
	if (textureCoords != null)
	{
		geometryInfo.setTextureCoordinateParams(1, 2);
		geometryInfo.setTextureCoordinates(0, textureCoords);
	}
	if (colors != null)
	{
		geometryInfo.setColors(colors);
	}
	geometryInfo.indexify();
	geometryInfo.compact();
	Geometry halfSphereGeometry = geometryInfo.getIndexedGeometryArray();
	return halfSphereGeometry;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:81,代码来源:HomeComponent3D.java


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