本文整理汇总了Java中com.badlogic.gdx.math.Matrix4.M20属性的典型用法代码示例。如果您正苦于以下问题:Java Matrix4.M20属性的具体用法?Java Matrix4.M20怎么用?Java Matrix4.M20使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.badlogic.gdx.math.Matrix4
的用法示例。
在下文中一共展示了Matrix4.M20属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Transform
/**
* Transform a Vector3 using a Transformation Matrix
*
* @param vector
* Vector to transform
* @param transform
* The Transformation matrix
* @return
*/
public static Vector3 Transform(Vector3 vector, Matrix4 transform) {
Vector3 result = new Vector3((vector.x * transform.val[Matrix4.M00])
+ (vector.y * transform.val[Matrix4.M10])
+ (vector.z * transform.val[Matrix4.M20])
+ transform.val[Matrix4.M30],
(vector.x * transform.val[Matrix4.M01])
+ (vector.y * transform.val[Matrix4.M11])
+ (vector.z * transform.val[Matrix4.M21])
+ transform.val[Matrix4.M31],
(vector.x * transform.val[Matrix4.M02])
+ (vector.y * transform.val[Matrix4.M12])
+ (vector.z * transform.val[Matrix4.M22])
+ transform.val[Matrix4.M32]);
return result;
}
示例2: getNodeToParentTransform
/**
* Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
* The matrix is in Pixels.
*/
public Matrix4 getNodeToParentTransform() {
if (_transformDirty) {
float x = _position.x, y = _position.y, z = _positionZ;
if (_ignoreAnchorPointForPosition) {
x += _anchorPointInPoints.x;
y += _anchorPointInPoints.y;
}
final float anchorPointX = _anchorPointInPoints.x * _scaleX;
final float anchorPointY = _anchorPointInPoints.y * _scaleY;
// Build Transform Matrix = translation * rotation * scale
final Matrix4 translation = poolMatrix_1.idt();
//move to anchor point first, then rotate
translation.setTranslation(x + anchorPointX, y + anchorPointY, z);
_transform.setFromEulerAngles(_rotationX, _rotationY, _rotationZ);
// _transform.set(_rotationQuat);
_transform.mulLeft(translation);
//move by (-anchorPoint.x, -anchorPoint.y, 0) after rotation
_transform.val[Matrix4.M03] -= anchorPointX;
_transform.val[Matrix4.M13] -= anchorPointY;
if (_scaleX != 1.f) {
// _tr
_transform.val[Matrix4.M00] *= _scaleX;
_transform.val[Matrix4.M10] *= _scaleX;
_transform.val[Matrix4.M20] *= _scaleX;
}
if (_scaleY != 1.f) {
_transform.val[Matrix4.M01] *= _scaleY;
_transform.val[Matrix4.M11] *= _scaleY;
_transform.val[Matrix4.M21] *= _scaleY;
}
if (_scaleZ != 1.f) {
_transform.val[Matrix4.M02] *= _scaleZ;
_transform.val[Matrix4.M12] *= _scaleZ;
_transform.val[Matrix4.M22] *= _scaleZ;
}
}
if (_additionalTransform != null) {
// // This is needed to support both Node::setNodeToParentTransform() and Node::setAdditionalTransform()
// // at the same time. The scenario is this:
// // at some point setNodeToParentTransform() is called.
// // and later setAdditionalTransform() is called every time. And since _transform
// // is being overwritten everyframe, _additionalTransform[1] is used to have a copy
// // of the last "_trasform without _additionalTransform"
if (_transformDirty) {
_additionalTransform[1].set(_transform);
}
//
if (_transformUpdated) {
_transform.set(_additionalTransform[1].mul(_additionalTransform[0]));
}
}
_transformDirty = _additionalTransformDirty = false;
return _transform;
}