Table of Contents

Interface IRenderAPI

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

The main api component to assist you in rendering pretty stuff onto the screen

public interface IRenderAPI

Properties

AmbientColor

The current ambient color (e.g. will return a blue tint when player is under water)

Vec3f AmbientColor { get; }

Property Value

Vec3f

CameraMatrixOrigin

Player camera matrix with player positioned at 0,0,0. You can use this matrix instead of CurrentModelviewMatrix for high precision rendering.

double[] CameraMatrixOrigin { get; }

Property Value

double[]

CameraMatrixOriginf

Player camera matrix with player positioned at 0,0,0. You can use this matrix instead of CurrentModelviewMatrix for high precision rendering.

float[] CameraMatrixOriginf { get; }

Property Value

float[]

CameraOffset

Can be used to offset the position of the player camera

ModelTransform CameraOffset { get; }

Property Value

ModelTransform

CameraType

The camera type.

EnumCameraMode CameraType { get; }

Property Value

EnumCameraMode

CurrentActiveShader

Gives you a reference to the currently active shader, or null if none is active right now

IShaderProgram CurrentActiveShader { get; }

Property Value

IShaderProgram

CurrentModelviewMatrix

The current top most matrix in the model view matrix stack.

float[] CurrentModelviewMatrix { get; }

Property Value

float[]

CurrentProjectionMatrix

The current top most matrix in the projection matrix stack

float[] CurrentProjectionMatrix { get; }

Property Value

float[]

CurrentRenderStage

The render stage the engine is currently at

EnumRenderStage CurrentRenderStage { get; }

Property Value

EnumRenderStage

CurrentShadowProjectionMatrix

The current projection matrix for shadow rendering (renders the scene from the viewpoint of the sun)

float[] CurrentShadowProjectionMatrix { get; }

Property Value

float[]

DecorativeFontName

The name of the font used during this render (if it exists).

[Obsolete("Please use ElementGeometrics.DecorativeFontName instead")]
string DecorativeFontName { get; }

Property Value

string

DefaultFrustumCuller

FrustumCulling DefaultFrustumCuller { get; }

Property Value

FrustumCulling

FogColor

The current fog color (e.g. will return a blue tint when player is under water)

Vec4f FogColor { get; }

Property Value

Vec4f

FogDensity

Density of the current fog. Fog is calculated as followed in the shaders: clamp(fogMin + 1 - 1 / exp(gl_FragDepth * fogDensity), 0, 1)

float FogDensity { get; }

Property Value

float

FogMin

Current minimum fog value

float FogMin { get; }

Property Value

float

FrameBuffers

List of all loaded frame buffers. To get the god rays frame buffer for exampple, do

Framebuffers[(int)EnumFrameBuffer.GodRays]
List<FrameBufferRef> FrameBuffers { get; }

Property Value

List<FrameBufferRef>

FrameHeight

Height of the primary render framebuffer

int FrameHeight { get; }

Property Value

int

FrameWidth

Width of the primary render framebuffer

int FrameWidth { get; }

Property Value

int

LineWidth

float LineWidth { set; }

Property Value

float

MvMatrix

The current modelview matrix stack

StackMatrix4 MvMatrix { get; }

Property Value

StackMatrix4

PMatrix

The current projection matrix stack

StackMatrix4 PMatrix { get; }

Property Value

StackMatrix4

PerceptionEffects

PerceptionEffects PerceptionEffects { get; }

Property Value

PerceptionEffects

PerspectiveProjectionMat

The default projection matrix used during perspective rendering. Is refreshed before EnumRenderStage.Opaque. Useful for doing projections in the Ortho stage via MatrixToolsd.Project()

double[] PerspectiveProjectionMat { get; }

Property Value

double[]

PerspectiveViewMat

The default view matrix used during perspective rendering. Is refreshed before EnumRenderStage.Opaque. Useful for doing projections in the Ortho stage via MatrixToolsd.Project()

double[] PerspectiveViewMat { get; }

Property Value

double[]

ScissorStack

Stack<ElementBounds> ScissorStack { get; }

Property Value

Stack<ElementBounds>

ShaderUniforms

A number of default shader uniforms

DefaultShaderUniforms ShaderUniforms { get; }

Property Value

DefaultShaderUniforms

StandardFontName

The standard font used during this render (if it exists).

[Obsolete("Please use ElementGeometrics.StandardFontName instead.")]
string StandardFontName { get; }

Property Value

string

StandardShader

