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
- Extension Methods
Properties
AmbientColor
The current ambient color (e.g. will return a blue tint when player is under water)
Vec3f AmbientColor { get; }
Property Value
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
CameraStuck
True if when in IFP mode the camera would end up inside blocks
bool CameraStuck { get; }
Property Value
CameraType
The desired camera type. Be aware, the actual camera type can change at runtime if the player is against a wall and tries to look from inside the wall - use entityPlayer.CameraMode to get the actual mode
EnumCameraMode CameraType { get; }
Property Value
CurrentActiveShader
Gives you a reference to the currently active shader, or null if none is active right now
IShaderProgram CurrentActiveShader { get; }
Property Value
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
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
DefaultFrustumCuller
FrustumCulling DefaultFrustumCuller { get; }
Property Value
FogColor
The current fog color (e.g. will return a blue tint when player is under water)
Vec4f FogColor { get; }
Property Value
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
FogMin
Current minimum fog value
float FogMin { get; }
Property Value
FrameBuffer
Set the current framebuffer
FrameBufferRef FrameBuffer { set; }
Property Value
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
FrameHeight
Height of the primary render framebuffer
int FrameHeight { get; }
Property Value
FrameWidth
Width of the primary render framebuffer
int FrameWidth { get; }
Property Value
LineWidth
float LineWidth { set; }
Property Value
MvMatrix
The current modelview matrix stack
StackMatrix4 MvMatrix { get; }
Property Value
PMatrix
The current projection matrix stack
StackMatrix4 PMatrix { get; }
Property Value
PerceptionEffects
PerceptionEffects PerceptionEffects { get; }
Property Value
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
ShaderUniforms
A number of default shader uniforms
DefaultShaderUniforms ShaderUniforms { get; }
Property Value
StandardFontName
The standard font used during this render (if it exists).
[Obsolete("Please use ElementGeometrics.StandardFontName instead.")]
string StandardFontName { get; }
Property Value
StandardShader
Gives you a reference to the "standard" shader, a general purpose shader for normal shading work
IStandardShaderProgram StandardShader { get; }
Property Value
TextureSize
int TextureSize { get; }
Property Value
UseSSBOs
If true, chunk rendering will use SSBOs - a OpenGL 4.30+ feature - for higher performance in game version 1.21+
bool UseSSBOs { get; }
Property Value
WireframeDebugRender
WireframeModes WireframeDebugRender { get; }
Property Value
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
pointlightIPointLight
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
xyzSizeintthe squared size of the texture.
normalSizeintthe size of the normals
uvSizeintthe size of the UV map.
rgbaSizeintsize of the RGBA colors.
flagsSizeintSize of the render flags.
indicesSizeintSize of the indices
customFloatsCustomMeshDataPartFloatFloat values of the mesh
customShortsCustomMeshDataPartShortcustomBytesCustomMeshDataPartByteByte values of the mesh
customIntsCustomMeshDataPartIntFloat values of the mesh
drawModeEnumDrawModeThe current draw mode
staticDrawboolwhether 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
textureidintThe OpenGL Identifier ID for the target texture to bind.
BitmapCreateFromPng(byte[])
Creates a bitmap from a given PNG.
BitmapExternal BitmapCreateFromPng(byte[] pngdata)
Parameters
pngdatabyte[]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
messagestring
CreateFrameBuffer(LoadedTexture)
FrameBufferRef CreateFrameBuffer(LoadedTexture intoTexture)
Parameters
intoTextureLoadedTexture
Returns
CreateUBO(IShaderProgram, int, string, int)
UBORef CreateUBO(IShaderProgram shaderProgram, int bindingPoint, string blockName, int size)
Parameters
shaderProgramIShaderProgrambindingPointintblockNamestringsizeint
Returns
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
vaoMeshRef
DestroyFrameBuffer(FrameBufferRef)
void DestroyFrameBuffer(FrameBufferRef fb)
Parameters
GLDeleteTexture(int)
Deletes given texture
void GLDeleteTexture(int textureId)
Parameters
textureIdintthe OpenGL Identifier for the target Texture.
GLDepthMask(bool)
Toggle writing to the depth buffer
void GLDepthMask(bool on)
Parameters
onbool
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
programEnumShaderProgram
Returns
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
inSlotItemSlotgroundEnumItemRenderTargetdtfloat
Returns
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
nameAssetLocationthe 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
nameAssetLocationthe location of the texture as it exists within the game or mod directory.
intoTextureLoadedTexturethe 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
nameAssetLocationthe location of the texture as it exists within the game or mod directory.
bmpBitmapRefThe referenced bitmap
intoTextureLoadedTexturethe 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
shaderProgramNumberint
Returns
GetTextureAtlasPosition(ItemStack)
Returns the first TextureAtlasPosition it can find for given block or item texture in itemstack.
TextureAtlasPosition GetTextureAtlasPosition(ItemStack itemstack)
Parameters
itemstackItemStack
Returns
GetUniformLocation(int, string)
Gets you the uniform location of given uniform for given shader
int GetUniformLocation(int shaderProgramNumber, string name)
Parameters
Returns
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
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
matrixdouble[]
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
GlScale(float, float, float)
Scales top most matrix in the games matrix stack
void GlScale(float x, float y, float z)
Parameters
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
GlScissorFlag(bool)
Whether scissor mode should be active or not
void GlScissorFlag(bool enable)
Parameters
enablebool
GlToggleBlend(bool, EnumBlendMode)
To enable/disable various blending modes
void GlToggleBlend(bool blend, EnumBlendMode blendMode = EnumBlendMode.Standard)
Parameters
blendboolblendModeEnumBlendMode
GlTranslate(double, double, double)
Translates top most matrix in the games matrix stack
void GlTranslate(double x, double y, double z)
Parameters
GlTranslate(float, float, float)
Translates top most matrix in the games matrix stack
void GlTranslate(float x, float y, float z)
Parameters
GlViewport(int, int, int, int)
void GlViewport(int x, int y, int width, int height)
Parameters
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
bgraPixelsint[]The pixel array
linearMagboolEnable/Disable Linear rendering or use Nearest rendering.
clampModeintThe current clamp mode
intoTextureLoadedTextureThe 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
rgbaPixelsint[]The pixel array
linearMagboolEnable/Disable Linear rendering or use Nearest rendering.
clampModeintThe current clamp mode
intoTextureLoadedTextureThe 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
bmpIBitmapintoTextureLoadedTexturelinearMagboolclampModeintgenerateMipmapsbool
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
bgraPixelsint[]The pixel array
widthintthe width of the final texture
heightintthe height of the final texture
linearMagboolEnable/Disable Linear rendering or use Nearest rendering.
clampModeintThe 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
rgbaPixelsint[]The pixel array
widthintthe width of the final texture
heightintthe height of the final texture
linearMagboolEnable/Disable Linear rendering or use Nearest rendering.
clampModeintThe 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
posXintThe position for light level reading
posYintThe position for light level reading
posZintThe position for light level reading
colorMulVec4f
Returns
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
boundsElementBoundsstackingboolIf 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
pointlightIPointLight
RemoveTexture(AssetLocation)
Removes given texture from the cache and from graphics card memory
bool RemoveTexture(AssetLocation name)
Parameters
nameAssetLocationthe 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
textTextureLoadedTextureposXfloatposYfloatzfloat
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
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
textureidintboundsElementBoundszfloatcolorVec4f
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
Render2DTexture(MultiTextureMeshRef, float, float, float, float, float)
Renders given texture onto the screen, uses supplied quad for rendering (gui mode)
void Render2DTexture(MultiTextureMeshRef quadModel, float posX, float posY, float width, float height, float z = 50)
Parameters
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
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
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
textureidintboundsElementBoundszfloatcolorVec4f
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
dtfloatentityEntityposXdoubleposYdoubleposZdoubleyawDeltafloatFor rotating the entity around its y-axis
sizefloatcolorint
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
stackItemStackatlasITextureAtlasAPIsizeintonCompleteAction<int>Once rendered, this returns a texture subid, which you can use to retrieve the textureAtlasPosition from the atlas
colorintsepiaLevelfloatscalefloat
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
inSlotItemSlotposXdoubleposYdoubleposZdoublesizefloatcolorintshadingboolrotateboolshowStackSizebool
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
inSlotItemSlotposXdoubleposYdoubleposZdoublesizefloatcolorintdtfloatshadingboolrotateboolshowStackSizebool
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
itemstackItemStackposXdoubleposYdoubleposZdoublesizefloatcolorintSet to WhiteArgb for normal rendering
shadingboolUnused.
rotateboolIf true, will slowly rotate the itemstack around the Y-Axis
showStackSizeboolIf 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
RenderMesh(MeshRef)
Renders given mesh onto the screen
void RenderMesh(MeshRef meshRef)
Parameters
meshRefMeshRef
RenderMesh(MeshRef, int[], int[], int)
Draws only a part of the mesh
void RenderMesh(MeshRef meshRef, int[] indicesStarts, int[] indicesSizes, int groupCount)
Parameters
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
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
mmrMultiTextureMeshReftextureSampleNamestringtextureNumberint
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
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
RenderTextureIntoFrameBuffer(int, LoadedTexture, float, float, float, float, FrameBufferRef, float, float, float)
void RenderTextureIntoFrameBuffer(int atlasTextureId, LoadedTexture fromTexture, float sourceX, float sourceY, float sourceWidth, float sourceHeight, FrameBufferRef fb, float targetX, float targetY, float alphaTest = 0.005)
Parameters
atlasTextureIdintfromTextureLoadedTexturesourceXfloatsourceYfloatsourceWidthfloatsourceHeightfloatfbFrameBufferReftargetXfloattargetYfloatalphaTestfloat
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
fromTextureLoadedTexturesourceXfloatsourceYfloatsourceWidthfloatsourceHeightfloatintoTextureLoadedTexturetargetXfloattargetYfloatalphaTestfloatIf 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
UpdateChunkMesh(MeshRef, MeshData)
Updates the existing mesh. Updates any non null data from updatedata. Version for chunks only (also decals, as they use chunk MeshDataPool system)
void UpdateChunkMesh(MeshRef meshRef, MeshData updatedata)
Parameters
UpdateMesh(MeshRef, MeshData)
Updates the existing mesh. Updates any non null data from updatedata
void UpdateMesh(MeshRef meshRef, MeshData updatedata)
Parameters
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
dataMeshData
Returns
UploadMultiTextureMesh(MeshData)
Same as UploadMesh(MeshData) but splits it into multiple MeshRefs, one for each texture
MultiTextureMeshRef UploadMultiTextureMesh(MeshData data)
Parameters
dataMeshData