Show / Hide Table of Contents

Class RenderContextImp

Implementation of the IRenderContextImp interface on top of WebGLDotNET.

Inheritance
System.Object
RenderContextImp
Implements
IRenderContextImp
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Engine.Imp.Graphics.Blazor
Assembly: Fusee.Engine.Imp.Graphics.Blazor.dll
Syntax
public class RenderContextImp : IRenderContextImp

Constructors

RenderContextImp(IRenderCanvasImp)

Initializes a new instance of the RenderContextImp class.

Declaration
public RenderContextImp(IRenderCanvasImp renderCanvasImp)
Parameters
Type Name Description
IRenderCanvasImp renderCanvasImp

The platform specific render canvas implementation.

Fields

gl

The WebGL rendering context base.

Declaration
protected WebGLRenderingContextBase gl
Field Value
Type Description
WebGLRenderingContextBase

gl2

The WebGL2 rendering context base.

Declaration
protected WebGL2RenderingContextBase gl2
Field Value
Type Description
WebGL2RenderingContextBase

Properties

ClearColor

Gets and sets the color of the background.

Declaration
public float4 ClearColor { get; set; }
Property Value
Type Description
float4

The color of the clear.

ClearDepth

Gets and sets the clear depth value which is used to clear the depth buffer.

Declaration
public float ClearDepth { get; set; }
Property Value
Type Description
System.Single

Specifies the depth value used when the depth buffer is cleared. The initial value is 1. This value is clamped to the range [0,1].

FuseePlatformId

Returns the current underlying rendering platform

Declaration
public FuseePlatformId FuseePlatformId { get; }
Property Value
Type Description
FuseePlatformId

Methods

AttacheTextureToFbo(IRenderTarget, Boolean, ITextureHandle, Int32)

Attaches a texture to the frame buffer object, associated with the given render target.

Declaration
public void AttacheTextureToFbo(IRenderTarget renderTarget, bool isDepthTex, ITextureHandle texHandle, int attachment = 0)
Parameters
Type Name Description
IRenderTarget renderTarget

The render target.

System.Boolean isDepthTex

Determines if the texture is a depth texture. In this case the texture is attached to DEPTH_ATTACHMENT.

ITextureHandle texHandle

The gpu handle of the texture.

System.Int32 attachment

Number of the fbo attachment. For example: attachment = 1 will attach the texture to COLOR_ATTACHMENT1.

BlitMultisample2DTextureToTexture(IWritableTexture, IWritableTexture)

Takes a WritableMultisampleTexture and blits the result of all samples into an existing WritableTexture for further use (e. g. bind and use as Albedo texture)

Declaration
public void BlitMultisample2DTextureToTexture(IWritableTexture input, IWritableTexture output)
Parameters
Type Name Description
IWritableTexture input

WritableMultisampleTexture

IWritableTexture output

WritableTexture

Clear(ClearFlags)

Clears the specified flags.

Declaration
public void Clear(ClearFlags flags)
Parameters
Type Name Description
ClearFlags flags

The flags.

ColorMask(Boolean, Boolean, Boolean, Boolean)

Enable or disable Color channels to be written to the frame buffer (final image). Use this function as a color channel filter for the final image.

Declaration
public void ColorMask(bool red, bool green, bool blue, bool alpha)
Parameters
Type Name Description
System.Boolean red

if set to true [red].

System.Boolean green

if set to true [green].

System.Boolean blue

if set to true [blue].

System.Boolean alpha

if set to true [alpha].

ConnectBufferToShaderStorage(IShaderHandle, IStorageBuffer, String)

Not supported?

Declaration
public void ConnectBufferToShaderStorage(IShaderHandle currentProgram, IStorageBuffer buffer, string ssboName)
Parameters
Type Name Description
IShaderHandle currentProgram
IStorageBuffer buffer
System.String ssboName
Exceptions
Type Condition
System.NotImplementedException

CreateAttributeBuffer(float3[], String)

Create one single multi-purpose attribute buffer

Declaration
public IAttribImp CreateAttributeBuffer(float3[] attributes, string attributeName)
Parameters
Type Name Description
float3[] attributes
System.String attributeName
Returns
Type Description
IAttribImp

CreateGBufferTarget(TexRes)

Generates a GBuffer target

