Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeometryInstance: Remove unimplemented LOD properties #57196

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions doc/classes/GeometryInstance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@
<member name="lightmap_scale" type="int" setter="set_lightmap_scale" getter="get_lightmap_scale" enum="GeometryInstance.LightmapScale" default="0">
Scale factor for the generated baked lightmap. Useful for adding detail to certain mesh instances.
</member>
<member name="lod_max_distance" type="float" setter="set_lod_max_distance" getter="get_lod_max_distance" default="0.0">
The GeometryInstance's max LOD distance.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_max_hysteresis" type="float" setter="set_lod_max_hysteresis" getter="get_lod_max_hysteresis" default="0.0">
The GeometryInstance's max LOD margin.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_min_distance" type="float" setter="set_lod_min_distance" getter="get_lod_min_distance" default="0.0">
The GeometryInstance's min LOD distance.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_min_hysteresis" type="float" setter="set_lod_min_hysteresis" getter="get_lod_min_hysteresis" default="0.0">
The GeometryInstance's min LOD margin.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="material_overlay" type="Material" setter="set_material_overlay" getter="get_material_overlay">
The material overlay for the whole geometry.
If a material is assigned to this property, it will be rendered on top of any other active material for all the surfaces.
Expand Down
19 changes: 0 additions & 19 deletions doc/classes/VisualServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1338,14 +1338,6 @@
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
</description>
</method>
<method name="instance_geometry_set_as_instance_lod">
<return type="void" />
<argument index="0" name="instance" type="RID" />
<argument index="1" name="as_lod_of_instance" type="RID" />
<description>
Not implemented in Godot 3.x.
</description>
</method>
<method name="instance_geometry_set_cast_shadows_setting">
<return type="void" />
<argument index="0" name="instance" type="RID" />
Expand All @@ -1354,17 +1346,6 @@
Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance.cast_shadow].
</description>
</method>
<method name="instance_geometry_set_draw_range">
<return type="void" />
<argument index="0" name="instance" type="RID" />
<argument index="1" name="min" type="float" />
<argument index="2" name="max" type="float" />
<argument index="3" name="min_margin" type="float" />
<argument index="4" name="max_margin" type="float" />
<description>
Not implemented in Godot 3.x.
</description>
</method>
<method name="instance_geometry_set_flag">
<return type="void" />
<argument index="0" name="instance" type="RID" />
Expand Down
61 changes: 0 additions & 61 deletions scene/3d/visual_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,42 +201,6 @@ GeometryInstance::LightmapScale GeometryInstance::get_lightmap_scale() const {
return lightmap_scale;
}

void GeometryInstance::set_lod_min_distance(float p_dist) {
lod_min_distance = p_dist;
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}

float GeometryInstance::get_lod_min_distance() const {
return lod_min_distance;
}

void GeometryInstance::set_lod_max_distance(float p_dist) {
lod_max_distance = p_dist;
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}

float GeometryInstance::get_lod_max_distance() const {
return lod_max_distance;
}

void GeometryInstance::set_lod_min_hysteresis(float p_dist) {
lod_min_hysteresis = p_dist;
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}

float GeometryInstance::get_lod_min_hysteresis() const {
return lod_min_hysteresis;
}

void GeometryInstance::set_lod_max_hysteresis(float p_dist) {
lod_max_hysteresis = p_dist;
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}

float GeometryInstance::get_lod_max_hysteresis() const {
return lod_max_hysteresis;
}

void GeometryInstance::_notification(int p_what) {
}

Expand Down Expand Up @@ -299,18 +263,6 @@ void GeometryInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lightmap_scale", "scale"), &GeometryInstance::set_lightmap_scale);
ClassDB::bind_method(D_METHOD("get_lightmap_scale"), &GeometryInstance::get_lightmap_scale);

ClassDB::bind_method(D_METHOD("set_lod_max_hysteresis", "mode"), &GeometryInstance::set_lod_max_hysteresis);
ClassDB::bind_method(D_METHOD("get_lod_max_hysteresis"), &GeometryInstance::get_lod_max_hysteresis);

ClassDB::bind_method(D_METHOD("set_lod_max_distance", "mode"), &GeometryInstance::set_lod_max_distance);
ClassDB::bind_method(D_METHOD("get_lod_max_distance"), &GeometryInstance::get_lod_max_distance);

ClassDB::bind_method(D_METHOD("set_lod_min_hysteresis", "mode"), &GeometryInstance::set_lod_min_hysteresis);
ClassDB::bind_method(D_METHOD("get_lod_min_hysteresis"), &GeometryInstance::get_lod_min_hysteresis);

ClassDB::bind_method(D_METHOD("set_lod_min_distance", "mode"), &GeometryInstance::set_lod_min_distance);
ClassDB::bind_method(D_METHOD("get_lod_min_distance"), &GeometryInstance::get_lod_min_distance);

ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin);
ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin);

Expand All @@ -329,14 +281,6 @@ void GeometryInstance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate_lightmap"), "set_generate_lightmap", "get_generate_lightmap");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lightmap_scale", PROPERTY_HINT_ENUM, "1x,2x,4x,8x"), "set_lightmap_scale", "get_lightmap_scale");

ADD_GROUP("LOD", "lod_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_distance", "get_lod_min_distance");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_hysteresis", "get_lod_min_hysteresis");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_distance", "get_lod_max_distance");
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_hysteresis", "get_lod_max_hysteresis");

