IDisposablepublic interface IRenderer extends IDisposable
IRenderer object given to you in render methods or access IGameInstance.getRenderer()| Modifier and Type | Method | Description |
|---|---|---|
void |
activateTextureBank(TextureBank bank) |
Activates a certain texture bank.
|
void |
addEmptyRect(float x,
float y,
float width,
float height,
float lineWidth,
int color) |
Draws a colored, unfilled rectangle at the specified x and y
coordinates.
|
void |
addEmptyRect(float x,
float y,
float width,
float height,
int color) |
Draws a colored, unfilled rectangle at the specified x and y
coordinates.
|
void |
addFilledRect(float x,
float y,
float width,
float height,
int color) |
Draws a colored, filled rectangle at the spcified x and y coordinates.
|
void |
addTexturedRegion(ITexture texture,
float x,
float y,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4,
float srcX,
float srcY,
float srcX2,
float srcY2,
int[] light,
int filter) |
Adds a certain region of a texture to this renderer.
|
void |
addTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
int color1,
int color2,
int color3,
float u1,
float v1,
float u2,
float v2,
float u3,
float v3) |
Adds a triangle to this renderer.
|
void |
addVertex(float x,
float y,
int color,
float u,
float v) |
Puts a single vertex into this renderer.
|
void |
backgroundColor(int color) |
Sets the background color for this renderer to clear the screen with.
|
void |
begin() |
Begins rendering with this renderer.
|
void |
calcScales() |
Calculates the gui and world scale.
|
IVAO |
createVAO() |
Creates a new vao for any modder to use
|
IVBO |
createVBO(boolean isStatic) |
Creates a new vbo for any modder to use
|
void |
describeItem(IGameInstance game,
IAssetManager manager,
ItemInstance instance) |
Renders an item's hover over information on the mouse cursor position.
|
void |
drawHoverInfo(IGameInstance game,
IAssetManager manager,
float x,
float y,
float scale,
boolean firstLineOffset,
boolean canLeaveScreen,
int maxLength,
java.util.List<java.lang.String> text) |
Draws a hovering information at the specified position using the
specified text
|
void |
drawHoverInfoAtMouse(IGameInstance game,
IAssetManager manager,
boolean firstLineOffset,
int maxLength,
java.lang.String... text) |
Draws a hovering information at the mouse's position using the specified
text
|
void |
drawHoverInfoAtMouse(IGameInstance game,
IAssetManager manager,
boolean firstLineOffset,
int maxLength,
java.util.List<java.lang.String> text) |
Draws a hovering information at the mouse's position using the specified
text
|
void |
end() |
Finishes rendering with this renderer and flushes the current rendering
context.
|
void |
flush() |
Flushes the current rendering context, rendering everything that has been
added to the renderer since the last call to this method.
|
double |
getCameraX() |
|
double |
getCameraY() |
|
float |
getDisplayRatio() |
Gets the display's ratio as a float.
|
int |
getFlushes() |
|
float |
getGuiScale() |
|
float |
getHeightInGui() |
|
float |
getHeightInWorld() |
|
double |
getMousedTileX() |
Returns the x position of the tile that the mouse is currently over.
|
double |
getMousedTileY() |
Returns the y position of the tile that the mouse is currently over.
|
float |
getMouseInGuiX() |
|
float |
getMouseInGuiY() |
|
IShaderProgram |
getProgram() |
|
float |
getRotation() |
|
float |
getRotationCenterX() |
|
float |
getRotationCenterY() |
|
float |
getScaleX() |
|
float |
getScaleY() |
|
ITexture |
getTexture() |
|
float |
getTranslationX() |
|
float |
getTranslationY() |
|
int |
getVertexAmount() |
|
java.nio.FloatBuffer |
getVertices() |
Gets the current vertices that this renderer is about to render.
|
float |
getWidthInGui() |
|
float |
getWidthInWorld() |
|
float |
getWorldScale() |
|
boolean |
isBiomeDebug() |
|
boolean |
isBoundBoxDebug() |
|
boolean |
isChunkBorderDebug() |
|
boolean |
isDebug() |
|
boolean |
isGuiDebug() |
|
boolean |
isHeightDebug() |
|
boolean |
isItemInfoDebug() |
|
boolean |
isLineDebug() |
|
boolean |
isMirroredHor() |
|
boolean |
isMirroredVert() |
|
void |
mirror(boolean hor,
boolean vert) |
Mirrors the renderer either horizontally or vertically.
|
IRenderer |
put(float f) |
Puts a single vertex component into this renderer and returns it for
convenience
|
void |
renderItemInGui(IGameInstance game,
IAssetManager manager,
ItemInstance slot,
float x,
float y,
float scale,
int color) |
Renders an item and its amount.
|
void |
renderItemInGui(IGameInstance game,
IAssetManager manager,
ItemInstance slot,
float x,
float y,
float scale,
int color,
boolean displayAmount,
boolean displayDurability) |
Renders an item and its amount.
|
void |
renderSlotInGui(IGameInstance game,
IAssetManager manager,
ItemInstance slot,
float x,
float y,
float scale,
boolean hovered,
boolean canPlaceInto) |
Renders a slot.
|
void |
resetTransformation() |
Resets this renderer's translation, rotation, scale, mirrored states and
texture origin back to their default values.
|
void |
rotate(float angle) |
Rotates this renderer's rendering context by the given angle.
|
void |
scale(float x,
float y) |
Scales the renderer by the given amount.
|
void |
setDefaultProgram(IShaderProgram program) |
Sets the
IShaderProgram that the game should fall back to when
setProgram(IShaderProgram) is called with a null parameter. |
void |
setMirrored(boolean hor,
boolean vert) |
Rather than mirroring the renderer (see
mirror(boolean,
boolean)), this method sets the mirrored states of this renderer to the
given values. |
void |
setProgram(IShaderProgram program) |
Sets the
IShaderProgram that the renderer should use to draw. |
void |
setRotation(float angle) |
Rather than rotating by a given angle (see
rotate(float)), this
method merely sets the rotation of this renderer to the given rotation. |
void |
setRotationCenter(float x,
float y) |
Sets the center of rotation for this renderer.
|
void |
setScale(float x,
float y) |
Rather than scaling by a given amount (see
scale(float, float)),
this method sets the scale of the renderer directly. |
void |
setTexture(ITexture texture) |
Sets the
ITexture that the renderer should render any vertices
with. |
void |
setTranslation(float x,
float y) |
Rather than translating by a certain amount (see
translate(float,
float)), this method sets the translation of this renderer to the given
x and y coordinates. |
void |
translate(float x,
float y) |
Translates this renderer's origin by the given amount.
|
void |
unbindAllTextures() |
Unbinds all currently bound textures in all banks
|
void |
unbindShaderProgram() |
Unbinds the currently bound shader program
|
void |
unbindTexture() |
Unbinds the currently bound texture
|
void |
unbindVAO() |
Unbinds the currently bound vao
|
void |
unbindVBO() |
Unbinds the currently bound vbo
|
dispose@ApiInternal void setDefaultProgram(IShaderProgram program)
IShaderProgram that the game should fall back to when
setProgram(IShaderProgram) is called with a null parameter. This
should only be used internally to set the world and gui shaders.program - The new default shader programvoid setProgram(IShaderProgram program)
IShaderProgram that the renderer should use to draw.
Calling this method while the renderer is active will cause the current
vertices to be flushed and rendered with the last set shader program.program - The new shader programvoid setTexture(ITexture texture)
ITexture that the renderer should render any vertices
with. Calling this method while the renderer is active will cause the
current vertices to be flushed and rendererd with the last set texture.texture - The new texturevoid addTexturedRegion(ITexture texture, float x, float y, float x2, float y2, float x3, float y3, float x4, float y4, float srcX, float srcY, float srcX2, float srcY2, int[] light, int filter)
ITexture.draw(float, float) methods, so using those
will be more convenient in most cases.texture - The texture to setx - The top left x coordinatey - The top left y coordinatex2 - The top right x coordinatey2 - The top right y coordinatex3 - The bottom right x coordinatey3 - The bottom right y coordinatex4 - The bottom left x coordinatey4 - The bottom left y coordinatesrcX - The top left x coordinate of the texturesrcY - The top left y coordinate of the texturesrcX2 - The bottom right x coordinate of the texturesrcY2 - The bottom right y coordinate of the texturelight - The light that the four corners of the drawn region should
interpolate between, or null if there should be no light
influencefilter - A filter color to modify this texture byVertexProcessor.addTexturedRegion(IRenderer, ITexture, float, float,
float, float, float, float, float, float, float, float, float, float,
int, int, int, int)void addTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
int color1,
int color2,
int color3,
float u1,
float v1,
float u2,
float v2,
float u3,
float v3)
addTexturedRegion(ITexture, float, float, float, float, float, float,
float, float, float, float, float, float, int[], int) twice to draw the
two triangles of the square (or square-ish) region.x1 - The first x coordinatey1 - The first y coordinatex2 - The second x coordinatey2 - The second y coordinatex3 - The third x coordinatey3 - The third y coordinatecolor1 - The color at the first cornercolor2 - The color at the second cornercolor3 - The color at the third corneru1 - The first texture xv1 - The first texture yu2 - The second texture xv2 - The second texture yu3 - The third texture xv3 - The third texture yVertexProcessor.addTriangle(IRenderer, float, float, float, float,
float, float, int, int, int, float, float, float, float, float, float)IRenderer put(float f)
f - The component to addvoid addVertex(float x,
float y,
int color,
float u,
float v)
addTriangle(float, float, float, float, float, float,
int, int, int, float, float, float, float, float, float) to add the
three vertices for the three corners.x - The x coordinatey - The y coordinatecolor - The coloru - The texture xv - The texture yVertexProcessor.addVertex(IRenderer, float, float, int, float,
float)@ApiInternal void begin()
@ApiInternal void end()
@ApiInternal void flush()
void rotate(float angle)
angle - The anglevoid setRotation(float angle)
rotate(float)), this
method merely sets the rotation of this renderer to the given rotation.
You can use this to reset the rotation back to 0 or its original state.angle - The anglevoid setRotationCenter(float x,
float y)
x - The rotation center's xy - The rotation center's yfloat getRotationCenterX()
float getRotationCenterY()
void translate(float x,
float y)
x - The origin xy - The origin yvoid setTranslation(float x,
float y)
translate(float,
float)), this method sets the translation of this renderer to the given
x and y coordinates.x - The origin xy - The origin yvoid scale(float x,
float y)
x - The x scaley - The y scalevoid setScale(float x,
float y)
scale(float, float)),
this method sets the scale of the renderer directly.x - The x scaley - The y scalevoid mirror(boolean hor,
boolean vert)
hor - If the renderer should be mirrored horizontallyvert - If the renderer should be mirrored verticallyvoid setMirrored(boolean hor,
boolean vert)
mirror(boolean,
boolean)), this method sets the mirrored states of this renderer to the
given values.hor - If the renderer should be mirrored horizontallyvert - If the renderer should be mirrored verticallyvoid resetTransformation()
float getRotation()
float getTranslationX()
float getTranslationY()
float getScaleX()
float getScaleY()
boolean isMirroredHor()
boolean isMirroredVert()
IShaderProgram getProgram()
setProgram(IShaderProgram)ITexture getTexture()
setTexture(ITexture)void renderSlotInGui(IGameInstance game, IAssetManager manager, ItemInstance slot, float x, float y, float scale, boolean hovered, boolean canPlaceInto)
ItemContainer to create functioning slots.game - The game instancemanager - The asset managerslot - The content of the slot to drawx - The x coordinatey - The y coordinatescale - The scalehovered - If the slot is currently being hovered or not. If
this value is true, then the slot will be rendered
with a slightly brighter colorcanPlaceInto - If the slot can contain the item that is currently on
the cursor. If this value is true, then the slot will
be rendered in grayscalevoid renderItemInGui(IGameInstance game, IAssetManager manager, ItemInstance slot, float x, float y, float scale, int color)
renderSlotInGui(IGameInstance, IAssetManager, ItemInstance, float,
float, float, boolean, boolean), only that it doesn't render the box
below the item.game - The game instancemanager - The asset managerslot - The item to drawx - The x coordinatey - The y coordinatescale - The scalecolor - The color to filter the item's renderer withvoid renderItemInGui(IGameInstance game, IAssetManager manager, ItemInstance slot, float x, float y, float scale, int color, boolean displayAmount, boolean displayDurability)
renderSlotInGui(IGameInstance, IAssetManager, ItemInstance, float,
float, float, boolean, boolean), only that it doesn't render the box
below the item.game - The game instancemanager - The asset managerslot - The item to drawx - The x coordinatey - The y coordinatescale - The scalecolor - The color to filter the item's renderer withdisplayAmount - If the amount of items in this instance should
be displayed as a little number below the itemdisplayDurability - If the durability of the item should be
displayedvoid describeItem(IGameInstance game, IAssetManager manager, ItemInstance instance)
isItemInfoDebug() text and
also fires the TooltipEvent.game - The game instancemanager - The asset managerinstance - The item whose information to drawvoid drawHoverInfoAtMouse(IGameInstance game, IAssetManager manager, boolean firstLineOffset, int maxLength, java.lang.String... text)
game - The game instancemanager - The asset managerfirstLineOffset - If the first line should have a bit of a gap below
it making it act as a "headline"maxLength - The maximum length before the tooltip wraps into
the next linetext - The array of lines of text to drawvoid drawHoverInfoAtMouse(IGameInstance game, IAssetManager manager, boolean firstLineOffset, int maxLength, java.util.List<java.lang.String> text)
game - The game instancemanager - The asset managerfirstLineOffset - If the first line should have a bit of a gap below
it making it act as a "headline"maxLength - The maximum length before the tooltip wraps into
the next linetext - The list of lines of text to drawvoid drawHoverInfo(IGameInstance game, IAssetManager manager, float x, float y, float scale, boolean firstLineOffset, boolean canLeaveScreen, int maxLength, java.util.List<java.lang.String> text)
game - The game instancemanager - The asset managerx - The x positiony - The y positionscale - The scale of the tooltipfirstLineOffset - If the first line should have a bit of a gap below
it making it act as a "headline"canLeaveScreen - If the tooltip can leave the screen or should stop
at the bordersmaxLength - The maximum length before the tooltip wraps into
the next linetext - The list of lines of text to drawvoid addEmptyRect(float x,
float y,
float width,
float height,
int color)
x - The x coordinatey - The y coordinatewidth - The widthheight - The heightcolor - The colorvoid addEmptyRect(float x,
float y,
float width,
float height,
float lineWidth,
int color)
x - The x coordinatey - The y coordinatewidth - The widthheight - The heightlineWidth - The width of the outlinescolor - The colorvoid addFilledRect(float x,
float y,
float width,
float height,
int color)
x - The x coordinatey - The y coordinatewidth - The widthheight - The heightcolor - The colorvoid activateTextureBank(TextureBank bank)
bank - The texture bank to read/write to and fromvoid unbindTexture()
void unbindAllTextures()
void unbindVAO()
void unbindVBO()
void unbindShaderProgram()
IVAO createVAO()
IVBO createVBO(boolean isStatic)
isStatic - Wether or not this vbo should use GL15.GL_STATIC_DRAW or GL15.GL_DYNAMIC_DRAW@ApiInternal void calcScales()
float getDisplayRatio()
float getGuiScale()
getDisplayRatio().float getWorldScale()
getDisplayRatio().float getWidthInWorld()
getWidthInGui()float getHeightInWorld()
getHeightInGui()float getWidthInGui()
IGameInstance.getWidth() multiplied by getGuiScale().getWidthInWorld()float getHeightInGui()
IGameInstance.getHeight() multiplied by getGuiScale().getHeightInWorld()float getMouseInGuiX()
getGuiScale()float getMouseInGuiY()
getGuiScale()boolean isDebug()
boolean isItemInfoDebug()
boolean isChunkBorderDebug()
boolean isGuiDebug()
boolean isLineDebug()
boolean isBiomeDebug()
boolean isHeightDebug()
boolean isBoundBoxDebug()
double getMousedTileX()
Util.floor(double)
will reveal the tile's grid position in the world, whereas the decimal
will reveal the percentage of how far into the tile the mouse cursor is.double getMousedTileY()
Util.floor(double)
will reveal the tile's grid position in the world, whereas the decimal
will reveal the percentage of how far into the tile the mouse cursor is.int getFlushes()
flush()void backgroundColor(int color)
color - The colorjava.nio.FloatBuffer getVertices()
put(float).int getVertexAmount()
double getCameraX()
double getCameraY()