Comments (7)
@ProjectPhysX I took mouse_sensitivity = 0.01
. It looks like the reaction is getting slower but I still cannot control a view angle properly.
from fluidx3d.
I'm probably telling you something you already know here but you just turn off mouse-input with the "u" key and alt-tab in/out of the program where required to avoid clicking the app window and re-enabling the mouse. I do a lot of remote desktop stuff to the workstation and just turn down the multipliers for I/J/K/L keys, using the mouse is a write-off on remote sessions for me.
from fluidx3d.
Hi @rodionstepanov and @SLGY,
I think the root cause here is that the Windows Remote Desktop client fails to execute the SetCursorPos
WinAPI command correctly, so it does not center the cursor after reading the distance between cursor and screen center and you see super fast uncontrollable rotation.
I've written an alternative mouse input method that does not rely on SetCursorPos
and should work better on remote systems. Please replace the entire LRESULT CALLBACK WndProc(...) {...}
function with this code:
LRESULT CALLBACK WndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam) {
if(message==WM_DESTROY) {
running = false;
PostQuitMessage(0);
exit(0);
} else if(message==WM_MOUSEMOVE) {
static int last_x=(int)camera.width/2, last_y=(int)camera.height/2;
const int new_x=(int)LOWORD(lParam), new_y=(int)HIWORD(lParam);
camera.input_mouse_dragged(new_x-last_x, new_y-last_y);
last_x = new_x;
last_y = new_y;
} else if(message==WM_MOUSEWHEEL) {
if((short)HIWORD(wParam)>0) camera.input_scroll_up(); else camera.input_scroll_down();
} else if(message==WM_LBUTTONDOWN||message==WM_MBUTTONDOWN||message==WM_RBUTTONDOWN) {
ShowCursor(!camera.lockmouse); // show/hide cursor
camera.input_key('U');
} else if(message==WM_KEYDOWN) {
int key = key_windows((int)wParam);
if(key=='U') ShowCursor(!camera.lockmouse); // show/hide cursor
camera.set_key_state(key, true);
key_bindings(key);
} else if(message==WM_KEYUP) {
int key = key_windows((int)wParam);
camera.set_key_state(key, false);
}
return DefWindowProc(window, message, wParam, lParam);
}
This workaround is not a suitable general solution however, as rotation stops as soon as the cursor hits the screen boundaries and on small screens you can't fully rotate ±90° vertically and 360° horizontally. So I put this code only here and not in the repo.
As 2 alternatives with the mouse input version in the repo, you can try:
- Disable hiding the cursor, by commenting out all
ShowCursor(false);
lines insrc/graphics.cpp
. Apparently hiding the cursor is one of the factors that breakSetCursorPos
. - In Windows Group Policy Editor, in
Local Computer Policy
->Computer Configuration
->Administrative Templates
->Windows Components
->Remote Desktop Services
->Remote Desktop Session Host
->Remote Session Environment
, setUse WDDM graphic display driver for Remote Desktop Connections
todisable
.
Kind regards,
Moritz
from fluidx3d.
Hi @ProjectPhysX!
Both recipes work but I stay with first one. No issue any more. Thanks a lot. I express my deepest gratitude and respect to you. It is very cool what you are doing.
from fluidx3d.
Hi @rodionstepanov,
thanks for reporting this. It's the age-old poor design choice of Microsoft's SetCursorPos
itself triggering a WM_MOUSEMOVE
event, when setting the cursor back to the center of the screen. Usually in my implementation this is not an issue, as screen_width/2
ad screen_height/2
are subtracted and the resulting movement upon cursor centering is 0/0
.
However, in another poor design choice by Microsoft, when the remote screen resolution is different and/or off-set compared to the client screen resolution, SetCursorPos(width/2, height/2)
works on client and the reported position from WM_MOUSEMOVE
is on remote, and when they mismatch, it adds the off-set mouse movement 60 times a second and rotates the camera very fast.
I have now changed the mouse input routine on Windows to avoid WM_MOUSEMOVE
alltogether. Please test this new version on your remote setup and tell me if it resolves the bug!
Kind regards,
Moritz
from fluidx3d.
I'm sorry but it does not resolve the bug. I've test with setup for 3D Taylor-Green vortices; Looks like sensitivity is very high.
from fluidx3d.
@rodionstepanov can you try if reducing the mouse_sensitivity
constant helps?
from fluidx3d.
Related Issues (20)
- Code fails in interactive mode sending "xcb_xlib_threads_sequence_lost". HOT 1
- Status file and Images not generated on a Linux Server HOT 5
- FR: Cubed Sphere Lattice HOT 4
- Calculation of liquid that does not fit in memory HOT 1
- neural network liquids HOT 1
- LBM has no member "graphics" HOT 1
- C2084 function 'int main(int,char* {})' already has a body............in file graphics. cpp HOT 4
- D3Q15 Dam Breaking Expanding Water HOT 3
- (Not an issue) - Porting to Perl and Python; first steps... making code a bit more standalone and general-purpose... HOT 1
- Wierdly behaving 3D objects / Meshes HOT 2
- Visualizing rho and u in Paraview HOT 3
- Less brittle Linux OpenCL setup instructions HOT 3
- No progress - stuck at Step 0 (benchmark works) HOT 2
- cannot find file "FluidX3D.exe" HOT 2
- Including the scale, frame-info, and copyright notice inside the output PNG files ? HOT 1
- INTERACTIVE_GRAPHICS_ASCII broken by the "Made camera movement/rotation/zoom behavior independent of framerate" feature? HOT 1
- Struct of Arrays vs Arrays of Structs: Possible Oversight? HOT 2
- Connection to flow5 possible?
- Order of pairs is non uniform between Lattice sets HOT 2
- Applying a force during simulation to simulate main line water pressure HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluidx3d.