IMaterialRendererServices.h 2.9 KB

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