IMeshSceneNode.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 __I_MESH_SCENE_NODE_H_INCLUDED__
  5. #define __I_MESH_SCENE_NODE_H_INCLUDED__
  6. #include "ISceneNode.h"
  7. namespace irr
  8. {
  9. namespace scene
  10. {
  11. class IShadowVolumeSceneNode;
  12. class IMesh;
  13. //! A scene node displaying a static mesh
  14. class IMeshSceneNode : public ISceneNode
  15. {
  16. public:
  17. //! Constructor
  18. /** Use setMesh() to set the mesh to display.
  19. */
  20. IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
  21. const core::vector3df& position = core::vector3df(0,0,0),
  22. const core::vector3df& rotation = core::vector3df(0,0,0),
  23. const core::vector3df& scale = core::vector3df(1,1,1))
  24. : ISceneNode(parent, mgr, id, position, rotation, scale) {}
  25. //! Sets a new mesh to display
  26. /** \param mesh Mesh to display. */
  27. virtual void setMesh(IMesh* mesh) = 0;
  28. //! Get the currently defined mesh for display.
  29. /** \return Pointer to mesh which is displayed by this node. */
  30. virtual IMesh* getMesh(void) = 0;
  31. /** The shadow can be rendered using the ZPass or the zfail
  32. method. ZPass is a little bit faster because the shadow volume
  33. creation is easier, but with this method there occur ugly
  34. looking artifacts when the camera is inside the shadow volume.
  35. These error do not occur with the ZFail method, but it can
  36. have trouble with clipping to the far-plane (it usually works
  37. well in OpenGL and fails with other drivers).
  38. \param shadowMesh: Optional custom mesh for shadow volume.
  39. \param id: Id of the shadow scene node. This id can be used to
  40. identify the node later.
  41. \param zfailmethod: If set to true, the shadow will use the
  42. zfail method, if not, zpass is used.
  43. \param infinity: Value used by the shadow volume algorithm to
  44. scale the shadow volume. For zfail shadow volumes on some drivers
  45. only suppport finite shadows, so camera zfar must be larger than
  46. shadow back cap,which is depending on the infinity parameter).
  47. Infinity value also scales by the scaling factors of the model.
  48. If shadows don't show up with zfail then try reducing infinity.
  49. If shadows are cut-off then try increasing infinity.
  50. \return Pointer to the created shadow scene node. This pointer
  51. should not be dropped. See IReferenceCounted::drop() for more
  52. information. */
  53. virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh=0,
  54. s32 id=-1, bool zfailmethod=true, f32 infinity=1000.0f) = 0;
  55. //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
  56. /** In this way it is possible to change the materials of a mesh
  57. causing all mesh scene nodes referencing this mesh to change, too.
  58. \param readonly Flag if the materials shall be read-only. */
  59. virtual void setReadOnlyMaterials(bool readonly) = 0;
  60. //! Check if the scene node should not copy the materials of the mesh but use them in a read only style
  61. /** This flag can be set by setReadOnlyMaterials().
  62. \return Whether the materials are read-only. */
  63. virtual bool isReadOnlyMaterials() const = 0;
  64. };
  65. } // end namespace scene
  66. } // end namespace irr
  67. #endif