Declaration
public IRenderTarget CreateGBufferTarget(TexRes res)
Parameters
Type Name Description
TexRes res
Returns
Type Description
IRenderTarget

CreateInstanceDataImp(IMeshImp)

Creates the instance data implementation.

Declaration
public IInstanceDataImp CreateInstanceDataImp(IMeshImp meshImp)
Parameters
Type Name Description
IMeshImp meshImp
Returns
Type Description
IInstanceDataImp

The IInstanceDataImp instance.

CreateMeshImp()

Creates the mesh implementation.

Declaration
public IMeshImp CreateMeshImp()
Returns
Type Description
IMeshImp

The IMeshImp instance.

CreateShaderProgram(String, String, String)

Creates the shader program by using a valid GLSL vertex and fragment shader code. This code is compiled at runtime. Do not use this function in frequent updates.

Declaration
public IShaderHandle CreateShaderProgram(string vs, string ps, string gs = null)
Parameters
Type Name Description
System.String vs

The vertex shader code.

System.String ps

The pixel(=fragment) shader code.

System.String gs

The vertex shader code.

Returns
Type Description
IShaderHandle

An instance of IShaderHandle.

Exceptions
Type Condition
System.ApplicationException

CreateShaderProgramCompute(String)

Creates a compute shader program. Not supported in WebGL2 ?

Declaration
public IShaderHandle CreateShaderProgramCompute(string cs = null)
Parameters
Type Name Description
System.String cs
Returns
Type Description
IShaderHandle
Exceptions
Type Condition
System.NotImplementedException

CreateTexture(ITexture)

Creates a new Texture and binds it to the shader.

Declaration
public ITextureHandle CreateTexture(ITexture img)
Parameters
Type Name Description
ITexture img

A given ImageData object, containing all necessary information for the upload to the graphics card.

Returns
Type Description
ITextureHandle

An ITextureHandle that can be used for texturing in the shader. In this implementation, the handle is an integer-value which is necessary for OpenTK.

CreateTexture(IWritableArrayTexture)

Creates an writable array texture Not supported for WebGL2 ?

Declaration
public ITextureHandle CreateTexture(IWritableArrayTexture img)
Parameters
Type Name Description
IWritableArrayTexture img
Returns
Type Description
ITextureHandle
Exceptions
Type Condition
System.NotImplementedException

CreateTexture(IWritableCubeMap)

Creates a new CubeMap and binds it to the shader.

Declaration
public ITextureHandle CreateTexture(IWritableCubeMap img)
Parameters
Type Name Description
IWritableCubeMap img

A given ImageData object, containing all necessary information for the upload to the graphics card.

Returns
Type Description
ITextureHandle

An ITextureHandle that can be used for texturing in the shader. In this implementation, the handle is an integer-value which is necessary for OpenTK.

CreateTexture(IWritableTexture)

Creates a new Texture and binds it to the shader.

Declaration
public ITextureHandle CreateTexture(IWritableTexture img)
Parameters
Type Name Description
IWritableTexture img

A given ImageData object, containing all necessary information for the upload to the graphics card.

Returns
Type Description
ITextureHandle

An ITextureHandle that can be used for texturing in the shader. In this implementation, the handle is an integer-value which is necessary for OpenTK.

DebugLine(float3, float3, float4)

Draws a Debug Line in 3D Space by using a start and end point (float3).

Declaration
public void DebugLine(float3 start, float3 end, float4 color)
Parameters
Type Name Description
float3 start

The starting point of the DebugLine.

float3 end

The endpoint of the DebugLine.

float4 color

The color of the DebugLine.

DeleteAttributeBuffer(IAttribImp)

Remove an attribute buffer previously created with CreateAttributeBuffer(float3[], String) and release all associated resources allocated on the GPU.

Declaration
public void DeleteAttributeBuffer(IAttribImp attribHandle)
Parameters
Type Name Description
IAttribImp attribHandle

The attribute handle.

DeleteFrameBuffer(IBufferHandle)

Free all allocated gpu memory that belong to a frame-buffer object.

Declaration
public void DeleteFrameBuffer(IBufferHandle bh)
Parameters
Type Name Description
IBufferHandle bh

The platform dependent abstraction of the gpu buffer handle.

DeleteRenderBuffer(IBufferHandle)

Free all allocated gpu memory that belong to a render-buffer object.

