environment.h
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 
32 #include "resource.h"
33 #include "servers/visual_server.h"
34 
35 class Environment : public Resource {
36 
37  OBJ_TYPE(Environment,Resource);
38 public:
39 
40  enum BG {
41 
42  BG_KEEP=VS::ENV_BG_KEEP,
43  BG_DEFAULT_COLOR=VS::ENV_BG_DEFAULT_COLOR,
44  BG_COLOR=VS::ENV_BG_COLOR,
45  BG_TEXTURE=VS::ENV_BG_TEXTURE,
46  BG_CUBEMAP=VS::ENV_BG_CUBEMAP,
47  BG_CANVAS=VS::ENV_BG_CANVAS,
48  BG_MAX=VS::ENV_BG_MAX
49  };
50 
51  enum BGParam {
52 
53  BG_PARAM_CANVAS_MAX_LAYER=VS::ENV_BG_PARAM_CANVAS_MAX_LAYER,
54  BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
55  BG_PARAM_TEXTURE=VS::ENV_BG_PARAM_TEXTURE,
56  BG_PARAM_CUBEMAP=VS::ENV_BG_PARAM_CUBEMAP,
57  BG_PARAM_ENERGY=VS::ENV_BG_PARAM_ENERGY,
58  BG_PARAM_SCALE=VS::ENV_BG_PARAM_SCALE,
59  BG_PARAM_GLOW=VS::ENV_BG_PARAM_GLOW,
60  BG_PARAM_MAX=VS::ENV_BG_PARAM_MAX
61  };
62 
63  enum Fx {
64  FX_AMBIENT_LIGHT=VS::ENV_FX_AMBIENT_LIGHT,
65  FX_FXAA=VS::ENV_FX_FXAA,
66  FX_GLOW=VS::ENV_FX_GLOW,
67  FX_DOF_BLUR=VS::ENV_FX_DOF_BLUR,
68  FX_HDR=VS::ENV_FX_HDR,
69  FX_FOG=VS::ENV_FX_FOG,
70  FX_BCS=VS::ENV_FX_BCS,
71  FX_SRGB=VS::ENV_FX_SRGB,
72  FX_MAX=VS::ENV_FX_MAX,
73  };
74 
75  enum FxBlurBlendMode {
76  FX_BLUR_BLEND_MODE_ADDITIVE,
77  FX_BLUR_BLEND_MODE_SCREEN,
78  FX_BLUR_BLEND_MODE_SOFTLIGHT,
79  };
80 
81  enum FxHDRToneMapper {
82  FX_HDR_TONE_MAPPER_LINEAR,
83  FX_HDR_TONE_MAPPER_LOG,
84  FX_HDR_TONE_MAPPER_REINHARDT,
85  FX_HDR_TONE_MAPPER_REINHARDT_AUTOWHITE,
86  };
87 
88  enum FxParam {
89  FX_PARAM_AMBIENT_LIGHT_COLOR=VS::ENV_FX_PARAM_AMBIENT_LIGHT_COLOR,
90  FX_PARAM_AMBIENT_LIGHT_ENERGY=VS::ENV_FX_PARAM_AMBIENT_LIGHT_ENERGY,
91  FX_PARAM_GLOW_BLUR_PASSES=VS::ENV_FX_PARAM_GLOW_BLUR_PASSES,
92  FX_PARAM_GLOW_BLUR_SCALE=VS::ENV_FX_PARAM_GLOW_BLUR_SCALE,
93  FX_PARAM_GLOW_BLUR_STRENGTH=VS::ENV_FX_PARAM_GLOW_BLUR_STRENGTH,
94  FX_PARAM_GLOW_BLUR_BLEND_MODE=VS::ENV_FX_PARAM_GLOW_BLUR_BLEND_MODE,
95  FX_PARAM_GLOW_BLOOM=VS::ENV_FX_PARAM_GLOW_BLOOM,
96  FX_PARAM_GLOW_BLOOM_TRESHOLD=VS::ENV_FX_PARAM_GLOW_BLOOM_TRESHOLD,
97  FX_PARAM_DOF_BLUR_PASSES=VS::ENV_FX_PARAM_DOF_BLUR_PASSES,
98  FX_PARAM_DOF_BLUR_BEGIN=VS::ENV_FX_PARAM_DOF_BLUR_BEGIN,
99  FX_PARAM_DOF_BLUR_RANGE=VS::ENV_FX_PARAM_DOF_BLUR_RANGE,
100  FX_PARAM_HDR_EXPOSURE=VS::ENV_FX_PARAM_HDR_EXPOSURE,
101  FX_PARAM_HDR_TONEMAPPER=VS::ENV_FX_PARAM_HDR_TONEMAPPER,
102  FX_PARAM_HDR_WHITE=VS::ENV_FX_PARAM_HDR_WHITE,
103  FX_PARAM_HDR_GLOW_TRESHOLD=VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD,
104  FX_PARAM_HDR_GLOW_SCALE=VS::ENV_FX_PARAM_HDR_GLOW_SCALE,
105  FX_PARAM_HDR_MIN_LUMINANCE=VS::ENV_FX_PARAM_HDR_MIN_LUMINANCE,
106  FX_PARAM_HDR_MAX_LUMINANCE=VS::ENV_FX_PARAM_HDR_MAX_LUMINANCE,
107  FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED=VS::ENV_FX_PARAM_HDR_EXPOSURE_ADJUST_SPEED,
108  FX_PARAM_FOG_BEGIN=VS::ENV_FX_PARAM_FOG_BEGIN,
109  FX_PARAM_FOG_BEGIN_COLOR=VS::ENV_FX_PARAM_FOG_BEGIN_COLOR,
110  FX_PARAM_FOG_END_COLOR=VS::ENV_FX_PARAM_FOG_END_COLOR,
111  FX_PARAM_FOG_ATTENUATION=VS::ENV_FX_PARAM_FOG_ATTENUATION,
112  FX_PARAM_FOG_BG=VS::ENV_FX_PARAM_FOG_BG,
113  FX_PARAM_BCS_BRIGHTNESS=VS::ENV_FX_PARAM_BCS_BRIGHTNESS,
114  FX_PARAM_BCS_CONTRAST=VS::ENV_FX_PARAM_BCS_CONTRAST,
115  FX_PARAM_BCS_SATURATION=VS::ENV_FX_PARAM_BCS_SATURATION,
116  FX_PARAM_MAX=VS::ENV_FX_PARAM_MAX
117  };
118 private:
119 
120  BG bg_mode;
121  Variant bg_param[BG_PARAM_MAX];
122  bool fx_enabled[FX_MAX];
123  Variant fx_param[FX_PARAM_MAX];
124  RID environment;
125 
126 protected:
127 
128  static void _bind_methods();
129 public:
130  void set_background(BG p_bg);
131  BG get_background() const;
132 
133  void set_background_param(BGParam p_param, const Variant& p_value);
134  Variant get_background_param(BGParam p_param) const;
135 
136  void set_enable_fx(Fx p_effect,bool p_enabled);
137  bool is_fx_enabled(Fx p_effect) const;
138 
139  void fx_set_param(FxParam p_param,const Variant& p_value);
140  Variant fx_get_param(FxParam p_param) const;
141 
142  virtual RID get_rid() const;
143 
144  Environment();
145  ~Environment();
146 };
147 
148 VARIANT_ENUM_CAST( Environment::BG );
149 VARIANT_ENUM_CAST( Environment::BGParam );
150 VARIANT_ENUM_CAST( Environment::Fx );
151 VARIANT_ENUM_CAST( Environment::FxParam );
152 
153 #endif // ENVIRONMENT_H
Definition: variant.h:74
Definition: environment.h:35
Definition: resource.h:89
Definition: rid.h:47