20#ifndef _SOURCE_RENDERING_TFAPPLICATION_H_
21#define _SOURCE_RENDERING_TFAPPLICATION_H_
24#include <TissueForge_private.h>
26#include <Magnum/GL/Context.h>
27#include <GLFW/glfw3.h>
28#include "tfImageConverters.h"
34 enum WindowAttributes {
35 TF_FOCUSED = GLFW_FOCUSED,
36 TF_ICONIFIED = GLFW_ICONIFIED,
37 TF_RESIZABLE = GLFW_RESIZABLE,
38 TF_VISIBLE = GLFW_VISIBLE,
39 TF_DECORATED = GLFW_DECORATED,
40 TF_AUTO_ICONIFY = GLFW_AUTO_ICONIFY,
41 TF_FLOATING = GLFW_FLOATING,
42 TF_MAXIMIZED = GLFW_MAXIMIZED,
43 TF_CENTER_CURSOR = GLFW_CENTER_CURSOR,
44 TF_TRANSPARENT_FRAMEBUFFER = GLFW_TRANSPARENT_FRAMEBUFFER,
45 TF_HOVERED = GLFW_HOVERED,
46 TF_FOCUS_ON_SHOW = GLFW_FOCUS_ON_SHOW,
47 TF_RED_BITS = GLFW_RED_BITS,
48 TF_GREEN_BITS = GLFW_GREEN_BITS,
49 TF_BLUE_BITS = GLFW_BLUE_BITS,
50 TF_ALPHA_BITS = GLFW_ALPHA_BITS,
51 TF_DEPTH_BITS = GLFW_DEPTH_BITS,
52 TF_STENCIL_BITS = GLFW_STENCIL_BITS,
53 TF_ACCUM_RED_BITS = GLFW_ACCUM_RED_BITS,
54 TF_ACCUM_GREEN_BITS = GLFW_ACCUM_GREEN_BITS,
55 TF_ACCUM_BLUE_BITS = GLFW_ACCUM_BLUE_BITS,
56 TF_ACCUM_ALPHA_BITS = GLFW_ACCUM_ALPHA_BITS,
57 TF_AUX_BUFFERS = GLFW_AUX_BUFFERS,
58 TF_STEREO = GLFW_STEREO,
59 TF_SAMPLES = GLFW_SAMPLES,
60 TF_SRGB_CAPABLE = GLFW_SRGB_CAPABLE,
61 TF_REFRESH_RATE = GLFW_REFRESH_RATE,
62 TF_DOUBLEBUFFER = GLFW_DOUBLEBUFFER,
63 TF_CLIENT_API = GLFW_CLIENT_API,
64 TF_CONTEXT_VERSION_MAJOR = GLFW_CONTEXT_VERSION_MAJOR,
65 TF_CONTEXT_VERSION_MINOR = GLFW_CONTEXT_VERSION_MINOR,
66 TF_CONTEXT_REVISION = GLFW_CONTEXT_REVISION,
67 TF_CONTEXT_ROBUSTNESS = GLFW_CONTEXT_ROBUSTNESS,
68 TF_OPENGL_FORWARD_COMPAT = GLFW_OPENGL_FORWARD_COMPAT,
69 TF_OPENGL_DEBUG_CONTEXT = GLFW_OPENGL_DEBUG_CONTEXT,
70 TF_OPENGL_PROFILE = GLFW_OPENGL_PROFILE,
71 TF_CONTEXT_RELEASE_BEHAVIOR = GLFW_CONTEXT_RELEASE_BEHAVIOR,
72 TF_CONTEXT_NO_ERROR = GLFW_CONTEXT_NO_ERROR,
73 TF_CONTEXT_CREATION_API = GLFW_CONTEXT_CREATION_API,
74 TF_SCALE_TO_MONITOR = GLFW_SCALE_TO_MONITOR,
75 TF_COCOA_RETINA_FRAMEBUFFER = GLFW_COCOA_RETINA_FRAMEBUFFER,
76 TF_COCOA_FRAME_NAME = GLFW_COCOA_FRAME_NAME,
77 TF_COCOA_GRAPHICS_SWITCHING = GLFW_COCOA_GRAPHICS_SWITCHING,
78 TF_X11_CLASS_NAME = GLFW_X11_CLASS_NAME,
79 TF_X11_INSTANCE_NAME = GLFW_X11_INSTANCE_NAME
128 unsigned windowFlag = 0;
184 struct UniverseRenderer;
262 virtual HRESULT mainLoopIteration(
double timeout)= 0;
265 virtual HRESULT setSwapInterval(
int si) = 0;
271 virtual int windowAttribute(WindowAttributes attr) = 0;
273 virtual HRESULT setWindowAttribute(WindowAttributes attr,
int val) = 0;
297 virtual HRESULT simulationStep();
299 virtual HRESULT messageLoop(
double et) = 0;
301 virtual Magnum::GL::AbstractFramebuffer& framebuffer() = 0;
304 virtual bool contextMakeCurrent() = 0;
306 virtual bool contextHasCurrent() = 0;
308 virtual bool contextRelease() = 0;
312 bool _dynamicBoundary =
true;
315 Magnum::Float _boundaryOffset = 0.0f;
322 Corrade::Containers::Array<char> JpegImageData();
323 Corrade::Containers::Array<char> BMPImageData();
324 Corrade::Containers::Array<char> HDRImageData();
325 Corrade::Containers::Array<char> PNGImageData();
326 Corrade::Containers::Array<char> TGAImageData();
328 std::tuple<char*, size_t> framebufferImageData();
Tissue Forge rendering and visualization.
Definition tfAngle.h:38
HRESULT screenshot(const std::string &filePath)
Save a screenshot of the current scene.
HRESULT show()
Shows any windows that were specified in the config. Does not start the universe time propagation unl...
HRESULT close()
Closes the main window, while the application / simulation continues to run.
HRESULT run(FloatP_t et=-1)
Runs the event loop until all windows close or simulation time expires. Automatically performs univer...
Definition tfSimulator.h:368
Definition tfApplication.h:86
WindowFlag
Window flag.
Definition tfApplication.h:93
@ Floating
Definition tfApplication.h:104
@ Fullscreen
Definition tfApplication.h:95
@ Resizable
Definition tfApplication.h:96
@ AutoIconify
Definition tfApplication.h:110
@ Focused
Definition tfApplication.h:112
@ Contextless
Definition tfApplication.h:125
@ Minimized
Definition tfApplication.h:103
@ Hidden
Definition tfApplication.h:97
DpiScalingPolicy
DPI scaling policy.
Definition tfApplication.h:139
Definition tfApplication.h:189
virtual HRESULT redraw()=0
virtual HRESULT waitEventsTimeout(double timeout)=0
virtual HRESULT waitEvents()=0
std::vector< GlfwWindow * > windows
Definition tfApplication.h:195
virtual HRESULT postEmptyEvent()=0
virtual HRESULT pollEvents()=0
Definition tfGlfwWindow.h:38
Definition tfUniverseRenderer.h:115
int32_t HRESULT
Definition tf_port.h:255