Skip to content

Significant rendering update#20

Merged
samtherussell merged 7 commits intoTeachingTechnologistBeth:masterfrom
AliShug:master
Nov 27, 2016
Merged

Significant rendering update#20
samtherussell merged 7 commits intoTeachingTechnologistBeth:masterfrom
AliShug:master

Conversation

@AliShug
Copy link
Copy Markdown
Contributor

@AliShug AliShug commented Nov 26, 2016

In terms of UX:

  • Adds a simple persistence-of-vision effect to all modules using the LED and LEDRow parts. At high clock speeds, these lights remain lit rather than flashing randomly. Behaviour is fairly consistent across frames and seems to mimic the real-world appearance of e.g. the display at medium-high refresh rates.
  • Smoother and more responsive camera movement
  • Smoother, more responsive and more accurate zoom with analog support (works correctly with trackpads)
  • Significantly reduced CPU load when not interacting with the application
  • Zero CPU load when not interacting with the application and the simulation is paused

On the backend, this encompasses ditching the old 30Hz-locked view refresh, and creating a split between "static" and "dynamic" rendering, where the background grid and module shapes make up the static portion. Static content is rendered relatively infrequently, chiefly when the camera is moved or zoomed. Dynamic content - stuff that depends on the simulation state - is rendered passively at 30Hz (with persistence-of-vision) and is also updated whenever the static content is.

Should solve #16 and fixes long-standing problems with camera zoom.

AliShug and others added 7 commits November 17, 2016 12:36
Still runs with a 30Hz "ticker" thread, which I want to get rid of.
Simulation-triggered dynamic refresh is capped at 30Hz, static drawing
(includes a dynamic redraw) happens as needed on user interactions.
Dynamic refresh is capped at 30Hz, changes which occur faster than that
are shown using persistence-of-vision. In the new system, LEDs which
were turned on at any point between the last rendered refresh and this
one are displayed as being on. I also added backend support for
adjustable dynamic (simulation-driven) refresh rate, although this may
not be that useful.

Overhauled zoom to support a wider range of zoom levels and smooth zoom
in/out e.g. with trackpad. Finally fixed zoom-to-point: zooming in and
out rapidly no longer causes the camera location to jump around
randomly. Grid display is now disabled when extremely zoomed-out, which
greatly improves performance (lots of lines = bad).
This is still useful at low simulation speeds!
@samtherussell
Copy link
Copy Markdown
Collaborator

Your'e a super star! :-p Had a quick look and it all seems fine. Hopefully I won't get students complaining all the time how it kills there laptops. The for the sleep function we could probably just get away with sleeping in ms and scrap the busy wait because no actually cares about the actually speed of it, but I guess its not doing to much harm to the performance.

@samtherussell samtherussell merged commit 0e13231 into TeachingTechnologistBeth:master Nov 27, 2016
@samtherussell
Copy link
Copy Markdown
Collaborator

Just found a little bug. When opening files like
test.modsim.txt
the wire don't render properly until a mouse press forces the screen the screen to be redrawn. Had a little look... might be something to do with xml readin. It didn't show up before because the screen updates meant it was updates anyway in a fraction of a second. Any ideas??

@AliShug
Copy link
Copy Markdown
Contributor Author

AliShug commented Nov 29, 2016 via email

@samtherussell
Copy link
Copy Markdown
Collaborator

Yeah, that's what I thought, but I couldn't find it. I did a little more digging and I think it might be some thing to do with setting the start and end of besier paths. Ie. The XML reader never does it And I'm pretty sure it should. Having said that I couldn't seem to get working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants