Domain for a GLFW window.
More...
#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/app/al_OpenGLGraphicsDomain.hpp>
|
std::mutex | mSubdomainLock |
|
double | mTimeDrift {0.0} |
|
std::vector< std::pair< std::shared_ptr< SynchronousDomain >, bool > > | mSubDomainList |
|
std::vector< ParameterMeta * > | mParameters |
|
Domain for a GLFW window.
set the onNewFrame, preOnDraw, onDraw and postOnDraw to determine what is drawn in the window.
You can get mouse and keyboard events through the Window instance avaialable through window()
Definition at line 89 of file al_OpenGLGraphicsDomain.hpp.
◆ cleanup()
◆ cleanupSubdomains()
bool al::ComputationDomain::cleanupSubdomains |
( |
bool |
pre = false | ) |
|
|
protectedinherited |
cleanup subdomains
- Parameters
-
pre | cleanup prepended domains if true, otherwise appended domains. |
- Returns
- true if all cleanup sucessful.
You must call this function twice: once for prepended and then for appended domains.
◆ init()
initialize
- Parameters
-
- Returns
- true if init succeeded
Multiple calls to init() should be allowed.
Reimplemented from al::ComputationDomain.
◆ initializeSubdomains()
bool al::ComputationDomain::initializeSubdomains |
( |
bool |
pre = false | ) |
|
|
protectedinherited |
initializeSubdomains should be called within the domain's initialization function
- Parameters
-
pre | initialize prepended domains if true, otherwise appended domains. |
- Returns
- true if all initializations sucessful.
You must call this function twice: once for prepended and then for appended domains.
◆ newSubDomain()
template<class DomainType >
std::shared_ptr< DomainType > al::ComputationDomain::newSubDomain |
( |
bool |
prepend = false | ) |
|
|
inherited |
Add a synchronous domain to this domain.
- Parameters
-
prepend | Determines whether the sub-domain should run before or after this domain |
- Returns
- the created domain.
The domain specified by DomainType must inherit from SynchronousDomian. It will trigger an assertion if not (will have undefined behavior for Release builds) This operation is thread safe if the domain can pause itself, but it is blocking, so there are no guarantees that it will not interefere with the timely running of the domain.
Definition at line 218 of file al_ComputationDomain.hpp.
◆ parameters()
std::vector<ParameterMeta *> al::ComputationDomain::parameters |
( |
| ) |
|
|
inlineinherited |
Return a list of parameters that control this domain.
- Returns
- list of parameters
The parameters provided here provide runtime "continuous" parameters, for example like audio gain or eye separation. There should be a clear distinction between values that need to be set on domain intialization that must remain immutable during domain operation and parameters provided here that provide continuous adjustment to the domain's operation.
Definition at line 104 of file al_ComputationDomain.hpp.
◆ registerCleanupCallback()
void al::ComputationDomain::registerCleanupCallback |
( |
std::function< void(ComputationDomain *)> |
callback | ) |
|
|
inherited |
register callbacks to be called in the cleanup() function
- Parameters
-
◆ registerInitializeCallback()
void al::ComputationDomain::registerInitializeCallback |
( |
std::function< void(ComputationDomain *)> |
callback | ) |
|
|
inherited |
register callbacks to be called in the init() function
- Parameters
-
◆ removeSubDomain()
void al::ComputationDomain::removeSubDomain |
( |
std::shared_ptr< SynchronousDomain > |
subDomain | ) |
|
|
inherited |
Remove a subdomain.
- Parameters
-
subDomain | This operation is thread safe, but it might block causing drops or missed deadlines for the parent domain. If this is a problem, the domain should be stopped prior to adding/removeing sub-domains. |
◆ tick()
bool al::GLFWOpenGLWindowDomain::tick |
( |
| ) |
|
|
overridevirtual |
Execute a pass of the domain.
- Returns
- true if execution of the domain succeeded
Reimplemented from al::SynchronousDomain.
◆ tickSubdomains()
bool al::ComputationDomain::tickSubdomains |
( |
bool |
pre = false | ) |
|
|
protectedinherited |
execute subdomains
- Parameters
-
pre | execute prepended domains if true, otherwise appended domains. |
- Returns
- true if all execution sucessful.
You must call this function twice: once for prepended and then for appended domains.
◆ timeDelta()
double al::ComputationDomain::timeDelta |
( |
| ) |
|
|
inlineinherited |
Return time delta with respect to previous processing pass for this domain.
- Returns
- time delta
The time delta may be set internally by the domain so that it is available whenever the domain ticks. It might be 0 for domains that don't support this functionality or that are tied to strict hardware clocks where this information is not necessary
Definition at line 75 of file al_ComputationDomain.hpp.
◆ onDraw
std::function<void(Graphics &)> al::GLFWOpenGLWindowDomain::onDraw = [](Graphics &g) { g.clear(0.3); } |
◆ onNewFrame
std::function<void()> al::GLFWOpenGLWindowDomain::onNewFrame |
Initial value:= [this]() {
mNav.
smooth(std::pow(0.0001, mTimeDrift));
mNav.
step(mTimeDrift * mParent->fps());
}
void step(double dt=1)
Accumulate pose based on velocity.
double smooth() const
Get smoothing amount.
Called once on every frame loop
Definition at line 102 of file al_OpenGLGraphicsDomain.hpp.
◆ postOnDraw
std::function<void()> al::GLFWOpenGLWindowDomain::postOnDraw = []() {} |
◆ preOnDraw
std::function<void()> al::GLFWOpenGLWindowDomain::preOnDraw |
Initial value:= [this]() {
mGraphics->framebuffer(FBO::DEFAULT);
mGraphics->viewport(0, 0, mWindow->fbWidth(), mWindow->fbHeight());
mGraphics->resetMatrixStack();
mGraphics->camera(mView);
mGraphics->color(1, 1, 1);
}
Called once before every draw call, when view and context has been prepared
Definition at line 111 of file al_OpenGLGraphicsDomain.hpp.
The documentation for this class was generated from the following file: