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
[CSM] Add function to set the FOV of the local player #5797
Conversation
Thanks but you missed the feature merge window, it will be delayed on next release |
I understand. :'( |
doc/client_lua_api.md
Outdated
* Act as if `message` was typed by the player into the terminal. | ||
* `minetest.run_server_chatcommand(cmd, param)` | ||
* Alias for `minetest.send_chat_message("/" .. cmd .. " " .. param)` | ||
* `minetest.clear_out_chat_queue()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nerzhul It was a mistake when copying stuff... I will fix it in a future commit.
src/camera.h
Outdated
return m_cache_fov; | ||
} | ||
|
||
inline f32 getZoomFov() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all getter should be const functions
What about the zoom feature we've already got? This PR in combination with a key press getter function will make the required privilege superflous. |
@SmallJoker The minimum value of zoom fov is much lower than the one of the normal fov. |
Okay for me |
src/camera.h
Outdated
inline void setFov(f32 fov) | ||
{ | ||
m_cache_fov = fov; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite nonsense to have getter and setter functions for m_cache_fov
and m_cache_zoom_fov
. If there were boundary checks, this would be acceptable but how it is right now you could make them public as cache_zoom
.
Please let members private it's an object not a structure.
|
@SmallJoker the range is limited because of this, right here. |
@nerzhul Well, we already have public members for objects. The best example for this is the @bigfoot547 I'm talking about limits when setting the |
@SmallJoker yes i know we have that ugly interface in player; i started to cleaning up years ago by moving some attributes to PlayerSAO/RemotePlayer or LocalPlayer for client, but not finished yet. Having getter and setters has no performance impact on code (they are inlined in majority cases), and we respect properly the difference between a struct and a class (class intend to have private members and struct public members) |
doc/client_lua_api.md
Outdated
@@ -842,16 +842,25 @@ Please do not try to access the reference until the camera is initialized, other | |||
* Returns with same syntax as above | |||
* `get_fov()` | |||
* Returns: | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix those spaces ?
doc/client_lua_api.md
Outdated
* `save_fov()` | ||
* Sets the "fov" setting to `get_fov().actual` | ||
* `save_zoom_fov()` | ||
* Sets the "zoom_fov" setting to `get_fov().zoom` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add a persist
boolean argument to the FOV setters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
A description in the first post would be nice, makes review easier. |
SmallJoker wrote:
@SmallJoker did you get a response to this?
|
why do we even have a zoom privilege in the first place? |
See the PR thread that added zoom. Zoom adds a 'superpower' to a player so a restriction was required for survival such that a player would need to craft a telescope type item before being able to zoom. |
What's wrong with the current implementation? |
Sorry didn't see the line above, seems ok then. |
Thanks @paramat |
doc/client_lua_api.md
Outdated
@@ -841,17 +841,25 @@ Please do not try to access the reference until the camera is initialized, other | |||
* `get_camera_mode()` | |||
* Returns with same syntax as above | |||
* `get_fov()` | |||
* All values are in degrees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation should match other lines in this section.
doc/client_lua_api.md
Outdated
* Pass true to the second argument to save the zoom fov to the setting. | ||
* `set_zoom_fov(fov_degrees, [persist])` | ||
* Sets the FOV for the local player when zoomed in | ||
* Pass true to the second argument to save the zoom fov to the setting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation should match other lines in this section.
doc/client_lua_api.md
Outdated
y = float, -- Vertical FOV | ||
max = float, -- The maximum of x and y | ||
actual = integer, -- What the FOV of the player would be (not adjusted for zooming) | ||
zoom = integer -- What the FOV of the player when zooming would be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the meaning of 'would be' in these lines? How is it different from x,y? This needs clarifying.
@paramat: I have rebased and addressed your reviews, so can you please review again? |
Conflicts: src/camera.h src/script/lua_api/l_camera.cpp
needs a rebase again... |
Rebased. @SmallJoker @paramat Please review. I don't want this PR to sit doing nothing :L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be added to CSM flavours.
Ok, I'll look into it |
👎 nerzhul this can't be merged because it conflicts with the zoomFOV changes being made by lhofhansl and me, and has errors. In this PR camera FOV is now restricted to 7 to 160 when it needs to range from 1 to 160. Is this useful for server-provided CSM? That is our new decider on CSM features, as CSM has to be as minimal as possible. If it is, it needs to be controlled by flavors as it is something that gives a player an advantage: if the client has distant mapblocks loaded, it can look at those and magnify them. |
👎 Actually, sorry but the zoom FOV parts of this can't be merged in any form, because zoom now loads and/or generates distant world like a telescope, a powerful ability that must be under complete server control and shouldn't be added to CSM. It also conflicts with the intentions of recent zoom changes by lhofhansl and myself. If you split off the normal FOV feature that might be fine. |
:/ well, I guess there's only one thing to say. |
No description provided.