I3DRenderUtilities

interface I3DRenderUtilities

The 3DRenderUtilities interface.

Vector2 MeasureText(IRenderContext context, string text, Protogame.IAssetReference<FontAsset> font)

Measures text as if it was rendered with the font asset.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • text (string) – The text to render.
  • font (Protogame.IAssetReference<FontAsset>) – The font to use for rendering.
Returns:

The T:Microsoft.Xna.Framework.Vector2.

void RenderLine(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, Color color)

Renders a 3D line.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • start (Microsoft.Xna.Framework.Vector3) – The start of the line.
  • end (Microsoft.Xna.Framework.Vector3) – The end of the line.
  • color (Microsoft.Xna.Framework.Color) – The color of the line.
void RenderLine(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, Protogame.TextureAsset texture, Vector2 startUV, Vector2 endUV)

Renders a 3D line using texture UVs.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • start (Microsoft.Xna.Framework.Vector3) – The start of the line.
  • end (Microsoft.Xna.Framework.Vector3) – The end of the line.
  • texture (Protogame.TextureAsset) – The texture to use.
  • startUV (Microsoft.Xna.Framework.Vector2) – The UV for the start of the line.
  • endUV (Microsoft.Xna.Framework.Vector2) – The UV for the end of the line.
void RenderRectangle(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Vector3 start, Vector3 end, Color color, bool filled)

Renders a rectangle.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • start (Microsoft.Xna.Framework.Vector3) – The top, left, position of the rectangle.
  • end (Microsoft.Xna.Framework.Vector3) – The bottom, right position of the rectangle.
  • color (Microsoft.Xna.Framework.Color) – The color of the rectangle.
  • filled (bool) – If set to true, the rectangle is rendered filled.
void RenderText(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix matrix, string text, Protogame.IAssetReference<FontAsset> font, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, System.Nullable<Color> textColor, bool renderShadow, System.Nullable<Color> shadowColor)

Renders text at the specified position.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • matrix (Microsoft.Xna.Framework.Matrix) – The matrix.
  • text (string) – The text to render.
  • font (Protogame.IAssetReference<FontAsset>) – The font to use for rendering.
  • horizontalAlignment (Protogame.HorizontalAlignment) – The horizontal alignment of the text (defaults to Left).
  • verticalAlignment (Protogame.VerticalAlignment) – The vertical alignment of the text (defaults to Top).
  • textColor (System.Nullable<Color>) – The text color (defaults to white).
  • renderShadow (bool) – Whether to render a shadow on the text (defaults to true).
  • shadowColor (System.Nullable<Color>) – The text shadow’s color (defaults to black).
void RenderTexture(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix matrix, Protogame.IAssetReference<TextureAsset> texture, System.Nullable<Color> color, bool flipHorizontally, bool flipVertically, System.Nullable<Rectangle> sourceArea)

Renders a texture at the specified position.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • matrix (Microsoft.Xna.Framework.Matrix) – The matrix.
  • texture (Protogame.IAssetReference<TextureAsset>) – The texture.
  • color (System.Nullable<Color>) – The colorization to apply to the texture.
  • flipHorizontally (bool) – If set to true the texture is flipped horizontally.
  • flipVertically (bool) – If set to true the texture is flipped vertically.
  • sourceArea (System.Nullable<Rectangle>) – The source Area.
void RenderCube(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix transform, Color color)

Renders a 3D cube from 0, 0, 0 to 1, 1, 1, applying the specified transformation.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • transform (Microsoft.Xna.Framework.Matrix) – The transformation to apply.
  • color (Microsoft.Xna.Framework.Color) – The color of the cube.
void RenderCube(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix transform, Protogame.TextureAsset texture, Vector2 topLeftUV, Vector2 bottomRightUV)

Renders a 3D cube from 0, 0, 0 to 1, 1, 1, applying the specified transformation, with the given texture and using the specified UV coordinates for each face of the cube.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • transform (Microsoft.Xna.Framework.Matrix) – The transformation to apply.
  • texture (Protogame.TextureAsset) – The texture to render on the cube.
  • topLeftUV (Microsoft.Xna.Framework.Vector2) – The top-left UV coordinate.
  • bottomRightUV (Microsoft.Xna.Framework.Vector2) – The bottom-right UV coordinate.
void RenderPlane(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix transform, Color color)

Renders a 2D plane from 0, 0 to 1, 1, applying the specified transformation.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • transform (Microsoft.Xna.Framework.Matrix) – The transformation to apply.
  • color (Microsoft.Xna.Framework.Color) – The color of the plane.
void RenderPlane(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix transform, Protogame.TextureAsset texture, Vector2 topLeftUV, Vector2 bottomRightUV)

Renders a 2D plane from 0, 0 to 1, 1, applying the specified transformation.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • transform (Microsoft.Xna.Framework.Matrix) – The transformation to apply.
  • texture (Protogame.TextureAsset) – The texture to render on the plane.
  • topLeftUV (Microsoft.Xna.Framework.Vector2) – The top-left UV coordinate.
  • bottomRightUV (Microsoft.Xna.Framework.Vector2) – The bottom-right UV coordinate.
void RenderCircle(IRenderContext context, Protogame.IEffect effect, Protogame.IEffectParameterSet effectParameterSet, Matrix matrix, Vector2 center, int radius, Color color, bool filled)

Renders a circle.

Parameters:
  • context (Protogame.IRenderContext) – The rendering context.
  • effect (Protogame.IEffect) –
  • effectParameterSet (Protogame.IEffectParameterSet) –
  • matrix (Microsoft.Xna.Framework.Matrix) –
  • center (Microsoft.Xna.Framework.Vector2) – The center of the circle.
  • radius (int) – The radius of the circle.
  • color (Microsoft.Xna.Framework.Color) – The color of the circle.
  • filled (bool) – If set to true, the circle is rendered filled.