Elvas Tower: Mouse control for 3D Cabs - Elvas Tower

Jump to content

Posting Rules

All new threads will be started by members of the Open Rails team, Staff, and/or Admins. Existing threads started in other forums may get moved here when it makes sense to do so.

Once a thread is started any member may post replies to it.
  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Mouse control for 3D Cabs Rate Topic: -----

#21 User is offline   ErickC 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,001
  • Joined: 18-July 17
  • Gender:Male
  • Location:Hastings, MN, US
  • Simulator:ORTS
  • Country:

Posted 20 September 2017 - 11:35 AM

The mouse controls now work, but it seems the click spots are located way out in left field. Think there's any way we could define where they would be? As it is, searching for a little spot way far away from the control you're trying to operate is a bit counter-intuitive.

#22 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 20 September 2017 - 02:15 PM

View PostCsantucci, on 20 September 2017 - 10:45 AM, said:

I've tested it and it works OK to me (consist AT3, using the .zip file with the complete trainset). To catch the control the mouse pointer must appear, therefore, if you don't see the mouse, first move it slowly to see the pointer and then actuate.


Ok. Because it works without problems to you, I suspected that we have different options selected. So I found the problem: It is if "dynamic shadows" is selected. Then you get strange effects (at least I get them on my computer). Hovering over a control make the mouse pointer flashing and after 2 seconds it will disappear every time. Sometimes the shown actuation control info even changes without moving the mouse.
Do you have the same effects when using dynamic shadows, Carlo?

#23 User is offline   ErickC 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,001
  • Joined: 18-July 17
  • Gender:Male
  • Location:Hastings, MN, US
  • Simulator:ORTS
  • Country:

Posted 20 September 2017 - 02:28 PM

Can confirm that turning off dynamic shadows cures the random nature of click spots. Odd!

#24 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 20 September 2017 - 02:38 PM

I tried it now without "dynamic shadows" a bit longer...and it works excellent! Good for OR to have this feature now!

#25 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 20 September 2017 - 10:56 PM

Jacob,
thank you for having successfully chased it! Yes, I had dynamic shadows disabled. By enabling them, I get the problem too. Now I hope not to need too much time to solve this.

#26 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 21 September 2017 - 01:33 AM

I have tested and I am in difficulty. What I am writing here is for someone with good knowledge in XNA, and especially for James. The problem is that the calculation of the FarPoint (called maxPointSource here https://msdn.microso....unproject.aspx ) by ViewPort.Unproject oscillates between a correct value and a wrong value when Dynamic Shadows are enabled, therefore not giving a stable catch (cabview control found) result. I attach a logfile with trace lines showing that. I checked all inputs to the ViewPort.Unproject function, but they are the same when the result is OK and when the result is wrong.
Attached File  OpenRailsLog.zip (5.22K)
Number of downloads: 461

P.S.
Checking further shows that the problem disappears avoiding execution of DrawShadows in RenderFrame.cs, or even avoiding only execution of these two lines
            graphicsDevice.SetRenderTarget(0, ShadowMapRenderTarget[shadowMapIndex]);
            graphicsDevice.DepthStencilBuffer = ShadowMapStencilBuffer;

and this line
            ShadowMap[shadowMapIndex] = ShadowMapRenderTarget[shadowMapIndex].GetTexture();

within such method.

#27 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 22 September 2017 - 09:32 AM

OK, at last solution seems of having been found. I hope to attach this evening the new patch. The shadow code changes the Viewport, which is used to compute NearPoint and FarPoint. So the default Viewport has to be saved in order to be always used to compute such points.

#28 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 22 September 2017 - 12:06 PM

In post #13 I have attached a new release of the patch that solves the problem created by the Dynamic Shadows.

#29 User is offline   jonas 

  • Engineer
  • Group: Status: Contributing Member
  • Posts: 548
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 22 September 2017 - 02:26 PM

With patch rev#4 it now works fine with dynamic shadows on my pc.

Your last posts sounds as it was a bit tricky to adjust it in the code. Thanks for solving it!

#30 User is offline   ErickC 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,001
  • Joined: 18-July 17
  • Gender:Male
  • Location:Hastings, MN, US
  • Simulator:ORTS
  • Country:

Posted 22 September 2017 - 03:04 PM

It works well here, too.

  • 6 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users