environment.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*************************************************************************/
  2. /* environment.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef ENVIRONMENT_H
  30. #define ENVIRONMENT_H
  31. #include "resource.h"
  32. #include "servers/visual_server.h"
  33. class Environment : public Resource {
  34. OBJ_TYPE(Environment,Resource);
  35. public:
  36. enum BG {
  37. BG_KEEP=VS::ENV_BG_KEEP,
  38. BG_DEFAULT_COLOR=VS::ENV_BG_DEFAULT_COLOR,
  39. BG_COLOR=VS::ENV_BG_COLOR,
  40. BG_TEXTURE=VS::ENV_BG_TEXTURE,
  41. BG_CUBEMAP=VS::ENV_BG_CUBEMAP,
  42. BG_CANVAS=VS::ENV_BG_CANVAS,
  43. BG_MAX=VS::ENV_BG_MAX
  44. };
  45. enum BGParam {
  46. BG_PARAM_CANVAS_MAX_LAYER=VS::ENV_BG_PARAM_CANVAS_MAX_LAYER,
  47. BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
  48. BG_PARAM_TEXTURE=VS::ENV_BG_PARAM_TEXTURE,
  49. BG_PARAM_CUBEMAP=VS::ENV_BG_PARAM_CUBEMAP,
  50. BG_PARAM_ENERGY=VS::ENV_BG_PARAM_ENERGY,
  51. BG_PARAM_SCALE=VS::ENV_BG_PARAM_SCALE,
  52. BG_PARAM_GLOW=VS::ENV_BG_PARAM_GLOW,
  53. BG_PARAM_MAX=VS::ENV_BG_PARAM_MAX
  54. };
  55. enum Fx {
  56. FX_AMBIENT_LIGHT=VS::ENV_FX_AMBIENT_LIGHT,
  57. FX_FXAA=VS::ENV_FX_FXAA,
  58. FX_GLOW=VS::ENV_FX_GLOW,
  59. FX_DOF_BLUR=VS::ENV_FX_DOF_BLUR,
  60. FX_HDR=VS::ENV_FX_HDR,
  61. FX_FOG=VS::ENV_FX_FOG,
  62. FX_BCS=VS::ENV_FX_BCS,
  63. FX_SRGB=VS::ENV_FX_SRGB,
  64. FX_MAX=VS::ENV_FX_MAX,
  65. };
  66. enum FxBlurBlendMode {
  67. FX_BLUR_BLEND_MODE_ADDITIVE,
  68. FX_BLUR_BLEND_MODE_SCREEN,
  69. FX_BLUR_BLEND_MODE_SOFTLIGHT,
  70. };
  71. enum FxHDRToneMapper {
  72. FX_HDR_TONE_MAPPER_LINEAR,
  73. FX_HDR_TONE_MAPPER_LOG,
  74. FX_HDR_TONE_MAPPER_REINHARDT,
  75. FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE,
  76. };
  77. enum FxParam {
  78. FX_PARAM_AMBIENT_LIGHT_COLOR=VS::ENV_FX_PARAM_AMBIENT_LIGHT_COLOR,
  79. FX_PARAM_AMBIENT_LIGHT_ENERGY=VS::ENV_FX_PARAM_AMBIENT_LIGHT_ENERGY,
  80. FX_PARAM_GLOW_BLUR_PASSES=VS::ENV_FX_PARAM_GLOW_BLUR_PASSES,
  81. FX_PARAM_GLOW_BLUR_SCALE=VS::ENV_FX_PARAM_GLOW_BLUR_SCALE,
  82. FX_PARAM_GLOW_BLUR_STRENGTH=VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH,
  83. FX_PARAM_GLOW_BLUR_BLEND_MODE=VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE,
  84. FX_PARAM_GLOW_BLOOM=VS::ENV_FX_PARAM_GLOW_BLOOM,
  85. FX_PARAM_GLOW_BLOOM_TRESHOLD=VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD,
  86. FX_PARAM_DOF_BLUR_PASSES=VS::ENV_FX_PARAM_DOF_BLUR_PASSES,
  87. FX_PARAM_DOF_BLUR_BEGIN=VS::ENV_FX_PARAM_DOF_BLUR_BEGIN,
  88. FX_PARAM_DOF_BLUR_RANGE=VS::ENV_FX_PARAM_DOF_BLUR_RANGE,
  89. FX_PARAM_HDR_EXPOSURE=VS::ENV_FX_PARAM_HDR_EXPOSURE,
  90. FX_PARAM_HDR_TONEMAPPER=VS::ENV_FX_PARAM_HDR_TONEMAPPER,
  91. FX_PARAM_HDR_WHITE=VS::ENV_FX_PARAM_HDR_WHITE,
  92. FX_PARAM_HDR_GLOW_TRESHOLD=VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD,
  93. FX_PARAM_HDR_GLOW_SCALE=VS::ENV_FX_PARAM_HDR_GLOW_SCALE,
  94. FX_PARAM_HDR_MIN_LUMINANCE=VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE,
  95. FX_PARAM_HDR_MAX_LUMINANCE=VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE,
  96. FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED=VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED,
  97. FX_PARAM_FOG_BEGIN=VS::ENV_FX_PARAM_FOG_BEGIN,
  98. FX_PARAM_FOG_BEGIN_COLOR=VS::ENV_FX_PARAM_FOG_BEGIN_COLOR,
  99. FX_PARAM_FOG_END_COLOR=VS::ENV_FX_PARAM_FOG_END_COLOR,
  100. FX_PARAM_FOG_ATTENUATION=VS::ENV_FX_PARAM_FOG_ATTENUATION,
  101. FX_PARAM_FOG_BG=VS::ENV_FX_PARAM_FOG_BG,
  102. FX_PARAM_BCS_BRIGHTNESS=VS::ENV_FX_PARAM_BCS_BRIGHTNESS,
  103. FX_PARAM_BCS_CONTRAST=VS::ENV_FX_PARAM_BCS_CONTRAST,
  104. FX_PARAM_BCS_SATURATION=VS::ENV_FX_PARAM_BCS_SATURATION,
  105. FX_PARAM_MAX=VS::ENV_FX_PARAM_MAX
  106. };
  107. private:
  108. BG bg_mode;
  109. Variant bg_param[BG_PARAM_MAX];
  110. bool fx_enabled[FX_MAX];
  111. Variant fx_param[FX_PARAM_MAX];
  112. RID environment;
  113. protected:
  114. static void _bind_methods();
  115. public:
  116. void set_background(BG p_bg);
  117. BG get_background() const;
  118. void set_background_param(BGParam p_param, const Variant& p_value);
  119. Variant get_background_param(BGParam p_param) const;
  120. void set_enable_fx(Fx p_effect,bool p_enabled);
  121. bool is_fx_enabled(Fx p_effect) const;
  122. void fx_set_param(FxParam p_param,const Variant& p_value);
  123. Variant fx_get_param(FxParam p_param) const;
  124. virtual RID get_rid() const;
  125. Environment();
  126. ~Environment();
  127. };
  128. VARIANT_ENUM_CAST( Environment::BG );
  129. VARIANT_ENUM_CAST( Environment::BGParam );
  130. VARIANT_ENUM_CAST( Environment::Fx );
  131. VARIANT_ENUM_CAST( Environment::FxParam );
  132. #endif // ENVIRONMENT_H