703004f830
-=-=-=-=-=- -ESM Shadow Mapping for softer and less glitchy shadows -HDR Pipeline (convert to Linear on texture import, convert to SRGB at the end) -Fix to xml parse bug
142 lines
5.5 KiB
C++
142 lines
5.5 KiB
C++
/*************************************************************************/
|
|
/* environment.h */
|
|
/*************************************************************************/
|
|
/* This file is part of: */
|
|
/* GODOT ENGINE */
|
|
/* http://www.godotengine.org */
|
|
/*************************************************************************/
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
/* */
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
/* a copy of this software and associated documentation files (the */
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
/* the following conditions: */
|
|
/* */
|
|
/* The above copyright notice and this permission notice shall be */
|
|
/* included in all copies or substantial portions of the Software. */
|
|
/* */
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
/*************************************************************************/
|
|
#ifndef ENVIRONMENT_H
|
|
#define ENVIRONMENT_H
|
|
|
|
#include "resource.h"
|
|
#include "servers/visual_server.h"
|
|
|
|
class Environment : public Resource {
|
|
|
|
OBJ_TYPE(Environment,Resource);
|
|
public:
|
|
|
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ENV_FX_PARAM_FOG_END_COLOR,
|
|
FX_PARAM_FOG_ATTENUATION=VS::ENV_FX_PARAM_FOG_ATTENUATION,
|
|
FX_PARAM_FOG_BG=VS::ENV_FX_PARAM_FOG_BG,
|
|
FX_PARAM_BCS_BRIGHTNESS=VS::ENV_FX_PARAM_BCS_BRIGHTNESS,
|
|
FX_PARAM_BCS_CONTRAST=VS::ENV_FX_PARAM_BCS_CONTRAST,
|
|
FX_PARAM_BCS_SATURATION=VS::ENV_FX_PARAM_BCS_SATURATION,
|
|
FX_PARAM_MAX=VS::ENV_FX_PARAM_MAX
|
|
};
|
|
private:
|
|
|
|
BG bg_mode;
|
|
Variant bg_param[BG_PARAM_MAX];
|
|
bool fx_enabled[FX_MAX];
|
|
Variant fx_param[FX_PARAM_MAX];
|
|
RID environment;
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
public:
|
|
void set_background(BG p_bg);
|
|
BG get_background() const;
|
|
|
|
void set_background_param(BGParam p_param, const Variant& p_value);
|
|
Variant get_background_param(BGParam p_param) const;
|
|
|
|
void set_enable_fx(Fx p_effect,bool p_enabled);
|
|
bool is_fx_enabled(Fx p_effect) const;
|
|
|
|
void fx_set_param(FxParam p_param,const Variant& p_value);
|
|
Variant fx_get_param(FxParam p_param) const;
|
|
|
|
virtual RID get_rid() const;
|
|
|
|
Environment();
|
|
~Environment();
|
|
};
|
|
|
|
VARIANT_ENUM_CAST( Environment::BG );
|
|
VARIANT_ENUM_CAST( Environment::BGParam );
|
|
VARIANT_ENUM_CAST( Environment::Fx );
|
|
VARIANT_ENUM_CAST( Environment::FxParam );
|
|
|
|
#endif // ENVIRONMENT_H
|