本文整理了Java中com.badlogic.gdx.math.Quaternion.idt
方法的一些代码示例,展示了Quaternion.idt
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.idt
方法的具体详情如下:
包路径:com.badlogic.gdx.math.Quaternion
类名称:Quaternion
方法名:idt
[英]Sets the quaternion to an identity Quaternion
[中]将四元数设置为标识四元数
代码示例来源:origin: libgdx/libgdx
public Quaternion () {
idt();
}
代码示例来源:origin: libgdx/libgdx
public Quaternion () {
idt();
}
代码示例来源:origin: libgdx/libgdx
public Transform idt () {
translation.set(0, 0, 0);
rotation.idt();
scale.set(1, 1, 1);
return this;
}
代码示例来源:origin: libgdx/libgdx
public Transform idt () {
translation.set(0, 0, 0);
rotation.idt();
scale.set(1, 1, 1);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** Sets the quaternion components from the given axis and angle around that axis.
* @param x X direction of the axis
* @param y Y direction of the axis
* @param z Z direction of the axis
* @param radians The angle in radians
* @return This quaternion for chaining. */
public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) {
float d = Vector3.len(x, y, z);
if (d == 0f) return idt();
d = 1f / d;
float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2;
float l_sin = (float)Math.sin(l_ang / 2);
float l_cos = (float)Math.cos(l_ang / 2);
return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor();
}
代码示例来源:origin: libgdx/libgdx
/** Sets the quaternion components from the given axis and angle around that axis.
* @param x X direction of the axis
* @param y Y direction of the axis
* @param z Z direction of the axis
* @param radians The angle in radians
* @return This quaternion for chaining. */
public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) {
float d = Vector3.len(x, y, z);
if (d == 0f) return idt();
d = 1f / d;
float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2;
float l_sin = (float)Math.sin(l_ang / 2);
float l_cos = (float)Math.cos(l_ang / 2);
return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor();
}
代码示例来源:origin: libgdx/libgdx
private void doneLoading () {
Model model = assets.get("data/g3d/invaders.g3dj", Model.class);
for (int i = 0; i < model.nodes.size; i++) {
String id = model.nodes.get(i).id;
ModelInstance instance = new ModelInstance(model, id);
Node node = instance.getNode(id);
instance.transform.set(node.globalTransform);
node.translation.set(0, 0, 0);
node.scale.set(1, 1, 1);
node.rotation.idt();
instance.calculateTransforms();
if (id.equals("space")) {
space = instance;
continue;
}
instances.add(instance);
if (id.equals("ship"))
ship = instance;
else if (id.startsWith("block"))
blocks.add(instance);
else if (id.startsWith("invader")) invaders.add(instance);
}
loading = false;
}
代码示例来源:origin: libgdx/libgdx
/** @param model The source {@link Model}
* @param transform The {@link Matrix4} instance for this ModelInstance to reference or null to create a new matrix.
* @param nodeId The ID of the {@link Node} within the {@link Model} for the instance to contain
* @param recursive True to recursively search the Model's node tree, false to only search for a root node
* @param parentTransform True to apply the parent's node transform to the instance (only applicable if recursive is true).
* @param mergeTransform True to apply the source node transform to the instance transform, resetting the node transform. */
public ModelInstance (final Model model, final Matrix4 transform, final String nodeId, boolean recursive,
boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) {
this.model = model;
this.transform = transform == null ? new Matrix4() : transform;
Node copy, node = model.getNode(nodeId, recursive);
this.nodes.add(copy = node.copy());
if (mergeTransform) {
this.transform.mul(parentTransform ? node.globalTransform : node.localTransform);
copy.translation.set(0, 0, 0);
copy.rotation.idt();
copy.scale.set(1, 1, 1);
} else if (parentTransform && copy.hasParent()) this.transform.mul(node.getParent().globalTransform);
invalidate();
copyAnimations(model.animations, shareKeyframes);
calculateTransforms();
}
代码示例来源:origin: libgdx/libgdx
/** @param model The source {@link Model}
* @param transform The {@link Matrix4} instance for this ModelInstance to reference or null to create a new matrix.
* @param nodeId The ID of the {@link Node} within the {@link Model} for the instance to contain
* @param recursive True to recursively search the Model's node tree, false to only search for a root node
* @param parentTransform True to apply the parent's node transform to the instance (only applicable if recursive is true).
* @param mergeTransform True to apply the source node transform to the instance transform, resetting the node transform. */
public ModelInstance (final Model model, final Matrix4 transform, final String nodeId, boolean recursive,
boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) {
this.model = model;
this.transform = transform == null ? new Matrix4() : transform;
Node copy, node = model.getNode(nodeId, recursive);
this.nodes.add(copy = node.copy());
if (mergeTransform) {
this.transform.mul(parentTransform ? node.globalTransform : node.localTransform);
copy.translation.set(0, 0, 0);
copy.rotation.idt();
copy.scale.set(1, 1, 1);
} else if (parentTransform && copy.hasParent()) this.transform.mul(node.getParent().globalTransform);
invalidate();
copyAnimations(model.animations, shareKeyframes);
calculateTransforms();
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public Quaternion () {
idt();
}
代码示例来源:origin: com.harium.etyl/etyl-gdx-util
public Quaternion () {
idt();
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public Transform idt () {
translation.set(0, 0, 0);
rotation.idt();
scale.set(1, 1, 1);
return this;
}
代码示例来源:origin: mbrlabs/Mundus
public void setGlobalSpace(boolean global) {
this.globalSpace = global;
xHandle.getRotation().idt();
xHandle.applyTransform();
yHandle.getRotation().idt();
yHandle.applyTransform();
zHandle.getRotation().idt();
zHandle.applyTransform();
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** Sets the quaternion components from the given axis and angle around that axis.
* @param x X direction of the axis
* @param y Y direction of the axis
* @param z Z direction of the axis
* @param radians The angle in radians
* @return This quaternion for chaining. */
public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) {
float d = Vector3.len(x, y, z);
if (d == 0f) return idt();
d = 1f / d;
float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2;
float l_sin = (float)Math.sin(l_ang / 2);
float l_cos = (float)Math.cos(l_ang / 2);
return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor();
}
代码示例来源:origin: com.harium.etyl/etyl-gdx-util
/** Sets the quaternion components from the given axis and angle around that axis.
* @param x X direction of the axis
* @param y Y direction of the axis
* @param z Z direction of the axis
* @param radians The angle in radians
* @return This quaternion for chaining. */
public Quaternion setFromAxisRad (final float x, final float y, final float z, final float radians) {
float d = Vector3.len(x, y, z);
if (d == 0f) return idt();
d = 1f / d;
float l_ang = radians < 0 ? MathUtils.PI2 - (-radians % MathUtils.PI2) : radians % MathUtils.PI2;
float l_sin = (float)Math.sin(l_ang / 2);
float l_cos = (float)Math.cos(l_ang / 2);
return this.set(d * x * l_sin, d * y * l_sin, d * z * l_sin, l_cos).nor();
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** @param model The source {@link Model}
* @param transform The {@link Matrix4} instance for this ModelInstance to reference or null to create a new matrix.
* @param nodeId The ID of the {@link Node} within the {@link Model} for the instance to contain
* @param recursive True to recursively search the Model's node tree, false to only search for a root node
* @param parentTransform True to apply the parent's node transform to the instance (only applicable if recursive is true).
* @param mergeTransform True to apply the source node transform to the instance transform, resetting the node transform. */
public ModelInstance (final Model model, final Matrix4 transform, final String nodeId, boolean recursive,
boolean parentTransform, boolean mergeTransform, boolean shareKeyframes) {
this.model = model;
this.transform = transform == null ? new Matrix4() : transform;
Node copy, node = model.getNode(nodeId, recursive);
this.nodes.add(copy = node.copy());
if (mergeTransform) {
this.transform.mul(parentTransform ? node.globalTransform : node.localTransform);
copy.translation.set(0, 0, 0);
copy.rotation.idt();
copy.scale.set(1, 1, 1);
} else if (parentTransform && copy.hasParent()) this.transform.mul(node.getParent().globalTransform);
invalidate();
copyAnimations(model.animations, shareKeyframes);
calculateTransforms();
}
内容来源于网络,如有侵权,请联系作者删除!