Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void AddLight(SpotLight spotLight)
- {
- device.SetRenderTarget(shadingTarget);
- device.BlendState = BlendState.Additive;
- effect2Lights.CurrentTechnique = effect2Lights.Techniques["DeferredSpotLight"];
- effect2Lights.Parameters["xNormalMap"].SetValue(normalMap);
- effect2Lights.Parameters["xDepthMap"].SetValue(depthMap);
- effect2Lights.Parameters["xShadowMap"].SetValue(shadowMap);
- effect2Lights.Parameters["xLightPosition"].SetValue(spotLight.Position);
- effect2Lights.Parameters["xLightStrength"].SetValue(spotLight.Strength);
- effect2Lights.Parameters["xConeDirection"].SetValue(spotLight.Direction);
- effect2Lights.Parameters["xConeAngle"].SetValue(spotLight.ConeAngle);
- effect2Lights.Parameters["xConeDecay"].SetValue(spotLight.ConeDecay);
- Matrix viewProjInv = Matrix.Invert(fpsCam.ViewMatrix * fpsCam.ProjectionMatrix);
- effect2Lights.Parameters["xViewProjectionInv"].SetValue(viewProjInv);
- effect2Lights.Parameters["xLightViewProjection"].SetValue(spotLight.ViewMatrix * spotLight.ProjectionMatrix);
- foreach (EffectPass pass in effect2Lights.CurrentTechnique.Passes)
- {
- pass.Apply();
- device.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, fsVertices, 0, 2);
- }
- device.SetRenderTarget(null);
- }
Add Comment
Please, Sign In to add comment