public class Shape extends java.lang.Object implements ITransformable.Translate, ITransformable.Rotate, ITransformable.Scale
MalisisRenderer
. Supports basic transformations like scaling, translation and rotations.ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate
Modifier and Type | Field and Description |
---|---|
protected Face[] |
faces
|
protected java.util.Map<java.lang.String,MergedVertex> |
mergedVertexes
The merged vertexes making up this
Shape . |
protected org.lwjgl.util.vector.Matrix4f |
transformMatrix
The matrix containing all the transformations applied to this
Shape . |
Constructor and Description |
---|
Shape()
Instantiates a new
Shape . |
Shape(Face... faces)
Instantiates a new
Shape . |
Shape(java.util.List<Face> faces)
Instantiates a new
Shape . |
Shape(Shape s)
Instantiates a new
Shape . |
Modifier and Type | Method and Description |
---|---|
Shape |
addFaces(Face[] faces)
|
Shape |
addFaces(Face[] faces,
java.lang.String groupName)
|
Shape |
applyMatrix()
Applies the transformations matrix to this
Shape . |
Shape |
copyMatrix(Shape shape)
Copies the transformation matrix from a
shape to this Shape . |
void |
deductParameters() |
void |
enableMergedVertexes()
Enables the
MergedVertex for this Shape . |
static Shape |
fromShapes(Shape... shapes)
Builds a
Shape from multiple ones. |
Face |
getFace(java.lang.String name)
Gets a face from its name.
|
Face[] |
getFaces()
|
java.util.List<Face> |
getFaces(java.lang.String name)
|
MergedVertex |
getMergedVertex(Vertex vertex)
Gets the
MergedVertex for the specified Vertex . |
java.util.List<MergedVertex> |
getMergedVertexes(Face face)
Gets a list of
MergedVertex with a base name containing Face name. |
java.util.List<MergedVertex> |
getMergedVertexes(net.minecraftforge.common.util.ForgeDirection direction)
Gets a list of
MergedVertex with a base name containing the ForgeDirection name. |
java.util.List<MergedVertex> |
getMergedVertexes(java.lang.String... names)
Gets a list of
MergedVertex with a name containing the specified name. |
java.util.List<Vertex> |
getVertexes(Face face)
|
java.util.List<Vertex> |
getVertexes(net.minecraftforge.common.util.ForgeDirection direction)
Gets a list of
Vertex with a base name containing the ForgeDirection name. |
java.util.List<Vertex> |
getVertexes(java.lang.String name)
Gets a list of
Vertex with a base name containing name. |
Shape |
interpolateUV()
|
Shape |
limit(net.minecraft.util.AxisAlignedBB aabb)
Limits this
Shape to the bounding box passed. |
Shape |
limit(double x,
double y,
double z,
double X,
double Y,
double Z)
Limits this
Shape to the bounding box passed. |
Shape |
removeFace(Face face)
|
Shape |
resetState()
|
void |
rotate(float angle,
float x,
float y,
float z)
Rotates this
Shape around the given axis the specified angle. |
void |
rotate(float angle,
float x,
float y,
float z,
float offsetX,
float offsetY,
float offsetZ)
Rotates this
Shape around the given axis the specified angle. |
void |
scale(float factor)
Scales this
Shape on all axis. |
void |
scale(float x,
float y,
float z)
Scale.
|
void |
scale(float x,
float y,
float z,
float offsetX,
float offsetY,
float offsetZ)
Scales this
Shape . |
Shape |
setBounds(float x,
float y,
float z,
float X,
float Y,
float Z)
Sets the bounds for this
Shape . |
Shape |
setParameters(RenderParameters params,
boolean merge)
|
Shape |
setParameters(java.lang.String name,
RenderParameters params,
boolean merge)
Set
RenderParameters for faces matching the specified name. |
Shape |
setSize(float width,
float height,
float depth)
Sets the size of this
Shape . |
Shape |
shrink(net.minecraftforge.common.util.ForgeDirection dir,
float factor)
Shrinks the
Face matching face name by a certain factor. |
Shape |
storeState()
|
void |
translate(float x,
float y,
float z)
Translates this
Shape . |
protected Face[] faces
protected org.lwjgl.util.vector.Matrix4f transformMatrix
Shape
.protected java.util.Map<java.lang.String,MergedVertex> mergedVertexes
Shape
.public Shape()
Shape
.public Shape(java.util.List<Face> faces)
Shape
.faces
- the facespublic Shape addFaces(Face[] faces, java.lang.String groupName)
faces
- the facesgroupName
- the group nameShape
public Face[] getFaces()
public java.util.List<Face> getFaces(java.lang.String name)
name
- the namepublic Face getFace(java.lang.String name)
name
- the namepublic void enableMergedVertexes()
MergedVertex
for this Shape
. Will transfer the current transformation matrix to the MergedVertex
public java.util.List<Vertex> getVertexes(java.lang.String name)
Vertex
with a base name containing name.name
- the namepublic java.util.List<Vertex> getVertexes(Face face)
face
- the facepublic java.util.List<Vertex> getVertexes(net.minecraftforge.common.util.ForgeDirection direction)
Vertex
with a base name containing the ForgeDirection
name.direction
- the directionpublic MergedVertex getMergedVertex(Vertex vertex)
MergedVertex
for the specified Vertex
.vertex
- the vertexpublic java.util.List<MergedVertex> getMergedVertexes(java.lang.String... names)
MergedVertex
with a name containing the specified name.names
- the namespublic java.util.List<MergedVertex> getMergedVertexes(Face face)
MergedVertex
with a base name containing Face
name.face
- the facepublic java.util.List<MergedVertex> getMergedVertexes(net.minecraftforge.common.util.ForgeDirection direction)
MergedVertex
with a base name containing the ForgeDirection
name.direction
- the directionpublic Shape copyMatrix(Shape shape)
shape
to this Shape
.shape
- the shapepublic Shape applyMatrix()
Shape
. This modifies the position of the vertexes
making up the
faces
of this Shape
.public Shape setParameters(RenderParameters params, boolean merge)
params
- the paramsmerge
- the mergeShape
public Shape setParameters(java.lang.String name, RenderParameters params, boolean merge)
RenderParameters
for faces
matching the specified name. If merge is true, the parameters will
be merge with the face
parameters instead of completely overriding them.name
- the nameparams
- the paramsmerge
- the mergeShape
public Shape setSize(float width, float height, float depth)
Shape
. width represents East-West axis, height represents Bottom-Top axis and
Depth represents North-South axis. The calculations are based on Vertex.baseName()
.width
- the widthheight
- the heightdepth
- the depthShape
public Shape setBounds(float x, float y, float z, float X, float Y, float Z)
Shape
. Calculations are based on Vertex.baseName()
.x
- the xy
- the yz
- the zX
- the xY
- the yZ
- the zShape
public Shape limit(net.minecraft.util.AxisAlignedBB aabb)
Shape
to the bounding box passed.aabb
- the aabbShape
public Shape limit(double x, double y, double z, double X, double Y, double Z)
Shape
to the bounding box passed.x
- the xy
- the yz
- the zX
- the xY
- the yZ
- the zpublic void translate(float x, float y, float z)
Shape
.translate
in interface ITransformable.Translate
x
- the xy
- the yz
- the zpublic void scale(float factor)
Shape
on all axis.factor
- the factorpublic void scale(float x, float y, float z)
x
- the xy
- the yz
- the zpublic void scale(float x, float y, float z, float offsetX, float offsetY, float offsetZ)
Shape
.scale
in interface ITransformable.Scale
x
- the xy
- the yz
- the zoffsetX
- the offset xoffsetY
- the offset yoffsetZ
- the offset zpublic void rotate(float angle, float x, float y, float z)
Shape
around the given axis the specified angle.angle
- the anglex
- the xy
- the yz
- the zpublic void rotate(float angle, float x, float y, float z, float offsetX, float offsetY, float offsetZ)
Shape
around the given axis the specified angle. Offsets the origin for the rotation.rotate
in interface ITransformable.Rotate
angle
- the anglex
- the xy
- the yz
- the zoffsetX
- the offset xoffsetY
- the offset yoffsetZ
- the offset zpublic Shape interpolateUV()
Shape
based on their position and the Face
orientation.Shape
public Shape shrink(net.minecraftforge.common.util.ForgeDirection dir, float factor)
Face
matching face name by a certain factor. The vertexes
of connected faces are
moved too.dir
- the dirfactor
- the factorpublic void deductParameters()