本文整理汇总了Java中glm.quat.Quat类的典型用法代码示例。如果您正苦于以下问题:Java Quat类的具体用法?Java Quat怎么用?Java Quat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Quat类属于glm.quat包,在下文中一共展示了Quat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cast
import glm.quat.Quat; //导入依赖的package包/类
public static Mat4 cast(Quat q, Mat4 res) {
res.m00 = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
res.m01 = 2 * q.x * q.y + 2 * q.w * q.z;
res.m02 = 2 * q.x * q.z - 2 * q.w * q.y;
res.m03 = 0.0f;
res.m10 = 2 * q.x * q.y - 2 * q.w * q.z;
res.m11 = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
res.m12 = 2 * q.y * q.z + 2 * q.w * q.x;
res.m13 = 0.0f;
res.m20 = 2 * q.x * q.z + 2 * q.w * q.y;
res.m21 = 2 * q.y * q.z - 2 * q.w * q.x;
res.m22 = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
res.m23 = 0.0f;
res.m30 = 0.0f;
res.m31 = 0.0f;
res.m32 = 0.0f;
res.m33 = 1.0f;
return res;
}
示例2: calcMatrix
import glm.quat.Quat; //导入依赖的package包/类
/**
* Generates the world-to-camera matrix for the view.
*
* @return
*/
@Override
public Mat4 calcMatrix() {
Mat4 theMat = new Mat4(1.0f);
/**
* Remember: these transforms are in reverse order.
*
* In this space, we are facing in the correct direction. Which means
* that the camera point is directly behind us by the radius number of
* units.
*/
theMat.translate(0.0f, 0.0f, -currView.radius());
//Rotate the world to look in the right direction..
Quat fullRotation = Glm.angleAxis_(currView.degSpinRotation(), new Vec3(0.0f, 0.0f, 1.0f));
fullRotation.mul(currView.orient());
theMat.mul(Mat4.cast_(fullRotation));
// Translate the world by the negation of the lookat point, placing the origin at the lookat point.
theMat.translate(currView.targetPos().negate_());
return theMat;
}
示例3: cast
import glm.quat.Quat; //导入依赖的package包/类
public static Mat3 cast(Quat q) {
Mat3 result = new Mat3();
result.m00 = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
result.m01 = 2 * q.x * q.y + 2 * q.w * q.z;
result.m02 = 2 * q.x * q.z - 2 * q.w * q.y;
result.m10 = 2 * q.x * q.y - 2 * q.w * q.z;
result.m11 = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
result.m12 = 2 * q.y * q.z + 2 * q.w * q.x;
result.m20 = 2 * q.x * q.z + 2 * q.w * q.y;
result.m21 = 2 * q.y * q.z - 2 * q.w * q.x;
result.m22 = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
return result;
}
示例4: rotateViewDegrees
import glm.quat.Quat; //导入依赖的package包/类
public void rotateViewDegrees(Quat rot, boolean fromInitial) {
if (!isDragging) {
fromInitial = false;
}
if (view != null) {
Quat viewQuat = Quat.cast_(view.calcMatrix());
Quat invViewQuat = viewQuat.conjugate_();
po.orientation((invViewQuat.mul(rot).mul(viewQuat).mul(fromInitial ? startDragOrient : po.orientation()))
.normalize());
} else {
rotateWorldDegrees(rot, fromInitial);
}
}
示例5: ViewData
import glm.quat.Quat; //导入依赖的package包/类
public ViewData(Vec3 targetPos, Quat orient, float radius, float degSpinRotation) {
this.targetPos = targetPos;
this.orient = orient;
this.radius = radius;
this.degSpinRotation = degSpinRotation;
}
示例6: angleAxis_
import glm.quat.Quat; //导入依赖的package包/类
public static Quat angleAxis_(float degAngle, Vec3 v) {
return Quat.angleAxis_(degAngle, v);
}
示例7: angleAxis
import glm.quat.Quat; //导入依赖的package包/类
public static Quat angleAxis(float degAngle, Vec3 v, Quat res) {
return Quat.angleAxis(degAngle, v, res);
}
示例8: dot
import glm.quat.Quat; //导入依赖的package包/类
public static float dot(Quat v0, Quat v1) {
return Quat.dot(v0, v1);
}
示例9: cast_
import glm.quat.Quat; //导入依赖的package包/类
public static Mat4 cast_(Quat q) {
return cast(q, new Mat4());
}
示例10: ObjectData
import glm.quat.Quat; //导入依赖的package包/类
public ObjectData(Vec3 position, Quat orientation) {
this.position = position;
this.orientation = orientation;
}
示例11: orientation
import glm.quat.Quat; //导入依赖的package包/类
public Quat orientation() {
return orientation;
}
示例12: calcRotationQuat
import glm.quat.Quat; //导入依赖的package包/类
private Quat calcRotationQuat(int axis, float degAngle) {
return Glm.angleAxis_(degAngle, axisVectors[axis]);
}
示例13: rotateWorldDegrees
import glm.quat.Quat; //导入依赖的package包/类
public void rotateWorldDegrees(Quat rot) {
rotateViewDegrees(rot, false);
}
示例14: rotateLocalDegrees
import glm.quat.Quat; //导入依赖的package包/类
public void rotateLocalDegrees(Quat rot) {
rotateLocalDegrees(rot, false);
}
示例15: mouseMove
import glm.quat.Quat; //导入依赖的package包/类
public void mouseMove(MouseEvent mouseEvent) {
if (isDragging) {
Vec2i position = new Vec2i(mouseEvent.getX(), mouseEvent.getY());
Vec2i diff = position.sub_(prevMousePos);
switch (rotateMode) {
case RotateMode.DUAL_AXIS:
Quat rot = calcRotationQuat(Axis.Y, diff.x * rotateScale);
rot = calcRotationQuat(Axis.X, diff.y * rotateScale).mul(rot).normalize();
rotateViewDegrees(rot);
break;
case RotateMode.BIAXIAL:
Vec2i initDiff = position.sub_(startDragMousePos);
int axis;
float degAngle;
if (Math.abs(initDiff.x) > Math.abs(initDiff.y)) {
axis = Axis.Y;
degAngle = initDiff.x * rotateScale;
} else {
axis = Axis.X;
degAngle = initDiff.y * rotateScale;
}
rot = calcRotationQuat(axis, degAngle);
rotateViewDegrees(rot, true);
break;
case RotateMode.SPIN:
rotateViewDegrees(calcRotationQuat(Axis.Z, -diff.x * rotateScale));
break;
}
prevMousePos = position;
}
}