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

Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport #88270

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Feb 13, 2024

Follow up #87164.

Current master build is failed by unqualified-id.

Previously this problem avoid by undef, but "near" and "far" are now reserved words generally, and that PR changed the reserved words in some files.

However other files also contained reserved words that needed to be changed.

(Although I feel Windows.h is too arrogant to use those common noun words as reserved words...🤔)

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

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

This rename seems like it should have a small blast radius aside from git clutter.

@bruvzg
Copy link
Member

bruvzg commented Feb 13, 2024

There are a few more cases of "far"/"near" in the tests/scene/test_camera_3d.h:

constexpr float near = 0.2f;
constexpr float far = 995.0f;
constexpr float fov = 120.0f;
constexpr float size = 7.0f;
constexpr float h_offset = 1.1f;
constexpr float v_offset = -1.6f;
const Vector2 frustum_offset(5, 7);
test_camera->set_near(near);
CHECK(test_camera->get_near() == near);
test_camera->set_far(far);
CHECK(test_camera->get_far() == far);

@TokageItLab
Copy link
Member Author

Now I believe all of them have been exterminated..

@akien-mga
Copy link
Member

Some of those changes were likely not needed as there was:

core/math/aabb.cpp
121:#undef near
122:#undef far

servers/rendering/renderer_scene_render.cpp
51:#undef near
52:#undef far

scene/resources/camera_attributes.cpp
377:#undef near
378:#undef far

scene/debugger/scene_debugger.cpp
76:#undef near
77:#undef far

(added in fe4850c)

But I would then suggest to keep those changes and remove the #undefs which were added as hacky workaround.

@TokageItLab
Copy link
Member Author

Alright, I removed #undef.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Looks great!

@akien-mga akien-mga merged commit dfe226b into godotengine:master Feb 13, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@TokageItLab TokageItLab deleted the avoid-near-far branch February 14, 2024 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants