| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  | using Microsoft.Xna.Framework; | 
					
						
							|  |  |  | using Microsoft.Xna.Framework.Graphics; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Kav | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public class Deferred_ToonEffect : Effect | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         EffectParameter gPositionParam; | 
					
						
							|  |  |  |         EffectParameter gAlbedoParam; | 
					
						
							|  |  |  |         EffectParameter gNormalParam; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         EffectParameter eyePositionParam; | 
					
						
							|  |  |  |         EffectParameter directionalLightDirectionParam; | 
					
						
							| 
									
										
										
										
											2020-10-02 05:26:40 +00:00
										 |  |  |         EffectParameter directionalLightColorParam; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         EffectParameter softnessParam; | 
					
						
							| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         public Texture2D GPosition { get; set; } | 
					
						
							|  |  |  |         public Texture2D GAlbedo { get; set; } | 
					
						
							|  |  |  |         public Texture2D GNormal { get; set; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public Vector3 EyePosition { get; set; } | 
					
						
							|  |  |  |         public Vector3 DirectionalLightDirection { get; set; } | 
					
						
							| 
									
										
										
										
											2020-10-02 05:26:40 +00:00
										 |  |  |         public Vector3 DirectionalLightColor { get; set; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public float Softness { get; set; } | 
					
						
							| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         public Deferred_ToonEffect(GraphicsDevice graphicsDevice) : base(graphicsDevice, Resources.Deferred_ToonEffect) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             CacheEffectParameters();    | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         protected override void OnApply() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             gPositionParam.SetValue(GPosition); | 
					
						
							|  |  |  |             gAlbedoParam.SetValue(GAlbedo); | 
					
						
							|  |  |  |             gNormalParam.SetValue(GNormal); | 
					
						
							| 
									
										
										
										
											2020-10-02 05:26:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  |             eyePositionParam.SetValue(EyePosition); | 
					
						
							|  |  |  |             directionalLightDirectionParam.SetValue(DirectionalLightDirection); | 
					
						
							| 
									
										
										
										
											2020-10-02 05:26:40 +00:00
										 |  |  |             directionalLightColorParam.SetValue(DirectionalLightColor); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             softnessParam.SetValue(Softness); | 
					
						
							| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         void CacheEffectParameters() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             gPositionParam                 = Parameters["gPosition"]; | 
					
						
							|  |  |  |             gAlbedoParam                   = Parameters["gAlbedo"]; | 
					
						
							|  |  |  |             gNormalParam                   = Parameters["gNormal"]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             eyePositionParam               = Parameters["EyePosition"]; | 
					
						
							|  |  |  |             directionalLightDirectionParam = Parameters["DirectionalLightDirection"]; | 
					
						
							| 
									
										
										
										
											2020-10-02 05:26:40 +00:00
										 |  |  |             directionalLightColorParam     = Parameters["DirectionalLightColor"]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             softnessParam                  = Parameters["Softness"]; | 
					
						
							| 
									
										
										
										
											2020-10-01 21:52:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |