本文整理匯總了Java中org.lwjgl.util.vector.Matrix4f.setIdentity方法的典型用法代碼示例。如果您正苦於以下問題:Java Matrix4f.setIdentity方法的具體用法?Java Matrix4f.setIdentity怎麽用?Java Matrix4f.setIdentity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.util.vector.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.setIdentity方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTransformationMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static Matrix4f createTransformationMatrix(final Vector3f translation, final float rx, final float ry, final float rz, final float scale) {
final Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.translate(translation, matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix, matrix);
Matrix4f.scale(new Vector3f(scale, scale, scale), matrix, matrix);
return matrix;
}
示例2: createTransformationMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static Matrix4f createTransformationMatrix(Vector3f translation, float rx, float ry, float rz, float scale) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.translate(translation, matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix, matrix);
Matrix4f.scale(new Vector3f(scale, scale, scale), matrix, matrix);
return matrix;
}
示例3: createViewMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static Matrix4f createViewMatrix(Camera camera) {
Matrix4f viewMatrix = new Matrix4f();
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
Vector3f cameraPos = camera.getPosition();
Vector3f negativeCameraPos = new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
return viewMatrix;
}
示例4: createView
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public Matrix4f createView(Matrix4f dest){
dest.setIdentity();
// MatrixUtil.rotateZXY(dest, PartialTick.calc(activeRotVec, prevRot, rot));
MatrixUtil.rotateZXY(dest, activeRotVec.set(rot));
Vec3f rotV=activeRotVec.clone().eulerToDirection().mul(-viewDistance.get());
if(rotV.y()<0) rotV.y((float)-Math.sqrt(-rotV.y()));
dest.translate(PartialTick.calc(EFF_POS, prevPos, pos).add(rotV).mul(-1F));
activeRotVec.mul(-1);
activeRotQuat.set(activeRotVec);
return dest;
}
示例5: createViewMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static Matrix4f createViewMatrix(final Camera camera) {
final Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0), matrix, matrix);
final Vector3f cameraPos = camera.getPosition();
final Vector3f negativeCameraPos = new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z);
Matrix4f.translate(negativeCameraPos, matrix, matrix);
return matrix;
}
示例6: updateViewMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static void updateViewMatrix(Matrix4f viewMatrix, float x, float y, float z, float pitch, float yaw){
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(pitch), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(yaw), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
Vector3f negativeCameraPos = new Vector3f(-x, -y, -z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
}
示例7: createTransformationMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
/**
* Creates transformation matrix for models in rendering.
* @param translation - Translation
* @param rx - Rotation on the x axis
* @param ry - Rotation on the y axis
* @param rz - Rotation on the z axis
* @param scale - Scale
* @return - Transformation matrix
*/
public static Matrix4f createTransformationMatrix(Vector3f translation, float rx, float ry, float rz, float scale) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.translate(translation, matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix, matrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix, matrix);
Matrix4f.scale(new Vector3f(scale, scale, scale), matrix, matrix);
return matrix;
}
示例8: createViewMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
/**
* Creates view matrix based off camera for rendering
* @param camera - camera to base view matrix
* @return - New view matrix
*/
public static Matrix4f createViewMatrix(Camera camera) {
Matrix4f viewMatrix = new Matrix4f();
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
Vector3f cameraPos = camera.getPosition();
Vector3f negativeCameraPos = new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
return viewMatrix;
}
示例9: updateViewMatrix
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
public static void updateViewMatrix(Matrix4f viewMatrix, float x, float y, float z, float pitch, float yaw) {
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(pitch), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(yaw), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
Vector3f negativeCameraPos = new Vector3f(-x, -y, -z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
}
示例10: getMatrixIdentity
import org.lwjgl.util.vector.Matrix4f; //導入方法依賴的package包/類
private Matrix4f getMatrixIdentity()
{
Matrix4f matrix4f = new Matrix4f();
matrix4f.setIdentity();
return matrix4f;
}