当前位置: 首页>>代码示例>>Java>>正文


Java Matrix4f.invert方法代码示例

本文整理汇总了Java中org.lwjgl.util.vector.Matrix4f.invert方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.invert方法的具体用法?Java Matrix4f.invert怎么用?Java Matrix4f.invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.util.vector.Matrix4f的用法示例。


在下文中一共展示了Matrix4f.invert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toWorldCoords

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Vector3f toWorldCoords(Vector4f eyeCoords) {
	Matrix4f invertedView = Matrix4f.invert(viewMatrix, null);
	Vector4f rayWorld = Matrix4f.transform(invertedView, eyeCoords, null);
	Vector3f mouseRay = new Vector3f(rayWorld.x, rayWorld.y, rayWorld.z);
	mouseRay.normalise();
	return mouseRay;
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:8,代码来源:MousePicker.java

示例2: toEyeCoords

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Vector4f toEyeCoords(Vector4f clipCoords) {
	Matrix4f invertedProjection = Matrix4f.invert(projectionMatrix, null);
	Vector4f eyeCoords = Matrix4f.transform(invertedProjection, clipCoords, null);
	return new Vector4f(eyeCoords.x, eyeCoords.y, -1f, 0f);
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:6,代码来源:MousePicker.java

示例3: 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);
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:56,代码来源:GLUProjection.java

示例4: calcInverseBindTransform

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * This is called during set-up, after the joints hierarchy has been
 * created. This calculates the model-space bind transform of this joint
 * like so: </br>
 * </br>
 * {@code bindTransform = parentBindTransform * localBindTransform}</br>
 * </br>
 * where "bindTransform" is the model-space bind transform of this joint,
 * "parentBindTransform" is the model-space bind transform of the parent
 * joint, and "localBindTransform" is the bone-space bind transform of this
 * joint. It then calculates and stores the inverse of this model-space bind
 * transform, for use when calculating the final animation transform each
 * frame. It then recursively calls the method for all of the children
 * joints, so that they too calculate and store their inverse bind-pose
 * transform.
 * 
 * @param parentBindTransform
 *            - the model-space bind transform of the parent joint.
 */
protected void calcInverseBindTransform(Matrix4f parentBindTransform){
	Matrix4f bindTransform=Matrix4f.mul(parentBindTransform, localBindTransform, null);
	Matrix4f.invert(bindTransform, inverseBindTransform);
	for(Joint child:children){
		child.calcInverseBindTransform(bindTransform);
	}
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:27,代码来源:Joint.java

示例5: calcInverseBindTransform

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * This is called during set-up, after the joints hierarchy has been
 * created. This calculates the model-space bind transform of this joint
 * like so: </br>
 * </br>
 * {@code bindTransform = parentBindTransform * localBindTransform}</br>
 * </br>
 * where "bindTransform" is the model-space bind transform of this joint,
 * "parentBindTransform" is the model-space bind transform of the parent
 * joint, and "localBindTransform" is the bone-space bind transform of this
 * joint. It then calculates and stores the inverse of this model-space bind
 * transform, for use when calculating the final animation transform each
 * frame. It then recursively calls the method for all of the children
 * joints, so that they too calculate and store their inverse bind-pose
 * transform.
 * 
 * @param parentBindTransform
 *            - the model-space bind transform of the parent joint.
 */
protected void calcInverseBindTransform(Matrix4f parentBindTransform) {
	Matrix4f bindTransform = Matrix4f.mul(parentBindTransform, localBindTransform, null);
	Matrix4f.invert(bindTransform, inverseBindTransform);
	for (Joint child : children) {
		child.calcInverseBindTransform(bindTransform);
	}
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:27,代码来源:Joint.java


注:本文中的org.lwjgl.util.vector.Matrix4f.invert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。