DualTextureProcessor.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // DualTextureProcessor.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using Microsoft.Xna.Framework.Content.Pipeline;
  11. using Microsoft.Xna.Framework.Content.Pipeline.Processors;
  12. using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
  13. using System.Collections.Generic;
  14. #endregion
  15. namespace ContentPipelineExtension
  16. {
  17. /// <summary>
  18. /// Custom processor for building the model used in the DualTextureEffect demo.
  19. /// This code automatically applies the DualTextureEffect onto the model, and
  20. /// also sets it up to reference the correct light map overlay texture.
  21. /// </summary>
  22. [ContentProcessor]
  23. class DualTextureProcessor : ModelProcessor
  24. {
  25. protected override MaterialContent ConvertMaterial(MaterialContent material, ContentProcessorContext context)
  26. {
  27. DualTextureMaterialContent dual = new DualTextureMaterialContent();
  28. // Copy the base (diffuse) texture from the existing BasicEffect material.
  29. dual.Texture = ((BasicMaterialContent)material).Texture;
  30. // Add the second lightmap texture.
  31. dual.Texture2 = new ExternalReference<TextureContent>("lightmap.tga");
  32. return base.ConvertMaterial(dual, context);
  33. }
  34. }
  35. }