本文整理汇总了Java中org.lwjgl.util.vector.Matrix4f.load方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.load方法的具体用法?Java Matrix4f.load怎么用?Java Matrix4f.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.util.vector.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTransforms
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的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: extractMainJointData
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private JointData extractMainJointData(XmlNode jointNode, boolean isRoot){
String nameId = jointNode.getAttribute("id");
int index = boneOrder.indexOf(nameId);
String[] matrixData = jointNode.getChild("matrix").getData().split(" ");
Matrix4f matrix = new Matrix4f();
matrix.load(convertData(matrixData));
matrix.transpose();
if(isRoot){
//because in Blender z is up, but in our game y is up.
Matrix4f.mul(CORRECTION, matrix, matrix);
}
jointCount++;
return new JointData(index, nameId, matrix);
}
示例3: getLastKnown
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
public Matrix4f getLastKnown(Matrix4f mat){
mat.load(prev);
return mat;
}
示例4: injectProjection
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void injectProjection(Matrix4f dest){
dest.load(projection);
}
示例5: updateMatrices
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
public void updateMatrices(IntBuffer viewport, FloatBuffer modelview, FloatBuffer projection, double widthScale, double heightScale) {
this.viewport = viewport;
this.modelview = modelview;
this.projection = projection;
this.widthScale = widthScale;
this.heightScale = heightScale;
//Get fov and display dimensions
float fov = (float) Math.toDegrees(Math.atan(1.0D / this.projection.get(5)) * 2.0D);
fovY = fov;
displayWidth = this.viewport.get(2);
displayHeight = this.viewport.get(3);
fovX = (float) Math.toDegrees(2.0D * Math.atan((displayWidth / displayHeight) * Math.tan(Math.toRadians(fovY) / 2.0D)));
//Getting modelview vectors
Vector3D ft = new Vector3D(this.modelview.get(12), this.modelview.get(13), this.modelview.get(14));
Vector3D lv = new Vector3D(this.modelview.get(0), this.modelview.get(1), this.modelview.get(2));
Vector3D uv = new Vector3D(this.modelview.get(4), this.modelview.get(5), this.modelview.get(6));
Vector3D fv = new Vector3D(this.modelview.get(8), this.modelview.get(9), this.modelview.get(10));
//Default axes
Vector3D nuv = new Vector3D(0, 1.0D, 0);
Vector3D nlv = new Vector3D(1.0D, 0, 0);
Vector3D nfv = new Vector3D(0, 0, 1.0D);
//Calculate yaw and pitch from modelview
double yaw = Math.toDegrees(Math.atan2(nlv.cross(lv).length(), nlv.dot(lv))) + 180.0D;
if (fv.x < 0.0D) {
yaw = 360.0D - yaw;
}
double pitch = 0.0D;
if ((-fv.y > 0.0D && yaw >= 90.0D && yaw < 270.0D) || (fv.y > 0.0D && !(yaw >= 90.0D && yaw < 270.0D))) {
pitch = Math.toDegrees(Math.atan2(nuv.cross(uv).length(), nuv.dot(uv)));
} else {
pitch = -Math.toDegrees(Math.atan2(nuv.cross(uv).length(), nuv.dot(uv)));
}
lookVec = getRotationVector(yaw, pitch);
//Get modelview matrix and invert it
Matrix4f modelviewMatrix = new Matrix4f();
modelviewMatrix.load(this.modelview.asReadOnlyBuffer());
modelviewMatrix.invert();
//Get frustum position
frustumPos = new Vector3D(modelviewMatrix.m30, modelviewMatrix.m31, modelviewMatrix.m32);
frustum = getFrustum(frustumPos.x, frustumPos.y, frustumPos.z, yaw, pitch, fov, 1.0F, displayWidth / displayHeight);
invFrustum = getFrustum(frustumPos.x, frustumPos.y, frustumPos.z, yaw - 180, -pitch, fov, 1.0F, displayWidth / displayHeight);
//Set view vec
viewVec = getRotationVector(yaw, pitch).normalized();
//Calculate screen border angles
bra = Math.toDegrees(Math.acos((displayHeight * heightScale) / Math.sqrt(displayWidth * widthScale * displayWidth * widthScale + displayHeight * heightScale * displayHeight * heightScale)));
bla = 360 - bra;
tra = bla - 180;
tla = bra + 180;
//Create screen border lines
rb = new Line(displayWidth * this.widthScale, 0, 0, 0, 1, 0);
tb = new Line(0, 0, 0, 1, 0, 0);
lb = new Line(0, 0, 0, 0, 1, 0);
bb = new Line(0, displayHeight * this.heightScale, 0, 1, 0, 0);
}