當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatBuffer.clear方法代碼示例

本文整理匯總了Java中java.nio.FloatBuffer.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatBuffer.clear方法的具體用法?Java FloatBuffer.clear怎麽用?Java FloatBuffer.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.FloatBuffer的用法示例。


在下文中一共展示了FloatBuffer.clear方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processTransforms

import java.nio.FloatBuffer; //導入方法依賴的package包/類
private void processTransforms(String jointName, String[] rawData, KeyFrameData[] keyFrames, boolean root){
	FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
	float[] matrixData = new float[16];
	for(int i=0;i<keyFrames.length;i++){
		for(int j=0;j<16;j++){
			matrixData[j] = Float.parseFloat(rawData[i*16 + j]);
		}
		buffer.clear();
		buffer.put(matrixData);
		buffer.flip();
		Matrix4f transform = new Matrix4f();
		transform.load(buffer);
		transform.transpose();
		if(root){
			//because up axis in Blender is different to up axis in game
			Matrix4f.mul(CORRECTION, transform, transform);
		}
		keyFrames[i].addJointTransform(new JointTransformData(jointName, transform));
	}
}
 
開發者ID:TheThinMatrix,項目名稱:OpenGL-Animation,代碼行數:21,代碼來源:AnimationLoader.java

示例2: getVertexBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
private FloatBuffer getVertexBuffer() {
    float[] vertices = this.getTransformedVertices();
    ByteBuffer bb = ByteBuffer.allocateDirect(vertices.length * 4);
    bb.order(ByteOrder.nativeOrder());
    FloatBuffer vertexBuffer = bb.asFloatBuffer();
    vertexBuffer.clear();
    vertexBuffer.put(vertices);
    vertexBuffer.position(0);
    return vertexBuffer;
}
 
開發者ID:sakkeerhussain,項目名稱:SpriteKit-Android,代碼行數:11,代碼來源:Sprite.java

示例3: postCelestialRotate

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void postCelestialRotate()
{
    FloatBuffer floatbuffer = tempMatrixDirectBuffer;
    floatbuffer.clear();
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer);
    floatbuffer.get(tempMat, 0, 16);
    SMath.multiplyMat4xVec4(sunPosition, tempMat, sunPosModelView);
    SMath.multiplyMat4xVec4(moonPosition, tempMat, moonPosModelView);
    System.arraycopy(shadowAngle == sunAngle ? sunPosition : moonPosition, 0, shadowLightPosition, 0, 3);
    checkGLError("postCelestialRotate");
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:12,代碼來源:Shaders.java

示例4: setUpPosition

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void setUpPosition()
{
    FloatBuffer floatbuffer = tempMatrixDirectBuffer;
    floatbuffer.clear();
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer);
    floatbuffer.get(tempMat, 0, 16);
    SMath.multiplyMat4xVec4(upPosition, tempMat, upPosModelView);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:9,代碼來源:Shaders.java

示例5: createFloatBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Generate a new FloatBuffer using the given array of float primitives.
 * @param data array of float primitives to place into a new FloatBuffer
 */
public static FloatBuffer createFloatBuffer(float... data) {
    if (data == null) {
        return null;
    }
    FloatBuffer buff = createFloatBuffer(data.length);
    buff.clear();
    buff.put(data);
    buff.flip();
    return buff;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:15,代碼來源:BufferUtils.java

示例6: getVector3Array

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Generates a Vector3f array from the given FloatBuffer.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a newly generated array of Vector3f objects
 */
public static Vector3f[] getVector3Array(FloatBuffer buff) {
    buff.clear();
    Vector3f[] verts = new Vector3f[buff.limit() / 3];
    for (int x = 0; x < verts.length; x++) {
        Vector3f v = new Vector3f(buff.get(), buff.get(), buff.get());
        verts[x] = v;
    }
    return verts;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:17,代碼來源:BufferUtils.java

示例7: getVector2Array

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Generates a Vector2f array from the given FloatBuffer.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a newly generated array of Vector2f objects
 */
public static Vector2f[] getVector2Array(FloatBuffer buff) {
    buff.clear();
    Vector2f[] verts = new Vector2f[buff.limit() / 2];
    for (int x = 0; x < verts.length; x++) {
        Vector2f v = new Vector2f(buff.get(), buff.get());
        verts[x] = v;
    }
    return verts;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:17,代碼來源:BufferUtils.java

示例8: getFloatArray

import java.nio.FloatBuffer; //導入方法依賴的package包/類
/**
 * Create a new float[] array and populate it with the given FloatBuffer's
 * contents.
 * 
 * @param buff
 *            the FloatBuffer to read from
 * @return a new float array populated from the FloatBuffer
 */
public static float[] getFloatArray(FloatBuffer buff) {
    if (buff == null) {
        return null;
    }
    buff.clear();
    float[] inds = new float[buff.limit()];
    for (int x = 0; x < inds.length; x++) {
        inds[x] = buff.get();
    }
    return inds;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:20,代碼來源:BufferUtils.java

示例9: postCelestialRotate

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void postCelestialRotate()
{
    FloatBuffer floatbuffer = tempMatrixDirectBuffer;
    floatbuffer.clear();
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer);
    floatbuffer.get(tempMat, 0, 16);
    SMath.multiplyMat4xVec4(sunPosition, tempMat, sunPosModelView);
    SMath.multiplyMat4xVec4(moonPosition, tempMat, moonPosModelView);
    System.arraycopy(shadowAngle == sunAngle ? sunPosition : moonPosition, 0, shadowLightPosition, 0, 3);
    setProgramUniform3f("sunPosition", sunPosition[0], sunPosition[1], sunPosition[2]);
    setProgramUniform3f("moonPosition", moonPosition[0], moonPosition[1], moonPosition[2]);
    setProgramUniform3f("shadowLightPosition", shadowLightPosition[0], shadowLightPosition[1], shadowLightPosition[2]);
    checkGLError("postCelestialRotate");
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:15,代碼來源:Shaders.java

示例10: setUpPosition

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void setUpPosition()
{
    FloatBuffer floatbuffer = tempMatrixDirectBuffer;
    floatbuffer.clear();
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer);
    floatbuffer.get(tempMat, 0, 16);
    SMath.multiplyMat4xVec4(upPosition, tempMat, upPosModelView);
    setProgramUniform3f("upPosition", upPosition[0], upPosition[1], upPosition[2]);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:10,代碼來源:Shaders.java

示例11: quatToGlMatrix

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static FloatBuffer quatToGlMatrix(FloatBuffer p_187418_0_, Quaternion p_187418_1_)
{
    p_187418_0_.clear();
    float f = p_187418_1_.x * p_187418_1_.x;
    float f1 = p_187418_1_.x * p_187418_1_.y;
    float f2 = p_187418_1_.x * p_187418_1_.z;
    float f3 = p_187418_1_.x * p_187418_1_.w;
    float f4 = p_187418_1_.y * p_187418_1_.y;
    float f5 = p_187418_1_.y * p_187418_1_.z;
    float f6 = p_187418_1_.y * p_187418_1_.w;
    float f7 = p_187418_1_.z * p_187418_1_.z;
    float f8 = p_187418_1_.z * p_187418_1_.w;
    p_187418_0_.put(1.0F - 2.0F * (f4 + f7));
    p_187418_0_.put(2.0F * (f1 + f8));
    p_187418_0_.put(2.0F * (f2 - f6));
    p_187418_0_.put(0.0F);
    p_187418_0_.put(2.0F * (f1 - f8));
    p_187418_0_.put(1.0F - 2.0F * (f + f7));
    p_187418_0_.put(2.0F * (f5 + f3));
    p_187418_0_.put(0.0F);
    p_187418_0_.put(2.0F * (f2 + f6));
    p_187418_0_.put(2.0F * (f5 - f3));
    p_187418_0_.put(1.0F - 2.0F * (f + f4));
    p_187418_0_.put(0.0F);
    p_187418_0_.put(0.0F);
    p_187418_0_.put(0.0F);
    p_187418_0_.put(0.0F);
    p_187418_0_.put(1.0F);
    p_187418_0_.rewind();
    return p_187418_0_;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:32,代碼來源:GlStateManager.java

示例12: updateFloatBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void updateFloatBuffer(FloatBuffer fb, float[] coords) {
    fb.clear();
    fb.put(coords);
    fb.position(0);
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:6,代碼來源:OpenGlUtils.java

示例13: storeDataInBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void storeDataInBuffer(FloatBuffer buffer, int vertexCount, float[]... data) {
	float[] interleavedData = interleaveFloatData(vertexCount, data);
	buffer.clear();
	buffer.put(interleavedData);
	buffer.flip();
}
 
開發者ID:TheThinMatrix,項目名稱:LowPolyWater,代碼行數:7,代碼來源:DataUtils.java

示例14: storeDataInBuffer

import java.nio.FloatBuffer; //導入方法依賴的package包/類
public static void storeDataInBuffer(FloatBuffer buffer, int vertexCount, float[]... data) {
    float[] interleavedData = interleaveFloatData(vertexCount, data);
    buffer.clear();
    buffer.put(interleavedData);
    buffer.flip();
}
 
開發者ID:GryPLOfficial,項目名稱:EcoSystem-Official,代碼行數:7,代碼來源:DataUtils.java


注:本文中的java.nio.FloatBuffer.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。