本文整理汇总了Java中com.badlogic.gdx.math.Matrix4.mul方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4.mul方法的具体用法?Java Matrix4.mul怎么用?Java Matrix4.mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.Matrix4
的用法示例。
在下文中一共展示了Matrix4.mul方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GLToClipTransform
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
public static void GLToClipTransform(Matrix4 transformOut) {
if(null == transformOut) return;
Director director = Director.getInstance();
Matrix4 projection = director.getMatrix(MATRIX_STACK_TYPE.MATRIX_STACK_PROJECTION);
Matrix4 modelview = director.getMatrix(MATRIX_STACK_TYPE.MATRIX_STACK_MODELVIEW);
// System.out.println(projection);
// System.out.println(modelview);
//?
transformOut.set(projection);
transformOut.mul(modelview);
// *transformOut = projection * modelview;
}
示例2: UpdateViewMatrix
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
private void UpdateViewMatrix()
{
Matrix4 cameraRotation = new Matrix4();
cameraRotation = Utils.createRotate(updownRot, leftrightRot, 0f, cameraRotation);
Vector3 cameraOriginalTarget = new Vector3(0, 0, -1);
Vector3 cameraOriginalUpVector = new Vector3(0, 1, 0);
// cameraRotation.rotate(1, 0, 0, cameraOriginalTarget.x);
Vector3 cameraRotatedTarget = Utils.Transform(cameraOriginalTarget, cameraRotation);
Vector3 cameraFinalTarget = Utils.addVector(position,cameraRotatedTarget);
up.set(Utils.Transform(cameraOriginalUpVector, cameraRotation));
view.setToLookAt(position, cameraFinalTarget, up);
float aspect = viewportWidth / viewportHeight;
projection.setToProjection(Math.abs(near), Math.abs(far), fieldOfView, aspect);
combined.set(projection);
Matrix4.mul(combined.val, view.val);
invProjectionView.set(combined);
Matrix4.inv(invProjectionView.val);
frustum.update(invProjectionView);
}
示例3: UpdateViewMatrix
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Update camera's matrix
*/
private void UpdateViewMatrix()
{
Matrix4 cameraRotation = new Matrix4();
cameraRotation = Utils.createRotate(updownRot, leftrightRot, 0f, cameraRotation);
Vector3 cameraOriginalTarget = new Vector3(0, 0, -1);
Vector3 cameraOriginalUpVector = new Vector3(0, 1, 0);
// cameraRotation.rotate(1, 0, 0, cameraOriginalTarget.x);
Vector3 cameraRotatedTarget = Utils.Transform(cameraOriginalTarget, cameraRotation);
Vector3 cameraFinalTarget = Utils.addVector(position,cameraRotatedTarget);
up.set(Utils.Transform(cameraOriginalUpVector, cameraRotation));
view.setToLookAt(position, cameraFinalTarget, up);
float aspect = viewportWidth / viewportHeight;
projection.setToProjection(Math.abs(near), Math.abs(far), fieldOfView, aspect);
combined.set(projection);
Matrix4.mul(combined.val, view.val);
invProjectionView.set(combined);
Matrix4.inv(invProjectionView.val);
frustum.update(invProjectionView);
}
示例4: update
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
@Override
public void update(){
combined.set(projection);
Matrix4.mul(combined.val, view.val);
invProjectionView.set(combined);
Matrix4.inv(invProjectionView.val);
frustum.update(invProjectionView);
}
示例5: begin
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Starts a new batch of shapes. Shapes drawn within the batch will attempt to use the type specified. The call to this method
* must be paired with a call to {@link #end()}.
*
* @see #setAutoShapeType(boolean)
*/
public void begin(ShapeType type) {
if (shapeType != null)
throw new IllegalStateException("Call end() before beginning a new shape batch.");
shapeType = type;
if (matrixDirty) {
combinedMatrix.set(projectionMatrix);
Matrix4.mul(combinedMatrix.val, transformMatrix.val);
matrixDirty = false;
}
renderer.begin(combinedMatrix, shapeType.getGlType());
}
示例6: update
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
@Override
public void update(boolean updateFrustum) {
// get the projection matrix from the HDM
VRSystem.VRSystem_GetProjectionMatrix(eye.index, near, far, projectionMat);
VRContext.hmdMat4toMatrix4(projectionMat, projection);
// get the eye space matrix from the HDM
VRSystem.VRSystem_GetEyeToHeadTransform(eye.index, eyeMat);
VRContext.hmdMat34ToMatrix4(eyeMat, eyeSpace);
invEyeSpace.set(eyeSpace).inv();
// get the pose matrix from the HDM
VRDevice hmd = context.getDeviceByType(VRDeviceType.HeadMountedDisplay);
Vector3 y = hmd.getUp(Space.World);
Vector3 z = hmd.getDirection(Space.World);
Vector3 p = hmd.getPosition(Space.World);
view.idt();
view.setToLookAt(p, tmp.set(p).add(z), y);
position.set(p);
direction.set(z);
up.set(y);
combined.set(projection);
Matrix4.mul(combined.val, invEyeSpace.val);
Matrix4.mul(combined.val, view.val);
if (updateFrustum) {
invProjectionView.set(combined);
Matrix4.inv(invProjectionView.val);
frustum.update(invProjectionView);
}
}
示例7: update
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
@Override
public void update (boolean updateFrustum) {
view.setToLookAt(position, tmp.set(position).add(direction), up);
combined.set(projection);
Matrix4.mul(combined.val, view.val);
if (updateFrustum) {
invProjectionView.set(combined);
Matrix4.inv(invProjectionView.val);
frustum.update(invProjectionView);
}
}
示例8: mulMatrix
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Multiply the mx1 and mx2, mx1 and mx2 will not be changed
*
* @param m1
* @param m2
* @return
*/
public static Matrix4 mulMatrix(Matrix4 m1, Matrix4 m2) {
Matrix4 mx1 = new Matrix4(m1.val);
Matrix4 mx2 = new Matrix4(m2.val);
return mx1.mul(mx2);
}