Skip to content

Commit a3d32cf

Browse files
committed
Fix GDCLASS public override
1 parent a747f40 commit a3d32cf

17 files changed

+141
-118
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Braces:
4646

4747
Private & Public:
4848
* Private variables/functions prefaced with `_`
49-
* Private/public/protected explicit and grouped together in that order, in header and cpp files
49+
* One initial public section for constants
50+
* Private/public/protected for members and functions in that order, in header and cpp files
5051
* Functions in h and cpp files in same order
5152

5253
Other formatting:

src/generated_tex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
void GeneratedTex::create(const TypedArray<Image> &p_layers) {
1313
if (!p_layers.is_empty()) {
14-
if (Terrain3D::_debug_level >= DEBUG) {
14+
if (Terrain3D::debug_level >= DEBUG) {
1515
LOG(DEBUG, "RenderingServer creating Texture2DArray, layers size: ", p_layers.size());
1616
for (int i = 0; i < p_layers.size(); i++) {
1717
Ref<Image> img = p_layers[i];

src/generated_tex.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
using namespace godot;
99

1010
class GeneratedTex {
11-
private:
11+
public:
12+
// Constants
1213
static inline const char *__class__ = "Terrain3DGeneratedTex";
14+
15+
private:
1316
RID _rid = RID();
1417
Ref<Image> _image;
1518
bool _dirty = false;

src/geoclipmap.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
using namespace godot;
99

1010
class GeoClipMap {
11-
private:
11+
public:
12+
// Constants
1213
static inline const char *__class__ = "Terrain3DGeoClipMap";
1314

15+
private:
1416
static inline int _patch_2d(int x, int y, int res);
1517
static RID _create_mesh(PackedVector3Array p_vertices, PackedInt32Array p_indices, AABB p_aabb);
1618

src/logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
UtilityFunctions::push_error(__class__, "::", __func__, ": ", __VA_ARGS__); \
3131
else if (level == WARN) \
3232
UtilityFunctions::push_warning(__class__, "::", __func__, ": ", __VA_ARGS__); \
33-
else if (Terrain3D::_debug_level >= level) \
33+
else if (Terrain3D::debug_level >= level) \
3434
UtilityFunctions::print(__class__, "::", __func__, ": ", __VA_ARGS__);
3535

3636
#endif // LOGGER_CLASS_H

src/terrain_3d.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
///////////////////////////
2424

2525
// Initialize static member variable
26-
int Terrain3D::_debug_level{ ERROR };
26+
int Terrain3D::debug_level{ ERROR };
2727

2828
void Terrain3D::_initialize() {
2929
LOG(INFO, "Checking material, storage, texture_list, signal, and mesh initialization");
@@ -67,8 +67,8 @@ void Terrain3D::_initialize() {
6767
// Initialize the system
6868
if (!_initialized && _is_inside_world && is_inside_tree()) {
6969
_material->initialize(_storage->get_region_size());
70-
_storage->_update_regions(true); // generate map arrays
71-
_texture_list->_update_list(); // generate texture arrays
70+
_storage->update_regions(true); // generate map arrays
71+
_texture_list->update_list(); // generate texture arrays
7272
_build(_clipmap_levels, _clipmap_size);
7373
_build_collision();
7474
_initialized = true;
@@ -480,7 +480,7 @@ Terrain3D::~Terrain3D() {
480480

481481
void Terrain3D::set_debug_level(int p_level) {
482482
LOG(INFO, "Setting debug level: ", p_level);
483-
_debug_level = CLAMP(p_level, 0, DEBUG_MAX);
483+
debug_level = CLAMP(p_level, 0, DEBUG_MAX);
484484
}
485485

486486
void Terrain3D::set_clipmap_levels(int p_count) {

src/terrain_3d.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@
2020
using namespace godot;
2121

2222
class Terrain3D : public Node3D {
23-
private:
2423
GDCLASS(Terrain3D, Node3D);
24+
25+
public:
26+
// Constants
2527
static inline const char *__class__ = "Terrain3D";
2628

29+
private:
2730
// Terrain state
2831
String _version = "0.8.4-dev";
2932
bool _is_inside_world = false;
3033
bool _initialized = false;
3134

3235
// Terrain settings
33-
static int _debug_level;
3436
int _clipmap_size = 48;
3537
int _clipmap_levels = 7;
3638

@@ -86,13 +88,15 @@ class Terrain3D : public Node3D {
8688
void _update_instances();
8789

8890
public:
91+
static int debug_level;
92+
8993
Terrain3D();
9094
~Terrain3D();
9195

9296
// Terrain settings
9397
String get_version() const { return _version; }
9498
void set_debug_level(int p_level);
95-
int get_debug_level() const { return _debug_level; }
99+
int get_debug_level() const { return debug_level; }
96100
void set_clipmap_levels(int p_count);
97101
int get_clipmap_levels() const { return _clipmap_levels; }
98102
void set_clipmap_size(int p_size);

src/terrain_3d_editor.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
using namespace godot;
1212

1313
class Terrain3DEditor : public Object {
14-
private:
1514
GDCLASS(Terrain3DEditor, Object);
16-
static inline const char *__class__ = "Terrain3DEditor";
1715

18-
// Constants & Definitions
16+
public:
17+
// Constants
18+
static inline const char *__class__ = "Terrain3DEditor";
1919

2020
enum Operation {
2121
ADD,
@@ -94,12 +94,11 @@ class Terrain3DEditor : public Object {
9494
real_t get_jitter() const { return _jitter; }
9595
};
9696

97+
private:
9798
// Object references
98-
9999
Terrain3D *_terrain = nullptr;
100100

101101
// Painter settings & variables
102-
103102
Tool _tool = REGION;
104103
Operation _operation = ADD;
105104
Brush _brush;
@@ -109,7 +108,6 @@ class Terrain3DEditor : public Object {
109108
bool _modified = false;
110109
Array _undo_set; // 0-2: map 0,1,2, 3: Region offsets, 4: height range
111110

112-
private:
113111
void _operate_region(Vector3 p_global_position);
114112
void _operate_map(Vector3 p_global_position, real_t p_camera_direction);
115113
bool _is_in_bounds(Vector2i p_position, Vector2i p_max_position);

src/terrain_3d_material.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void Terrain3DMaterial::_preload_shaders() {
2828
#include "shaders/main.glsl"
2929
);
3030

31-
if (Terrain3D::_debug_level >= DEBUG) {
31+
if (Terrain3D::debug_level >= DEBUG) {
3232
Array keys = _shader_code.keys();
3333
for (int i = 0; i < keys.size(); i++) {
3434
LOG(DEBUG, "Loaded shader insert: ", keys[i]);
@@ -186,7 +186,7 @@ void Terrain3DMaterial::_update_regions(const Array &p_args) {
186186
RS->material_set_param(_material, "_region_map", _region_map);
187187
RS->material_set_param(_material, "_region_map_size", Terrain3DStorage::REGION_MAP_SIZE);
188188
RS->material_set_param(_material, "_region_uv_limit", Terrain3DStorage::REGION_MAP_SIZE / 2);
189-
if (Terrain3D::_debug_level >= DEBUG) {
189+
if (Terrain3D::debug_level >= DEBUG) {
190190
LOG(DEBUG, "Region map");
191191
for (int i = 0; i < _region_map.size(); i++) {
192192
if (_region_map[i]) {

src/terrain_3d_material.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
using namespace godot;
1111

1212
class Terrain3DMaterial : public Resource {
13-
private:
1413
GDCLASS(Terrain3DMaterial, Resource);
14+
15+
public:
16+
// Constants
1517
static inline const char *__class__ = "Terrain3DMaterial";
1618

19+
private:
1720
bool _initialized = false;
1821
RID _material;
1922
RID _shader;

0 commit comments

Comments
 (0)