reflection_probe.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*************************************************************************/
  2. /* reflection_probe.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  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 REFLECTIONPROBE_H
  31. #define REFLECTIONPROBE_H
  32. #include "scene/3d/visual_instance.h"
  33. #include "scene/resources/sky_box.h"
  34. #include "scene/resources/texture.h"
  35. #include "servers/visual_server.h"
  36. class ReflectionProbe : public VisualInstance {
  37. GDCLASS(ReflectionProbe, VisualInstance);
  38. public:
  39. enum UpdateMode {
  40. UPDATE_ONCE,
  41. UPDATE_ALWAYS,
  42. };
  43. private:
  44. RID probe;
  45. float intensity;
  46. float max_distance;
  47. Vector3 extents;
  48. Vector3 origin_offset;
  49. bool box_projection;
  50. bool enable_shadows;
  51. bool interior;
  52. Color interior_ambient;
  53. float interior_ambient_energy;
  54. float interior_ambient_probe_contribution;
  55. uint32_t cull_mask;
  56. UpdateMode update_mode;
  57. protected:
  58. static void _bind_methods();
  59. void _validate_property(PropertyInfo &property) const;
  60. public:
  61. void set_intensity(float p_intensity);
  62. float get_intensity() const;
  63. void set_interior_ambient(Color p_ambient);
  64. Color get_interior_ambient() const;
  65. void set_interior_ambient_energy(float p_energy);
  66. float get_interior_ambient_energy() const;
  67. void set_interior_ambient_probe_contribution(float p_contribution);
  68. float get_interior_ambient_probe_contribution() const;
  69. void set_max_distance(float p_distance);
  70. float get_max_distance() const;
  71. void set_extents(const Vector3 &p_extents);
  72. Vector3 get_extents() const;
  73. void set_origin_offset(const Vector3 &p_extents);
  74. Vector3 get_origin_offset() const;
  75. void set_as_interior(bool p_enable);
  76. bool is_set_as_interior() const;
  77. void set_enable_box_projection(bool p_enable);
  78. bool is_box_projection_enabled() const;
  79. void set_enable_shadows(bool p_enable);
  80. bool are_shadows_enabled() const;
  81. void set_cull_mask(uint32_t p_layers);
  82. uint32_t get_cull_mask() const;
  83. void set_update_mode(UpdateMode p_mode);
  84. UpdateMode get_update_mode() const;
  85. virtual AABB get_aabb() const;
  86. virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
  87. ReflectionProbe();
  88. ~ReflectionProbe();
  89. };
  90. VARIANT_ENUM_CAST(ReflectionProbe::UpdateMode);
  91. #endif // REFLECTIONPROBE_H