Class BetaRenderer
Implements
Inherited Members
Namespace: Genesis.Graphics.RenderDevice
Assembly: Genesis.dll
Syntax
public class BetaRenderer : IRenderDevice
Constructors
BetaRenderer(IntPtr, RenderSettings)
Declaration
public BetaRenderer(IntPtr hwnd, RenderSettings settings)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | hwnd | |
RenderSettings | settings |
Fields
sceneBuffer
Declaration
public Framebuffer sceneBuffer
Field Value
Type | Description |
---|---|
Framebuffer |
Methods
Begin()
Beginn to draw
Declaration
public void Begin()
BuildFramebuffer(int, int)
Creates a new framebuffer
Declaration
public Framebuffer BuildFramebuffer(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | |
int | height |
Returns
Type | Description |
---|---|
Framebuffer |
BuildFramebuffer(int, int, Texture)
Creates a new framebuffer
Declaration
public Framebuffer BuildFramebuffer(int width, int height, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
int | width | |
int | height | |
Texture | texture |
Returns
Type | Description |
---|---|
Framebuffer |
BuildFramebuffer(int, int, int)
Creates a new framebuffer
Declaration
public Framebuffer BuildFramebuffer(int width, int height, int texture)
Parameters
Type | Name | Description |
---|---|---|
int | width | |
int | height | |
int | texture |
Returns
Type | Description |
---|---|
Framebuffer |
CreateDynamicVertexBuffer(float[])
Creates a dynamic vertex buffer in OpenGL and initializes it with the specified vertices. Dynamic buffers are suitable for frequently changing data, like dynamic vertex updates.
Declaration
public int CreateDynamicVertexBuffer(float[] verticies)
Parameters
Type | Name | Description |
---|---|---|
float[] | verticies | The array of vertices to be stored in the buffer. |
Returns
Type | Description |
---|---|
int | The OpenGL handle (ID) of the created dynamic vertex buffer. |
CreateShader(string, ShaderProgram)
Loads a shader program
Declaration
public void CreateShader(string name, ShaderProgram program)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
ShaderProgram | program |
CreateStaticVertexBuffer(float[])
Creates a static vertex buffer in OpenGL and initializes it with the specified vertices. Static buffers are suitable for infrequently changing data, like static geometry.
Declaration
public int CreateStaticVertexBuffer(float[] verticies)
Parameters
Type | Name | Description |
---|---|---|
float[] | verticies | The array of vertices to be stored in the buffer. |
Returns
Type | Description |
---|---|
int | The OpenGL handle (ID) of the created static vertex buffer. |
Dispose()
Disposes the render device
Declaration
public void Dispose()
DisposeElement(GameElement)
Disposes the element data from the gpu
Declaration
public void DisposeElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element | The element to dispose |
DisposeElement3D(Element3D)
Dispose the 3D element
Declaration
public void DisposeElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element |
DisposeFont(Font)
Disposes the font
Declaration
public void DisposeFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font |
DisposeShader(ShaderProgram)
Deletes the shader program
Declaration
public void DisposeShader(ShaderProgram program)
Parameters
Type | Name | Description |
---|---|---|
ShaderProgram | program |
DisposeTexture(Texture)
Disposes the texture
Declaration
public void DisposeTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture |
DrawBufferedSprite(BufferedSprite)
Draws a buffered sprite in the current rendering context.
Declaration
public void DrawBufferedSprite(BufferedSprite bufferedSprite)
Parameters
Type | Name | Description |
---|---|---|
BufferedSprite | bufferedSprite | The buffered sprite to draw. |
DrawCircle(Vec3, float, Color, float)
Draws an circle
Declaration
public void DrawCircle(Vec3 center, float radius, Color color, float borderWidth)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | center | Location for the circle |
float | radius | Radius for the circle |
Color | color | Color for the circle |
float | borderWidth | Border width for the circle |
DrawElement3D(Element3D)
Draws an 3D element within the scene
Declaration
public void DrawElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element |
DrawGameElement(GameElement)
Renders the GameElement
Declaration
public void DrawGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element |
DrawLine(Vec3, Vec3, Color)
Draws a line
Declaration
public void DrawLine(Vec3 from, Vec3 to, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | from | |
Vec3 | to | |
Color | color |
DrawMesh(Mesh, Color)
Draws a mesh
Declaration
public void DrawMesh(Mesh mesh, Color color)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | |
Color | color |
DrawParticleEmitter(ParticleEmitter)
Draws the particle emitter
Declaration
public void DrawParticleEmitter(ParticleEmitter emitter)
Parameters
Type | Name | Description |
---|---|---|
ParticleEmitter | emitter |
DrawRect(Rect, Color)
Draws a rect with no fill
Declaration
public void DrawRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
Color | color |
DrawRect(Rect, Color, float)
Draws a rect with no fill
Declaration
public void DrawRect(Rect rect, Color color, float borderWidth)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
Color | color | |
float | borderWidth |
DrawSkyBox(Skybox)
Draws an skybox
Declaration
public void DrawSkyBox(Skybox skybox)
Parameters
Type | Name | Description |
---|---|---|
Skybox | skybox |
DrawSprite(Sprite)
Renders a sprite with modern gl
Declaration
public void DrawSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite |
DrawSprite(Vec3, Vec3, Texture)
Draws a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | |
Vec3 | size | |
Texture | texture |
DrawSprite(Vec3, Vec3, Texture, TexCoords)
Draws a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | |
Vec3 | size | |
Texture | texture | |
TexCoords | texCoords |
DrawSprite(Vec3, Vec3, Color, Texture)
Renders a sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | |
Vec3 | size | |
Color | color | |
Texture | texture |
DrawSprite(Vec3, Vec3, Color, Texture, TexCoords)
Draws a Sprite
Declaration
public void DrawSprite(Vec3 location, Vec3 size, Color color, Texture texture, TexCoords texCoords)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | |
Vec3 | size | |
Color | color | |
Texture | texture | |
TexCoords | texCoords |
DrawString(string, Vec3, float, Font, Color)
Renders a String
Declaration
public void DrawString(string text, Vec3 location, float fontSize, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | |
Vec3 | location | |
float | fontSize | |
Font | font | |
Color | color |
DrawString(string, Vec3, float, float, Font, Color)
Renders a string
Declaration
public void DrawString(string text, Vec3 location, float fontSize, float spacing, Font font, Color color)
Parameters
Type | Name | Description |
---|---|---|
string | text | |
Vec3 | location | |
float | fontSize | |
float | spacing | |
Font | font | |
Color | color |
DrawTexture(Vec3, Vec3, float, float, Texture)
Draws a texture
Declaration
public void DrawTexture(Vec3 location, Vec3 size, float repeateX, float repeatY, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | location | |
Vec3 | size | |
float | repeateX | |
float | repeatY | |
Texture | texture |
DrawVectors(Vec3[], Color)
Draws the vector array
Declaration
public void DrawVectors(Vec3[] vecs, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3[] | vecs | |
Color | color |
End()
Ends the rendering
Declaration
public void End()
FillCircle(Vec3, float, Color)
Renders an filled circle
Declaration
public void FillCircle(Vec3 center, float radius, Color color)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | center | Center of the circle |
float | radius | Radius of the circle |
Color | color | Color of the circle |
FillRect(Rect, Color)
Fills a rectangle with the given color. LegacyGL
Declaration
public void FillRect(Rect rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
Color | color |
FinishCanvasRendering(Scene, Canvas)
Finish the canvas rendering
Declaration
public void FinishCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene from the canvas |
Canvas | canvas | The canvas to render |
FinishLightmap2D(Scene, Framebuffer)
Finish the lightmap 2D rendering
Declaration
public void FinishLightmap2D(Scene scene, Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | |
Framebuffer | framebuffer |
FinishSceneRendering(Scene)
Finish the scene rendering
Declaration
public void FinishSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene which getted rendered |
GenerateTexture(OpenGL, Texture)
Generates a texture
Declaration
public int GenerateTexture(OpenGL gl, Texture texture)
Parameters
Type | Name | Description |
---|---|---|
OpenGL | gl | |
Texture | texture |
Returns
Type | Description |
---|---|
int |
GenerateTexture(OpenGL, Bitmap)
Generates a texture
Declaration
public int GenerateTexture(OpenGL gl, Bitmap texture)
Parameters
Type | Name | Description |
---|---|---|
OpenGL | gl | |
Bitmap | texture |
Returns
Type | Description |
---|---|
int |
GetError()
Returns an error code from the render device
Declaration
public int GetError()
Returns
Type | Description |
---|---|
int |
GetHandle()
Returns the handle of the render target
Declaration
public IntPtr GetHandle()
Returns
Type | Description |
---|---|
IntPtr |
GetRenderer()
Returns the native renderer
Declaration
public OpenGL GetRenderer()
Returns
Type | Description |
---|---|
OpenGL |
GetShaderProgram(ShaderProgram)
Returns the shader programm with the typeof the refProgram. Returns null is no program found
Declaration
public ShaderProgram GetShaderProgram(ShaderProgram refProgram)
Parameters
Type | Name | Description |
---|---|---|
ShaderProgram | refProgram |
Returns
Type | Description |
---|---|
ShaderProgram |
Init()
Initial the moderngl render device
Declaration
public void Init()
InitElement3D(Element3D)
Inital an 3D element
Declaration
public void InitElement3D(Element3D element)
Parameters
Type | Name | Description |
---|---|---|
Element3D | element |
InitGameElement(GameElement)
Inits the game element
Declaration
public void InitGameElement(GameElement element)
Parameters
Type | Name | Description |
---|---|---|
GameElement | element |
InitNormalMap(string)
Inital the normal map for an 3D element if the normal map file isnt existing an empty 1x1 normal map get created
Declaration
public int InitNormalMap(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path |
Returns
Type | Description |
---|---|
int |
InitSprite(Sprite)
Initial the sprite
Declaration
public void InitSprite(Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
Sprite | sprite |
InitTexture(string)
Initial the diffuse texture for the 3D model If the texture file isnt existing an empty 1x1 texture get created
Declaration
public int InitTexture(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path |
Returns
Type | Description |
---|---|
int |
LoadFont(Font)
Loads the the font
Declaration
public void LoadFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font |
LoadTexture(Texture)
Loads a texture into the vram
Declaration
public void LoadTexture(Texture texture)
Parameters
Type | Name | Description |
---|---|---|
Texture | texture |
ModelViewMatrix()
This function will not be used within this render device
Declaration
public void ModelViewMatrix()
PopMatrix()
This function will not be used within this render device
Declaration
public void PopMatrix()
PrepareCanvasRendering(Scene, Canvas)
Prepares the renderer for the canvas rendering
Declaration
public void PrepareCanvasRendering(Scene scene, Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene from the canvas |
Canvas | canvas | The canvas to render |
PrepareLightmap2D(Scene, Framebuffer)
Prepares the render for the 2D lightmap
Declaration
public void PrepareLightmap2D(Scene scene, Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | |
Framebuffer | framebuffer |
PrepareSceneRendering(Scene)
Prepares the renderer for scene rendering
Declaration
public void PrepareSceneRendering(Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene to render |
ProjectionMatrix()
This function will not be used within this render device
Declaration
public void ProjectionMatrix()
PushMatrix()
This function will not be used within this render device
Declaration
public void PushMatrix()
Rotate(float, Vec3)
This function will not be used within this render device
Declaration
public void Rotate(float angle, Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
float | angle | |
Vec3 | vector |
SetCamera(Viewport, Camera)
Set the Projection and view matrices
Declaration
public void SetCamera(Viewport viewport, Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Viewport | viewport | |
Camera | camera |
SetFramebuffer(Framebuffer)
Sets an framebuffer as active render target
Declaration
public void SetFramebuffer(Framebuffer framebuffer)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | framebuffer | The framebuffer for the rendering |
SetFramebuffer(int)
Sets an framebuffer as active render target
Declaration
public void SetFramebuffer(int framebuffer)
Parameters
Type | Name | Description |
---|---|---|
int | framebuffer | The framebuffer id for the rendering |
SetLightSource(Light)
Sets an Lightsource
Declaration
public void SetLightSource(Light light)
Parameters
Type | Name | Description |
---|---|---|
Light | light |
SetViewport(Viewport)
Sets the viewport for the rendering
Declaration
public void SetViewport(Viewport viewport)
Parameters
Type | Name | Description |
---|---|---|
Viewport | viewport |
TextureClampS()
Sets the texture clampS
Declaration
public void TextureClampS()
TextureClampT()
Sets the texture clampT
Declaration
public void TextureClampT()
TextureRepeatS()
Sets the texture repeatS
Declaration
public void TextureRepeatS()
TextureRepeatT()
Sets the texture repeatT
Declaration
public void TextureRepeatT()
Translate(Vec3)
This function will not be used within this render device
Declaration
public void Translate(Vec3 vector)
Parameters
Type | Name | Description |
---|---|---|
Vec3 | vector |
Translate(float, float, float)
This function will not be used within this render device
Declaration
public void Translate(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
float | x | |
float | y | |
float | z |
UpdateFramebufferSize(Framebuffer, int, int)
Update the framebuffer size
Declaration
public void UpdateFramebufferSize(Framebuffer framebuffer, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Framebuffer | framebuffer | |
int | width | |
int | height |