//ADD_SIGNAL( MethodInfo("visibility_changed"));

BIND_ENUM_CONSTANT(LIGHTMAP_SCALE_1X);
BIND_ENUM_CONSTANT(LIGHTMAP_SCALE_2X);
BIND_ENUM_CONSTANT(LIGHTMAP_SCALE_4X);
Expand All @@ -354,11 +298,6 @@ void GeometryInstance::_bind_methods() {
}

GeometryInstance::GeometryInstance() {
lod_min_distance = 0;
lod_max_distance = 0;
lod_min_hysteresis = 0;
lod_max_hysteresis = 0;

for (int i = 0; i < FLAG_MAX; i++) {
flags[i] = false;
}
Expand Down
16 changes: 0 additions & 16 deletions scene/3d/visual_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ class GeometryInstance : public VisualInstance {
ShadowCastingSetting shadow_casting_setting;
Ref<Material> material_override;
Ref<Material> material_overlay;
float lod_min_distance;
float lod_max_distance;
float lod_min_hysteresis;
float lod_max_hysteresis;

float extra_cull_margin;

Expand All @@ -135,18 +131,6 @@ class GeometryInstance : public VisualInstance {
void set_lightmap_scale(LightmapScale p_scale);
LightmapScale get_lightmap_scale() const;

void set_lod_min_distance(float p_dist);
float get_lod_min_distance() const;

void set_lod_max_distance(float p_dist);
float get_lod_max_distance() const;

void set_lod_min_hysteresis(float p_dist);
float get_lod_min_hysteresis() const;

void set_lod_max_hysteresis(float p_dist);
float get_lod_max_hysteresis() const;

virtual void set_material_override(const Ref<Material> &p_material);
Ref<Material> get_material_override() const;

Expand Down
3 changes: 0 additions & 3 deletions servers/visual/visual_server_raster.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,6 @@ class VisualServerRaster : public VisualServer {
BIND2(instance_geometry_set_material_override, RID, RID)
BIND2(instance_geometry_set_material_overlay, RID, RID)

BIND5(instance_geometry_set_draw_range, RID, float, float, float, float)
BIND2(instance_geometry_set_as_instance_lod, RID, RID)

#undef BINDBASE
//from now on, calls forwarded to this singleton
#define BINDBASE VSG::canvas
Expand Down
5 changes: 0 additions & 5 deletions servers/visual/visual_server_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,11 +1569,6 @@ void VisualServerScene::instance_geometry_set_material_overlay(RID p_instance, R
}
}

void VisualServerScene::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) {
}
void VisualServerScene::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) {
}
Comment on lines -1572 to -1575
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone curious, this is the core part where the implementation is missing. Everything else which is removed in this PR is just scaffolding to expose the feature that should be implemented here (but isn't).


void VisualServerScene::_update_instance(Instance *p_instance) {
p_instance->version++;

Expand Down
3 changes: 0 additions & 3 deletions servers/visual/visual_server_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,6 @@ class VisualServerScene {
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material);
virtual void instance_geometry_set_material_overlay(RID p_instance, RID p_material);

virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin);
virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance);

_FORCE_INLINE_ void _update_instance(Instance *p_instance);
_FORCE_INLINE_ void _update_instance_aabb(Instance *p_instance);
_FORCE_INLINE_ void _update_dirty_instance(Instance *p_instance);
Expand Down
3 changes: 0 additions & 3 deletions servers/visual/visual_server_wrap_mt.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,6 @@ class VisualServerWrapMT : public VisualServer {
FUNC2(instance_geometry_set_material_override, RID, RID)
FUNC2(instance_geometry_set_material_overlay, RID, RID)

FUNC5(instance_geometry_set_draw_range, RID, float, float, float, float)
FUNC2(instance_geometry_set_as_instance_lod, RID, RID)

/* CANVAS (2D) */

FUNCRID(canvas)
Expand Down
2 changes: 0 additions & 2 deletions servers/visual_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2145,8 +2145,6 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("instance_geometry_set_cast_shadows_setting", "instance", "shadow_casting_setting"), &VisualServer::instance_geometry_set_cast_shadows_setting);
ClassDB::bind_method(D_METHOD("instance_geometry_set_material_override", "instance", "material"), &VisualServer::instance_geometry_set_material_override);
ClassDB::bind_method(D_METHOD("instance_geometry_set_material_overlay", "instance", "material"), &VisualServer::instance_geometry_set_material_overlay);
ClassDB::bind_method(D_METHOD("instance_geometry_set_draw_range", "instance", "min", "max", "min_margin", "max_margin"), &VisualServer::instance_geometry_set_draw_range);
ClassDB::bind_method(D_METHOD("instance_geometry_set_as_instance_lod", "instance", "as_lod_of_instance"), &VisualServer::instance_geometry_set_as_instance_lod);

ClassDB::bind_method(D_METHOD("instances_cull_aabb", "aabb", "scenario"), &VisualServer::_instances_cull_aabb_bind, DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("instances_cull_ray", "from", "to", "scenario"), &VisualServer::_instances_cull_ray_bind, DEFVAL(RID()));
Expand Down
3 changes: 0 additions & 3 deletions servers/visual_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -964,9 +964,6 @@ class VisualServer : public Object {
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
virtual void instance_geometry_set_material_overlay(RID p_instance, RID p_material) = 0;

virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) = 0;

/* CANVAS (2D) */

virtual RID canvas_create() = 0;
Expand Down