本文整理汇总了Java中org.lwjgl.util.vector.Matrix4f.translate方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.translate方法的具体用法?Java Matrix4f.translate怎么用?Java Matrix4f.translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.util.vector.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Region
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
* Creates a square region of length size SIZE, and generates tiled terrain.
* @param x The x offset of the region
* @param z The z offset of the region
*/
public Region(float x, float z) {
transformationMatrix = new Matrix4f();
transformationMatrix.translate(new Vector3f(x * SIZE, 0, z * SIZE));
if(grassTexture == null) {
grassTexture = new Texture("grass.png");
}
createTerrain();
water = new WaterRegion(x * SIZE, z * SIZE);
}
示例6: update
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
* Updates the view matrix
*/
public void update() {
// Rotate the scene based on orientation
QuaternionUtil.toRotationMatrix(orientation, view);
// Translate the scene based on position
Matrix4f.translate(position.negate(null), view, view);
}
示例7: 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);
}
示例8: calculateMvpMatrix
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Matrix4f calculateMvpMatrix(Sun sun, ICamera camera) {
Matrix4f modelMatrix = new Matrix4f();
Vector3f sunPos = sun.getWorldPosition(camera.getPosition());
Matrix4f.translate(sunPos, modelMatrix, modelMatrix);
Matrix4f modelViewMat = applyViewMatrix(modelMatrix, camera.getViewMatrix());
Matrix4f.scale(new Vector3f(sun.getScale(), sun.getScale(), sun.getScale()), modelViewMat, modelViewMat);
return Matrix4f.mul(camera.getProjectionMatrix(), modelViewMat, null);
}
示例9: createTransformationMatrix
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
* Creates transformation matrix for GUIs in rendering.
* @param translation - Translation
* @param scale - Scale
* @return - Transformation matrix
*/
public static Matrix4f createTransformationMatrix(Vector2f translation, Vector2f scale) {
Matrix4f matrix = new Matrix4f();
matrix.setIdentity();
Matrix4f.translate(translation, matrix, matrix);
Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
return matrix;
}
示例10: 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;
}
示例11: updateViewMatrix
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void updateViewMatrix() {
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(pitch.get()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(yaw), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
Vector3f negativeCameraPos = new Vector3f(-position.x, -position.y, -position.z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
}
示例12: 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);
}
示例13: updateViewMatrix
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void updateViewMatrix() {
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(-position.x,-position.y,-position.z);
Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
}
示例14: createModelMatrix
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Matrix4f createModelMatrix(float x, float y, float z, float scale) {
Matrix4f modelMatrix = new Matrix4f();
Matrix4f.translate(new Vector3f(x, y, z), modelMatrix, modelMatrix);
Matrix4f.scale(new Vector3f(scale, scale, scale), modelMatrix, modelMatrix);
return modelMatrix;
}
示例15: getLocalTransform
import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
* In this method the bone-space transform matrix is constructed by
* translating an identity matrix using the position variable and then
* applying the rotation. The rotation is applied by first converting the
* quaternion into a rotation matrix, which is then multiplied with the
* transform matrix.
*
* @return This bone-space joint transform as a matrix. The exact same
* transform as represented by the position and rotation in this
* instance, just in matrix form.
*/
protected Matrix4f getLocalTransform(){
Matrix4f matrix=new Matrix4f();
matrix.translate(position);
Matrix4f.mul(matrix, rotation.toRotationMatrix(), matrix);
return matrix;
}