Skip to content

Commit b026da3

Browse files
committed
References MonoGameDemoTools now for loading of embedded shaders
1 parent 6707028 commit b026da3

File tree

8 files changed

+28
-14
lines changed

8 files changed

+28
-14
lines changed

BloomEffectRenderer/BloomEffectRenderer.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<HintPath>..\packages\Faders.1.1.0\lib\portable45-net45+win8+wpa81\Faders.dll</HintPath>
5858
<Private>True</Private>
5959
</Reference>
60+
<Reference Include="InputStateManager, Version=1.1.0.2, Culture=neutral, processorArchitecture=MSIL">
61+
<HintPath>..\packages\InputStateManager.1.1.0.2\lib\portable45-net45+win8+wpa81\InputStateManager.dll</HintPath>
62+
<Private>True</Private>
63+
</Reference>
6064
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
6165
<HintPath>..\packages\JetBrains.Annotations.11.1.0\lib\portable40-net40+sl5+win8+wp8+wpa81\JetBrains.Annotations.dll</HintPath>
6266
<Private>True</Private>
@@ -65,6 +69,10 @@
6569
<HintPath>..\packages\MonoGame.Framework.Portable.3.6.0.1625\lib\portable-net45+win8+wpa81\MonoGame.Framework.dll</HintPath>
6670
<Private>True</Private>
6771
</Reference>
72+
<Reference Include="MonoGameDemoTools, Version=1.1.0.5, Culture=neutral, processorArchitecture=MSIL">
73+
<HintPath>..\packages\MonoGameDemoTools.1.1.0.5\lib\portable45-net45+win8+wpa81\MonoGameDemoTools.dll</HintPath>
74+
<Private>True</Private>
75+
</Reference>
6876
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
6977
<HintPath>..\packages\NUnit.3.6.1\lib\portable-net45+win8+wp8+wpa81\nunit.framework.dll</HintPath>
7078
<Private>True</Private>

BloomEffectRenderer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
// You can specify all the values or you can default the Build and Revision Numbers
2727
// by using the '*' as shown below:
2828
// [assembly: AssemblyVersion("1.0.*")]
29-
[assembly: AssemblyVersion("1.1.0.5")]
30-
[assembly: AssemblyFileVersion("1.1.0.5")]
29+
[assembly: AssemblyVersion("1.1.0.6")]
30+
[assembly: AssemblyFileVersion("1.1.0.6")]

BloomEffectRenderer/Renderer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
// ***************************************************************************
2727

2828
using System;
29-
using BloomEffectRenderer.Effects;
3029
using JetBrains.Annotations;
3130
using Microsoft.Xna.Framework;
3231
using Microsoft.Xna.Framework.Graphics;
32+
using MonoGameDemoTools;
3333