Gives you a reference to the "standard" shader, a general purpose shader for normal shading work

IStandardShaderProgram StandardShader { get; }

Property Value

IStandardShaderProgram

TextureSize

int TextureSize { get; }

Property Value

int

Methods

AddPointLight(IPointLight)

Adds a dynamic light source to the scene. Will not be rendered if the current point light count exceeds max dynamic lights in the graphics settings

void AddPointLight(IPointLight pointlight)

Parameters

pointlight IPointLight

AllocateEmptyMesh(int, int, int, int, int, int, CustomMeshDataPartFloat, CustomMeshDataPartShort, CustomMeshDataPartByte, CustomMeshDataPartInt, EnumDrawMode, bool)

Allocates memory on the graphics card. Can use UpdateMesh() to populate it with data. The custom mesh data parts may be null. Sizes are in bytes.

MeshRef AllocateEmptyMesh(int xyzSize, int normalSize, int uvSize, int rgbaSize, int flagsSize, int indicesSize, CustomMeshDataPartFloat customFloats, CustomMeshDataPartShort customShorts, CustomMeshDataPartByte customBytes, CustomMeshDataPartInt customInts, EnumDrawMode drawMode = EnumDrawMode.Triangles, bool staticDraw = true)

Parameters

xyzSize int

the squared size of the texture.

normalSize int

the size of the normals

uvSize int

the size of the UV map.

rgbaSize int

size of the RGBA colors.

flagsSize int

Size of the render flags.

indicesSize int

Size of the indices

customFloats CustomMeshDataPartFloat

Float values of the mesh

customShorts CustomMeshDataPartShort
customBytes CustomMeshDataPartByte

Byte values of the mesh

customInts CustomMeshDataPartInt

Float values of the mesh

drawMode EnumDrawMode

The current draw mode

staticDraw bool

whether the draw should be static or dynamic.

Returns

MeshRef

the reference to the mesh

BindTexture2d(int)

Binds given texture. For use with shaders - you should assign the texture directly though shader uniforms.

void BindTexture2d(int textureid)

Parameters

textureid int

The OpenGL Identifier ID for the target texture to bind.

BitmapCreateFromPng(byte[])

Creates a bitmap from a given PNG.

BitmapExternal BitmapCreateFromPng(byte[] pngdata)

Parameters

pngdata byte[]

the PNG data passed in.

Returns

BitmapExternal

A bitmap object.

CheckGlError(string)

If opengl debug mode is enabled and an opengl error is found this method will throw an exception. It is recommended to use this methods in a few spots during render code to track down rendering issues in time.

void CheckGlError(string message = "")

Parameters

message string

DeleteMesh(MeshRef)

Frees up the memory on the graphics card. Should always be called at the end of a meshes lifetime to prevent memory leaks. Equivalent to calling Dispose on the meshref itself

void DeleteMesh(MeshRef vao)

Parameters

vao MeshRef

GLDeleteTexture(int)

Deletes given texture

void GLDeleteTexture(int textureId)

Parameters

textureId int

the OpenGL Identifier for the target Texture.

GLDepthMask(bool)

Toggle writing to the depth buffer

void GLDepthMask(bool on)

Parameters

on bool

GLDisableDepthTest()

Disables the Depth Test.

void GLDisableDepthTest()

GLEnableDepthTest()

Enables the Depth Test.

void GLEnableDepthTest()

GetEngineShader(EnumShaderProgram)

Gives you access to all of the vanilla shaders

IShaderProgram GetEngineShader(EnumShaderProgram program)

Parameters

program EnumShaderProgram

Returns

IShaderProgram

GetItemStackRenderInfo(ItemSlot, EnumItemRenderTarget, float)

Returns you a render info object of given item stack. Can be used to render held items onto a creature.

ItemRenderInfo GetItemStackRenderInfo(ItemSlot inSlot, EnumItemRenderTarget ground, float dt)

Parameters

inSlot ItemSlot
ground EnumItemRenderTarget
dt float

Returns

ItemRenderInfo

GetOrLoadTexture(AssetLocation)

Loads given texture through the assets managers and loads it onto the graphics card. Will return a cached version on every subsequent call to this method.

int GetOrLoadTexture(AssetLocation name)

Parameters

name AssetLocation

the location of the texture as it exists within the game or mod directory.

Returns

int

The texture id

GetOrLoadTexture(AssetLocation, ref LoadedTexture)

Loads given texture through the assets managers and loads it onto the graphics card. Will return a cached version on every subsequent call to this method.

void GetOrLoadTexture(AssetLocation name, ref LoadedTexture intoTexture)

Parameters

name AssetLocation

the location of the texture as it exists within the game or mod directory.

intoTexture LoadedTexture

the texture object to be populated. If it already is populated it will be disposed first

GetOrLoadTexture(AssetLocation, BitmapRef, ref LoadedTexture)

Loads the texture supplied by the bitmap, uploads it to the graphics card and keeps a cached version under given name. Will return that cached version on every subsequent call to this method.

void GetOrLoadTexture(AssetLocation name, BitmapRef bmp, ref LoadedTexture intoTexture)

Parameters

name AssetLocation

the location of the texture as it exists within the game or mod directory.

bmp BitmapRef

The referenced bitmap

intoTexture LoadedTexture

the texture object to be populated. If it already is populated it will be disposed first

GetShader(int)

Gives you access to all currently registered shaders identified by their number

IShaderProgram GetShader(int shaderProgramNumber)

Parameters

shaderProgramNumber int

Returns

IShaderProgram

GetTextureAtlasPosition(ItemStack)

Returns the first TextureAtlasPosition it can find for given block or item texture in itemstack.

TextureAtlasPosition GetTextureAtlasPosition(ItemStack itemstack)

Parameters

itemstack ItemStack

Returns

TextureAtlasPosition

GetUniformLocation(int, string)

Gets you the uniform location of given uniform for given shader

int GetUniformLocation(int shaderProgramNumber, string name)

Parameters

shaderProgramNumber int
name string

Returns

int

GlDisableCullFace()

Disables the culling faces.

void GlDisableCullFace()

GlEnableCullFace()

Enables the Culling faces.

void GlEnableCullFace()

GlGenerateTex2DMipmaps()

Regenerates the mip maps for the currently bound texture

void GlGenerateTex2DMipmaps()

GlGetError()

Returns null if no OpenGL Error happened, otherwise one of the official opengl error codes

string GlGetError()

Returns

string

GlGetMaxTextureSize()

Max size a texture can have on the current graphics card

int GlGetMaxTextureSize()

Returns

int

The maximum size a texture can have on the current graphics card in Pixels.

GlLoadMatrix(double[])

Replaces the top most matrix with given one

void GlLoadMatrix(double[] matrix)

Parameters

matrix double[]

GlMatrixModeModelView()

The current model view.

void GlMatrixModeModelView()

GlPopMatrix()

Pops the top most matrix from the games matrix stack

void GlPopMatrix()

GlPushMatrix()

Pushes a copy of the current matrix onto the games matrix stack

void GlPushMatrix()

GlRotate(float, float, float, float)

Rotates top most matrix in the games matrix stack

void GlRotate(float angle, float x, float y, float z)

Parameters

angle float
x float
y float
z float

GlScale(float, float, float)

Scales top most matrix in the games matrix stack

void GlScale(float x, float y, float z)

Parameters

x float
y float
z float

GlScissor(int, int, int, int)

Tells the graphics card to not render anything outside supplied bounds. Only sets the boundaries. Can be turned on/off with GlScissorFlag(true/false)

void GlScissor(int x, int y, int width, int height)

Parameters

x int
y int
width int
height int

GlScissorFlag(bool)

Whether scissor mode should be active or not

void GlScissorFlag(bool enable)

Parameters

enable bool

GlToggleBlend(bool, EnumBlendMode)

To enable/disable various blending modes

void GlToggleBlend(bool blend, EnumBlendMode blendMode = EnumBlendMode.Standard)

Parameters

blend bool
blendMode EnumBlendMode

GlTranslate(double, double, double)

Translates top most matrix in the games matrix stack

void GlTranslate(double x, double y, double z)

Parameters

x double
y double
z double

GlTranslate(float, float, float)

Translates top most matrix in the games matrix stack

void GlTranslate(float x, float y, float z)

Parameters

x float
y float
z float

GlViewport(int, int, int, int)

void GlViewport(int x, int y, int width, int height)

Parameters

x int
y int
width int
height int

LoadOrUpdateTextureFromBgra(int[], bool, int, ref LoadedTexture)

Loads texture from Pixels in BGRA format.

void LoadOrUpdateTextureFromBgra(int[] bgraPixels, bool linearMag, int clampMode, ref LoadedTexture intoTexture)

Parameters

bgraPixels int[]

The pixel array

linearMag bool

Enable/Disable Linear rendering or use Nearest rendering.

clampMode int

The current clamp mode

intoTexture LoadedTexture

The target texture space it should load the pixels into. Must have width/height set accordingly. Will set the opengl textureid upon successful load

LoadOrUpdateTextureFromRgba(int[], bool, int, ref LoadedTexture)

Loads texture from Pixels in RGBA format.

void LoadOrUpdateTextureFromRgba(int[] rgbaPixels, bool linearMag, int clampMode, ref LoadedTexture intoTexture)

Parameters

rgbaPixels int[]

The pixel array

linearMag bool

Enable/Disable Linear rendering or use Nearest rendering.

clampMode int

The current clamp mode

intoTexture LoadedTexture

The target texture space it should load the pixels into. Must have width/height set accordingly. Will set the opengl textureid upon successful load.

LoadTexture(IBitmap, ref LoadedTexture, bool, int, bool)

void LoadTexture(IBitmap bmp, ref LoadedTexture intoTexture, bool linearMag = false, int clampMode = 0, bool generateMipmaps = false)

Parameters

bmp IBitmap
intoTexture LoadedTexture
linearMag bool
clampMode int
generateMipmaps bool

LoadTextureFromBgra(int[], int, int, bool, int)

Loads texture from Pixels in BGRA format.

[Obsolete("Use LoadOrUpdateTextureFromBgra(int[] bgraPixels, bool linearMag, int clampMode, ref LoadedTexture intoTexture); instead. This method cannot warn you of memory leaks when the texture is not properly disposed.")]
int LoadTextureFromBgra(int[] bgraPixels, int width, int height, bool linearMag, int clampMode)

Parameters

bgraPixels int[]

The pixel array

width int

the width of the final texture

height int

the height of the final texture

linearMag bool

Enable/Disable Linear rendering or use Nearest rendering.

clampMode int

The current clamp mode

Returns

int

The GLID for the resulting texture.

LoadTextureFromRgba(int[], int, int, bool, int)

Loads texture from Pixels in RGBA format.

[Obsolete("Use LoadOrUpdateTextureFromRgba(int[] bgraPixels, bool linearMag, int clampMode, ref LoadedTexture intoTexture); instead. This method cannot warn you of memory leaks when the texture is not properly disposed.")]
int LoadTextureFromRgba(int[] rgbaPixels, int width, int height, bool linearMag, int clampMode)

Parameters

rgbaPixels int[]

The pixel array

width int

the width of the final texture

height int

the height of the final texture

linearMag bool

Enable/Disable Linear rendering or use Nearest rendering.

clampMode int

The current clamp mode

Returns

int

The OpenGL Identifier for the resulting texture.

PopScissor()

End scissor mode. Disable any previously set render constraints

void PopScissor()

PreparedStandardShader(int, int, int, Vec4f)

Populates the uniforms and light values for given positions and calls shader.Use().

IStandardShaderProgram PreparedStandardShader(int posX, int posY, int posZ, Vec4f colorMul = null)

Parameters

posX int

The position for light level reading

posY int

The position for light level reading

posZ int

The position for light level reading

colorMul Vec4f

Returns

IStandardShaderProgram

PushScissor(ElementBounds, bool)

Convenience method for GlScissor(). Tells the graphics card to not render anything outside supplied bounds. Can be turned of again with PopScissor(). Any previously applied scissor will be restored after calling PopScissor().

void PushScissor(ElementBounds bounds, bool stacking = false)

Parameters

bounds ElementBounds
stacking bool

If true, also applies scissoring from the previous call to PushScissor, otherwise replaces the scissor bounds

RemovePointLight(IPointLight)

Removes a dynamic light source from the scene

void RemovePointLight(IPointLight pointlight)

Parameters

pointlight IPointLight

RemoveTexture(AssetLocation)

Removes given texture from the cache and from graphics card memory

bool RemoveTexture(AssetLocation name)

Parameters

name AssetLocation

the location of the texture as it exists within the game or mod directory.

Returns

bool

whether the operation was successful or not.

Render2DLoadedTexture(LoadedTexture, float, float, float)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode)

void Render2DLoadedTexture(LoadedTexture textTexture, float posX, float posY, float z = 50)

Parameters

textTexture LoadedTexture
posX float
posY float
z float

Render2DTexture(int, float, float, float, float, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode)

void Render2DTexture(int textureid, float posX, float posY, float width, float height, float z = 50, Vec4f color = null)

Parameters

textureid int
posX float
posY float
width float
height float
z float
color Vec4f

Render2DTexture(int, ElementBounds, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode)