Declaration
public void DeleteRenderBuffer(IBufferHandle bh)
Parameters
Type Name Description
IBufferHandle bh

The platform dependent abstraction of the gpu buffer handle.

DeleteStorageBuffer(IBufferHandle)

Not supported?

Declaration
public void DeleteStorageBuffer(IBufferHandle storageBufferHandle)
Parameters
Type Name Description
IBufferHandle storageBufferHandle
Exceptions
Type Condition
System.NotImplementedException

DetachTextureFromFbo(IRenderTarget, RenderTargetTextureTypes)

TODO: IMPLEMENT

Declaration
public void DetachTextureFromFbo(IRenderTarget renderTarget, RenderTargetTextureTypes type)
Parameters
Type Name Description
IRenderTarget renderTarget
RenderTargetTextureTypes type

DetachTextureFromFbo(IRenderTarget, Boolean, Int32)

Detaches a texture from the frame buffer object, associated with the given render target.

Declaration
public void DetachTextureFromFbo(IRenderTarget renderTarget, bool isDepthTex, int attachment = 0)
Parameters
Type Name Description
IRenderTarget renderTarget

The render target.

System.Boolean isDepthTex

Determines if the texture is a depth texture. In this case the texture currently associated with DEPTH_ATTACHMENT will be detached.

System.Int32 attachment

Number of the fbo attachment. For example: attachment = 1 will detach the texture currently associated with COLOR_ATTACHMENT1.

DisableDepthClamp()

Disables depths clamping. EnableDepthClamp()

Declaration
public void DisableDepthClamp()

DispatchCompute(Int32, Int32, Int32, Int32)

Not supported?

Declaration
public void DispatchCompute(int kernelIndex, int threadGroupsX, int threadGroupsY, int threadGroupsZ)
Parameters
Type Name Description
System.Int32 kernelIndex
System.Int32 threadGroupsX
System.Int32 threadGroupsY
System.Int32 threadGroupsZ
Exceptions
Type Condition
System.NotImplementedException

EnableDepthClamp()

The clipping behavior against the Z position of a vertex can be turned off by activating depth clamping. This is done with glEnable(GL_DEPTH_CLAMP). This will cause the clip-space Z to remain unclipped by the front and rear viewing volume. See: https://www.khronos.org/opengl/wiki/Vertex_Post-Processing#Depth_clamping

Declaration
public void EnableDepthClamp()

GetActiveUniformsList(IShaderHandle)

Gets the shader parameter list of a specific IShaderHandle.

Declaration
public IList<IActiveUniform> GetActiveUniformsList(IShaderHandle shaderProgram)
Parameters
Type Name Description
IShaderHandle shaderProgram

The shader program.

Returns
Type Description
System.Collections.Generic.IList<IActiveUniform>

All Shader parameters of a shader program are returned.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

GetBufferContent(Rectangle, ITextureHandle)

Gets the content of the buffer.

Declaration
public void GetBufferContent(Rectangle quad, ITextureHandle texId)
Parameters
Type Name Description
Rectangle quad

The Rectangle where the content is draw into.

ITextureHandle texId

The texture identifier.

GetHardwareCapabilities(HardwareCapability)

Returns the capabilities of the underlying graphics hardware

Declaration
public uint GetHardwareCapabilities(HardwareCapability capability)
Parameters
Type Name Description
HardwareCapability capability
Returns
Type Description
System.UInt32

uint

GetHardwareDescription()

Returns a human readable description of the underlying graphics hardware. This implementation reports GL_VENDOR, GL_RENDERER, GL_VERSION and GL_EXTENSIONS.

Declaration
public string GetHardwareDescription()
Returns
Type Description
System.String

GetParamValue(IShaderHandle, IUniformHandle)

Gets the float parameter value inside a shader program by using a IUniformHandle as search reference. Do not use this function in frequent updates as it transfers information from the graphics card to the cpu which takes time.

Declaration
public float GetParamValue(IShaderHandle program, IUniformHandle param)
Parameters
Type Name Description
IShaderHandle program

The shader program.

IUniformHandle param

The parameter.

Returns
Type Description
System.Single

The current parameter's value.

GetPixelColor(Int32, Int32, Int32, Int32)

Retrieves a sub-image of the given region.