3434
namespace BloomEffectRenderer
3535
{
@@ -41,6 +41,9 @@ public class Renderer
4141
private bool IsBloomRenderTarget1Passed { get; set; }
4242
private bool IsBloomRenderTarget2Passed { get; set; }
4343

44+
private EmbeddedEffectsManager EmbeddedEffectsManager { get; } =
45+
new EmbeddedEffectsManager(typeof(Renderer), "BloomEffectRenderer.Effects.Resources");
46+
4447
private Effect CombineEffect { get; set; }
4548
private Effect ExtractEffect { get; set; }
4649
private Effect GaussianBlurEffect { get; set; }
@@ -115,9 +118,9 @@ public void Initialize(GraphicsDevice graphicsDevice, Point resolution,
115118
/// <param name="graphicsDevice">The graphics device.</param>
116119
public void LoadContent(GraphicsDevice graphicsDevice)
117120
{
118-
ExtractEffect = new Effect(graphicsDevice, EffectResource.ExtractEffect.Bytecode);
119-
GaussianBlurEffect = new Effect(graphicsDevice, EffectResource.BlurEffect.Bytecode);
120-
CombineEffect = new Effect(graphicsDevice, EffectResource.CombineEffect.Bytecode);
121+
ExtractEffect = EmbeddedEffectsManager.Load(graphicsDevice, "BloomExtract");
122+
GaussianBlurEffect = EmbeddedEffectsManager.Load(graphicsDevice, "GaussianBlur");
123+
CombineEffect = EmbeddedEffectsManager.Load(graphicsDevice, "BloomCombine");
121124
}
122125

123126
/// <summary>
@@ -127,13 +130,12 @@ public void LoadContent(GraphicsDevice graphicsDevice)
127130
/// </summary>
128131
public void UnloadContent()
129132
{
133+
EmbeddedEffectsManager.UnloadContent();
134+
130135
if (!IsBloomRenderTarget1Passed)
131136
BloomRenderTarget1?.Dispose();
132137
if (!IsBloomRenderTarget2Passed)
133138
BloomRenderTarget2?.Dispose();
134-
ExtractEffect?.Dispose();
135-
GaussianBlurEffect?.Dispose();
136-
CombineEffect?.Dispose();
137139
}
138140

139141
/// <summary>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Faders" version="1.1.0" targetFramework="portable45-net45+win8+wpa81" />
4+
<package id="InputStateManager" version="1.1.0.2" targetFramework="portable45-net45+win8+wpa81" />
45
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="portable45-net45+win8+wpa81" />
56
<package id="MonoGame.Framework.Portable" version="3.6.0.1625" targetFramework="portable45-net45+win8+wpa81" />
7+
<package id="MonoGameDemoTools" version="1.1.0.5" targetFramework="portable45-net45+win8+wpa81" />
68
<package id="NUnit" version="3.6.1" targetFramework="portable45-net45+win8+wpa81" />
79
<package id="System.Runtime" version="4.3.0" targetFramework="portable45-net45+win8+wpa81" />
810
</packages>

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Thx to the [MonoGame.Extended](https://github.com/craftworkgames/MonoGame.Extend
4040

4141
Thx to [Jjagg](https://github.com/Jjagg) for reviewing the shaders.
4242

43+
Image by [Michael Beckwith](https://www.flickr.com/people/78207463@N04) from [Inside St Kentigerns RC Church.](https://www.flickr.com/photos/78207463@N04/8226826999/)
44+
4345

4446

4547
### Example

TestGame/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.1")]
36-
[assembly: AssemblyFileVersion("1.0.0.1")]
35+
[assembly: AssemblyVersion("1.0.0.2")]
36+
[assembly: AssemblyFileVersion("1.0.0.2")]

TestGame/TestGame.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
<HintPath>..\packages\MonoGame.Framework.DesktopGL.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
6464
<Private>True</Private>
6565
</Reference>
66-
<Reference Include="MonoGameDemoTools, Version=1.1.0.1, Culture=neutral, processorArchitecture=MSIL">
67-
<HintPath>..\packages\MonoGameDemoTools.1.1.0.1\lib\portable45-net45+win8+wpa81\MonoGameDemoTools.dll</HintPath>
66+
<Reference Include="MonoGameDemoTools, Version=1.1.0.5, Culture=neutral, processorArchitecture=MSIL">
67+
<HintPath>..\packages\MonoGameDemoTools.1.1.0.5\lib\portable45-net45+win8+wpa81\MonoGameDemoTools.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">

TestGame/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net45" />
66
<package id="MonoGame.Framework.DesktopGL" version="3.6.0.1625" targetFramework="net45" />
77
<package id="MonoGame.Framework.Portable" version="3.6.0.1625" targetFramework="net45" />
8-
<package id="MonoGameDemoTools" version="1.1.0.1" targetFramework="net45" />
8+
<package id="MonoGameDemoTools" version="1.1.0.5" targetFramework="net45" />
99
<package id="NUnit" version="3.6.1" targetFramework="net45" />
1010
<package id="System.Runtime" version="4.3.0" targetFramework="net45" />
1111
</packages>

0 commit comments

Comments
 (0)