1
0

IMaterialRendererServices.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (C) 2002-2012 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. #pragma once
  5. #include "SMaterial.h"
  6. namespace irr
  7. {
  8. namespace video
  9. {
  10. class IVideoDriver;
  11. //! Interface providing some methods for changing advanced, internal states of a IVideoDriver.
  12. class IMaterialRendererServices
  13. {
  14. public:
  15. //! Destructor
  16. virtual ~IMaterialRendererServices() {}
  17. //! Can be called by an IMaterialRenderer to make its work easier.
  18. /** Sets all basic renderstates if needed.
  19. Basic render states are diffuse, ambient, specular, and emissive color,
  20. specular power, bilinear and trilinear filtering, wireframe mode,
  21. grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
  22. fog enabling.
  23. \param material The new material to be used.
  24. \param lastMaterial The material used until now.
  25. \param resetAllRenderstates Set to true if all renderstates should be
  26. set, regardless of their current state. */
  27. virtual void setBasicRenderStates(const SMaterial &material,
  28. const SMaterial &lastMaterial,
  29. bool resetAllRenderstates) = 0;
  30. //! Return an index constant for the vertex shader based on a uniform variable name.
  31. virtual s32 getVertexShaderConstantID(const c8 *name) = 0;
  32. //! Sets a value for a vertex shader uniform variable.
  33. /** \param index Index of the variable (as received from getVertexShaderConstantID)
  34. \param floats Pointer to array of floats
  35. \param count Amount of floats in array.
  36. \return True if successful.
  37. */
  38. virtual bool setVertexShaderConstant(s32 index, const f32 *floats, int count) = 0;
  39. //! Int interface for the above.
  40. virtual bool setVertexShaderConstant(s32 index, const s32 *ints, int count) = 0;
  41. //! Uint interface for the above.
  42. virtual bool setVertexShaderConstant(s32 index, const u32 *ints, int count) = 0;
  43. //! Return an index constant for the pixel shader for the given uniform variable name
  44. virtual s32 getPixelShaderConstantID(const c8 *name) = 0;
  45. //! Sets a value for the given pixel shader uniform variable
  46. /** This can be used if you used a high level shader language like GLSL
  47. or HLSL to create a shader. See setVertexShaderConstant() for an
  48. example on how to use this.
  49. \param index Index of the variable (as received from getPixelShaderConstantID)
  50. \param floats Pointer to array of floats
  51. \param count Amount of floats in array.
  52. \return True if successful. */
  53. virtual bool setPixelShaderConstant(s32 index, const f32 *floats, int count) = 0;
  54. //! Int interface for the above.
  55. virtual bool setPixelShaderConstant(s32 index, const s32 *ints, int count) = 0;
  56. //! Uint interface for the above.
  57. virtual bool setPixelShaderConstant(s32 index, const u32 *ints, int count) = 0;
  58. //! Get pointer to the IVideoDriver interface
  59. /** \return Pointer to the IVideoDriver interface */
  60. virtual IVideoDriver *getVideoDriver() = 0;
  61. };
  62. } // end namespace video
  63. } // end namespace irr