Adding option to re-orient our sky
This commit is contained in:
parent
5f32fc8208
commit
f3dd3c0830
|
@ -77,6 +77,15 @@
|
|||
<member name="background_sky_custom_fov" type="float" setter="set_sky_custom_fov" getter="get_sky_custom_fov">
|
||||
[Sky] resource's custom field of view.
|
||||
</member>
|
||||
<member name="background_sky_orientation" type="Basis" setter="set_sky_orientation" getter="get_sky_orientation">
|
||||
[Sky] resource's rotation expressed as a [Basis]
|
||||
</member>
|
||||
<member name="background_sky_rotation" type="Vector3" setter="set_sky_rotation" getter="get_sky_rotation">
|
||||
[Sky] resource's rotation expressed as euler angles in radians
|
||||
</member>
|
||||
<member name="background_sky_rotation_degrees" type="Vector3" setter="set_sky_rotation_degrees" getter="get_sky_rotation_degrees">
|
||||
[Sky] resource's rotation expressed as euler angles in degrees
|
||||
</member>
|
||||
<member name="dof_blur_far_amount" type="float" setter="set_dof_blur_far_amount" getter="get_dof_blur_far_amount">
|
||||
Amount of far blur.
|
||||
</member>
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {}
|
||||
void environment_set_sky(RID p_env, RID p_sky) {}
|
||||
void environment_set_sky_custom_fov(RID p_env, float p_scale) {}
|
||||
void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {}
|
||||
void environment_set_bg_color(RID p_env, const Color &p_color) {}
|
||||
void environment_set_bg_energy(RID p_env, float p_energy) {}
|
||||
void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {}
|
||||
|
|
|
@ -668,6 +668,13 @@ void RasterizerSceneGLES2::environment_set_sky_custom_fov(RID p_env, float p_sca
|
|||
env->sky_custom_fov = p_scale;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->sky_orientation = p_orientation;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_bg_color(RID p_env, const Color &p_color) {
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
@ -2283,8 +2290,14 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
|||
}
|
||||
} else {
|
||||
if (use_radiance_map) {
|
||||
if (p_env) {
|
||||
Transform sky_orientation(p_env->sky_orientation, Vector3(0.0, 0.0, 0.0));
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, sky_orientation.affine_inverse() * p_view_transform);
|
||||
} else {
|
||||
// would be a bit weird if we dont have this...
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::RADIANCE_INVERSE_XFORM, p_view_transform);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_env) {
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::BG_ENERGY, p_env->bg_energy);
|
||||
|
@ -2393,7 +2406,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
|||
state.scene_shader.set_conditional(SceneShaderGLES2::FOG_HEIGHT_ENABLED, false);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy) {
|
||||
void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy, const Basis &p_sky_orientation) {
|
||||
ERR_FAIL_COND(!p_sky);
|
||||
|
||||
RasterizerStorageGLES2::Texture *tex = storage->texture_owner.getornull(p_sky->panorama);
|
||||
|
@ -2473,6 +2486,10 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
|
|||
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_CUSTOM_ALPHA, false);
|
||||
storage->shaders.copy.bind();
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES2::MULTIPLIER, p_energy);
|
||||
|
||||
// don't know why but I always have problems setting a uniform mat3, so we're using a transform
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES2::SKY_TRANSFORM, Transform(p_sky_orientation, Vector3(0.0, 0.0, 0.0)).affine_inverse());
|
||||
|
||||
if (asymmetrical) {
|
||||
// pack the bits we need from our projection matrix
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES2::ASYM_PROJ, camera.matrix[2][0], camera.matrix[0][0], camera.matrix[2][1], camera.matrix[1][1]);
|
||||
|
@ -2648,7 +2665,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
|
||||
|
||||
if (sky && sky->panorama.is_valid()) {
|
||||
_draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy);
|
||||
_draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -344,6 +344,7 @@ public:
|
|||
|
||||
RID sky;
|
||||
float sky_custom_fov;
|
||||
Basis sky_orientation;
|
||||
|
||||
Color bg_color;
|
||||
float bg_energy;
|
||||
|
@ -403,6 +404,7 @@ public:
|
|||
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky);
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy);
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
|
||||
|
@ -654,7 +656,7 @@ public:
|
|||
bool p_alpha_pass,
|
||||
bool p_shadow);
|
||||
|
||||
void _draw_sky(RasterizerStorageGLES2::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy);
|
||||
void _draw_sky(RasterizerStorageGLES2::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy, const Basis &p_sky_orientation);
|
||||
|
||||
_FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES2::Material *p_material, bool p_reverse_cull, bool p_alpha_pass, Size2i p_skeleton_tex_size = Size2i(0, 0));
|
||||
_FORCE_INLINE_ void _setup_geometry(RenderList::Element *p_element, RasterizerStorageGLES2::Skeleton *p_skeleton);
|
||||
|
|
|
@ -92,6 +92,7 @@ uniform float custom_alpha;
|
|||
#endif
|
||||
|
||||
#if defined(USE_PANORAMA) || defined(USE_ASYM_PANO)
|
||||
uniform highp mat4 sky_transform;
|
||||
|
||||
vec4 texturePanorama(sampler2D pano, vec3 normal) {
|
||||
|
||||
|
@ -113,7 +114,12 @@ void main() {
|
|||
|
||||
#ifdef USE_PANORAMA
|
||||
|
||||
vec4 color = texturePanorama(source, normalize(cube_interp));
|
||||
vec3 cube_normal = normalize(cube_interp);
|
||||
cube_normal.z = -cube_normal.z;
|
||||
cube_normal = mat3(sky_transform) * cube_normal;
|
||||
cube_normal.z = -cube_normal.z;
|
||||
|
||||
vec4 color = texturePanorama(source, cube_normal);
|
||||
|
||||
#elif defined(USE_ASYM_PANO)
|
||||
|
||||
|
@ -125,7 +131,7 @@ void main() {
|
|||
cube_normal.z = -1000000.0;
|
||||
cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y;
|
||||
cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a;
|
||||
cube_normal = mat3(pano_transform) * cube_normal;
|
||||
cube_normal = mat3(sky_transform) * mat3(pano_transform) * cube_normal;
|
||||
cube_normal.z = -cube_normal.z;
|
||||
|
||||
vec4 color = texturePanorama(source, normalize(cube_normal.xyz));
|
||||
|
|
|
@ -791,6 +791,14 @@ void RasterizerSceneGLES3::environment_set_sky_custom_fov(RID p_env, float p_sca
|
|||
env->sky_custom_fov = p_scale;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
||||
env->sky_orientation = p_orientation;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::environment_set_bg_color(RID p_env, const Color &p_color) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
|
@ -2427,7 +2435,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
|
|||
}
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy) {
|
||||
void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy, const Basis &p_sky_orientation) {
|
||||
|
||||
ERR_FAIL_COND(!p_sky);
|
||||
|
||||
|
@ -2519,7 +2527,12 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C
|
|||
storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_PANORAMA, !asymmetrical);
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES3::USE_MULTIPLIER, true);
|
||||
storage->shaders.copy.bind();
|
||||
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES3::MULTIPLIER, p_energy);
|
||||
|
||||
// don't know why but I always have problems setting a uniform mat3, so we're using a transform
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES3::SKY_TRANSFORM, Transform(p_sky_orientation, Vector3(0.0, 0.0, 0.0)).affine_inverse());
|
||||
|
||||
if (asymmetrical) {
|
||||
// pack the bits we need from our projection matrix
|
||||
storage->shaders.copy.set_uniform(CopyShaderGLES3::ASYM_PROJ, camera.matrix[2][0], camera.matrix[0][0], camera.matrix[2][1], camera.matrix[1][1]);
|
||||
|
@ -2538,6 +2551,7 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C
|
|||
}
|
||||
|
||||
void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, bool p_no_fog) {
|
||||
Transform sky_orientation;
|
||||
|
||||
//store camera into ubo
|
||||
store_camera(p_cam_projection, state.ubo_data.projection_matrix);
|
||||
|
@ -2578,6 +2592,9 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
|
|||
state.ubo_data.bg_color[2] = bg_color.b;
|
||||
state.ubo_data.bg_color[3] = bg_color.a;
|
||||
|
||||
//use the inverse of our sky_orientation, we may need to skip this if we're using a reflection probe?
|
||||
sky_orientation = Transform(env->sky_orientation, Vector3(0.0, 0.0, 0.0)).affine_inverse();
|
||||
|
||||
state.env_radiance_data.ambient_contribution = env->ambient_sky_contribution;
|
||||
state.ubo_data.ambient_occlusion_affect_light = env->ssao_light_affect;
|
||||
state.ubo_data.ambient_occlusion_affect_ssao = env->ssao_ao_channel_affect;
|
||||
|
@ -2646,7 +2663,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
|
|||
|
||||
//fill up environment
|
||||
|
||||
store_transform(p_cam_transform, state.env_radiance_data.transform);
|
||||
store_transform(sky_orientation * p_cam_transform, state.env_radiance_data.transform);
|
||||
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, state.env_radiance_ubo);
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(State::EnvironmentRadianceUBO), &state.env_radiance_data);
|
||||
|
@ -4389,7 +4406,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
|||
*/
|
||||
|
||||
if (sky && sky->panorama.is_valid())
|
||||
_draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy);
|
||||
_draw_sky(sky, p_cam_projection, p_cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
|
||||
}
|
||||
|
||||
//_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true);
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
TonemapShaderGLES3 tonemap_shader;
|
||||
|
||||
struct SceneDataUBO {
|
||||
//this is a std140 compatible struct. Please read the OpenGL 3.3 Specificaiton spec before doing any changes
|
||||
//this is a std140 compatible struct. Please read the OpenGL 3.3 Specification spec before doing any changes
|
||||
float projection_matrix[16];
|
||||
float inv_projection_matrix[16];
|
||||
float camera_inverse_matrix[16];
|
||||
|
@ -365,6 +365,7 @@ public:
|
|||
|
||||
RID sky;
|
||||
float sky_custom_fov;
|
||||
Basis sky_orientation;
|
||||
|
||||
Color bg_color;
|
||||
float bg_energy;
|
||||
|
@ -531,6 +532,7 @@ public:
|
|||
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky);
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy);
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
|
||||
|
@ -823,7 +825,7 @@ public:
|
|||
|
||||
_FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass, bool p_shadow_pass);
|
||||
|
||||
void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy);
|
||||
void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy, const Basis &p_sky_orientation);
|
||||
|
||||
void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, bool p_no_fog = false);
|
||||
void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows);
|
||||
|
|
|
@ -79,6 +79,7 @@ uniform float multiplier;
|
|||
#endif
|
||||
|
||||
#if defined(USE_PANORAMA) || defined(USE_ASYM_PANO)
|
||||
uniform highp mat4 sky_transform;
|
||||
|
||||
vec4 texturePanorama(vec3 normal, sampler2D pano) {
|
||||
|
||||
|
@ -121,7 +122,12 @@ void main() {
|
|||
|
||||
#ifdef USE_PANORAMA
|
||||
|
||||
vec4 color = texturePanorama(normalize(cube_interp), source);
|
||||
vec3 cube_normal = normalize(cube_interp);
|
||||
cube_normal.z = -cube_normal.z;
|
||||
cube_normal = mat3(sky_transform) * cube_normal;
|
||||
cube_normal.z = -cube_normal.z;
|
||||
|
||||
vec4 color = texturePanorama(cube_normal, source);
|
||||
|
||||
#elif defined(USE_ASYM_PANO)
|
||||
|
||||
|
@ -133,7 +139,7 @@ void main() {
|
|||
cube_normal.z = -1000000.0;
|
||||
cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y;
|
||||
cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a;
|
||||
cube_normal = mat3(pano_transform) * cube_normal;
|
||||
cube_normal = mat3(sky_transform) * mat3(pano_transform) * cube_normal;
|
||||
cube_normal.z = -cube_normal.z;
|
||||
|
||||
vec4 color = texturePanorama(normalize(cube_normal.xyz), source);
|
||||
|
|
|
@ -61,6 +61,25 @@ void Environment::set_sky_custom_fov(float p_scale) {
|
|||
bg_sky_custom_fov = p_scale;
|
||||
VS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale);
|
||||
}
|
||||
void Environment::set_sky_orientation(const Basis &p_orientation) {
|
||||
|
||||
bg_sky_orientation = p_orientation;
|
||||
_change_notify("background_sky_rotation");
|
||||
_change_notify("background_sky_rotation_degrees");
|
||||
VS::get_singleton()->environment_set_sky_orientation(environment, bg_sky_orientation);
|
||||
}
|
||||
void Environment::set_sky_rotation(const Vector3 &p_euler_rad) {
|
||||
|
||||
bg_sky_orientation.set_euler(p_euler_rad);
|
||||
_change_notify("background_sky_orientation");
|
||||
_change_notify("background_sky_rotation_degrees");
|
||||
VS::get_singleton()->environment_set_sky_orientation(environment, bg_sky_orientation);
|
||||
}
|
||||
void Environment::set_sky_rotation_degrees(const Vector3 &p_euler_deg) {
|
||||
|
||||
set_sky_rotation(p_euler_deg * Math_PI / 180.0);
|
||||
_change_notify("background_sky_rotation");
|
||||
}
|
||||
void Environment::set_bg_color(const Color &p_color) {
|
||||
|
||||
bg_color = p_color;
|
||||
|
@ -106,6 +125,22 @@ float Environment::get_sky_custom_fov() const {
|
|||
return bg_sky_custom_fov;
|
||||
}
|
||||
|
||||
Basis Environment::get_sky_orientation() const {
|
||||
|
||||
return bg_sky_orientation;
|
||||
}
|
||||
|
||||
Vector3 Environment::get_sky_rotation() const {
|
||||
|
||||
// should we cache this? maybe overkill
|
||||
return bg_sky_orientation.get_euler();
|
||||
}
|
||||
|
||||
Vector3 Environment::get_sky_rotation_degrees() const {
|
||||
|
||||
return get_sky_rotation() * 180.0 / Math_PI;
|
||||
}
|
||||
|
||||
Color Environment::get_bg_color() const {
|
||||
|
||||
return bg_color;
|
||||
|
@ -268,7 +303,7 @@ Ref<Texture> Environment::get_adjustment_color_correction() const {
|
|||
|
||||
void Environment::_validate_property(PropertyInfo &property) const {
|
||||
|
||||
if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "ambient_light/sky_contribution") {
|
||||
if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "background_sky_orientation" || property.name == "ambient_light/sky_contribution") {
|
||||
if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) {
|
||||
property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
|
||||
}
|
||||
|
@ -875,6 +910,9 @@ void Environment::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background);
|
||||
ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky);
|
||||
ClassDB::bind_method(D_METHOD("set_sky_custom_fov", "scale"), &Environment::set_sky_custom_fov);
|
||||
ClassDB::bind_method(D_METHOD("set_sky_orientation", "orientation"), &Environment::set_sky_orientation);
|
||||
ClassDB::bind_method(D_METHOD("set_sky_rotation", "euler_radians"), &Environment::set_sky_rotation);
|
||||
ClassDB::bind_method(D_METHOD("set_sky_rotation_degrees", "euler_degrees"), &Environment::set_sky_rotation_degrees);
|
||||
ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color);
|
||||
ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy);
|
||||
ClassDB::bind_method(D_METHOD("set_canvas_max_layer", "layer"), &Environment::set_canvas_max_layer);
|
||||
|
@ -885,6 +923,9 @@ void Environment::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background);
|
||||
ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky);
|
||||
ClassDB::bind_method(D_METHOD("get_sky_custom_fov"), &Environment::get_sky_custom_fov);
|
||||
ClassDB::bind_method(D_METHOD("get_sky_orientation"), &Environment::get_sky_orientation);
|
||||
ClassDB::bind_method(D_METHOD("get_sky_rotation"), &Environment::get_sky_rotation);
|
||||
ClassDB::bind_method(D_METHOD("get_sky_rotation_degrees"), &Environment::get_sky_rotation_degrees);
|
||||
ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color);
|
||||
ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy);
|
||||
ClassDB::bind_method(D_METHOD("get_canvas_max_layer"), &Environment::get_canvas_max_layer);
|
||||
|
@ -896,6 +937,9 @@ void Environment::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Color+Sky,Canvas,Keep"), "set_background", "get_background");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BASIS, "background_sky_orientation"), "set_sky_orientation", "get_sky_orientation");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "background_sky_rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_sky_rotation", "get_sky_rotation");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "background_sky_rotation_degrees", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_sky_rotation_degrees", "get_sky_rotation_degrees");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer");
|
||||
|
@ -1226,6 +1270,7 @@ Environment::Environment() {
|
|||
|
||||
bg_mode = BG_CLEAR_COLOR;
|
||||
bg_sky_custom_fov = 0;
|
||||
bg_sky_orientation = Basis();
|
||||
bg_energy = 1.0;
|
||||
bg_canvas_max_layer = 0;
|
||||
ambient_energy = 1.0;
|
||||
|
|
|
@ -91,6 +91,7 @@ private:
|
|||
BGMode bg_mode;
|
||||
Ref<Sky> bg_sky;
|
||||
float bg_sky_custom_fov;
|
||||
Basis bg_sky_orientation;
|
||||
Color bg_color;
|
||||
float bg_energy;
|
||||
int bg_canvas_max_layer;
|
||||
|
@ -182,6 +183,9 @@ public:
|
|||
void set_background(BGMode p_bg);
|
||||
void set_sky(const Ref<Sky> &p_sky);
|
||||
void set_sky_custom_fov(float p_scale);
|
||||
void set_sky_orientation(const Basis &p_orientation);
|
||||
void set_sky_rotation(const Vector3 &p_euler_rad);
|
||||
void set_sky_rotation_degrees(const Vector3 &p_euler_deg);
|
||||
void set_bg_color(const Color &p_color);
|
||||
void set_bg_energy(float p_energy);
|
||||
void set_canvas_max_layer(int p_max_layer);
|
||||
|
@ -192,6 +196,9 @@ public:
|
|||
BGMode get_background() const;
|
||||
Ref<Sky> get_sky() const;
|
||||
float get_sky_custom_fov() const;
|
||||
Basis get_sky_orientation() const;
|
||||
Vector3 get_sky_rotation() const;
|
||||
Vector3 get_sky_rotation_degrees() const;
|
||||
Color get_bg_color() const;
|
||||
float get_bg_energy() const;
|
||||
int get_canvas_max_layer() const;
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) = 0;
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
||||
|
|
|
@ -495,6 +495,7 @@ public:
|
|||
BIND2(environment_set_background, RID, EnvironmentBG)
|
||||
BIND2(environment_set_sky, RID, RID)
|
||||
BIND2(environment_set_sky_custom_fov, RID, float)
|
||||
BIND2(environment_set_sky_orientation, RID, const Basis &)
|
||||
BIND2(environment_set_bg_color, RID, const Color &)
|
||||
BIND2(environment_set_bg_energy, RID, float)
|
||||
BIND2(environment_set_canvas_max_layer, RID, int)
|
||||
|
|
|
@ -421,6 +421,7 @@ public:
|
|||
FUNC2(environment_set_background, RID, EnvironmentBG)
|
||||
FUNC2(environment_set_sky, RID, RID)
|
||||
FUNC2(environment_set_sky_custom_fov, RID, float)
|
||||
FUNC2(environment_set_sky_orientation, RID, const Basis &)
|
||||
FUNC2(environment_set_bg_color, RID, const Color &)
|
||||
FUNC2(environment_set_bg_energy, RID, float)
|
||||
FUNC2(environment_set_canvas_max_layer, RID, int)
|
||||
|
|
|
@ -1903,6 +1903,7 @@ void VisualServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("environment_set_background", "env", "bg"), &VisualServer::environment_set_background);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky", "env", "sky"), &VisualServer::environment_set_sky);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky_custom_fov", "env", "scale"), &VisualServer::environment_set_sky_custom_fov);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_sky_orientation", "env", "orientation"), &VisualServer::environment_set_sky_orientation);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_bg_color", "env", "color"), &VisualServer::environment_set_bg_color);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &VisualServer::environment_set_bg_energy);
|
||||
ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &VisualServer::environment_set_canvas_max_layer);
|
||||
|
|
|
@ -709,6 +709,7 @@ public:
|
|||
virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
|
||||
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
|
||||
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
||||
|
|
Loading…
Reference in New Issue