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


Java DataConstants类代码示例

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


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

示例1: add

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public VertexBufferObjectAttributesBuilder add(final int pLocation, final String pName, final int pSize, final int pType, final boolean pNormalized) {
	if (VertexBufferObjectAttributesBuilder.WORAROUND_GLES2_GLVERTEXATTRIBPOINTER_MISSING) {
		this.mVertexBufferObjectAttributes[this.mIndex] = new VertexBufferObjectAttributeFix(pLocation, pName, pSize, pType, pNormalized, this.mOffset);
	} else {
		this.mVertexBufferObjectAttributes[this.mIndex] = new VertexBufferObjectAttribute(pLocation, pName, pSize, pType, pNormalized, this.mOffset);
	}

	switch (pType) {
		case GLES20.GL_FLOAT:
			this.mOffset += pSize * DataConstants.BYTES_PER_FLOAT;
			break;
		case GLES20.GL_UNSIGNED_BYTE:
			this.mOffset += pSize * DataConstants.BYTES_PER_BYTE;
			break;
		default:
			throw new IllegalArgumentException("Unexpected pType: '" + pType + "'.");
	}

	this.mIndex++;

	return this;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:23,代码来源:VertexBufferObjectAttributesBuilder.java

示例2: LongBackedBitVector

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public LongBackedBitVector(final int pSize) throws IllegalArgumentException {
	if (pSize <= 0) {
		throw new IllegalArgumentException("pSize must be > 0.");
	}
	this.mSize = pSize;

	/* Check if bytes perfectly fit into the data fields or if there are some overflow bytes that need special treatment. */
	final boolean perfectDataFit = (pSize % DataConstants.BITS_PER_LONG) == 0;

	final int dataLength;
	if (perfectDataFit) {
		dataLength = pSize / DataConstants.BITS_PER_LONG;
	} else {
		/* Extra field for overflow bytes. */
		dataLength = (pSize / DataConstants.BITS_PER_LONG) + 1;
	}
	this.mData = new long[dataLength];
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:LongBackedBitVector.java

示例3: getBit

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
@Override
public int getBit(final int pIndex) throws IllegalArgumentException {
	if (pIndex < 0) {
		throw new IllegalArgumentException("pIndex must be >= 0.");
	}
	if (pIndex >= this.mSize) {
		throw new IllegalArgumentException("pIndex must be < size.");
	}

	final int dataIndex = pIndex / DataConstants.BITS_PER_LONG;
	final int dataOffset = pIndex % DataConstants.BITS_PER_LONG;

	final long dataField = this.mData[dataIndex];

	final int rightShift = DataConstants.BITS_PER_LONG - dataOffset - 1;
	final long dataBit = (dataField >> rightShift) & 0x01;
	final int bit = (int)dataBit;

	return bit;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:21,代码来源:LongBackedBitVector.java

示例4: VertexBufferObject

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
/**
 * @param pVertexBufferObjectManager (Optional, if you manage reloading on your own.)
 * @param pCapacity
 * @param pDrawType
 * @param pAutoDispose when passing <code>true</code> this {@link VertexBufferObject} loads itself to the active {@link VertexBufferObjectManager}. <b><u>WARNING:</u></b> When passing <code>false</code> one needs to take care of that by oneself!
 * @param pVertexBufferObjectAttributes to be automatically enabled on the {@link ShaderProgram} used in {@link #bind(ShaderProgram)}.
 */
public VertexBufferObject(final VertexBufferObjectManager pVertexBufferObjectManager, final int pCapacity, final DrawType pDrawType, final boolean pAutoDispose, final VertexBufferObjectAttributes pVertexBufferObjectAttributes) {
	this.mVertexBufferObjectManager = pVertexBufferObjectManager;
	this.mCapacity = pCapacity;
	this.mUsage = pDrawType.getUsage();
	this.mAutoDispose = pAutoDispose;
	this.mVertexBufferObjectAttributes = pVertexBufferObjectAttributes;

	this.mByteBuffer = BufferUtils.allocateDirectByteBuffer(pCapacity * DataConstants.BYTES_PER_FLOAT);

	this.mByteBuffer.order(ByteOrder.nativeOrder());
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:VertexBufferObject.java

示例5: writeTextureToHardware

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final IPVRTexturePixelBufferStrategyBufferManager pvrTextureLoadStrategyManager = this.mPVRTexturePixelBufferStrategy.newPVRTexturePixelBufferStrategyManager(this);

	int width = this.getWidth();
	int height = this.getHeight();

	final int dataLength = this.mPVRTextureHeader.getDataLength();

	final int bytesPerPixel = this.mPVRTextureHeader.getBitsPerPixel() / DataConstants.BITS_PER_BYTE;

	/* Adjust unpack alignment. */
	GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);

	int currentLevel = 0;
	int currentPixelDataOffset = 0;
	while (currentPixelDataOffset < dataLength) {
		if (currentLevel > 0 && (width != height || MathUtils.nextPowerOfTwo(width) != width)) {
			Debug.w("Mipmap level '" + currentLevel + "' is not squared. Width: '" + width + "', height: '" + height + "'. Texture won't render correctly.");
		}

		final int currentPixelDataSize = height * width * bytesPerPixel;

		/* Load the current level. */
		this.mPVRTexturePixelBufferStrategy.loadPVRTextureData(pvrTextureLoadStrategyManager, width, height, bytesPerPixel, this.mPixelFormat, currentLevel, currentPixelDataOffset, currentPixelDataSize);

		currentPixelDataOffset += currentPixelDataSize;

		/* Prepare next mipmap level. */
		width = Math.max(width / 2, 1);
		height = Math.max(height / 2, 1);

		currentLevel++;
	}

	/* Restore default unpack alignment. */
	GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:39,代码来源:PVRTexture.java

示例6: getPVRTextureBuffer

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public ByteBuffer getPVRTextureBuffer() throws IOException {
	final InputStream inputStream = this.getInputStream();
	try {
		final ByteBufferOutputStream os = new ByteBufferOutputStream(DataConstants.BYTES_PER_KILOBYTE, DataConstants.BYTES_PER_MEGABYTE / 2);
		StreamUtils.copy(inputStream, os);
		return os.toByteBuffer();
	} finally {
		StreamUtils.close(inputStream);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:PVRTexture.java

示例7: PVRTextureHeader

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public PVRTextureHeader(final byte[] pData) {
	this.mDataByteBuffer = ByteBuffer.wrap(pData);
	this.mDataByteBuffer.rewind();
	this.mDataByteBuffer.order(ByteOrder.LITTLE_ENDIAN);

	/* Check magic bytes. */
	if (!ArrayUtils.equals(pData, 11 * DataConstants.BYTES_PER_INT, PVRTextureHeader.MAGIC_IDENTIFIER, 0, PVRTextureHeader.MAGIC_IDENTIFIER.length)) {
		throw new IllegalArgumentException("Invalid " + this.getClass().getSimpleName() + "!");
	}

	this.mPVRTextureFormat = PVRTextureFormat.fromID(this.getFlags() & PVRTextureHeader.FORMAT_FLAG_MASK);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:PVRTexture.java

示例8: getLongBits

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
@Override
public long getLongBits(final int pIndex, final int pLength) throws IllegalArgumentException {
	/* Sanity checks. */
	if (pIndex < 0) {
		throw new IllegalArgumentException("pIndex must be >= 0.");
	}
	if (pLength < 0) {
		throw new IllegalArgumentException("pLength must be >= 0.");
	}
	if ((pIndex + pLength) > this.mSize) {
		throw new IllegalArgumentException("pIndex + pLength must be <= size.");
	}

	/* Early exit. */
	if (pLength == 0) {
		return 0L;
	}

	final int dataIndex = pIndex / DataConstants.BITS_PER_LONG;
	final int offset = pIndex % DataConstants.BITS_PER_LONG;

	final long data;
	if (offset == 0) {
		data = this.mData[dataIndex];
	} else if ((offset + pLength) <= DataConstants.BITS_PER_LONG) {
		data = this.mData[dataIndex] << offset;
	} else {
		/* Join bits from adjacent data fields. */
		data = (this.mData[dataIndex] << offset) | (this.mData[dataIndex + 1] >>> (DataConstants.BITS_PER_LONG - offset));
	}

	if (pLength == DataConstants.BITS_PER_LONG) {
		return data;
	} else {
		final int rightShift = DataConstants.BITS_PER_LONG - pLength;
		final long mask = 0xFFFFFFFFFFFFFFFFL >>> rightShift;
	final long unmaskedBits = data >> rightShift;
				return unmaskedBits & mask;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:41,代码来源:LongBackedBitVector.java

示例9: VertexBufferObject

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
/**
 * @param pVertexBufferObjectManager (Optional, if you manage reloading on your own.)
 * @param pCapacity
 * @param pDrawType
 * @param pAutoDispose when passing <code>true</code> this {@link org.andengine.opengl.vbo.VertexBufferObject} loads itself to the active {@link VertexBufferObjectManager}. <b><u>WARNING:</u></b> When passing <code>false</code> one needs to take care of that by oneself!
 * @param pVertexBufferObjectAttributes to be automatically enabled on the {@link ShaderProgram} used in {@link #bind(ShaderProgram)}.
 */
public VertexBufferObject(final VertexBufferObjectManager pVertexBufferObjectManager, final int pCapacity, final DrawType pDrawType, final boolean pAutoDispose, final VertexBufferObjectAttributes pVertexBufferObjectAttributes) {
	this.mVertexBufferObjectManager = pVertexBufferObjectManager;
	this.mCapacity = pCapacity;
	this.mUsage = pDrawType.getUsage();
	this.mAutoDispose = pAutoDispose;
	this.mVertexBufferObjectAttributes = pVertexBufferObjectAttributes;

	this.mByteBuffer = BufferUtils.allocateDirectByteBuffer(pCapacity * DataConstants.BYTES_PER_FLOAT);

	this.mByteBuffer.order(ByteOrder.nativeOrder());
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:VertexBufferObject.java

示例10: getByteCapacity

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
@Override
public int getByteCapacity() {
	return this.mCapacity * DataConstants.BYTES_PER_FLOAT;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:5,代码来源:ZeroMemoryVertexBufferObject.java

示例11: headerLength

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public int headerLength() {
	return this.mDataByteBuffer.getInt(0 * DataConstants.BYTES_PER_INT); // TODO Constants
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:PVRTexture.java

示例12: getHeight

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public int getHeight() {
	return this.mDataByteBuffer.getInt(1 * DataConstants.BYTES_PER_INT);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:PVRTexture.java

示例13: getWidth

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public int getWidth() {
	return this.mDataByteBuffer.getInt(2 * DataConstants.BYTES_PER_INT);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:PVRTexture.java

示例14: getNumMipmaps

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public int getNumMipmaps() {
	return this.mDataByteBuffer.getInt(3 * DataConstants.BYTES_PER_INT);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:PVRTexture.java

示例15: getFlags

import org.andengine.util.adt.data.constants.DataConstants; //导入依赖的package包/类
public int getFlags() {
	return this.mDataByteBuffer.getInt(4 * DataConstants.BYTES_PER_INT);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:4,代码来源:PVRTexture.java


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