void Render2DTexture(int textureid, ElementBounds bounds, float z = 50, Vec4f color = null)

Parameters

textureid int
bounds ElementBounds
z float
color Vec4f

Render2DTexture(MeshRef, int, float, float, float, float, float)

Renders given texture onto the screen, uses supplied quad for rendering (gui mode)

void Render2DTexture(MeshRef quadModel, int textureid, float posX, float posY, float width, float height, float z = 50)

Parameters

quadModel MeshRef
textureid int
posX float
posY float
width float
height float
z float

Render2DTexturePremultipliedAlpha(int, double, double, double, double, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode). Assumes the texture to use a premultiplied alpha channel

void Render2DTexturePremultipliedAlpha(int textureid, double posX, double posY, double width, double height, float z = 50, Vec4f color = null)

Parameters

textureid int
posX double
posY double
width double
height double
z float
color Vec4f

Render2DTexturePremultipliedAlpha(int, float, float, float, float, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode). Assumes the texture to use a premultiplied alpha channel

void Render2DTexturePremultipliedAlpha(int textureid, float posX, float posY, float width, float height, float z = 50, Vec4f color = null)

Parameters

textureid int
posX float
posY float
width float
height float
z float
color Vec4f

Render2DTexturePremultipliedAlpha(int, ElementBounds, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode). Assumes the texture to use a premultiplied alpha channel

void Render2DTexturePremultipliedAlpha(int textureid, ElementBounds bounds, float z = 50, Vec4f color = null)

Parameters

textureid int
bounds ElementBounds
z float
color Vec4f

RenderEntityToGui(float, Entity, double, double, double, float, float, int)

Renders given entity at given position (gui/orthographic mode)

void RenderEntityToGui(float dt, Entity entity, double posX, double posY, double posZ, float yawDelta, float size, int color)

Parameters

dt float
entity Entity
posX double
posY double
posZ double
yawDelta float

For rotating the entity around its y-axis

size float
color int

RenderItemStackToAtlas(ItemStack, ITextureAtlasAPI, int, Action<int>, int, float, float)

Renders given itemstack into supplied texture atlas. This is a rather costly operation. Also be sure to cache the results, as each call to this method consumes more space in your texture atlas. If you call this method outside the ortho render stage, it will enqueue a render task for next frame. Rather exceptionally, this method is also thread safe. If called from another thread, the render task always gets enqueued. The call back will always be run on the main thread.

bool RenderItemStackToAtlas(ItemStack stack, ITextureAtlasAPI atlas, int size, Action<int> onComplete, int color = -1, float sepiaLevel = 0, float scale = 1)

Parameters

stack ItemStack
atlas ITextureAtlasAPI
size int
onComplete Action<int>

Once rendered, this returns a texture subid, which you can use to retrieve the textureAtlasPosition from the atlas

color int
sepiaLevel float
scale float

Returns

bool

True if the render could complete immediatly, false if it has to wait until the next ortho render stage

RenderItemstackToGui(ItemSlot, double, double, double, float, int, bool, bool, bool)

Renders given itemstack in slot at given position (gui/orthographic mode)

void RenderItemstackToGui(ItemSlot inSlot, double posX, double posY, double posZ, float size, int color, bool shading = true, bool rotate = false, bool showStackSize = true)

Parameters

inSlot ItemSlot
posX double
posY double
posZ double
size float
color int
shading bool
rotate bool
showStackSize bool

RenderItemstackToGui(ItemSlot, double, double, double, float, int, float, bool, bool, bool)

Renders given itemstack in slot at given position (gui/orthographic mode)

void RenderItemstackToGui(ItemSlot inSlot, double posX, double posY, double posZ, float size, int color, float dt, bool shading = true, bool rotate = false, bool showStackSize = true)

Parameters

inSlot ItemSlot
posX double
posY double
posZ double
size float
color int
dt float
shading bool
rotate bool
showStackSize bool

RenderItemstackToGui(ItemStack, double, double, double, float, int, bool, bool, bool)

Renders given itemstack at given position (gui/orthographic mode)

[Obsolete("Use RenderItemstackToGui(inSlot, ....) instead")]
void RenderItemstackToGui(ItemStack itemstack, double posX, double posY, double posZ, float size, int color, bool shading = true, bool rotate = false, bool showStackSize = true)

Parameters

itemstack ItemStack
posX double
posY double
posZ double
size float
color int

Set to WhiteArgb for normal rendering

shading bool

Unused.

rotate bool

