Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Most of Graphics/ cleaned up.
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Mar 24, 2014
1 parent 8c3f245 commit 9569acb
Show file tree
Hide file tree
Showing 38 changed files with 2,035 additions and 2,043 deletions.
15 changes: 8 additions & 7 deletions MonoGame.Framework/Graphics/ClearOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
*/
#endregion

#region Using Statements
using System;
#endregion

namespace Microsoft.Xna.Framework.Graphics
{
[Flags]
public enum ClearOptions
{
[Flags]
public enum ClearOptions
{
Target = 1,
DepthBuffer = 2,
Stencil = 4
}
DepthBuffer = 2,
Stencil = 4
}
}

2 changes: 2 additions & 0 deletions MonoGame.Framework/Graphics/ColorWriteChannels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/
#endregion

#region Using Statements
using System;
#endregion

namespace Microsoft.Xna.Framework.Graphics
{
Expand Down
3 changes: 0 additions & 3 deletions MonoGame.Framework/Graphics/CubeMapFace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
#endregion

using System;

namespace Microsoft.Xna.Framework.Graphics
{
public enum CubeMapFace
Expand All @@ -21,4 +19,3 @@ public enum CubeMapFace
NegativeZ
}
}

12 changes: 7 additions & 5 deletions MonoGame.Framework/Graphics/DeviceLostException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
*/
#endregion

#region Using Statements
using System;
#endregion

namespace Microsoft.Xna.Framework
{
[Serializable]
public class DeviceLostException : Exception
{
// TODO: How exactly does this behave? Also, lol, DirectX.
}
[Serializable]
public class DeviceLostException : Exception
{
// TODO: How exactly does this behave? Also, lol, DirectX.
}
}
12 changes: 7 additions & 5 deletions MonoGame.Framework/Graphics/DeviceNotResetException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
*/
#endregion

#region Using Statements
using System;
#endregion

namespace Microsoft.Xna.Framework
{
[Serializable]
public class DeviceNotResetException : Exception
{
// TODO: How exactly does this behave? Also, lol, DirectX.
}
[Serializable]
public class DeviceNotResetException : Exception
{
// TODO: How exactly does this behave? Also, lol, DirectX.
}
}
209 changes: 107 additions & 102 deletions MonoGame.Framework/Graphics/DirectionalLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,124 +15,129 @@
namespace Microsoft.Xna.Framework.Graphics
{
public sealed class DirectionalLight
{
#region Public Properties
{
#region Public Properties

public Vector3 DiffuseColor
{
get
{
return diffuseColor;
}
set
{
diffuseColor = value;
if (this.enabled && this.diffuseColorParameter != null)
diffuseColorParameter.SetValue(diffuseColor);
}
}
private Vector3 INTERNAL_diffuseColor;
public Vector3 DiffuseColor
{
get
{
return INTERNAL_diffuseColor;
}
set
{
INTERNAL_diffuseColor = value;
if (Enabled && diffuseColorParameter != null)
{
diffuseColorParameter.SetValue(INTERNAL_diffuseColor);
}
}
}

public Vector3 Direction
{
get
{
return direction;
}
set
{
direction = value;
if (this.directionParameter != null)
directionParameter.SetValue(direction);
}
}
private Vector3 INTERNAL_direction;
public Vector3 Direction
{
get
{
return INTERNAL_direction;
}
set
{
INTERNAL_direction = value;
if (directionParameter != null)
{
directionParameter.SetValue(INTERNAL_direction);
}
}
}

private Vector3 INTERNAL_specularColor;
public Vector3 SpecularColor
{
get
{
return INTERNAL_specularColor;
}
set
{
INTERNAL_specularColor = value;
if (Enabled && specularColorParameter != null)
{
specularColorParameter.SetValue(INTERNAL_specularColor);
}
}
}

public Vector3 SpecularColor
{
get
{
return specularColor;
}
set
{
specularColor = value;
if (this.enabled && this.specularColorParameter != null)
specularColorParameter.SetValue(specularColor);
}
}
public bool Enabled
{
get { return enabled; }
set
{
if (this.enabled != value)
{
this.enabled = value;
if (this.enabled)
{
if (this.diffuseColorParameter != null)
{
this.diffuseColorParameter.SetValue(this.diffuseColor);
}
if (this.specularColorParameter != null)
{
this.specularColorParameter.SetValue(this.specularColor);
}
}
else
{
if (this.diffuseColorParameter != null)
{
this.diffuseColorParameter.SetValue(Vector3.Zero);
}
if (this.specularColorParameter != null)
{
this.specularColorParameter.SetValue(Vector3.Zero);
}
}
}
private bool INTERNAL_enabled;
public bool Enabled
{
get
{
return INTERNAL_enabled;
}
set
{
if (INTERNAL_enabled != value)
{
INTERNAL_enabled = value;
if (INTERNAL_enabled)
{
if (diffuseColorParameter != null)
{
diffuseColorParameter.SetValue(DiffuseColor);
}
if (specularColorParameter != null)
{
specularColorParameter.SetValue(SpecularColor);
}
}
else
{
if (diffuseColorParameter != null)
{
diffuseColorParameter.SetValue(Vector3.Zero);
}
if (specularColorParameter != null)
{
specularColorParameter.SetValue(Vector3.Zero);
}
}
}

}
}
}
}

#endregion
#endregion

#region Internal Variables
#region Internal Variables

internal EffectParameter diffuseColorParameter;
internal EffectParameter diffuseColorParameter;
internal EffectParameter directionParameter;
internal EffectParameter specularColorParameter;

#endregion
#endregion

#region Private Variables
#region Public Constructor

Vector3 diffuseColor;
Vector3 direction;
Vector3 specularColor;
bool enabled;

#endregion

#region Public Constructor

public DirectionalLight (EffectParameter directionParameter, EffectParameter diffuseColorParameter, EffectParameter specularColorParameter, DirectionalLight cloneSource)
{
public DirectionalLight(
EffectParameter directionParameter,
EffectParameter diffuseColorParameter,
EffectParameter specularColorParameter,
DirectionalLight cloneSource
) {
this.diffuseColorParameter = diffuseColorParameter;
this.directionParameter = directionParameter;
this.specularColorParameter = specularColorParameter;
if (cloneSource != null) {
this.diffuseColor = cloneSource.diffuseColor;
this.direction = cloneSource.direction;
this.specularColor = cloneSource.specularColor;
this.enabled = cloneSource.enabled;
} else {
this.diffuseColorParameter = diffuseColorParameter;
this.directionParameter = directionParameter;
this.specularColorParameter = specularColorParameter;
if (cloneSource != null)
{
DiffuseColor = cloneSource.DiffuseColor;
Direction = cloneSource.Direction;
SpecularColor = cloneSource.SpecularColor;
Enabled = cloneSource.Enabled;
}
}

#endregion
}
#endregion
}
}

Loading

0 comments on commit 9569acb

Please sign in to comment.