/Irrlicht/CTRTextureGouraud.h

http://myjeh.googlecode.com/ · C++ Header · 85 lines · 52 code · 21 blank · 12 comment · 0 complexity · 4d85af4f5a22c44c42370dce0b8261ba MD5 · raw file

  1. // Copyright (C) 2002-2010 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __C_TRIANGLE_RENDERER_TEXTURE_GOURAUD_H_INCLUDED__
  5. #define __C_TRIANGLE_RENDERER_TEXTURE_GOURAUD_H_INCLUDED__
  6. #include "IrrCompileConfig.h"
  7. #ifndef _IRR_COMPILE_WITH_SOFTWARE_
  8. // forward declarations for create methods
  9. namespace irr
  10. {
  11. namespace video
  12. {
  13. class ITriangleRenderer;
  14. class IZBuffer;
  15. } // end namespace video
  16. } // end namespace irr
  17. #else
  18. #include "ITriangleRenderer.h"
  19. #include "IImage.h"
  20. namespace irr
  21. {
  22. namespace video
  23. {
  24. //! CTRTextureGouraud class
  25. class CTRTextureGouraud : public ITriangleRenderer
  26. {
  27. public:
  28. //! constructor
  29. CTRTextureGouraud(IZBuffer* zbuffer);
  30. //! destructor
  31. virtual ~CTRTextureGouraud();
  32. //! sets a render target
  33. virtual void setRenderTarget(video::IImage* surface, const core::rect<s32>& viewPort);
  34. //! draws an indexed triangle list
  35. virtual void drawIndexedTriangleList(S2DVertex* vertices, s32 vertexCount, const u16* indexList, s32 triangleCount);
  36. //! en or disables the backface culling
  37. virtual void setBackfaceCulling(bool enabled = true);
  38. //! sets the Texture
  39. virtual void setTexture(video::IImage* texture);
  40. protected:
  41. //! vertauscht zwei vertizen
  42. inline void swapVertices(const S2DVertex** v1, const S2DVertex** v2)
  43. {
  44. const S2DVertex* b = *v1;
  45. *v1 = *v2;
  46. *v2 = b;
  47. }
  48. video::IImage* RenderTarget;
  49. core::rect<s32> ViewPortRect;
  50. IZBuffer* ZBuffer;
  51. s32 SurfaceWidth;
  52. s32 SurfaceHeight;
  53. bool BackFaceCullingEnabled;
  54. TZBufferType* lockedZBuffer;
  55. u16* lockedSurface;
  56. u16* lockedTexture;
  57. s32 lockedTextureWidth;
  58. s32 textureXMask, textureYMask;
  59. video::IImage* Texture;
  60. };
  61. } // end namespace video
  62. } // end namespace irr
  63. #endif
  64. #endif