If true, will slowly rotate the itemstack around the Y-Axis

showStackSize bool

If true, will render a number depicting how many blocks/item are in the stack

RenderLine(BlockPos, float, float, float, float, float, float, int)

Inefficiently renders a line between 2 points

void RenderLine(BlockPos origin, float posX1, float posY1, float posZ1, float posX2, float posY2, float posZ2, int color)

Parameters

origin BlockPos
posX1 float
posY1 float
posZ1 float
posX2 float
posY2 float
posZ2 float
color int

RenderMesh(MeshRef)

Renders given mesh onto the screen

void RenderMesh(MeshRef meshRef)

Parameters

meshRef MeshRef

RenderMesh(MeshRef, int[], int[], int)

Draws only a part of the mesh

void RenderMesh(MeshRef meshRef, int[] indicesStarts, int[] indicesSizes, int groupCount)

Parameters

meshRef MeshRef
indicesStarts int[]
indicesSizes int[]
groupCount int

RenderMeshInstanced(MeshRef, int)

Uses the graphics instanced rendering methods to efficiently render the same mesh multiple times. Use the custom mesh data parts with instanced flag on to supply custom data to each mesh.

void RenderMeshInstanced(MeshRef meshRef, int quantity = 1)

Parameters

meshRef MeshRef
quantity int

RenderMultiTextureMesh(MultiTextureMeshRef)

Renders given mesh onto the screen, with the mesh requiring multiple render calls for each texture, does not asign any texture

void RenderMultiTextureMesh(MultiTextureMeshRef mmr)

Parameters

mmr MultiTextureMeshRef

RenderMultiTextureMesh(MultiTextureMeshRef, string, int)

Renders given mesh onto the screen, with the mesh requiring multiple render calls for each texture, asigns the associated texture each call

void RenderMultiTextureMesh(MultiTextureMeshRef mmr, string textureSampleName, int textureNumber = 0)

Parameters

mmr MultiTextureMeshRef
textureSampleName string
textureNumber int

RenderRectangle(float, float, float, float, float, int)

Renders a rectangle outline at given position

void RenderRectangle(float posX, float posY, float posZ, float width, float height, int color)

Parameters

posX float
posY float
posZ float
width float
height float
color int

RenderTexture(int, double, double, double, double, float, Vec4f)

Renders given texture onto the screen, uses a simple quad for rendering (gui mode)

void RenderTexture(int textureid, double posX, double posY, double width, double height, float z = 50, Vec4f color = null)

Parameters

textureid int
posX double
posY double
width double
height double
z float
color Vec4f

RenderTextureIntoTexture(LoadedTexture, float, float, float, float, LoadedTexture, float, float, float)

Renders given texture into another texture. If you use the resulting texture for in-world rendering, remember to recreate the mipmaps via GlGenerateTex2DMipmaps()

void RenderTextureIntoTexture(LoadedTexture fromTexture, float sourceX, float sourceY, float sourceWidth, float sourceHeight, LoadedTexture intoTexture, float targetX, float targetY, float alphaTest = 0.005)

Parameters

fromTexture LoadedTexture
sourceX float
sourceY float
sourceWidth float
sourceHeight float
intoTexture LoadedTexture
targetX float
targetY float
alphaTest float

If below given threshold, the pixel is not drawn into the target texture. (Default: 0.05)

Reset3DProjection()

void Reset3DProjection()

Set3DProjection(float, float)

void Set3DProjection(float zfar, float fov)

Parameters

zfar float
fov float

UpdateMesh(MeshRef, MeshData)

Updates the existing mesh. Updates any non null data from updatedata

void UpdateMesh(MeshRef meshRef, MeshData updatedata)

Parameters

meshRef MeshRef
updatedata MeshData

UploadMesh(MeshData)

Uploads your mesh onto the graphics card for rendering (= load into a VAO).

If you use a custom shader, these are the VBO locations: xyz=0, uv=1, rgba=2, rgba2=3, flags=4, customFloats=5, customInts=6, customBytes=7 (indices do not get their own data location)
If any of them are null, the vbo location is not consumed and all used location numbers shift by -1

MeshRef UploadMesh(MeshData data)

Parameters

data MeshData

Returns

MeshRef

UploadMultiTextureMesh(MeshData)

Same as UploadMesh(MeshData) but splits it into multiple MeshRefs, one for each texture

MultiTextureMeshRef UploadMultiTextureMesh(MeshData data)

Parameters

data MeshData

Returns

MultiTextureMeshRef