Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
TissueForge::Simulator Struct Reference

The Simulator is the entry point to simulation, this is the very first object that needs to be initialized before any other method can be called. All the methods of the Simulator are static, but the constructor needs to be called first to initialize everything. More...

#include <tfSimulator.h>

Inheritance diagram for TissueForge::Simulator:
Collaboration diagram for TissueForge::Simulator:

Classes

struct  Config
 
class  GLConfig
 OpenGL context configuration. More...
 

Public Types

enum  WindowFlags : std::uint16_t {
  Fullscreen = 1 << 0 , Borderless = 1 << 1 , Resizable = 1 << 2 , Hidden = 1 << 3 ,
  Maximized = 1 << 4 , Minimized = 1 << 5 , AlwaysOnTop = 1 << 6 , AutoIconify = 1 << 7 ,
  Focused = 1 << 8 , Contextless = 1 << 9
}
 Window flag. More...
 
enum class  EngineIntegrator : int { FORWARD_EULER = TissueForge::EngineIntegrator::FORWARD_EULER , RUNGE_KUTTA_4 = TissueForge::EngineIntegrator::RUNGE_KUTTA_4 }
 
enum  Key { NONE , WINDOWLESS , GLFW }
 
enum  Options {
  Windowless = 1 << 0 , glfw = 1 << 1 , GlForwardCompatible = 1 << 2 , GlNoError = 1 << 3 ,
  GlDebug = 1 << 4 , GlStereo = 1 << 5
}
 
enum class  DpiScalingPolicy : std::uint8_t { Virtual = 2 , Physical = 3 , Default = Virtual }
 
enum  Flags { Running = 1 << 0 }
 

Public Member Functions

HRESULT makeCurrent ()
 Make the instance the global simulator object.
 

Static Public Member Functions

static Simulatorget ()
 
static HRESULT initConfig (const Config &conf, const GLConfig &glConf)
 
static HRESULT pollEvents ()
 
static HRESULT waitEvents ()
 
static HRESULT waitEventsTimeout (FloatP_t timeout)
 
static HRESULT postEmptyEvent ()
 
static HRESULT run (FloatP_t et)
 Runs the event loop until all windows close or simulation time expires. Automatically performs universe time propogation.
 
static HRESULT show ()
 Shows any windows that were specified in the config. Does not start the universe time propagation unlike run.
 
static HRESULT close ()
 Closes the main window, while the application / simulation continues to run.
 
static HRESULT destroy ()
 
static HRESULT redraw ()
 
static HRESULT swapInterval (int si)
 
static const int getNumThreads ()
 
static const rendering::GlfwWindowgetWindow ()
 
static HRESULT throwExceptions (const bool &_throw)
 
static bool throwingExceptions ()
 

Public Attributes

int32_t kind
 
struct rendering::Applicationapp
 
std::vector< rendering::GlfwWindow * > windows
 

Detailed Description

The Simulator is the entry point to simulation, this is the very first object that needs to be initialized before any other method can be called. All the methods of the Simulator are static, but the constructor needs to be called first to initialize everything.

The Simulator manages all of the operating system interface, it manages window creation, end user input events, GPU access, threading, inter-process messaging and so forth. All 'physical' modeling concepts go in the Universe.

Member Enumeration Documentation

◆ Options

Enumerator
GlForwardCompatible 

Forward compatible context

@requires_gl Core/compatibility profile distinction and forward compatibility applies only to desktop GL.

GlNoError 

Specifies whether errors should be generated by the context. If enabled, situations that would have generated errors instead cause undefined behavior.

Note
Supported since GLFW 3.2.
GlDebug 

Debug context. Enabled automatically if the --magnum-gpu-validation command-line option is present.

GlStereo 

Stereo rendering

◆ WindowFlags

Window flag.

See also
WindowFlags, setWindowFlags()
Enumerator
Fullscreen 

Fullscreen window

Borderless 

No window decoration

Resizable 

Resizable window

Hidden 

Hidden window

Maximized 

Maximized window

Note
Supported since GLFW 3.2.
Minimized 

Minimized window

AlwaysOnTop 

Always on top @m_since_latest

AutoIconify 

Automatically iconify (minimize) if fullscreen window loses input focus

Focused 

Window has input focus

Contextless 

Do not create any GPU context. Use together with GlfwApplication(const Arguments&), GlfwApplication(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to prevent implicit creation of an OpenGL context.

Note
Supported since GLFW 3.2.

Member Function Documentation

◆ get()

static Simulator * TissueForge::Simulator::get ( )
static

gets the global simulator object, returns NULL if fail.

◆ getNumThreads()

static const int TissueForge::Simulator::getNumThreads ( )
static

Number of threads

◆ makeCurrent()

HRESULT TissueForge::Simulator::makeCurrent ( )

Make the instance the global simulator object.

Returns
HRESULT

◆ pollEvents()

static HRESULT TissueForge::Simulator::pollEvents ( )
static

This function processes only those events that are already in the event queue and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

◆ postEmptyEvent()

static HRESULT TissueForge::Simulator::postEmptyEvent ( )
static

This function posts an empty event from the current thread to the event queue, causing waitEvents or waitEventsTimeout to return.

◆ redraw()

static HRESULT TissueForge::Simulator::redraw ( )
static

Redraw the scene

◆ run()

static HRESULT TissueForge::Simulator::run ( FloatP_t et)
static

Runs the event loop until all windows close or simulation time expires. Automatically performs universe time propogation.

Parameters
etperiod to execute, in units of simulation time; a negative number runs infinitely

◆ swapInterval()

static HRESULT TissueForge::Simulator::swapInterval ( int si)
static

This function sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the time glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.

A context that supports either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accepts negative swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions with glfwExtensionSupported.

A context must be current on the calling thread. Calling this function without a current context will cause a GLFW_NO_CURRENT_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your swapchain instead.

Parameters [in] interval The minimum number of screen updates to wait for until the buffers are swapped by glfwSwapBuffers. Errors Possible errors include GLFW_NOT_INITIALIZED, GLFW_NO_CURRENT_CONTEXT and GLFW_PLATFORM_ERROR. Remarks This function is not called during context creation, leaving the swap interval set to whatever is the default on that platform. This is done because some swap interval extensions used by GLFW do not allow the swap interval to be reset to zero once it has been set to a non-zero value. Some GPU drivers do not honor the requested swap interval, either because of a user setting that overrides the application's request or due to bugs in the driver.

◆ throwExceptions()

static HRESULT TissueForge::Simulator::throwExceptions ( const bool & _throw)
static

Set whether errors result in exceptions

◆ throwingExceptions()

static bool TissueForge::Simulator::throwingExceptions ( )
static

Check whether errors result in exceptions

◆ waitEvents()

static HRESULT TissueForge::Simulator::waitEvents ( )
static

This function puts the calling thread to sleep until at least one event is available in the event queue. Once one or more events are available, it behaves exactly like glfwPollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.

◆ waitEventsTimeout()

static HRESULT TissueForge::Simulator::waitEventsTimeout ( FloatP_t timeout)
static

This function puts the calling thread to sleep until at least one event is available in the event queue, or until the specified timeout is reached. If one or more events are available, it behaves exactly like pollEvents, i.e. the events in the queue are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.

The timeout value must be a positive finite number. Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.

On some platforms, a window move, resize or menu operation will cause event processing to block. This is due to how event processing is designed on those platforms. You can use the window refresh callback to redraw the contents of your window when necessary during such operations.


The documentation for this struct was generated from the following file: