当前位置: 首页>>代码示例>>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;未经允许,请勿转载。