本文整理汇总了Java中ch.fhnw.util.math.Mat4.multiply方法的典型用法代码示例。如果您正苦于以下问题:Java Mat4.multiply方法的具体用法?Java Mat4.multiply怎么用?Java Mat4.multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.fhnw.util.math.Mat4
的用法示例。
在下文中一共展示了Mat4.multiply方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransformedGeometryData
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
@Override
public float[][] getTransformedGeometryData() {
float[][] src = geometry.getData();
float[][] dst = new float[src.length][];
IGeometryAttribute[] attrs = geometry.getAttributes();
Mat4 tp = Mat4.multiply(Mat4.translate(position), transform);
dst[0] = tp.transform(src[0]);
for (int i = 1; i < src.length; ++i) {
if (attrs[i].equals(IGeometry.NORMAL_ARRAY)) {
Mat3 tn = new Mat3(tp).inverse().transpose();
dst[i] = tn.transform(src[i]);
} else {
dst[i] = Arrays.copyOf(src[i], src[i].length);
}
}
return dst;
}
示例2: addToAzimuth
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
/**
* Orbit around target with camera orbit axis. Positive value orbits
* counter-clock-wise around axis.
*
* @param delta
* relative angle in degrees
*/
public void addToAzimuth(float delta) {
Mat4 m = Mat4.multiply(Mat4.translate(camera.getTarget()), Mat4.rotate(delta, camera.getCameraOrbitAxis()),
Mat4.translate(camera.getTarget().negate()));
Vec3 p = m.transform(camera.getPosition());
Vec3 u = m.transform(camera.getPosition().add(camera.getUp())).subtract(p);
camera.setPosition(p);
camera.setUp(u);
}
示例3: addToElevation
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
/**
* Orbit around target on camera-x axis. Positive value orbits clock-wise
* around camera-x axis, i.e. moves camera "up"
*
* @param delta
* relative angle in degrees
*/
public void addToElevation(float delta) {
Mat4 m = Mat4.multiply(Mat4.translate(camera.getTarget()), Mat4.rotate(-delta, camera.getCameraXAxis()),
Mat4.translate(camera.getTarget().negate()));
Vec3 p = m.transform(camera.getPosition());
Vec3 u = m.transform(camera.getPosition().add(camera.getUp())).subtract(p);
if (KEEP_ROT_X_POSITIVE && Vec3.Z.dot(u) < 0)
return;
camera.setPosition(p);
camera.setUp(u);
}
示例4: getViewProjMatrix
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
@Override
public Mat4 getViewProjMatrix() {
if (viewProjMatrix == null) {
viewProjMatrix = Mat4.multiply(getProjMatrix(), getViewMatrix());
}
return viewProjMatrix;
}
示例5: getData
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
@Override
public Object[] getData() {
Mat4 rot = Mat4.rotate(rotation, Vec3.Z);
Mat4 view = Mat4.lookAt(new Vec3(0, 10, 10), Vec3.ZERO, Vec3.Z);
Mat4 proj = Mat4.perspective(45, 1, 1, 100);
Mat4 mvp = Mat4.multiply(proj, view, rot);
return data(mvp);
}
示例6: calcTransformation
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
private Mat4 calcTransformation(Vec3 pos, Vec3 velocity) {
float angleY = (float) Math.atan2(velocity.z, velocity.x);
float angleX = (float) Math.atan2(velocity.y, Math.sqrt(Math.pow(velocity.x, 2) + Math.pow(velocity.z, 2)));
float angleYinGrad = (float)Math.toDegrees(angleY);
float angleXinGrad = (float)Math.toDegrees(angleX);
return Mat4.multiply(Mat4.translate(pos),
Mat4.rotate(angleXinGrad, Vec3.X),
Mat4.rotate(angleYinGrad, Vec3.Y));
}
示例7: getTransformedPositionData
import ch.fhnw.util.math.Mat4; //导入方法依赖的package包/类
@Override
public float[] getTransformedPositionData() {
Mat4 tp = Mat4.multiply(Mat4.translate(position), transform);
return tp.transform(geometry.getData()[0]);
}