Package codechicken.lib.model
Class Quad
java.lang.Object
codechicken.lib.model.Quad
- All Implemented Interfaces:
IVertexConsumer,IVertexProducer
A simple easy to manipulate quad format. Can be reset and then used on a different format.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanboolean@Nullable net.minecraft.core.Direction@Nullable net.minecraft.client.renderer.texture.TextureAtlasSpriteint -
Constructor Summary
ConstructorsConstructorDescriptionQuad()Use this if you reset the quad each time you use it.Quad(CachedFormat format) use this if you want to initialize the quad with a format. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.client.renderer.block.model.BakedQuadbake()Bakes this Quad to a BakedQuad.voidcalculateOrientation(boolean setNormal) Re-calculates the Orientation of this quad, optionally the normal vector.voidClamps the Quad inside the box.voidclamp(net.minecraft.world.phys.AABB bb) Clamps the Quad inside the box.copy()Used to create a new quad complete copy of this one.Copies the data inside the given quad to this one.final CachedFormatformat()com.mojang.blaze3d.vertex.VertexFormatvoidpipe(IVertexConsumer consumer) voidput(int element, float... data) voidAssumes the data is already completely unpacked.voidreset(CachedFormat format) Reset the quad to the new format.resetInterp(InterpHelper helper, int s) Used to reset the interpolation values inside the provided helper.voidrewind()Rewind this Quad without completely resetting it.voidsetApplyDiffuseLighting(boolean diffuse) voidsetQuadOrientation(net.minecraft.core.Direction orientation) voidsetQuadTint(int tint) voidsetTexture(net.minecraft.client.renderer.texture.TextureAtlasSprite texture) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface codechicken.lib.model.IVertexConsumer
put
-
Field Details
-
tintIndex
public int tintIndex -
orientation
@Nullable public @Nullable net.minecraft.core.Direction orientation -
diffuseLighting
public boolean diffuseLighting -
sprite
@Nullable public @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite sprite -
vertices
-
full
public boolean full
-
-
Constructor Details
-
Quad
public Quad()Use this if you reset the quad each time you use it. -
Quad
use this if you want to initialize the quad with a format.- Parameters:
format- The format.
-
-
Method Details
-
format
-
getVertexFormat
public com.mojang.blaze3d.vertex.VertexFormat getVertexFormat()- Specified by:
getVertexFormatin interfaceIVertexConsumer
-
setQuadTint
public void setQuadTint(int tint) - Specified by:
setQuadTintin interfaceIVertexConsumer
-
setQuadOrientation
public void setQuadOrientation(net.minecraft.core.Direction orientation) - Specified by:
setQuadOrientationin interfaceIVertexConsumer
-
setApplyDiffuseLighting
public void setApplyDiffuseLighting(boolean diffuse) - Specified by:
setApplyDiffuseLightingin interfaceIVertexConsumer
-
setTexture
public void setTexture(net.minecraft.client.renderer.texture.TextureAtlasSprite texture) - Specified by:
setTexturein interfaceIVertexConsumer
-
put
public void put(int element, float... data) - Specified by:
putin interfaceIVertexConsumer
-
put
Description copied from interface:IVertexConsumerAssumes the data is already completely unpacked. You must always copy the data from the quad provided to an internal cache. basically: this.quad.put(quad);- Specified by:
putin interfaceIVertexConsumer- Parameters:
quad- The quad to copy data from.
-
pipe
- Specified by:
pipein interfaceIVertexProducer- Parameters:
consumer- consumer to receive the vertex data this producer can provide
-
resetInterp
Used to reset the interpolation values inside the provided helper.- Parameters:
helper- The helper.s- The axis. side >> 1;- Returns:
- The same helper.
-
clamp
public void clamp(net.minecraft.world.phys.AABB bb) Clamps the Quad inside the box.- Parameters:
bb- The box.
-
clamp
Clamps the Quad inside the box.- Parameters:
cuboid- The box.
-
calculateOrientation
public void calculateOrientation(boolean setNormal) Re-calculates the Orientation of this quad, optionally the normal vector.- Parameters:
setNormal- If the normal vector should be updated.
-
copy
Used to create a new quad complete copy of this one.- Returns:
- The new quad.
-
copyFrom
Copies the data inside the given quad to this one. This ignores VertexFormat, please make sure your quads are in the same format.- Parameters:
quad- The Quad to copy from.- Returns:
- This quad.
-
reset
Reset the quad to the new format.- Parameters:
format- The new format.
-
rewind
public void rewind()Rewind this Quad without completely resetting it. -
bake
public net.minecraft.client.renderer.block.model.BakedQuad bake()Bakes this Quad to a BakedQuad.- Returns:
- The BakedQuad.
-