Interface IRenderDevice
Interface for a rendering device that handles graphics rendering operations.
Namespace: Genesis.Graphics
Assembly: Genesis.dll
Syntax
public interface IRenderDevice
Methods
Begin()
Begins the rendering process.
Declaration
void Begin()
BuildFramebuffer(int, int)
Builds a framebuffer with the specified width and height.
Declaration
Framebuffer BuildFramebuffer(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the framebuffer. |
int | height | The height of the framebuffer. |
Returns
Type | Description |
---|---|
Framebuffer | The built framebuffer. |
BuildFramebuffer(int, int, Texture)
Builds a framebuffer with the specified width, height, and texture.
Declaration
Framebuffer BuildFramebuffer(int width, int height, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the framebuffer. |
int | height | The height of the framebuffer. |
Texture | texture | The texture associated with the framebuffer. |
Returns
Type | Description |
---|---|
Framebuffer | The built framebuffer. |
BuildFramebuffer(int, int, int)
Builds a framebuffer with the specified width, height, and texture ID.
Declaration
Framebuffer BuildFramebuffer(int width, int height, int texture)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the framebuffer. |
int | height | The height of the framebuffer. |
int | texture | The ID of the texture associated with the framebuffer. |
Returns
Type | Description |
---|---|
Framebuffer | The built framebuffer. |
BuildShadowMap(int, int)
Builds a framebuffer for rendering shadow maps.
Declaration
Framebuffer BuildShadowMap(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the framebuffer. |
int | height | The height of the framebuffer. |
Returns
Type | Description |
---|---|
Framebuffer | A framebuffer object configured for shadow mapping. |
CreateDynamicVertexBuffer(float[])
Creates a dynamic vertex buffer with the specified float array.
Declaration
int CreateDynamicVertexBuffer(float[] floats)
Parameters
Type | Name | Description |
---|---|---|
float[] | floats | The float array for the dynamic vertex buffer. |
Returns
Type | Description |
---|---|
int | The ID of the created dynamic vertex buffer. |
CreateStaticVertexBuffer(float[])
Creates a static vertex buffer with the specified vertices.
Declaration
int CreateStaticVertexBuffer(float[] verticies)
Parameters
Type | Name | Description |
---|---|---|
float[] | verticies | The vertices for the static vertex buffer. |
Returns
Type | Description |
---|---|
int | The ID of the created static vertex buffer. |
Dispose()
Disposes of the rendering device and releases any resources.
Declaration
void Dispose()
DisposeElement(GameElement)
Disposes the game element
Declaration
void DisposeElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The element to dispose |
DisposeElement3D(Element3D)
Disposes the specified 3D element, freeing up resources.
Declaration
void DisposeElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element | The 3D element to dispose. |
DisposeFont(Font)
Disposes the specified font, freeing up resources.
Declaration
void DisposeFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font to dispose. |
DisposeInstance(RenderInstanceContainer)
Declaration
void DisposeInstance(RenderInstanceContainer element)
Parameters
Type | Name | Description |
---|---|---|
RenderInstanceContainer | element |
DisposeTexture(Texture)
Disposes the specified texture, freeing up resources.
Declaration
void DisposeTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to dispose. |
DrawBufferedSprite(BufferedSprite)
Draws a buffered sprite in the current rendering context.
Declaration
void DrawBufferedSprite(BufferedSprite bufferedSprite)
Parameters
Type | Name | Description |
---|---|---|
BufferedSprite | bufferedSprite | The buffered sprite to draw. |
DrawCircle(Vec3, float, Color, float)
Declaration
void DrawCircle(Vec3 center, float radius, Color color, float borderWidth)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | center | |
float | radius | |
Color | color | |
float | borderWidth |
DrawElement3D(Element3D)
Draws a 3D element in the current rendering context.
Declaration
void DrawElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element | The 3D element to draw. |
DrawGameElement(GameElement)
Draws a game element in the current rendering context.
Declaration
void DrawGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The game element to draw. |
DrawInstance(RenderInstanceContainer)
Declaration
void DrawInstance(RenderInstanceContainer element)
Parameters
Type | Name | Description |
---|---|---|
RenderInstanceContainer | element |
DrawLine(Vec3, Vec3, Color)
Draws a line with specified starting and ending points and color in the current rendering context.
Declaration
void DrawLine(Vec3 from, Vec3 to, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | from | The starting point of the line. |
Vec3 | to | The ending point of the line. |
Color | color | The color of the line. |
DrawMesh(Mesh, Color)
Draws a mesh with specified mesh and color in the current rendering context.
Declaration
void DrawMesh(Mesh mesh, Color color)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The mesh to draw. |
Color | color | The color of the mesh. |
DrawRect(Rect, Color)
Draws a colored rectangle with specified position and size in the current rendering context.
Declaration
void DrawRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to draw. |
Color | color | The color of the rectangle. |
DrawRect(Rect, Color, float)
Draws a colored rectangle with specified position, size, and border width in the current rendering context.
Declaration
void DrawRect(Rect rect, Color color, float borderWidth)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to draw. |
Color | color | The color of the rectangle. |
float | borderWidth | The width of the rectangle border. |
DrawSkyBox(Skybox)
Draws a skybox in the current rendering context.
Declaration
void DrawSkyBox(Skybox skybox)
Parameters
Type | Name | Description |
---|---|---|
Skybox | skybox | The skybox to draw. |
DrawSprite(Sprite)
Draws a sprite in the current rendering context.
Declaration
void DrawSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite | The sprite to draw. |
DrawSprite(Vec3, Vec3, Texture)
Draws a sprite with specified location, size, and texture in the current rendering context.
Declaration
void DrawSprite(Vec3 location, Vec3 size, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Texture | texture | The texture of the sprite. |
DrawSprite(Vec3, Vec3, Texture, TexCoords)
Draws a sprite with specified location, size, texture, and texture coordinates in the current rendering context.
Declaration
void DrawSprite(Vec3 location, Vec3 size, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Texture | texture | The texture of the sprite. |
TexCoords | texCoords | The texture coordinates of the sprite. |
DrawSprite(Vec3, Vec3, Color, Texture)
Draws a sprite with specified location, size, color, and texture in the current rendering context.
Declaration
void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Color | color | The color of the sprite. |
Texture | texture | The texture of the sprite. |
DrawSprite(Vec3, Vec3, Color, Texture, TexCoords)
Draws a sprite with specified location, size, color, texture, and texture coordinates in the current rendering context.
Declaration
void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the sprite. |
Vec3 | size | The size of the sprite. |
Color | color | The color of the sprite. |
Texture | texture | The texture of the sprite. |
TexCoords | texCoords | The texture coordinates of the sprite. |
DrawString(string, Vec3, float, Font, Color)
Draws a string with specified text, location, fontsize, font, and color in the current rendering context.
Declaration
void DrawString(string text, Vec3 location, float fontsize, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to draw. |
Vec3 | location | The location of the text. |
float | fontsize | The fontsize of the text. |
Font | font | The font to use for drawing the text. |
Color | color | The color of the text. |
DrawString(string, Vec3, float, float, Font, Color)
Draws a string with specified text, location, fontsize, spacing, font, and color in the current rendering context.
Declaration
void DrawString(string text, Vec3 location, float fontsize, float spacing, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to draw. |
Vec3 | location | The location of the text. |
float | fontsize | The fontsize of the text. |
float | spacing | The spacing between characters. |
Font | font | The font to use for drawing the text. |
Color | color | The color of the text. |
DrawTexture(Vec3, Vec3, float, float, Texture)
Draws a texture with specified location, size, and texture coordinates in the current rendering context.
Declaration
void DrawTexture(Vec3 location, Vec3 size, float repeatX, float repeatY, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | The location of the texture. |
Vec3 | size | The size of the texture. |
float | repeatX | The horizontal texture repeat factor. |
float | repeatY | The vertical texture repeat factor. |
Texture | texture | The texture to draw. |
DrawVectors(Vec3[], Color)
Draws vectors with specified positions in the current rendering context.
Declaration
void DrawVectors(Vec3[] vecs, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3[] | vecs | The array of vectors to draw. |
Color | color | The color of the vectors. |
EditBufferSubData(int, int, float[])
Declaration
void EditBufferSubData(int bufferId, int offset, float[] data)
Parameters
Type | Name | Description |
---|---|---|
int | bufferId | |
int | offset | |
float[] | data |
End()
Ends the rendering process.
Declaration
void End()
FillCircle(Vec3, float, Color)
Declaration
void FillCircle(Vec3 center, float radius, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | center | |
float | radius | |
Color | color |
FillRect(Rect, Color)
Fills a colored rectangle with specified position and size in the current rendering context.
Declaration
void FillRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | The rectangle to fill. |
Color | color | The color to fill the rectangle with. |
FinishCanvasRendering(Scene, Canvas)
Finishes the rendering for a canvas within a 2D scene.
Declaration
void FinishCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene containing the canvas. |
Canvas | canvas | The canvas to finish rendering. |
FinishLightmap2D(Scene, Framebuffer)
Finish the lightmap 2D rendering
Declaration
void FinishLightmap2D(Scene scene, Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | |
Framebuffer | framebuffer |
FinishSceneRendering(Scene)
Finishes the rendering for a 2D scene.
Declaration
void FinishSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene to finish rendering. |
FinishShadowPass(Viewport)
Completes the shadow pass by finalizing any state changes or cleanup required after rendering the shadow map. This may involve restoring viewport settings or other post-processing tasks.
Declaration
void FinishShadowPass(Viewport viewport)
Parameters
Type | Name | Description |
---|---|---|
Viewport | viewport | The viewport object representing the final render area on the screen or in the context. |
GenerateLightspaceMatrix(Camera, Viewport, Light)
Generates a matrix that transforms coordinates from world space to light space. This matrix is used to project the scene from the perspective of the light source.
Declaration
mat4 GenerateLightspaceMatrix(Camera camera, Viewport viewport, Light lightSource)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera object used to generate the view matrix. This is typically a camera with a perspective or orthographic projection. |
Viewport | viewport | The viewport from the current render target |
Light | lightSource | The light source used to compute the light space matrix. This includes information like position and direction of the light. |
Returns
Type | Description |
---|---|
mat4 | A 4x4 matrix representing the light space transformation. |
GetError()
Gets the last OpenGL error code.
Declaration
int GetError()
Returns
Type | Description |
---|---|
int | The error code. |
GetHandle()
Gets the handle (pointer) to the underlying rendering context.
Declaration
IntPtr GetHandle()
Returns
Type | Description |
---|---|
IntPtr | The handle to the rendering context. |
Init()
Initializes the rendering device.
Declaration
void Init()
InitElement3D(Element3D)
Initializes a 3D element for rendering.
Declaration
void InitElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element |
InitGameElement(GameElement)
Initializes a game element for rendering.
Declaration
void InitGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element |
InitInstance(RenderInstanceContainer)
Declaration
void InitInstance(RenderInstanceContainer element)
Parameters
Type | Name | Description |
---|---|---|
RenderInstanceContainer | element |
InitMaterial(Material)
Initialize a material for rendering
Declaration
void InitMaterial(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material |
InitSprite(Sprite)
Initializes a sprite for rendering.
Declaration
void InitSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite |
IsMaterialLoaded(Material)
Declaration
bool IsMaterialLoaded(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material |
Returns
Type | Description |
---|---|
bool |
LoadFont(Font)
Loads a font into the rendering device.
Declaration
void LoadFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | The font to load. |
LoadTexture(Texture)
Loads a texture into the rendering device.
Declaration
void LoadTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture | The texture to load. |
ModelViewMatrix()
Sets the current rendering matrix to the model-view matrix.
Declaration
void ModelViewMatrix()
PopMatrix()
Pops the matrix from the top of the matrix stack.
Declaration
void PopMatrix()
PrepareCanvasRendering(Scene, Canvas)
Prepares the rendering for a canvas within a 2D scene.
Declaration
void PrepareCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene containing the canvas. |
Canvas | canvas | The canvas to prepare rendering for. |
PrepareLightmap2D(Scene, Framebuffer)
Prepares the render for the 2D lightmap
Declaration
void PrepareLightmap2D(Scene scene, Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | |
Framebuffer | framebuffer |
PrepareSceneRendering(Scene)
Prepares the rendering for a 2D scene.
Declaration
void PrepareSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The 2D scene to prepare. |
PrepareShadowPass(Framebuffer, mat4)
Prepares the framebuffer and matrix for rendering shadows. This setup is necessary before rendering the scene to the shadow map.
Declaration
void PrepareShadowPass(Framebuffer shadowmap, mat4 lightspaceMatrix)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | shadowmap | The framebuffer that will be used to render the shadow map. |
mat4 | lightspaceMatrix | The matrix used to transform scene coordinates into light space for shadow mapping. |
ProjectionMatrix()
Sets the current rendering matrix to the projection matrix.
Declaration
void ProjectionMatrix()
PushMatrix()
Pushes the current matrix onto the matrix stack.
Declaration
void PushMatrix()
RenderShadowmap(Framebuffer, mat4, Scene3D)
Renders the scene from the perspective of the light source into the shadow map framebuffer. This creates the shadow map texture used for shadow testing.
Declaration
void RenderShadowmap(Framebuffer shadowmap, mat4 lightspaceMatrix, Scene3D scene)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | shadowmap | The framebuffer where the shadow map will be rendered. |
mat4 | lightspaceMatrix | The matrix that transforms scene coordinates into light space. |
Scene3D | scene | The 3D scene to be rendered into the shadow map. |
Rotate(float, Vec3)
Rotates the matrix by the specified angle around the given vector.
Declaration
void Rotate(float angle, Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
float | angle | The rotation angle in degrees. |
Vec3 | vector | The vector to rotate around. |
SetCamera(Viewport, Camera)
Sets the camera for rendering.
Declaration
void SetCamera(Viewport viewport, Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Viewport | viewport | |
Camera | camera | The camera to set. |
SetFramebuffer(Framebuffer)
Sets the active framebuffer using its ID.
Declaration
void SetFramebuffer(Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | framebuffer | The ID of the framebuffer to set as active. |
SetFramebuffer(int)
Sets the active framebuffer using the specified framebuffer object.
Declaration
void SetFramebuffer(int framebuffer)
Parameters
Type | Name | Description |
---|---|---|
int | framebuffer | The framebuffer to set as active. |
SetLightSource(Light)
Sets the light source for rendering.
Declaration
void SetLightSource(Light light)
Parameters
Type | Name | Description |
---|---|---|
Light | light | The light source to set. |
SetProjectionMatrix(mat4)
Declaration
void SetProjectionMatrix(mat4 projectionMatrix)
Parameters
Type | Name | Description |
---|---|---|
mat4 | projectionMatrix |
SetViewMatrix(mat4)
Declaration
void SetViewMatrix(mat4 viewMatrix)
Parameters
Type | Name | Description |
---|---|---|
mat4 | viewMatrix |
SetViewport(Viewport)
Sets the viewport for rendering.
Declaration
void SetViewport(Viewport viewport)
Parameters
Type | Name | Description |
---|---|---|
Viewport | viewport |
TextureClampS()
Sets the texture wrapping mode to clamp in the S direction.
Declaration
void TextureClampS()
TextureClampT()
Sets the texture wrapping mode to clamp in the T direction.
Declaration
void TextureClampT()
TextureRepeatS()
Sets the texture wrapping mode to repeat in the S direction.
Declaration
void TextureRepeatS()
TextureRepeatT()
Sets the texture wrapping mode to repeat in the T direction.
Declaration
void TextureRepeatT()
Translate(Vec3)
Translates the matrix by the specified vector.
Declaration
void Translate(Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | vector | The translation vector. |
Translate(float, float, float)
Translates the matrix by the specified coordinates.
Declaration
void Translate(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-coordinate translation. |
float | y | The y-coordinate translation. |
float | z | The z-coordinate translation. |
UpdateFramebufferSize(Framebuffer, int, int)
Updates the size of the specified framebuffer.
Declaration
void UpdateFramebufferSize(Framebuffer framebuffer, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | framebuffer | The framebuffer to update. |
int | width | The new width of the framebuffer. |
int | height | The new height of the framebuffer. |