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


Java LittleEndianDataInputStream.readInt方法代码示例

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


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

示例1: readBinary

import rajawali.util.LittleEndianDataInputStream; //导入方法依赖的package包/类
/**
 * Read stream as binary STL. This is significantly faster than ASCII parsing. Additionally binary files are much
 * more compressed allowing smaller file sizes for larger models compared to ASCII.
 *
 * @param dis
 * @throws IOException
 */
private void readBinary(final LittleEndianDataInputStream dis) throws IOException {
    RajLog.i("StlPaser: Reading Binary");

    // Skip the header
    dis.skip(80);

    // Read the number of facets (have to convert the uint to a long
    int facetCount = dis.readInt();

    float[] verticesArr = new float[facetCount * 9];
    float[] normalsArr = new float[facetCount * 9];
    int[] indicesArr = new int[facetCount * 3];
    float[] tempNorms = new float[3];
    int vertPos = 0, normPos = 0;

    for (int i = 0; i < indicesArr.length; i++)
        indicesArr[i] = i;

    // Read all the facets
    while (dis.available() > 0) {

        // Read normals
        for (int j = 0; j < 3; j++) {
            tempNorms[j] = dis.readFloat();
            if (Float.isNaN(tempNorms[j]) || Float.isInfinite(tempNorms[j])) {
                RajLog.w("STL contains bad normals of NaN or Infinite!");
                tempNorms[0] = 0;
                tempNorms[1] = 0;
                tempNorms[2] = 0;
                break;
            }
        }

        for (int j = 0; j < 3; j++) {
            normalsArr[normPos++] = tempNorms[0];
            normalsArr[normPos++] = tempNorms[1];
            normalsArr[normPos++] = tempNorms[2];
        }

        // Read vertices
        for (int j = 0; j < 9; j++)
            verticesArr[vertPos++] = dis.readFloat();

        dis.skip(2);
    }

    mRootObject.setData(verticesArr, normalsArr, null, null, indicesArr);
}
 
开发者ID:BitMastro,项目名称:PortalLW,代码行数:56,代码来源:StlParser.java

示例2: readBinary

import rajawali.util.LittleEndianDataInputStream; //导入方法依赖的package包/类
/**
 * Read stream as binary STL. This is significantly faster than ASCII parsing. Additionally binary files are much
 * more compressed allowing smaller file sizes for larger models compared to ASCII.
 * 
 * @param dis
 * @throws IOException
 */
private void readBinary(final LittleEndianDataInputStream dis) throws IOException {
	RajLog.i("StlPaser: Reading Binary");

	// Skip the header
	dis.skip(80);

	// Read the number of facets (have to convert the uint to a long
	int facetCount = dis.readInt();

	float[] verticesArr = new float[facetCount * 9];
	float[] normalsArr = new float[facetCount * 9];
	int[] indicesArr = new int[facetCount * 3];
	float[] tempNorms = new float[3];
	int vertPos = 0, normPos = 0;

	for (int i = 0; i < indicesArr.length; i++)
		indicesArr[i] = i;

	// Read all the facets
	while (dis.available() > 0) {

		// Read normals
		for (int j = 0; j < 3; j++) {
			tempNorms[j] = dis.readFloat();
			if (Float.isNaN(tempNorms[j]) || Float.isInfinite(tempNorms[j])) {
				RajLog.w("STL contains bad normals of NaN or Infinite!");
				tempNorms[0] = 0;
				tempNorms[1] = 0;
				tempNorms[2] = 0;
				break;
			}
		}

		for (int j = 0; j < 3; j++) {
			normalsArr[normPos++] = tempNorms[0];
			normalsArr[normPos++] = tempNorms[1];
			normalsArr[normPos++] = tempNorms[2];
		}

		// Read vertices
		for (int j = 0; j < 9; j++)
			verticesArr[vertPos++] = dis.readFloat();

		dis.skip(2);
	}

	mRootObject.setData(verticesArr, normalsArr, null, null, indicesArr);
}
 
开发者ID:takyonxxx,项目名称:IRobot-Android,代码行数:56,代码来源:LoaderSTL.java


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