本文整理汇总了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));
}
}
示例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;
}
示例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");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例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]);
}
示例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_;
}
示例12: updateFloatBuffer
import java.nio.FloatBuffer; //导入方法依赖的package包/类
public static void updateFloatBuffer(FloatBuffer fb, float[] coords) {
fb.clear();
fb.put(coords);
fb.position(0);
}
示例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();
}
示例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();
}