MoI discussion forum
MoI discussion forum

Full Version: Constant Viewport refresh?

From: Fubax
22 Aug 2018   [#1]
Is there a way to refresh (have constant above 1 fps), when you don't move the camera?
Maybe some script with infinite loop?

Currently FPS is equal 0 when you don't interact with the viewport.
Constant refresh rate is needed for DirectX injector (ReShade) options menu, which adds Anti-aliasing.
From: Michael Gibson
22 Aug 2018   [#2] In reply to [#1]
Hi Fubax, sorry no I don't know of a way to do that without having a severe impact on performance.

MoI isn't set up like a game that has a constantly running render loop, MoI only redraws the screen when it needs it.

- Michael
From: Fubax
22 Aug 2018   [#3] In reply to [#2]
Hi Michael, I don't mind performance impact. I'am fully aware it will eat a lot of resources. But anyway I need to sometimes enable render loop.
Can you share how-to do so?
From: Michael Gibson
22 Aug 2018   [#4] In reply to [#3]
Hi Fubax, well I really don't recommend it but you could try inserting a some script like this inside of CommandBar.htm :

code:
		<script>
			var g_intervalID = null;

			function constantRedrawTimerFunc()
			{
				moi.ui.redrawViewports();
			}

			function startConstantRedraw()
			{
				if ( !g_intervalID )
					g_intervalID = window.setInterval( constantRedrawTimerFunc, 300 ); // call timerfunc every 300 ms.
			}

			function stopConstantRedraw()
			{
				if ( g_intervalID )
				{
					window.clearInterval( g_intervalID );
					g_intervalID = null;
				}
			}
		</script>


Then set up 2 shortcut keys with:

script: moi.ui.commandBar.startConstantRedraw();

script: moi.ui.commandBar.stopConstantRedraw();


The call to moi.ui.redrawViewports(); will not immediately draw the viewports, it will mark them as needing an update and they'll get redrawn when the message queue is next emptied.

- Michael
From: Fubax
23 Aug 2018   [#5] In reply to [#4]
Thank you Michael, it works. I only had to use it temporally so the implementation is very nice.