Rename height_base to be height_start, for consistency

master
Marc Gilleron 2020-01-21 23:57:22 +00:00
parent df3a649e18
commit 01b3201689
2 changed files with 10 additions and 10 deletions

View File

@ -29,11 +29,11 @@ VoxelStreamHeightmap::SdfMode VoxelStreamHeightmap::get_sdf_mode() const {
return (VoxelStreamHeightmap::SdfMode)_heightmap.settings.mode;
}
void VoxelStreamHeightmap::set_height_base(float base) {
_heightmap.settings.range.base = base;
void VoxelStreamHeightmap::set_height_start(float start) {
_heightmap.settings.range.base = start;
}
float VoxelStreamHeightmap::get_height_base() const {
float VoxelStreamHeightmap::get_height_start() const {
return _heightmap.settings.range.base;
}
@ -53,15 +53,15 @@ void VoxelStreamHeightmap::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sdf_mode", "mode"), &VoxelStreamHeightmap::set_sdf_mode);
ClassDB::bind_method(D_METHOD("get_sdf_mode"), &VoxelStreamHeightmap::get_sdf_mode);
ClassDB::bind_method(D_METHOD("set_height_base", "base"), &VoxelStreamHeightmap::set_height_base);
ClassDB::bind_method(D_METHOD("get_height_base"), &VoxelStreamHeightmap::get_height_base);
ClassDB::bind_method(D_METHOD("set_height_start", "start"), &VoxelStreamHeightmap::set_height_start);
ClassDB::bind_method(D_METHOD("get_height_start"), &VoxelStreamHeightmap::get_height_start);
ClassDB::bind_method(D_METHOD("set_height_range", "range"), &VoxelStreamHeightmap::set_height_range);
ClassDB::bind_method(D_METHOD("get_height_range"), &VoxelStreamHeightmap::get_height_range);
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel");
ADD_PROPERTY(PropertyInfo(Variant::INT, "sdf_mode", PROPERTY_HINT_ENUM, HeightmapSdf::MODE_HINT_STRING), "set_sdf_mode", "get_sdf_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_base"), "set_height_base", "get_height_base");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_start"), "set_height_start", "get_height_start");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_range"), "set_height_range", "get_height_range");
BIND_ENUM_CONSTANT(SDF_VERTICAL);

View File

@ -23,8 +23,8 @@ public:
void set_sdf_mode(SdfMode mode);
SdfMode get_sdf_mode() const;
void set_height_base(float base);
float get_height_base() const;
void set_height_start(float start);
float get_height_start() const;
void set_height_range(float range);
float get_height_range() const;
@ -37,11 +37,11 @@ protected:
const Vector3i bs = out_buffer.get_size();
bool use_sdf = channel == VoxelBuffer::CHANNEL_SDF;
if (oy > get_height_base() + get_height_range()) {
if (oy > get_height_start() + get_height_range()) {
// The bottom of the block is above the highest ground can go (default is air)
return;
}
if (oy + (bs.y << lod) < get_height_base()) {
if (oy + (bs.y << lod) < get_height_start()) {
// The top of the block is below the lowest ground can go
out_buffer.clear_channel(_channel, use_sdf ? 0 : _matter_type);
return;