Package codechicken.lib.vec
Class Rotation
java.lang.Object
codechicken.lib.vec.ITransformation<Vector3,Transformation>
codechicken.lib.vec.Transformation
codechicken.lib.vec.Rotation
- All Implemented Interfaces:
IVertexOperation,Copyable<Transformation>
-
Nested Class Summary
Nested classes/interfaces inherited from interface codechicken.lib.render.pipeline.IVertexOperation
IVertexOperation.VertexOperationRegistry -
Field Summary
FieldsModifier and TypeFieldDescriptiondoublestatic Vector3[]static Transformation[]Clockwise pi/2 about y looking downstatic int[]static Transformation[]static int[]static int[]Rotate pi/2 * this offset for [side] about y axis before rotating to the side for the rotation indicies to line upFields inherited from class codechicken.lib.vec.Transformation
operationIndex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies this transformation to a matrix as a multiplication on the right hand side.voidApplies this transformation to vecvoidApplies this transformation to a normal (doesn't translate)copy()static intgetSidedRotation(net.minecraft.world.entity.player.Player player, int side) static intgetSideFromLookAngle(net.minecraft.world.entity.LivingEntity entity) inverse()Attempts to invert the Transformation.booleanReturns true if this transformation is redundant, eg.merge(Transformation next) Returns a simplified transformation that performs this, followed by next.static introtateSide(int s, int r) static introtationTo(int s1, int s2) Reverse of rotateSidestatic TransformationsideOrientation(int s, int r) toQuat()toString()Methods inherited from class codechicken.lib.vec.Transformation
at, load, operate, operationID, withMethods inherited from class codechicken.lib.vec.ITransformation
$plus$plus
-
Field Details
-
quarterRotations
Clockwise pi/2 about y looking down -
sideRotations
-
axes
-
sideRotMap
public static int[] sideRotMap -
rotSideMap
public static int[] rotSideMap -
sideRotOffsets
public static int[] sideRotOffsetsRotate pi/2 * this offset for [side] about y axis before rotating to the side for the rotation indicies to line up -
angle
public double angle -
axis
-
-
Constructor Details
-
Rotation
-
Rotation
public Rotation(double angle, double x, double y, double z) -
Rotation
-
Rotation
-
-
Method Details
-
rotateSide
public static int rotateSide(int s, int r) -
rotationTo
public static int rotationTo(int s1, int s2) Reverse of rotateSide -
getSidedRotation
public static int getSidedRotation(net.minecraft.world.entity.player.Player player, int side) - Parameters:
player- The placing player, used for obtaining the look vectorside- The side of the block being placed on- Returns:
- The rotation for the face == side^1
-
sideOrientation
- Returns:
- The rotation quat for side 0 and rotation 0 to side s with rotation r
-
getSideFromLookAngle
public static int getSideFromLookAngle(net.minecraft.world.entity.LivingEntity entity) - Parameters:
entity- The placing entity, used for obtaining the look vector- Returns:
- The side towards which the entity is most directly looking.
-
apply
Description copied from class:ITransformationApplies this transformation to vec- Specified by:
applyin classITransformation<Vector3,Transformation>
-
applyN
Description copied from class:TransformationApplies this transformation to a normal (doesn't translate)- Specified by:
applyNin classTransformation- Parameters:
normal- The normal to transform
-
apply
Description copied from class:TransformationApplies this transformation to a matrix as a multiplication on the right hand side.- Specified by:
applyin classTransformation- Parameters:
mat- The matrix to combine this transformation with
-
toQuat
-
inverse
Description copied from class:ITransformationAttempts to invert the Transformation.The transformations inverse may be itself, or the transform may not have an inverse. In that case a
IrreversibleTransformationExceptionis thrown.- Specified by:
inversein classITransformation<Vector3,Transformation> - Returns:
- The inverse transform.
-
merge
Description copied from class:ITransformationReturns a simplified transformation that performs this, followed by next. If such a transformation does not exist, returns null- Overrides:
mergein classITransformation<Vector3,Transformation>
-
isRedundant
public boolean isRedundant()Description copied from class:ITransformationReturns true if this transformation is redundant, eg. Scale(1, 1, 1), Translation(0, 0, 0) or Rotation(0, a, b, c)- Overrides:
isRedundantin classITransformation<Vector3,Transformation>
-
toString
-
copy
-