IOctreeSceneNode.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_OCTREE_SCENE_NODE_H_INCLUDED
  5. #define IRR_I_OCTREE_SCENE_NODE_H_INCLUDED
  6. #include "IMeshSceneNode.h"
  7. namespace irr
  8. {
  9. namespace scene
  10. {
  11. //! Settings if/how octree scene nodes are using hardware mesh-buffers
  12. /** VBO = Vertex buffer object = meshbuffers bound on the graphic-card instead of uploaded each frame.
  13. It can not be generally said which mode is optimal for drawing as this depends
  14. on the scene. So you have to try and experiment for your meshes which one works best.
  15. */
  16. enum EOCTREENODE_VBO
  17. {
  18. //! No VBO's used. Vertices+indices send to graphic-card on each render.
  19. EOV_NO_VBO,
  20. //! VBO's used. Draw the complete meshbuffers if any polygon in it is visible.
  21. //! This allows VBO's for the meshbuffers to be completely static, but basically means
  22. //! the octree is not used as an octree (not it still does do all the octree calculations)
  23. //! Might work in very specific cases, but if this is gives you the best fastest results
  24. //! you should probably compare as well to simply using a static mesh with no octree at all.
  25. //! In most cases the other 2 options should work better with an octree.
  26. EOV_USE_VBO,
  27. //! VBO's used. The index-buffer information is updated each frame
  28. //! with only the visible parts of a tree-node.
  29. //! So the vertex-buffer is static and the index-buffer is dynamic.
  30. //! This is the default
  31. EOV_USE_VBO_WITH_VISIBITLY
  32. };
  33. //! Kind of checks polygons of the octree scene nodes use against camera
  34. enum EOCTREE_POLYGON_CHECKS
  35. {
  36. //! Check against box of the camera frustum
  37. //! This is the default
  38. EOPC_BOX,
  39. //! against the camera frustum
  40. EOPC_FRUSTUM
  41. };
  42. //! A scene node displaying a static mesh
  43. class IOctreeSceneNode : public irr::scene::IMeshSceneNode
  44. {
  45. public:
  46. //! Constructor
  47. /** Use setMesh() to set the mesh to display.
  48. */
  49. IOctreeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
  50. const core::vector3df& position = core::vector3df(0,0,0),
  51. const core::vector3df& rotation = core::vector3df(0,0,0),
  52. const core::vector3df& scale = core::vector3df(1,1,1))
  53. : IMeshSceneNode(parent, mgr, id, position, rotation, scale) {}
  54. //! Get if/how vertex buffer object are used for the meshbuffers
  55. // NOTE: Will currently _always_ return EOV_NO_VBO.
  56. // Octree's with VBO's don't work yet correctly.
  57. virtual EOCTREENODE_VBO getUseVBO() const = 0;
  58. //! Set the kind of tests polygons do for visibility against the camera
  59. virtual void setPolygonChecks(EOCTREE_POLYGON_CHECKS checks) = 0;
  60. //! Get the kind of tests polygons do for visibility against the camera
  61. virtual EOCTREE_POLYGON_CHECKS getPolygonChecks() const = 0;
  62. };
  63. } // end namespace scene
  64. } // end namespace irr
  65. #endif