More const qualifiers.

This commit is contained in:
Relintai 2020-04-16 17:54:32 +02:00
parent 367c203cc6
commit b21030ae89
12 changed files with 38 additions and 38 deletions

View File

@ -32,21 +32,21 @@ void WorldArea::set_aabb(const AABB value) {
Ref<Texture> WorldArea::get_map_texture() const { Ref<Texture> WorldArea::get_map_texture() const {
return _map_texture; return _map_texture;
} }
void WorldArea::set_map_texture(const Ref<Texture> value) { void WorldArea::set_map_texture(const Ref<Texture> &value) {
_map_texture = value; _map_texture = value;
} }
Ref<Texture> WorldArea::get_fov_texture() const { Ref<Texture> WorldArea::get_fov_texture() const {
return _fov_texture; return _fov_texture;
} }
void WorldArea::set_fov_texture(const Ref<Texture> value) { void WorldArea::set_fov_texture(const Ref<Texture> &value) {
_fov_texture = value; _fov_texture = value;
} }
String WorldArea::get_name() const { String WorldArea::get_name() const {
return _name; return _name;
} }
void WorldArea::set_name(const String value) { void WorldArea::set_name(const String &value) {
_name = value; _name = value;
} }

View File

@ -37,13 +37,13 @@ public:
void set_aabb(const AABB value); void set_aabb(const AABB value);
Ref<Texture> get_map_texture() const; Ref<Texture> get_map_texture() const;
void set_map_texture(const Ref<Texture> value); void set_map_texture(const Ref<Texture> &value);
Ref<Texture> get_fov_texture() const; Ref<Texture> get_fov_texture() const;
void set_fov_texture(const Ref<Texture> value); void set_fov_texture(const Ref<Texture> &value);
String get_name() const; String get_name() const;
void set_name(const String value); void set_name(const String &value);
int get_level() const; int get_level() const;
void set_level(const int value); void set_level(const int value);

View File

@ -43,7 +43,7 @@ void VoxelLight::set_world_position(const int x, const int y, const int z) {
_FORCE_INLINE_ Color VoxelLight::get_color() const { _FORCE_INLINE_ Color VoxelLight::get_color() const {
return _color; return _color;
} }
void VoxelLight::set_color(Color color) { void VoxelLight::set_color(const Color &color) {
_color = color; _color = color;
} }

View File

@ -38,7 +38,7 @@ public:
void set_world_position(const int x, const int y, const int z); void set_world_position(const int x, const int y, const int z);
Color get_color() const; Color get_color() const;
void set_color(const Color color); void set_color(const Color &color);
float get_size() const; float get_size() const;
void set_size(const float strength); void set_size(const float strength);

View File

@ -46,7 +46,7 @@ void VoxelSurface::set_transparent(const bool transparent) {
Rect2 VoxelSurface::get_rect(const VoxelSurfaceSides side) const { Rect2 VoxelSurface::get_rect(const VoxelSurfaceSides side) const {
return _rects[side]; return _rects[side];
} }
void VoxelSurface::set_rect(const VoxelSurfaceSides side, const Rect2 rect) { void VoxelSurface::set_rect(const VoxelSurfaceSides side, const Rect2 &rect) {
_rects[side] = rect; _rects[side] = rect;
} }
@ -58,7 +58,7 @@ void VoxelSurface::set_library(Ref<VoxelmanLibrary> library) {
_library = (*library); _library = (*library);
} }
_FORCE_INLINE_ Vector2 VoxelSurface::transform_uv(const VoxelSurfaceSides p_side, const Vector2 p_uv) const { _FORCE_INLINE_ Vector2 VoxelSurface::transform_uv(const VoxelSurfaceSides p_side, const Vector2 &p_uv) const {
Vector2 uv = p_uv; Vector2 uv = p_uv;
Rect2 r = _rects[p_side]; Rect2 r = _rects[p_side];
@ -71,7 +71,7 @@ _FORCE_INLINE_ Vector2 VoxelSurface::transform_uv(const VoxelSurfaceSides p_side
return uv; return uv;
} }
_FORCE_INLINE_ Vector2 VoxelSurface::transform_uv_scaled(const VoxelSurfaceSides p_side, const Vector2 p_uv, int p_current_x, int p_current_y, int p_max) const { _FORCE_INLINE_ Vector2 VoxelSurface::transform_uv_scaled(const VoxelSurfaceSides p_side, const Vector2 &p_uv, const int p_current_x, const int p_current_y, const int p_max) const {
Vector2 uv = p_uv; Vector2 uv = p_uv;
Rect2 r = _rects[p_side]; Rect2 r = _rects[p_side];

View File

@ -74,13 +74,13 @@ public:
void set_transparent(const bool transparent); void set_transparent(const bool transparent);
Rect2 get_rect(const VoxelSurfaceSides side) const; Rect2 get_rect(const VoxelSurfaceSides side) const;
void set_rect(const VoxelSurfaceSides side, const Rect2 rect); void set_rect(const VoxelSurfaceSides side, const Rect2 &rect);
Ref<VoxelmanLibrary> get_library() const; Ref<VoxelmanLibrary> get_library() const;
void set_library(Ref<VoxelmanLibrary> library); void set_library(Ref<VoxelmanLibrary> library);
Vector2 transform_uv(const VoxelSurfaceSides p_side, const Vector2 p_uv) const; Vector2 transform_uv(const VoxelSurfaceSides p_side, const Vector2 &p_uv) const;
Vector2 transform_uv_scaled(const VoxelSurfaceSides p_side, const Vector2 p_uv, int p_current_x, int p_current_y, int p_max) const; Vector2 transform_uv_scaled(const VoxelSurfaceSides p_side, const Vector2 &p_uv, const int p_current_x, const int p_current_y, const int p_max) const;
virtual void refresh_rects(); virtual void refresh_rects();

View File

@ -35,14 +35,14 @@ typedef class StandardMaterial3D SpatialMaterial;
Ref<AtlasTexture> VoxelSurfaceMerger::get_region(const VoxelSurfaceSides side) { Ref<AtlasTexture> VoxelSurfaceMerger::get_region(const VoxelSurfaceSides side) {
return _regions[side]; return _regions[side];
} }
void VoxelSurfaceMerger::set_region(const VoxelSurfaceSides side, Ref<AtlasTexture> texture) { void VoxelSurfaceMerger::set_region(const VoxelSurfaceSides side, const Ref<AtlasTexture> &texture) {
_regions[side] = texture; _regions[side] = texture;
} }
Ref<Texture> VoxelSurfaceMerger::get_texture(const VoxelSurfaceSides side) { Ref<Texture> VoxelSurfaceMerger::get_texture(const VoxelSurfaceSides side) {
return _textures[side]; return _textures[side];
} }
void VoxelSurfaceMerger::set_texture(const VoxelSurfaceSides side, Ref<Texture> texture) { void VoxelSurfaceMerger::set_texture(const VoxelSurfaceSides side, const Ref<Texture> &texture) {
_textures[side] = texture; _textures[side] = texture;
} }

View File

@ -40,10 +40,10 @@ class VoxelSurfaceMerger : public VoxelSurface {
public: public:
Ref<AtlasTexture> get_region(const VoxelSurfaceSides side); Ref<AtlasTexture> get_region(const VoxelSurfaceSides side);
void set_region(const VoxelSurfaceSides side, Ref<AtlasTexture> texture); void set_region(const VoxelSurfaceSides side, const Ref<AtlasTexture> &texture);
Ref<Texture> get_texture(const VoxelSurfaceSides side); Ref<Texture> get_texture(const VoxelSurfaceSides side);
void set_texture(const VoxelSurfaceSides side, Ref<Texture> texture); void set_texture(const VoxelSurfaceSides side, const Ref<Texture> &texture);
void refresh_rects(); void refresh_rects();

View File

@ -55,7 +55,7 @@ void VoxelmanLibraryMerger::set_keep_original_atlases(const bool value) {
Color VoxelmanLibraryMerger::get_background_color() const { Color VoxelmanLibraryMerger::get_background_color() const {
return _packer->get_background_color(); return _packer->get_background_color();
} }
void VoxelmanLibraryMerger::set_background_color(const Color color) { void VoxelmanLibraryMerger::set_background_color(const Color &color) {
_packer->set_background_color(color); _packer->set_background_color(color);
} }
@ -252,7 +252,7 @@ void VoxelmanLibraryMerger::add_prop(Ref<PackedScene> value) {
////_props[value->get_id()] = value; ////_props[value->get_id()] = value;
} }
void VoxelmanLibraryMerger::set_prop(const int id, Ref<PackedScene> value) { void VoxelmanLibraryMerger::set_prop(const int id, const Ref<PackedScene> &value) {
//_props[value->get_id()] = value; //_props[value->get_id()] = value;
} }
void VoxelmanLibraryMerger::remove_prop(const int id) { void VoxelmanLibraryMerger::remove_prop(const int id) {
@ -335,7 +335,7 @@ void VoxelmanLibraryMerger::refresh_rects() {
} }
} }
void VoxelmanLibraryMerger::_setup_material_albedo(int material_index, Ref<Texture> texture) { void VoxelmanLibraryMerger::_setup_material_albedo(const int material_index, const Ref<Texture> &texture) {
Ref<SpatialMaterial> mat; Ref<SpatialMaterial> mat;
int count = 0; int count = 0;

View File

@ -50,7 +50,7 @@ public:
void set_keep_original_atlases(const bool value); void set_keep_original_atlases(const bool value);
Color get_background_color() const; Color get_background_color() const;
void set_background_color(const Color color); void set_background_color(const Color &color);
int get_margin() const; int get_margin() const;
void set_margin(const int margin); void set_margin(const int margin);
@ -77,7 +77,7 @@ public:
Ref<PackedScene> get_prop(const int id); Ref<PackedScene> get_prop(const int id);
void add_prop(Ref<PackedScene> value); void add_prop(Ref<PackedScene> value);
void set_prop(const int id, Ref<PackedScene> value); void set_prop(const int id, const Ref<PackedScene> &value);
void remove_prop(const int id); void remove_prop(const int id);
int get_num_props() const; int get_num_props() const;
void clear_props(); void clear_props();
@ -87,7 +87,7 @@ public:
void refresh_rects(); void refresh_rects();
void _setup_material_albedo(int material_index, Ref<Texture> texture); void _setup_material_albedo(const int material_index, const Ref<Texture> &texture);
VoxelmanLibraryMerger(); VoxelmanLibraryMerger();
~VoxelmanLibraryMerger(); ~VoxelmanLibraryMerger();

View File

@ -31,36 +31,36 @@ SOFTWARE.
Ref<Environment> EnvironmentData::get_environment() { Ref<Environment> EnvironmentData::get_environment() {
return _environment; return _environment;
} }
void EnvironmentData::set_environment(Ref<Environment> value) { void EnvironmentData::set_environment(const Ref<Environment> &value) {
_environment = value; _environment = value;
} }
Color EnvironmentData::get_color(int index) { Color EnvironmentData::get_color(const int index) {
ERR_FAIL_INDEX_V(index, LIGHT_COUNT, Color()); ERR_FAIL_INDEX_V(index, LIGHT_COUNT, Color());
return _colors[index]; return _colors[index];
} }
void EnvironmentData::set_color(int index, Color value) { void EnvironmentData::set_color(const int index, const Color &value) {
ERR_FAIL_INDEX(index, LIGHT_COUNT); ERR_FAIL_INDEX(index, LIGHT_COUNT);
_colors[index] = value; _colors[index] = value;
} }
float EnvironmentData::get_energy(int index) { float EnvironmentData::get_energy(const int index) {
ERR_FAIL_INDEX_V(index, LIGHT_COUNT, 0); ERR_FAIL_INDEX_V(index, LIGHT_COUNT, 0);
return _energies[index]; return _energies[index];
} }
void EnvironmentData::set_energy(int index, float value) { void EnvironmentData::set_energy(const int index, const float value) {
ERR_FAIL_INDEX(index, LIGHT_COUNT); ERR_FAIL_INDEX(index, LIGHT_COUNT);
_energies[index] = value; _energies[index] = value;
} }
float EnvironmentData::get_indirect_energy(int index) { float EnvironmentData::get_indirect_energy(const int index) {
ERR_FAIL_INDEX_V(index, LIGHT_COUNT, 0); ERR_FAIL_INDEX_V(index, LIGHT_COUNT, 0);
return _indirect_energies[index]; return _indirect_energies[index];
} }
void EnvironmentData::set_indirect_energy(int index, float value) { void EnvironmentData::set_indirect_energy(const int index, const float value) {
ERR_FAIL_INDEX(index, LIGHT_COUNT); ERR_FAIL_INDEX(index, LIGHT_COUNT);
_indirect_energies[index] = value; _indirect_energies[index] = value;

View File

@ -44,14 +44,14 @@ class EnvironmentData : public Resource {
public: public:
Ref<Environment> get_environment(); Ref<Environment> get_environment();
void set_environment(Ref<Environment> value); void set_environment(const Ref<Environment> &value);
Color get_color(int index); Color get_color(const int index);
void set_color(int index, Color value); void set_color(const int index, const Color &value);
float get_energy(int index); float get_energy(const int index);
void set_energy(int index, float value); void set_energy(const int index, const float value);
float get_indirect_energy(int index); float get_indirect_energy(const int index);
void set_indirect_energy(int index, float value); void set_indirect_energy(const int index, const float value);
void setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light); void setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light);
void setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light); void setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light);