matrix.setRotation( new AxisAngle4f( 0, 1, 0, rotation ) );
public TrajectoireCamera(final int _nbCles, final BUniversInterface _u, final boolean _boucle, final int _temps, final int _nbCycles) { univers_ = _u; boucle_ = _boucle; nbCles_ = _nbCles; if (boucle_) { pourcentAtIndex_ = new float[nbCles_ + 1]; positions_ = new Point3f[nbCles_ + 1]; directions_ = new Quat4f[nbCles_ + 1]; } else { pourcentAtIndex_ = new float[nbCles_]; positions_ = new Point3f[nbCles_]; directions_ = new Quat4f[nbCles_]; } temps_ = _temps; nbCycles_ = _nbCycles; axe_ = new Transform3D(); axe_.set(new AxisAngle4f(1f, 0f, 0f, 0f)); }
@Nonnull @Override @SideOnly(Side.CLIENT) public Pair<IBakedModel, Matrix4f> getModel(float delta) { Matrix4f matrix = new Matrix4f(); matrix.setIdentity(); matrix.setRotation(new AxisAngle4f(0f, 1f, 0f, delta)); IBakedModel model = this.model; if (model == null) { model = this.model = RenderHelpers.getMesher().getItemModel(new ItemStack(item)); } return Pair.of(model, matrix); }
private static Multimap<Orientation, XYZRotation> calculateXyzRotations(Map<Matrix3f, Orientation> fromMatrix) { final Multimap<Orientation, XYZRotation> toXYZRotation = HashMultimap.create(); for (Rotation x : Rotation.values()) for (Rotation y : Rotation.values()) for (Rotation z : Rotation.values()) { final XYZRotation rotation = new XYZRotation(x, y, z); Quat4f q = new Quat4f(0, 0, 0, 1); Quat4f tmp = new Quat4f(); tmp.set(new AxisAngle4f(0, 0, 1, z.angle)); q.mul(tmp); tmp.set(new AxisAngle4f(0, 1, 0, y.angle)); q.mul(tmp); tmp.set(new AxisAngle4f(1, 0, 0, x.angle)); q.mul(tmp); Matrix3f m = new Matrix3f(); m.set(q); roundMatrixElements(m); final Orientation orientation = fromMatrix.get(m); Preconditions.checkNotNull(orientation, rotation); toXYZRotation.put(orientation, rotation); } return toXYZRotation; }
@Nonnull @Override @SideOnly(Side.CLIENT) public Pair<IBakedModel, Matrix4f> getModel(float delta) { Matrix4f matrix = new Matrix4f(); matrix.setIdentity(); // We flip the laser so it points forwards on turtles. if (stack.getItemDamage() == LASER_ID) { delta = (float) ((delta + Math.PI) % (2 * Math.PI)); } matrix.setRotation(new AxisAngle4f(0f, 1f, 0f, delta)); return Pair.of( RenderHelpers.getMesher().getItemModel(stack), matrix ); } }
private static Vector3d rotate(Vector3d vector, Vector3d axis, double angle) { Matrix3f rotate = new Matrix3f(); rotate.set(new AxisAngle4f(new Vector3f(axis), (float) Math.toRadians(angle))); Vector3f result = new Vector3f(); Vector3f vector3f = new Vector3f(vector); rotate.transform(vector3f, result); return new Vector3d(result); }
private static Vector3d rotate(Vector3d vector, Vector3d axis, double angle) { Matrix3f rotate = new Matrix3f(); rotate.set(new AxisAngle4f(new Vector3f(axis), (float) Math.toRadians(angle))); Vector3f result = new Vector3f(); Vector3f vector3f = new Vector3f(vector); rotate.transform(vector3f, result); return new Vector3d(result); }
rot.setRotation(new AxisAngle4f(cross.getX(),cross.getY(),cross.getZ(),angle)); tx.mul(rot);