Declaration
public IImageData GetPixelColor(int x, int y, int w = 1, int h = 1)
Parameters
Type Name Description
System.Int32 x

The x value of the start of the region.

System.Int32 y

The y value of the start of the region.

System.Int32 w

The width to copy.

System.Int32 h

The height to copy.

Returns
Type Description
IImageData

The specified sub-image

GetPixelDepth(Int32, Int32)

Retrieves the Z-value at the given pixel position.

Declaration
public float GetPixelDepth(int x, int y)
Parameters
Type Name Description
System.Int32 x

The x value.

System.Int32 y

The y value.

Returns
Type Description
System.Single

The Z value at (x, y).

GetRenderState(RenderState)

Retrieves the current value for the given RenderState that is applied to the current WebGL based RenderContext.

Declaration
public uint GetRenderState(RenderState renderState)
Parameters
Type Name Description
RenderState renderState

The RenderState setting to be retrieved. See RenderState for further information.

Returns
Type Description
System.UInt32
Exceptions
Type Condition
System.ArgumentOutOfRangeException

pm;Value + ((PolygonMode)pm) + not handled or depFunc;Value + ((DepthFunction)depFunc) + not handled or renderState

GetShaderParam(IShaderHandle, String)

Gets the shader parameter. The Shader parameter is used to bind values inside of shader programs that run on the graphics card. Do not use this function in frequent updates as it transfers information from graphics card to the cpu which takes time.

Declaration
public IUniformHandle GetShaderParam(IShaderHandle shaderProgram, string paramName)
Parameters
Type Name Description
IShaderHandle shaderProgram

The shader program.

System.String paramName

Name of the parameter.

Returns
Type Description
IUniformHandle

The Shader parameter is returned if the name is found, otherwise null.

GetShaderStorageBufferList(IShaderHandle)

Returns the shader storage buffer list Not supported in WebGL2 ?

Declaration
public IList<IActiveUniform> GetShaderStorageBufferList(IShaderHandle shaderProgram)
Parameters
Type Name Description
IShaderHandle shaderProgram
Returns
Type Description
System.Collections.Generic.IList<IActiveUniform>
Exceptions
Type Condition
System.NotImplementedException

GetShaderUniformParam(IShaderHandle, String)

Returns a shader uniform parameter based on a name Not supported in WebGL2 ?

Declaration
public IUniformHandle GetShaderUniformParam(IShaderHandle shaderProgram, string paramName)
Parameters
Type Name Description
IShaderHandle shaderProgram
System.String paramName
Returns
Type Description
IUniformHandle
Exceptions
Type Condition
System.NotImplementedException

MemoryBarrier()

Defines a barrier ordering memory transactions. At the moment it will insert all supported barriers.

Declaration
public void MemoryBarrier()

ReatatchTextureFromFbo(IRenderTarget, RenderTargetTextureTypes, ITextureHandle)

TODO: IMPLEMENT

Declaration
public void ReatatchTextureFromFbo(IRenderTarget renderTarget, RenderTargetTextureTypes type, ITextureHandle texHandle)
Parameters
Type Name Description
IRenderTarget renderTarget
RenderTargetTextureTypes type
ITextureHandle texHandle

