IShadowVolumeSceneNode.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef IRR_I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED
  5. #define IRR_I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED
  6. #include "ISceneNode.h"
  7. namespace irr
  8. {
  9. namespace scene
  10. {
  11. class IMesh;
  12. enum ESHADOWVOLUME_OPTIMIZATION
  13. {
  14. //! Create volumes around every triangle
  15. ESV_NONE,
  16. //! Create volumes only around the silhouette of the mesh
  17. /** This can reduce the number of volumes drastically,
  18. but will have an upfront-cost where it calculates adjacency of
  19. triangles. Also it will not work with all models. Basically
  20. if you see strange black shadow lines then you have a model
  21. for which it won't work.
  22. We get that information about adjacency by comparing the positions of
  23. all edges in the mesh (even if they are in different meshbuffers). */
  24. ESV_SILHOUETTE_BY_POS
  25. };
  26. //! Scene node for rendering a shadow volume into a stencil buffer.
  27. class IShadowVolumeSceneNode : public ISceneNode
  28. {
  29. public:
  30. //! constructor
  31. IShadowVolumeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id)
  32. : ISceneNode(parent, mgr, id) {}
  33. //! Sets the mesh from which the shadow volume should be generated.
  34. /** To optimize shadow rendering, use a simpler mesh for shadows.
  35. */
  36. virtual void setShadowMesh(const IMesh* mesh) = 0;
  37. //! Updates the shadow volumes for current light positions.
  38. virtual void updateShadowVolumes() = 0;
  39. //! Set optimization used to create shadow volumes
  40. /** Default is ESV_SILHOUETTE_BY_POS. If the shadow
  41. looks bad then give ESV_NONE a try (which will be slower).
  42. Alternatively you can try to fix the model, it's often
  43. because it's not closed (aka if you'd put water in it then
  44. that would leak out). */
  45. virtual void setOptimization(ESHADOWVOLUME_OPTIMIZATION optimization) = 0;
  46. //! Get currently active optimization used to create shadow volumes
  47. virtual ESHADOWVOLUME_OPTIMIZATION getOptimization() const = 0;
  48. };
  49. } // end namespace scene
  50. } // end namespace irr
  51. #endif