Table of Contents

Class BasicEffect

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

Built-in effect that supports optional texturing, vertex coloring, fog, and lighting.

public class BasicEffect : Effect, IDisposable, IEffectMatrices, IEffectLights, IEffectFog
Inheritance
BasicEffect
Implements
Inherited Members

Constructors

BasicEffect(BasicEffect)

Creates a new BasicEffect by cloning parameter settings from an existing instance.

protected BasicEffect(BasicEffect cloneSource)

Parameters

cloneSource BasicEffect

BasicEffect(GraphicsDevice)

Creates a new BasicEffect with default parameter settings.

public BasicEffect(GraphicsDevice device)

Parameters

device GraphicsDevice

Properties

Alpha

Gets or sets the material alpha.

public float Alpha { get; set; }

Property Value

float

AmbientLightColor

The floating point ambient light color.

public Vector3 AmbientLightColor { get; set; }

Property Value

Vector3

DiffuseColor

Gets or sets the material diffuse color (range 0 to 1).

public Vector3 DiffuseColor { get; set; }

Property Value

Vector3

DirectionalLight0

Returns the first directional light.

public DirectionalLight DirectionalLight0 { get; }

Property Value

DirectionalLight

DirectionalLight1

Returns the second directional light.

public DirectionalLight DirectionalLight1 { get; }

Property Value

DirectionalLight

DirectionalLight2

Returns the third directional light.

public DirectionalLight DirectionalLight2 { get; }

Property Value

DirectionalLight

EmissiveColor

Gets or sets the material emissive color (range 0 to 1).

public Vector3 EmissiveColor { get; set; }

Property Value

Vector3

FogColor

The floating point fog color.

public Vector3 FogColor { get; set; }

Property Value

Vector3

FogEnabled

Used to toggle the rendering of fog.

public bool FogEnabled { get; set; }

Property Value

bool

FogEnd

The world space distance from the camera at which fogging is fully applied.

public float FogEnd { get; set; }

Property Value

float

Remarks

FogEnd should be greater than FogStart. If FogEnd and FogStart are the same value everything is fully fogged.

FogStart

The world space distance from the camera at which fogging begins.

public float FogStart { get; set; }

Property Value

float

Remarks

FogStart should be less than FogEnd. If FogEnd and FogStart are the same value everything is fully fogged.

LightingEnabled

Toggles the rendering of lighting.

public bool LightingEnabled { get; set; }

Property Value

bool

PreferPerPixelLighting

Gets or sets the per-pixel lighting prefer flag.

public bool PreferPerPixelLighting { get; set; }

Property Value

bool

Projection

Gets or sets the projection matrix.

public Matrix Projection { get; set; }

Property Value

Matrix

SpecularColor

Gets or sets the material specular color (range 0 to 1).

public Vector3 SpecularColor { get; set; }

Property Value

Vector3

SpecularPower

Gets or sets the material specular power.

public float SpecularPower { get; set; }

Property Value

float

Texture

Gets or sets the current texture.

public Texture2D Texture { get; set; }

Property Value

Texture2D

TextureEnabled

Gets or sets whether texturing is enabled.

public bool TextureEnabled { get; set; }

Property Value

bool

VertexColorEnabled

Gets or sets whether vertex color is enabled.

public bool VertexColorEnabled { get; set; }

Property Value

bool

View

Gets or sets the view matrix.

public Matrix View { get; set; }

Property Value

Matrix

World

Gets or sets the world matrix.

public Matrix World { get; set; }

Property Value

Matrix

Methods

Clone()

Creates a clone of the current BasicEffect instance.

public override Effect Clone()

Returns

Effect

EnableDefaultLighting()

Initializes the lights to the standard key/fill/back lighting rig.

public void EnableDefaultLighting()

OnApply()

Lazily computes derived parameter values immediately before applying the effect.

protected override void OnApply()