/** * <code>setRotationQuaternion</code> builds a rotation from a * <code>Quaternion</code>. * * @param quat * the quaternion to build the rotation from. * @throws NullPointerException * if quat is null. */ public void setRotationQuaternion(Quaternion quat) { quat.toRotationMatrix(this); }
/** * * <code>set</code> defines the values of the matrix based on a supplied * <code>Quaternion</code>. It should be noted that all previous values * will be overridden. * * @param quaternion * the quaternion to create a rotational matrix from. * @return this */ public Matrix3f set(Quaternion quaternion) { return quaternion.toRotationMatrix(this); }
/** * <code>toRotationMatrix</code> converts this quaternion to a rotational * matrix. Note: the result is created from a normalized version of this quat. * * @return the rotation matrix representation of this quaternion. */ public Matrix3f toRotationMatrix() { Matrix3f matrix = new Matrix3f(); return toRotationMatrix(matrix); }
/** * * <code>toAxes</code> takes in an array of three vectors. Each vector * corresponds to an axis of the coordinate system defined by the quaternion * rotation. * * @param axis * the array of vectors to be filled. */ public void toAxes(Vector3f axis[]) { Matrix3f tempMat = toRotationMatrix(); axis[0] = tempMat.getColumn(0, axis[0]); axis[1] = tempMat.getColumn(1, axis[1]); axis[2] = tempMat.getColumn(2, axis[2]); }
public Matrix3f getPhysicsRotationMatrix() { gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation()); return physicsLocation.getRotation().toRotationMatrix(); }
public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(spatial.getWorldTranslation()); setPhysicsRotation(spatial.getWorldRotation().toRotationMatrix()); }
/** * Stores the skinning transform in the specified Matrix4f. * The skinning transform applies the animation of the bone to a vertex. * * This assumes that the world transforms for the entire bone hierarchy * have already been computed, otherwise this method will return undefined * results. * * @param outTransform */ void getOffsetTransform(Matrix4f outTransform, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3, Matrix3f tmp4) { // Computing scale Vector3f scale = modelScale.mult(modelBindInverseScale, tmp3); // Computing rotation Quaternion rotate = modelRot.mult(modelBindInverseRot, tmp1); // Computing translation // Translation depend on rotation and scale Vector3f translate = modelPos.add(rotate.mult(scale.mult(modelBindInversePos, tmp2), tmp2), tmp2); // Populating the matrix outTransform.setTransform(translate, scale, rotate.toRotationMatrix(tmp4)); }
vehicle.resetSuspension(); bridge.setPhysicsLocation(new Vector3f(0,1.4f,4)); bridge.setPhysicsRotation(Quaternion.DIRECTION_Z.toRotationMatrix());
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), trans.getScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } else if (spatial instanceof Node) { createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic); shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } else if (spatial instanceof Geometry) { Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE); shape.addChildShape(childShape, trans.getTranslation(), trans.getRotation().toRotationMatrix()); shape.addChildShape(createSingleBoxShape(spatial, realRootNode), trans.getTranslation(), trans.getRotation().toRotationMatrix());
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), trans.getScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } else if (spatial instanceof Node) { createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic); shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()), trans.getTranslation(), trans.getRotation().toRotationMatrix()); } else if (spatial instanceof Geometry) { Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE); shape.addChildShape(childShape, trans.getTranslation(), trans.getRotation().toRotationMatrix()); shape.addChildShape(createSingleBoxShape(spatial, realRootNode), trans.getTranslation(), trans.getRotation().toRotationMatrix());
/** * Callback from Control.render(), do not use. * * @param rm * @param vp */ private void renderFromControl(RenderManager rm, ViewPort vp) { Camera cam = vp.getCamera(); if (meshType == ParticleMesh.Type.Point) { float C = cam.getProjectionMatrix().m00; C *= cam.getWidth() * 0.5f; // send attenuation params this.getMaterial().setFloat("Quadratic", C); } Matrix3f inverseRotation = Matrix3f.IDENTITY; TempVars vars = null; if (!worldSpace) { vars = TempVars.get(); inverseRotation = this.getWorldRotation().toRotationMatrix(vars.tempMat3).invertLocal(); } particleMesh.updateParticleData(particles, cam, inverseRotation); if (!worldSpace) { vars.release(); } }
private void updateMatrix() { TempVars vars = TempVars.get(); Matrix3f r = vars.tempMat3; Matrix4f u = uniformMatrix; transform.getRotation().toRotationMatrix(r); u.m00 = r.get(0,0); u.m10 = r.get(1,0); u.m20 = r.get(2,0); u.m01 = r.get(0,1); u.m11 = r.get(1,1); u.m21 = r.get(2,1); u.m02 = r.get(0,2); u.m12 = r.get(1,2); u.m22 = r.get(2,2); //scale u.m30 = transform.getScale().x; u.m31 = transform.getScale().y; u.m32 = transform.getScale().z; //position u.m03 = transform.getTranslation().x; u.m13 = transform.getTranslation().y; u.m23 = transform.getTranslation().z; vars.release(); }
/** * <code>setRotationQuaternion</code> builds a rotation from a * <code>Quaternion</code>. * * @param quat * the quaternion to build the rotation from. * @throws NullPointerException * if quat is null. */ public void setRotationQuaternion(Quaternion quat) { quat.toRotationMatrix(this); }
/** * <code>setRotationQuaternion</code> builds a rotation from a * <code>Quaternion</code>. * * @param quat * the quaternion to build the rotation from. * @throws NullPointerException * if quat is null. */ public void setRotationQuaternion(Quaternion quat) { quat.toRotationMatrix(this); }
/** * * <code>set</code> defines the values of the matrix based on a supplied * <code>Quaternion</code>. It should be noted that all previous values * will be overridden. * * @param quaternion * the quaternion to create a rotational matrix from. * @return this */ public Matrix3f set(Quaternion quaternion) { return quaternion.toRotationMatrix(this); }
/** * <code>toRotationMatrix</code> converts this quaternion to a rotational * matrix. Note: the result is created from a normalized version of this quat. * * @return the rotation matrix representation of this quaternion. */ public Matrix3f toRotationMatrix() { Matrix3f matrix = new Matrix3f(); return toRotationMatrix(matrix); }
/** * <code>toRotationMatrix</code> converts this quaternion to a rotational * matrix. Note: the result is created from a normalized version of this quat. * * @return the rotation matrix representation of this quaternion. */ public Matrix3f toRotationMatrix() { Matrix3f matrix = new Matrix3f(); return toRotationMatrix(matrix); }
public static Matrix4f getBoneToModelMatrix(Bone bone, Matrix4f m, Matrix3f tmp1) { m.setTransform(bone.getModelSpacePosition(), bone.getModelSpaceScale(), bone.getModelSpaceRotation().toRotationMatrix(tmp1)); return m; }
public Matrix3f getPhysicsRotationMatrix() { gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation()); return physicsLocation.getRotation().toRotationMatrix(); }
void _convPMDEuler(Matrix3f out, float x, float y, float z) { Quaternion qx = new Quaternion(); Quaternion qy = new Quaternion(); Quaternion qz = new Quaternion(); qx.fromAngles(x, 0, 0); qy.fromAngles(0, y, 0); qz.fromAngles(0, 0, z); qz.multLocal(qy); qz.multLocal(qx); qz.toRotationMatrix(out); } void convPMDEuler(Matrix3f out, float x, float y, float z) {