Debian Codegraph @

scene/3d/reflection_probe.h

raw symbols SCIP
1 /**************************************************************************/
2 /* reflection_probe.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
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 // DISABLE_DEPRECATED
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);