Skip to content
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

Added getFPS() method to get current fps #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vabada
Copy link

@vabada vabada commented Nov 20, 2014

In the development of a script to send periodically statistics of performance of three.js examples to a server I needed this functionality.
I saw this question in StackOverflow (http://stackoverflow.com/questions/5531100) so I though it's maybe helpful for other people.

In the development of a script to send periodically statistics of performance of three.js examples to a server I needed this functionality
@ashconnell
Copy link

+1 it would also be nice if you could get an average fps over the time it was instantiated

Copy link

@Mothman8658 Mothman8658 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show ads

@MasterJames
Copy link

Mine #53
points #33
I've wondered if this part could use a little more attention?
In the end it's a higher level problem that has many solutions so I think it's up to each dev to build/roll their tracking of that somehow? at least I suspect that's how it is with the Stats. Super light weight is maybe the priority. It's easy to add from these PRs if you need it too I supposed.
Anyway I've advocated a complex system to manage and optimize parameters like spot light shadow map res. etc. the list goes on for relative camera distance etc. Then you want the FPS monitoring built on top of each class, so it's probably best not in the core.
I suppose then a side project would be in order that git references THREEjs and injects these kinds of class enhancements.
Another example I suggested was optionally be able to pass an object to the creation functions for all objects/classes. Then you'd check if the first argument is an Object and breakout the settings, or else do it the original (possibly dated) way (argument list). This is also agreeably easy to do, but maybe not appropriate and is complicated and unclear even if supper useful when working with a nosql database.
[So only other suggestion I have on all this is to open up an "Officially" only skeletal more experimental Repo for these ideas that could find maybe their way into the system eventually, but would reside more optionally. Obviously these extra efforts would need delegation to volunteer(s).]

@GreysonR
Copy link

I found a good alternative for this
Around line 86 you'll find this: fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
Below that you can add stats.fps = ( frames * 1000 ) / ( time - prevTime );
Then when you want to get the fps, it is automatically stored in stats.fps

@advancedsoftwarecanada
Copy link

Will confirm this working, but I set as a window.StatsFPS = ......

I was having issues with my scope for a weird project.

@christopherball
Copy link

christopherball commented Dec 13, 2023

Seeing as this issue has been open for 9+ years, out of necessity for my own work, I've created a fork and added the missing functionality. If this ever gets fixed in the mainline, I'd be happy to retire my fork ;). Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants