本文整理汇总了Java中com.jme3.math.Matrix4f.multProj方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.multProj方法的具体用法?Java Matrix4f.multProj怎么用?Java Matrix4f.multProj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.math.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.multProj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorldCoordinates
import com.jme3.math.Matrix4f; //导入方法依赖的package包/类
/**
* @see Camera#getWorldCoordinates
*/
public Vector3f getWorldCoordinates(Vector2f screenPosition,
float zPos, Vector3f store) {
if (store == null) {
store = new Vector3f();
}
Matrix4f inverseMat = new Matrix4f(viewProjectionMatrix);
inverseMat.invertLocal();
store.set(
(screenPosition.x / getWidth() - viewPortLeft) / (viewPortRight - viewPortLeft) * 2 - 1,
(screenPosition.y / getHeight() - viewPortBottom) / (viewPortTop - viewPortBottom) * 2 - 1,
zPos * 2 - 1);
float w = inverseMat.multProj(store, store);
store.multLocal(1f / w);
return store;
}
示例2: computeBoundForPoints
import com.jme3.math.Matrix4f; //导入方法依赖的package包/类
/**
* Compute bounds from an array of points
* @param pts
* @param mat
* @return
*/
public static BoundingBox computeBoundForPoints(Vector3f[] pts, Matrix4f mat) {
Vector3f min = new Vector3f(Vector3f.POSITIVE_INFINITY);
Vector3f max = new Vector3f(Vector3f.NEGATIVE_INFINITY);
Vector3f temp = new Vector3f();
for (int i = 0; i < pts.length; i++) {
float w = mat.multProj(pts[i], temp);
temp.x /= w;
temp.y /= w;
// Why was this commented out?
temp.z /= w;
min.minLocal(temp);
max.maxLocal(temp);
}
Vector3f center = min.add(max).multLocal(0.5f);
Vector3f extent = max.subtract(min).multLocal(0.5f);
//Nehon 08/18/2010 : Added an offset to the extend to avoid banding artifacts when the frustum are aligned
return new BoundingBox(center, extent.x + 2.0f, extent.y + 2.0f, extent.z + 2.5f);
}
示例3: transform
import com.jme3.math.Matrix4f; //导入方法依赖的package包/类
public BoundingVolume transform(Matrix4f trans, BoundingVolume store) {
BoundingBox box;
if (store == null || store.getType() != Type.AABB) {
box = new BoundingBox();
} else {
box = (BoundingBox) store;
}
TempVars vars = TempVars.get();
float w = trans.multProj(center, box.center);
box.center.divideLocal(w);
Matrix3f transMatrix = vars.tempMat3;
trans.toRotationMatrix(transMatrix);
// Make the rotation matrix all positive to get the maximum x/y/z extent
transMatrix.absoluteLocal();
vars.vect1.set(xExtent, yExtent, zExtent);
transMatrix.mult(vars.vect1, vars.vect1);
// Assign the biggest rotations after scales.
box.xExtent = FastMath.abs(vars.vect1.getX());
box.yExtent = FastMath.abs(vars.vect1.getY());
box.zExtent = FastMath.abs(vars.vect1.getZ());
vars.release();
return box;
}