world_3d.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**************************************************************************/
  2. /* world_3d.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef WORLD_3D_H
  31. #define WORLD_3D_H
  32. #include "core/io/resource.h"
  33. #include "scene/resources/compositor.h"
  34. #include "scene/resources/environment.h"
  35. #include "servers/physics_server_3d.h"
  36. #include "servers/rendering_server.h"
  37. class CameraAttributes;
  38. class Camera3D;
  39. class VisibleOnScreenNotifier3D;
  40. struct SpatialIndexer;
  41. class World3D : public Resource {
  42. GDCLASS(World3D, Resource);
  43. private:
  44. RID scenario;
  45. mutable RID space;
  46. mutable RID navigation_map;
  47. Ref<Environment> environment;
  48. Ref<Environment> fallback_environment;
  49. Ref<CameraAttributes> camera_attributes;
  50. Ref<Compositor> compositor;
  51. HashSet<Camera3D *> cameras;
  52. protected:
  53. static void _bind_methods();
  54. friend class Camera3D;
  55. void _register_camera(Camera3D *p_camera);
  56. void _remove_camera(Camera3D *p_camera);
  57. public:
  58. RID get_space() const;
  59. RID get_navigation_map() const;
  60. RID get_scenario() const;
  61. void set_environment(const Ref<Environment> &p_environment);
  62. Ref<Environment> get_environment() const;
  63. void set_fallback_environment(const Ref<Environment> &p_environment);
  64. Ref<Environment> get_fallback_environment() const;
  65. void set_camera_attributes(const Ref<CameraAttributes> &p_camera_attributes);
  66. Ref<CameraAttributes> get_camera_attributes() const;
  67. void set_compositor(const Ref<Compositor> &p_compositor);
  68. Ref<Compositor> get_compositor() const;
  69. _FORCE_INLINE_ const HashSet<Camera3D *> &get_cameras() const { return cameras; }
  70. PhysicsDirectSpaceState3D *get_direct_space_state();
  71. World3D();
  72. ~World3D();
  73. };
  74. #endif // WORLD_3D_H