Guest User

Untitled

a guest
Jun 25th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1.         private void AddLight(SpotLight spotLight)
  2.         {
  3.             device.SetRenderTarget(shadingTarget);
  4.             device.BlendState = BlendState.Additive;
  5.             effect2Lights.CurrentTechnique = effect2Lights.Techniques["DeferredSpotLight"];
  6.             effect2Lights.Parameters["xNormalMap"].SetValue(normalMap);
  7.             effect2Lights.Parameters["xDepthMap"].SetValue(depthMap);
  8.             effect2Lights.Parameters["xShadowMap"].SetValue(shadowMap);
  9.  
  10.             effect2Lights.Parameters["xLightPosition"].SetValue(spotLight.Position);
  11.             effect2Lights.Parameters["xLightStrength"].SetValue(spotLight.Strength);
  12.             effect2Lights.Parameters["xConeDirection"].SetValue(spotLight.Direction);
  13.             effect2Lights.Parameters["xConeAngle"].SetValue(spotLight.ConeAngle);
  14.             effect2Lights.Parameters["xConeDecay"].SetValue(spotLight.ConeDecay);
  15.  
  16.             Matrix viewProjInv = Matrix.Invert(fpsCam.ViewMatrix * fpsCam.ProjectionMatrix);
  17.             effect2Lights.Parameters["xViewProjectionInv"].SetValue(viewProjInv);
  18.             effect2Lights.Parameters["xLightViewProjection"].SetValue(spotLight.ViewMatrix * spotLight.ProjectionMatrix);
  19.  
  20.             foreach (EffectPass pass in effect2Lights.CurrentTechnique.Passes)
  21.             {
  22.                 pass.Apply();
  23.                 device.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, fsVertices, 0, 2);
  24.             }
  25.             device.SetRenderTarget(null);          
  26.         }
Add Comment
Please, Sign In to add comment