baked_light_instance.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*************************************************************************/
  2. /* baked_light_instance.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 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 BAKED_LIGHT_INSTANCE_H
  31. #define BAKED_LIGHT_INSTANCE_H
  32. #include "scene/3d/visual_instance.h"
  33. #include "scene/resources/baked_light.h"
  34. class BakedLightBaker;
  35. class BakedLightInstance : public VisualInstance {
  36. OBJ_TYPE(BakedLightInstance, VisualInstance);
  37. Ref<BakedLight> baked_light;
  38. protected:
  39. static void _bind_methods();
  40. public:
  41. RID get_baked_light_instance() const;
  42. void set_baked_light(const Ref<BakedLight> &baked_light);
  43. Ref<BakedLight> get_baked_light() const;
  44. virtual AABB get_aabb() const;
  45. virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const;
  46. String get_configuration_warning() const;
  47. BakedLightInstance();
  48. };
  49. class BakedLightSampler : public VisualInstance {
  50. OBJ_TYPE(BakedLightSampler, VisualInstance);
  51. public:
  52. enum Param {
  53. PARAM_RADIUS = VS::BAKED_LIGHT_SAMPLER_RADIUS,
  54. PARAM_STRENGTH = VS::BAKED_LIGHT_SAMPLER_STRENGTH,
  55. PARAM_ATTENUATION = VS::BAKED_LIGHT_SAMPLER_ATTENUATION,
  56. PARAM_DETAIL_RATIO = VS::BAKED_LIGHT_SAMPLER_DETAIL_RATIO,
  57. PARAM_MAX = VS::BAKED_LIGHT_SAMPLER_MAX
  58. };
  59. protected:
  60. RID base;
  61. float params[PARAM_MAX];
  62. int resolution;
  63. static void _bind_methods();
  64. public:
  65. virtual AABB get_aabb() const;
  66. virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const;
  67. void set_param(Param p_param, float p_value);
  68. float get_param(Param p_param) const;
  69. void set_resolution(int p_resolution);
  70. int get_resolution() const;
  71. BakedLightSampler();
  72. ~BakedLightSampler();
  73. };
  74. VARIANT_ENUM_CAST(BakedLightSampler::Param);
  75. #endif // BAKED_LIGHT_H