| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/3d/visual_instance_3d.h" |
| 34 |
|
| 35 |
class ReflectionProbe : public VisualInstance3D { |
| 36 |
GDCLASS(ReflectionProbe, VisualInstance3D); |
| 37 |
|
| 38 |
public: |
| 39 |
enum UpdateMode { |
| 40 |
UPDATE_ONCE, |
| 41 |
UPDATE_ALWAYS, |
| 42 |
}; |
| 43 |
|
| 44 |
enum AmbientMode { |
| 45 |
AMBIENT_DISABLED, |
| 46 |
AMBIENT_ENVIRONMENT, |
| 47 |
AMBIENT_COLOR |
| 48 |
}; |
| 49 |
|
| 50 |
private: |
| 51 |
RID probe; |
| 52 |
float intensity = 1.0; |
| 53 |
float blend_distance = 1.0; |
| 54 |
float max_distance = 0.0; |
| 55 |
Vector3 size = Vector3(20, 20, 20); |
| 56 |
Vector3 origin_offset = Vector3(0, 0, 0); |
| 57 |
bool box_projection = false; |
| 58 |
bool enable_shadows = false; |
| 59 |
bool interior = false; |
| 60 |
AmbientMode ambient_mode = AMBIENT_ENVIRONMENT; |
| 61 |
Color ambient_color = Color(0, 0, 0); |
| 62 |
float ambient_color_energy = 1.0; |
| 63 |
float mesh_lod_threshold = 1.0; |
| 64 |
|
| 65 |
uint32_t cull_mask = (1 << 20) - 1; |
| 66 |
uint32_t reflection_mask = (1 << 20) - 1; |
| 67 |
UpdateMode update_mode = UPDATE_ONCE; |
| 68 |
|
| 69 |
protected: |
| 70 |
static void _bind_methods(); |
| 71 |
void _validate_property(PropertyInfo &p_property) const; |
| 72 |
#ifndef DISABLE_DEPRECATED |
| 73 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 74 |
bool _get(const StringName &p_name, Variant &r_property) const; |
| 75 |
#endif |
| 76 |
|
| 77 |
public: |
| 78 |
void set_intensity(float p_intensity); |
| 79 |
float get_intensity() const; |
| 80 |
|
| 81 |
void set_blend_distance(float p_blend_distance); |
| 82 |
float get_blend_distance() const; |
| 83 |
|
| 84 |
void set_ambient_mode(AmbientMode p_mode); |
| 85 |
AmbientMode get_ambient_mode() const; |
| 86 |
|
| 87 |
void set_ambient_color(Color p_ambient); |
| 88 |
Color get_ambient_color() const; |
| 89 |
|
| 90 |
void set_ambient_color_energy(float p_energy); |
| 91 |
float get_ambient_color_energy() const; |
| 92 |
|
| 93 |
void set_interior_ambient_probe_contribution(float p_contribution); |
| 94 |
float get_interior_ambient_probe_contribution() const; |
| 95 |
|
| 96 |
void set_max_distance(float p_distance); |
| 97 |
float get_max_distance() const; |
| 98 |
|
| 99 |
void set_mesh_lod_threshold(float p_pixels); |
| 100 |
float get_mesh_lod_threshold() const; |
| 101 |
|
| 102 |
void set_size(const Vector3 &p_size); |
| 103 |
Vector3 get_size() const; |
| 104 |
|
| 105 |
void set_origin_offset(const Vector3 &p_offset); |
| 106 |
Vector3 get_origin_offset() const; |
| 107 |
|
| 108 |
void set_as_interior(bool p_enable); |
| 109 |
bool is_set_as_interior() const; |
| 110 |
|
| 111 |
void set_enable_box_projection(bool p_enable); |
| 112 |
bool is_box_projection_enabled() const; |
| 113 |
|
| 114 |
void set_enable_shadows(bool p_enable); |
| 115 |
bool are_shadows_enabled() const; |
| 116 |
|
| 117 |
void set_cull_mask(uint32_t p_layers); |
| 118 |
uint32_t get_cull_mask() const; |
| 119 |
|
| 120 |
void set_reflection_mask(uint32_t p_layers); |
| 121 |
uint32_t get_reflection_mask() const; |
| 122 |
|
| 123 |
void set_update_mode(UpdateMode p_mode); |
| 124 |
UpdateMode get_update_mode() const; |
| 125 |
|
| 126 |
virtual AABB get_aabb() const override; |
| 127 |
|
| 128 |
ReflectionProbe(); |
| 129 |
~ReflectionProbe(); |
| 130 |
}; |
| 131 |
|
| 132 |
VARIANT_ENUM_CAST(ReflectionProbe::AmbientMode); |
| 133 |
VARIANT_ENUM_CAST(ReflectionProbe::UpdateMode); |