922f361cb0
- Made a bunch of changes to comply with Godot 4 API - Use Godot's Vector3i and add the missing stuff with helper functions - Transvoxel uses custom attributes API, the old way would not work - Wrap MeshOptimizer in a unique namespace (see build script why) - Added clang-format file for the module as some rules now differ - Prevent thirdparty code and lookup tables from being clang-formatted - Very likely full of runtime bugs that need fixing
26 lines
430 B
C++
26 lines
430 B
C++
#ifndef VOXEL_VIEWER_REF_COUNT_H
|
|
#define VOXEL_VIEWER_REF_COUNT_H
|
|
|
|
#include <core/error/error_macros.h>
|
|
|
|
class VoxelRefCount {
|
|
public:
|
|
inline void add() {
|
|
++_count;
|
|
}
|
|
|
|
inline void remove() {
|
|
ERR_FAIL_COND_MSG(_count == 0, "Trying to decrease refcount when it's already zero");
|
|
--_count;
|
|
}
|
|
|
|
inline unsigned int get() const {
|
|
return _count;
|
|
}
|
|
|
|
private:
|
|
unsigned int _count = 0;
|
|
};
|
|
|
|
#endif // VOXEL_VIEWER_REF_COUNT_H
|