RemoveBiTangents(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveBiTangents(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveBoneIndices(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveBoneIndices(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveBoneWeights(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveBoneWeights(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveColors(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveColors(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveColors1(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveColors1(IMeshImp mesh)
Parameters
Type Name Description
IMeshImp mesh

The mesh which buffer respectively GPU memory should be deleted.

RemoveColors2(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveColors2(IMeshImp mesh)
Parameters
Type Name Description
IMeshImp mesh

The mesh which buffer respectively GPU memory should be deleted.

RemoveFlags(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveFlags(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveInstanceData(IInstanceDataImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveInstanceData(IInstanceDataImp instanceImp)
Parameters
Type Name Description
IInstanceDataImp instanceImp

The instance data whose buffers are to be deleted.

RemoveNormals(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveNormals(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveShader(IShaderHandle)

Removes shader from the GPU

Declaration
public void RemoveShader(IShaderHandle sp)
Parameters
Type Name Description
IShaderHandle sp

RemoveTangents(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveTangents(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveTextureHandle(ITextureHandle)

Free all allocated gpu memory that belong to the given ITextureHandle.

Declaration
public void RemoveTextureHandle(ITextureHandle textureHandle)
Parameters
Type Name Description
ITextureHandle textureHandle

The ITextureHandle which gpu allocated memory will be freed.

RemoveTriangles(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveTriangles(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveUVs(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveUVs(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

RemoveVertices(IMeshImp)

Deletes the buffer associated with the mesh implementation.

Declaration
public void RemoveVertices(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

The mesh which buffer respectively GPU memory should be deleted.

Render(IMeshImp, IInstanceDataImp)

Renders the specified IMeshImp.

Declaration
public void Render(IMeshImp mr, IInstanceDataImp instanceData = null)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

IInstanceDataImp instanceData

The IInstanceDataImp

Scissor(Int32, Int32, Int32, Int32)

Only pixels that lie within the scissor box can be modified by drawing commands. Note that the Scissor test must be enabled for this to work.

Declaration
public void Scissor(int x, int y, int width, int height)
Parameters
Type Name Description
System.Int32 x

X Coordinate of the lower left point of the scissor box.

System.Int32 y

Y Coordinate of the lower left point of the scissor box.

System.Int32 width

Width of the scissor box.

System.Int32 height

Height of the scissor box.

SetActiveAndBindTexture(IUniformHandle, ITextureHandle, TextureType)

Sets a texture active and binds it.

Declaration
public void SetActiveAndBindTexture(IUniformHandle param, ITextureHandle texId, TextureType texTarget)
Parameters
Type Name Description
IUniformHandle param

The shader parameter, associated with this texture.

ITextureHandle texId

The texture handle.

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

SetActiveAndBindTexture(IUniformHandle, ITextureHandle, TextureType, out Int32)

Sets a texture active and binds it.

Declaration
public void SetActiveAndBindTexture(IUniformHandle param, ITextureHandle texId, TextureType texTarget, out int texUnit)
Parameters
Type Name Description
IUniformHandle param

The shader parameter, associated with this texture.

ITextureHandle texId

The texture handle.

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

System.Int32 texUnit

The texture unit.

SetActiveAndBindTextureArray(IUniformHandle, ITextureHandle[], TextureType)

Sets a given Shader Parameter to a created texture

Declaration
public void SetActiveAndBindTextureArray(IUniformHandle param, ITextureHandle[] texIds, TextureType texTarget)
Parameters
Type Name Description
IUniformHandle param

Shader Parameter used for texture binding

ITextureHandle[] texIds

An array of ITextureHandles returned from CreateTexture method or the ShaderEffectManager.

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

SetActiveAndBindTextureArray(IUniformHandle, ITextureHandle[], TextureType, out Int32[])

Sets a texture active and binds it.

Declaration
public void SetActiveAndBindTextureArray(IUniformHandle param, ITextureHandle[] texIds, TextureType texTarget, out int[] texUnitArray)
Parameters
Type Name Description
IUniformHandle param

The shader parameter, associated with this texture.

ITextureHandle[] texIds

An array of ITextureHandles returned from CreateTexture method or the ShaderEffectManager.

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

System.Int32[] texUnitArray

The texture units.

SetBiTangents(IMeshImp, ReadOnlySpan<float3>)

Binds the bitangents onto the GL render context and assigns an BiTangentBuffer index to the passed IMeshImp instance.

Declaration
public void SetBiTangents(IMeshImp mr, ReadOnlySpan<float3> bitangents)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float3> bitangents

The BiTangents.

Exceptions
Type Condition
System.ArgumentException

BiTangents must not be null or empty

System.ApplicationException

SetBoneIndices(IMeshImp, ReadOnlySpan<float4>)

Binds the bone indices onto the GL render context and assigns an BondeIndexBuffer index to the passed IMeshImp instance.

Declaration
public void SetBoneIndices(IMeshImp mr, ReadOnlySpan<float4> boneIndices)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float4> boneIndices

The bone indices.

Exceptions
Type Condition
System.ArgumentException

BoneIndices must not be null or empty

System.ApplicationException

SetBoneWeights(IMeshImp, ReadOnlySpan<float4>)

Binds the bone weights onto the GL render context and assigns an BondeWeightBuffer index to the passed IMeshImp instance.

Declaration
public void SetBoneWeights(IMeshImp mr, ReadOnlySpan<float4> boneWeights)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float4> boneWeights

The bone weights.

Exceptions
Type Condition
System.ArgumentException

BoneWeights must not be null or empty

System.ApplicationException

SetColors(IMeshImp, ReadOnlySpan<UInt32>)

Binds the colors onto the GL render context and assigns an ColorBuffer index to the passed IMeshImp instance.

Declaration
public void SetColors(IMeshImp mr, ReadOnlySpan<uint> colors)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<System.UInt32> colors

The colors.

Exceptions
Type Condition
System.ArgumentException

colors must not be null or empty

System.ApplicationException

SetColors1(IMeshImp, ReadOnlySpan<UInt32>)

Binds the second set of colors onto the GL render context and assigns an ColorBuffer index to the passed IMeshImp instance.

Declaration
public void SetColors1(IMeshImp mr, ReadOnlySpan<uint> colors)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<System.UInt32> colors

The colors.

Exceptions
Type Condition
System.ArgumentException

colors must not be null or empty

System.ApplicationException

SetColors2(IMeshImp, ReadOnlySpan<UInt32>)

Binds the third set of colors onto the GL render context and assigns an ColorBuffer index to the passed IMeshImp instance.

Declaration
public void SetColors2(IMeshImp mr, ReadOnlySpan<uint> colors)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<System.UInt32> colors

The colors.

Exceptions
Type Condition
System.ArgumentException

colors must not be null or empty

System.ApplicationException

SetFlags(IMeshImp, ReadOnlySpan<UInt32>)

Binds the lags onto the GL render context and assigns an buffer index to the passed IMeshImp instance.

Declaration
public void SetFlags(IMeshImp mr, ReadOnlySpan<uint> flags)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<System.UInt32> flags

The flags.

Exceptions
Type Condition
System.ArgumentException

colors must not be null or empty

System.ApplicationException

SetInstanceColor(IInstanceDataImp, float4[])

Creates or updates the instance color buffer..

Declaration
public void SetInstanceColor(IInstanceDataImp instanceImp, float4[] instanceColors)
Parameters
Type Name Description
IInstanceDataImp instanceImp

The Fusee.Engine.Imp.Graphics.Blazor.InstanceDataImp.

float4[] instanceColors

The colors of the instances.

SetInstanceTransform(IInstanceDataImp, float3[], float3[], float3[])

Creates or updates the instance transform buffer. Positions, scales and rotations become the instance model matrices.

Declaration
public void SetInstanceTransform(IInstanceDataImp instanceImp, float3[] instancePositions, float3[] instanceRotations, float3[] instanceScales)
Parameters
Type Name Description
IInstanceDataImp instanceImp

The Fusee.Engine.Imp.Graphics.Blazor.InstanceDataImp.

float3[] instancePositions

The positions of the instances.

float3[] instanceRotations

The rotations of the instances.

float3[] instanceScales

The scales of the instances.

SetLineWidth(Single)

Set the width of line primitives.

Declaration
public void SetLineWidth(float width)
Parameters
Type Name Description
System.Single width

SetNormals(IMeshImp, ReadOnlySpan<float3>)

Binds the normals onto the GL render context and assigns an NormalBuffer index to the passed IMeshImp instance.

Declaration
public void SetNormals(IMeshImp mr, ReadOnlySpan<float3> normals)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float3> normals

The normals.

Exceptions
Type Condition
System.ArgumentException

Normals must not be null or empty

System.ApplicationException

SetRenderState(RenderState, UInt32)

Sets the RenderState object onto the current OpenGL based RenderContext.

Declaration
public void SetRenderState(RenderState renderState, uint value)
Parameters
Type Name Description
RenderState renderState

State of the render(enum).

System.UInt32 value

The value. See RenderState for detailed information.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

value or value or value or renderState

SetRenderTarget(IRenderTarget, ITextureHandle[])

Renders into the given textures of the RenderTarget.

Declaration
public void SetRenderTarget(IRenderTarget renderTarget, ITextureHandle[] texHandles)
Parameters
Type Name Description
IRenderTarget renderTarget

The render target.

ITextureHandle[] texHandles

The texture handles, associated with the given textures. Each handle should be created by the TextureManager in the RenderContext.

SetRenderTarget(IWritableArrayTexture, Int32, ITextureHandle)

Sets an IWritableArrayTexture as render target Not supported in WebGL2 ?

Declaration
public void SetRenderTarget(IWritableArrayTexture tex, int layer, ITextureHandle texHandle)
Parameters
Type Name Description
IWritableArrayTexture tex
System.Int32 layer
ITextureHandle texHandle
Exceptions
Type Condition
System.NotImplementedException

SetRenderTarget(IWritableCubeMap, ITextureHandle)

Renders into the given cube map.

Declaration
public void SetRenderTarget(IWritableCubeMap tex, ITextureHandle texHandle)
Parameters
Type Name Description
IWritableCubeMap tex

The texture.

ITextureHandle texHandle

The texture handle, associated with the given cube map. Should be created by the TextureManager in the RenderContext.

SetRenderTarget(IWritableTexture, ITextureHandle)

Renders into the given texture.

Declaration
public void SetRenderTarget(IWritableTexture tex, ITextureHandle texHandle)
Parameters
Type Name Description
IWritableTexture tex

The texture.

ITextureHandle texHandle

The texture handle, associated with the given texture. Should be created by the TextureManager in the RenderContext.

SetShader(IShaderHandle)

Sets the shader program onto the GL render context.

Declaration
public void SetShader(IShaderHandle program)
Parameters
Type Name Description
IShaderHandle program

The shader program.

SetShaderParam(IUniformHandle, float2)

Sets a float2 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float2 val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float2 val

The value.

SetShaderParam(IUniformHandle, float2[])

Sets a float2 array as shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float2[] val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float2[] val

The value.

SetShaderParam(IUniformHandle, float3)

Sets a float3 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float3 val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float3 val

The value.

SetShaderParam(IUniformHandle, float3[])

Sets a float3 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float3[] val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float3[] val

The value.

SetShaderParam(IUniformHandle, float4)

Sets a float4 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float4 val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float4 val

The value.

SetShaderParam(IUniformHandle, float4[])

Sets a float4 array shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float4[] val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float4[] val

The value.

SetShaderParam(IUniformHandle, float4x4)

Sets a float4x4 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float4x4 val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float4x4 val

The value.

SetShaderParam(IUniformHandle, float4x4[])

Sets a float4x4 array shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float4x4[] val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

float4x4[] val

The value.

SetShaderParam(IUniformHandle, int2)

Sets a int2 shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, int2 val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

int2 val

The value.

SetShaderParam(IUniformHandle, Double)

Sets the shader parameter, casts to float first.

Declaration
public void SetShaderParam(IUniformHandle param, double val)
Parameters
Type Name Description
IUniformHandle param
System.Double val
Exceptions
Type Condition
System.NotImplementedException

SetShaderParam(IUniformHandle, Int32)

Sets a int shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, int val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

System.Int32 val

The value.

SetShaderParam(IUniformHandle, Single)

Sets a float shader parameter.

Declaration
public void SetShaderParam(IUniformHandle param, float val)
Parameters
Type Name Description
IUniformHandle param

The parameter.

System.Single val

The value.

SetShaderParamImage(IUniformHandle, ITextureHandle, TextureType, ImagePixelFormat)

Sets an shader parameter to an image.

Declaration
public void SetShaderParamImage(IUniformHandle param, ITextureHandle texId, TextureType texTarget, ImagePixelFormat format)
Parameters
Type Name Description
IUniformHandle param
ITextureHandle texId
TextureType texTarget
ImagePixelFormat format
Exceptions
Type Condition
System.NotImplementedException

SetShaderParamTexture(IUniformHandle, ITextureHandle, TextureType)

Sets a given Shader Parameter to a created texture

Declaration
public void SetShaderParamTexture(IUniformHandle param, ITextureHandle texId, TextureType texTarget)
Parameters
Type Name Description
IUniformHandle param

Shader Parameter used for texture binding

ITextureHandle texId

An ITextureHandle probably returned from CreateTexture method

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

SetShaderParamTextureArray(IUniformHandle, ITextureHandle[], TextureType)

Sets a given Shader Parameter to a created texture

Declaration
public void SetShaderParamTextureArray(IUniformHandle param, ITextureHandle[] texIds, TextureType texTarget)
Parameters
Type Name Description
IUniformHandle param

Shader Parameter used for texture binding

ITextureHandle[] texIds

An array of ITextureHandles probably returned from CreateTexture method

TextureType texTarget

The texture type, describing to which texture target the texture gets bound to.

SetTangents(IMeshImp, ReadOnlySpan<float4>)

Binds the tangents onto the GL render context and assigns an TangentBuffer index to the passed IMeshImp instance.

Declaration
public void SetTangents(IMeshImp mr, ReadOnlySpan<float4> tangents)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float4> tangents

The tangents.

Exceptions
Type Condition
System.ArgumentException

Tangents must not be null or empty

System.ApplicationException

SetTextureFilterMode(ITextureHandle, TextureFilterMode)

Sets the texture filter mode

Declaration
public void SetTextureFilterMode(ITextureHandle tex, TextureFilterMode filterMode)
Parameters
Type Name Description
ITextureHandle tex
TextureFilterMode filterMode

SetTextureWrapMode(ITextureHandle, TextureWrapMode)

Sets the texture wrapping mode

Declaration
public void SetTextureWrapMode(ITextureHandle tex, TextureWrapMode wrapMode)
Parameters
Type Name Description
ITextureHandle tex
TextureWrapMode wrapMode

SetTriangles(IMeshImp, ReadOnlySpan<UInt32>)

Binds the triangles onto the GL render context and assigns an ElementBuffer index to the passed IMeshImp instance.

Declaration
public void SetTriangles(IMeshImp mr, ReadOnlySpan<uint> triangleIndices)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<System.UInt32> triangleIndices

The triangle indices.

Exceptions
Type Condition
System.ArgumentException

triangleIndices must not be null or empty

System.ApplicationException

SetUVs(IMeshImp, ReadOnlySpan<float2>)

Binds the UV coordinates onto the GL render context and assigns an UVBuffer index to the passed IMeshImp instance.

Declaration
public void SetUVs(IMeshImp mr, ReadOnlySpan<float2> uvs)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float2> uvs

The UV's.

Exceptions
Type Condition
System.ArgumentException

UVs must not be null or empty

System.ApplicationException

SetVertexArrayObject(IMeshImp)

Sets the vertex array object

Declaration
public void SetVertexArrayObject(IMeshImp mr)
Parameters
Type Name Description
IMeshImp mr

SetVertices(IMeshImp, ReadOnlySpan<float3>)

Binds the vertices onto the GL render context and assigns an VertexBuffer index to the passed IMeshImp instance.

Declaration
public void SetVertices(IMeshImp mr, ReadOnlySpan<float3> vertices)
Parameters
Type Name Description
IMeshImp mr

The IMeshImp instance.

System.ReadOnlySpan<float3> vertices

The vertices.

Exceptions
Type Condition
System.ArgumentException

Vertices must not be null or empty

System.ApplicationException

StorageBufferSetData<T>(IStorageBuffer, T[])

Not supported?

Declaration
public void StorageBufferSetData<T>(IStorageBuffer storageBuffer, T[] data)
    where T : struct
Parameters
Type Name Description
IStorageBuffer storageBuffer
T[] data
Type Parameters
Name Description
T
Exceptions
Type Condition
System.NotImplementedException

UpdateTextureRegion(ITextureHandle, ITexture, Int32, Int32, Int32, Int32)

Updates a specific rectangle of a texture.

Declaration
public void UpdateTextureRegion(ITextureHandle tex, ITexture img, int startX, int startY, int width, int height)
Parameters
Type Name Description
ITextureHandle tex

The texture to which the ImageData is bound to.

ITexture img

The ImageData struct containing information about the image.

System.Int32 startX

The x-value of the upper left corner of th rectangle.

System.Int32 startY

The y-value of the upper left corner of th rectangle.

System.Int32 width

The width of the rectangle.

System.Int32 height

The height of the rectangle.

Remarks

/// Look at the VideoTextureExample for further information.

Viewport(Int32, Int32, Int32, Int32)

Set the Viewport of the rendering output window by x,y position and width,height parameters. The Viewport is the portion of the final image window.

Declaration
public void Viewport(int x, int y, int width, int height)
Parameters
Type Name Description
System.Int32 x

The x.

System.Int32 y

The y.

System.Int32 width

The width.

System.Int32 height

The height.

Implements

IRenderContextImp
Generated by DocFX
GitHub Repo
Back to top