本文整理汇总了Java中com.ra4king.opengl.util.math.Vector3.cross方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3.cross方法的具体用法?Java Vector3.cross怎么用?Java Vector3.cross使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ra4king.opengl.util.math.Vector3
的用法示例。
在下文中一共展示了Vector3.cross方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookAt
import com.ra4king.opengl.util.math.Vector3; //导入方法依赖的package包/类
@CopyStruct
public static Matrix4 lookAt(Vector3 eye, Vector3 center, Vector3 up) {
Vector3 w = new Vector3(center).sub(eye).normalize();
up = new Vector3(up).normalize();
Vector3 u = w.cross(up, new Vector3());
Vector3 v = u.cross(w, new Vector3());
return new Matrix4(new float[] {
u.x(), v.x(), -w.x(), 0,
u.y(), v.y(), -w.y(), 0,
u.z(), v.z(), -w.z(), 0,
0, 0, 0, 1
}).translate(new Vector3(eye).mult(-1));
}
示例2: calcLookAtMatrix
import com.ra4king.opengl.util.math.Vector3; //导入方法依赖的package包/类
private Matrix4 calcLookAtMatrix(Vector3 cameraPoint, Vector3 lookPoint, Vector3 upPoint) {
Vector3 lookDir = new Vector3(lookPoint).sub(cameraPoint).normalize();
Vector3 upDir = new Vector3(upPoint).normalize();
Vector3 rightDir = lookDir.cross(upDir).normalize();
Vector3 perpUpDir = rightDir.cross(lookDir);
Matrix4 rotMat = new Matrix4().clearToIdentity();
rotMat.putColumn(0, rightDir, 0);
rotMat.putColumn(1, perpUpDir, 0);
rotMat.putColumn(2, lookDir.mult(-1), 0);
return rotMat.transpose().translate(new Vector3(cameraPoint).mult(-1));
}
示例3: calcLookAtMatrix
import com.ra4king.opengl.util.math.Vector3; //导入方法依赖的package包/类
private Matrix4 calcLookAtMatrix(Vector3 cameraPoint, Vector3 lookPoint, Vector3 upPoint) {
Vector3 lookDir = new Vector3(lookPoint).sub(cameraPoint).normalize();
Vector3 upDir = upPoint.normalize();
Vector3 rightDir = lookDir.cross(upDir).normalize();
Vector3 perpUpDir = rightDir.cross(lookDir);
Matrix4 rotMat = new Matrix4().clearToIdentity();
rotMat.putColumn(0, rightDir);
rotMat.putColumn(1, perpUpDir);
rotMat.putColumn(2, lookDir.mult(-1));
return rotMat.transpose().translate(cameraPoint.mult(-1));
}
示例4: lookAt
import com.ra4king.opengl.util.math.Vector3; //导入方法依赖的package包/类
public static Matrix4 lookAt(Vector3 eye, Vector3 center, Vector3 up) {
Vector3 f = center.copy().sub(eye).normalize();
up = up.copy().normalize();
Vector3 s = f.cross(up);
Vector3 u = s.cross(f);
return new Matrix4(new float[] {
s.x(), u.x(), -f.x(), 0,
s.y(), u.y(), -f.y(), 0,
s.z(), u.z(), -f.z(), 0,
0, 0, 0, 1
}).translate(eye.copy().mult(-1));
}