Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tf_system.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of Tissue Forge.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
24
25#ifndef _SOURCE_TF_SYSTEM_H_
26#define _SOURCE_TF_SYSTEM_H_
27
28#include "TissueForge_private.h"
29#include "tf_util.h"
30#include "tfLogger.h"
31#include "rendering/tfGlInfo.h"
32#include "rendering/tfEglInfo.h"
34#include "rendering/tfArrowRenderer.h"
35
36
37namespace TissueForge::system {
38
39
40 CPPAPI_FUNC(void) printPerformanceCounters();
41
42 HRESULT LoggerCallbackImpl(LogEvent, std::ostream *);
43
44 CPPAPI_FUNC(std::tuple<char*, size_t>) imageData();
45
60 CPPAPI_FUNC(HRESULT) screenshot(const std::string &filePath);
61
78 CPPAPI_FUNC(HRESULT) screenshot(const std::string &filePath, const bool &decorate, const FVector3 &bgcolor);
79
80 CPPAPI_FUNC(bool) contextHasCurrent();
81 CPPAPI_FUNC(HRESULT) contextMakeCurrent();
82 CPPAPI_FUNC(HRESULT) contextRelease();
83
85 CPPAPI_FUNC(bool) cameraIsLagging();
86
89
92
95
97 CPPAPI_FUNC(float) cameraGetLagging();
98
100 CPPAPI_FUNC(HRESULT) cameraSetLagging(const float &lagging);
101
110 CPPAPI_FUNC(HRESULT) cameraMoveTo(const FVector3 &eye, const FVector3 &center, const FVector3 &up);
111
120 CPPAPI_FUNC(HRESULT) cameraMoveTo(const FVector3 &center, const FQuaternion &rotation, const float &zoom);
121
127 CPPAPI_FUNC(HRESULT) cameraViewBottom();
128
134 CPPAPI_FUNC(HRESULT) cameraViewTop();
135
141 CPPAPI_FUNC(HRESULT) cameraViewLeft();
142
148 CPPAPI_FUNC(HRESULT) cameraViewRight();
149
155 CPPAPI_FUNC(HRESULT) cameraViewBack();
156
162 CPPAPI_FUNC(HRESULT) cameraViewFront();
163
169 CPPAPI_FUNC(HRESULT) cameraReset();
170
171 /* Rotate the camera from the previous (screen) mouse position to the
172 current (screen) position */
173 CPPAPI_FUNC(HRESULT) cameraRotateMouse(const iVector2 &mousePos);
174
175 /* Translate the camera from the previous (screen) mouse position to
176 the current (screen) mouse position */
177 CPPAPI_FUNC(HRESULT) cameraTranslateMouse(const iVector2 &mousePos);
178
185
192
199
206
213
220
226 CPPAPI_FUNC(HRESULT) cameraRotateDown();
227
233 CPPAPI_FUNC(HRESULT) cameraRotateUp();
234
240 CPPAPI_FUNC(HRESULT) cameraRotateLeft();
241
248
254 CPPAPI_FUNC(HRESULT) cameraRollLeft();
255
261 CPPAPI_FUNC(HRESULT) cameraRollRight();
262
268 CPPAPI_FUNC(HRESULT) cameraZoomIn();
269
275 CPPAPI_FUNC(HRESULT) cameraZoomOut();
276
277 /* Rotate the camera from the previous (screen) mouse position to the
278 current (screen) position */
279 CPPAPI_FUNC(HRESULT) cameraInitMouse(const iVector2 &mousePos);
280
281 /* Translate the camera by the delta amount of (NDC) mouse position.
282 Note that NDC position must be in [-1, -1] to [1, 1]. */
283 CPPAPI_FUNC(HRESULT) cameraTranslateBy(const FVector2 &trans);
284
293 CPPAPI_FUNC(HRESULT) cameraZoomBy(const float &delta);
294
301 CPPAPI_FUNC(HRESULT) cameraZoomTo(const float &distance);
302
312 CPPAPI_FUNC(HRESULT) cameraRotateToAxis(const FVector3 &axis, const float &distance);
313
322 CPPAPI_FUNC(HRESULT) cameraRotateToEulerAngle(const FVector3 &angles);
323
332 CPPAPI_FUNC(HRESULT) cameraRotateByEulerAngle(const FVector3 &angles);
333
339 CPPAPI_FUNC(FVector3) cameraCenter();
340
346 CPPAPI_FUNC(FQuaternion) cameraRotation();
347
353 CPPAPI_FUNC(float) cameraZoom();
354
361
363 CPPAPI_FUNC(const bool) getRendering3DBonds();
364
366 CPPAPI_FUNC(void) setRendering3DBonds(const bool &_flag);
367
369 CPPAPI_FUNC(void) toggleRendering3DBonds();
370
372 CPPAPI_FUNC(const bool) getRendering3DAngles();
373
375 CPPAPI_FUNC(void) setRendering3DAngles(const bool &_flag);
376
378 CPPAPI_FUNC(void) toggleRendering3DAngles();
379
381 CPPAPI_FUNC(const bool) getRendering3DDihedrals();
382
384 CPPAPI_FUNC(void) setRendering3DDihedrals(const bool &_flag);
385
387 CPPAPI_FUNC(void) toggleRendering3DDihedrals();
388
390 CPPAPI_FUNC(void) setRendering3DAll(const bool &_flag);
391
393 CPPAPI_FUNC(void) toggleRendering3DAll();
394
396 CPPAPI_FUNC(const FloatP_t) getLineWidth();
397
399 CPPAPI_FUNC(HRESULT) setLineWidth(const FloatP_t &lineWidth);
400
402 CPPAPI_FUNC(const FloatP_t) getLineWidthMin();
403
405 CPPAPI_FUNC(const FloatP_t) getLineWidthMax();
406
412 CPPAPI_FUNC(FVector3) getAmbientColor();
413
420 CPPAPI_FUNC(HRESULT) setAmbientColor(const FVector3 &color);
421
429 CPPAPI_FUNC(HRESULT) setAmbientColor(const FVector3 &color, const unsigned int &srFlag);
430
436 CPPAPI_FUNC(FVector3) getDiffuseColor();
437
444 CPPAPI_FUNC(HRESULT) setDiffuseColor(const FVector3 &color);
445
453 CPPAPI_FUNC(HRESULT) setDiffuseColor(const FVector3 &color, const unsigned int &srFlag);
454
460 CPPAPI_FUNC(FVector3) getSpecularColor();
461
468 CPPAPI_FUNC(HRESULT) setSpecularColor(const FVector3 &color);
469
477 CPPAPI_FUNC(HRESULT) setSpecularColor(const FVector3 &color, const unsigned int &srFlag);
478
484 CPPAPI_FUNC(float) getShininess();
485
492 CPPAPI_FUNC(HRESULT) setShininess(const float &shininess);
493
501 CPPAPI_FUNC(HRESULT) setShininess(const float &shininess, const unsigned int &srFlag);
502
508 CPPAPI_FUNC(FVector3) getGridColor();
509
516 CPPAPI_FUNC(HRESULT) setGridColor(const FVector3 &color);
517
523 CPPAPI_FUNC(FVector3) getSceneBoxColor();
524
531 CPPAPI_FUNC(HRESULT) setSceneBoxColor(const FVector3 &color);
532
538 CPPAPI_FUNC(FVector3) getLightDirection();
539
546 CPPAPI_FUNC(HRESULT) setLightDirection(const FVector3& lightDir);
547
555 CPPAPI_FUNC(HRESULT) setLightDirection(const FVector3& lightDir, const unsigned int &srFlag);
556
562 CPPAPI_FUNC(FVector3) getLightColor();
563
570 CPPAPI_FUNC(HRESULT) setLightColor(const FVector3 &color);
571
579 CPPAPI_FUNC(HRESULT) setLightColor(const FVector3 &color, const unsigned int &srFlag);
580
586 CPPAPI_FUNC(FVector3) getBackgroundColor();
587
594 CPPAPI_FUNC(HRESULT) setBackgroundColor(const FVector3 &color);
595
602 CPPAPI_FUNC(bool) decorated();
603
610 CPPAPI_FUNC(HRESULT) decorateScene(const bool &decorate);
611
618 CPPAPI_FUNC(bool) showingDiscretization();
619
626 CPPAPI_FUNC(HRESULT) showDiscretization(const bool &show);
627
633 CPPAPI_FUNC(FVector3) getDiscretizationColor();
634
641 CPPAPI_FUNC(HRESULT) setDiscretizationColor(const FVector3 &color);
642
643 /* Update screen size after the window has been resized */
644 CPPAPI_FUNC(HRESULT) viewReshape(const iVector2 &windowSize);
645
646 CPPAPI_FUNC(std::string) performanceCounters();
647
653 CPPAPI_FUNC(std::unordered_map<std::string, bool>) cpu_info();
654
660 CPPAPI_FUNC(std::list<std::string>) compile_flags();
661
667 CPPAPI_FUNC(std::unordered_map<std::string, std::string>) gl_info();
668
674 CPPAPI_FUNC(std::string) egl_info();
675
679 CPPAPI_FUNC(std::vector<std::string>) colorMapperNames();
680
693 CPPAPI_FUNC(int) addRenderArrow(rendering::ArrowData *arrow);
694
710 CPPAPI_FUNC(std::pair<int, rendering::ArrowData*>) addRenderArrow(
711 const FVector3 &position,
712 const FVector3 &components,
713 const rendering::Style &style,
714 const float &scale=1.0
715 );
716
725 CPPAPI_FUNC(HRESULT) removeRenderArrow(const int &arrowId);
726
732 CPPAPI_FUNC(rendering::ArrowData*) getRenderArrow(const int &arrowId);
733
734};
735
736#endif // _SOURCE_TF_SYSTEM_H_
HRESULT show()
Shows any windows that were specified in the config. Does not start the universe time propagation unl...
Vector visualization specification.
Definition tfArrowRenderer.h:46
The Tissue Forge style type.
Definition tfStyle.h:46
Definition tfUniverseRenderer.h:115
int32_t HRESULT
Definition tf_port.h:255
HRESULT cameraZoomOut()
Zoom the camera out.
HRESULT showDiscretization(const bool &show)
Set flag to draw/not draw discretization.
HRESULT cameraReset()
Reset the camera.
HRESULT cameraTranslateBackward()
Translate the camera backward.
HRESULT cameraViewLeft()
Move the camera to view the domain from the left.
const FloatP_t getLineWidthMax()
std::unordered_map< std::string std::string > gl_info()
Get OpenGL info.
FVector3 getBackgroundColor()
Get the background color.
HRESULT cameraRotateRight()
Rotate the camera right.
void toggleRendering3DDihedrals()
const bool getRendering3DBonds()
FVector3 getAmbientColor()
Get the ambient color.
float getShininess()
Get the shininess.
HRESULT cameraRotateToAxis(const FVector3 &axis, const float &distance)
Rotate the camera to a point from the view center a distance along an axis.
HRESULT cameraTranslateForward()
Translate the camera forward.
void setRendering3DAngles(const bool &_flag)
HRESULT cameraRotateDown()
Rotate the camera down.
HRESULT cameraTranslateUp()
Translate the camera up.
HRESULT cameraTranslateDown()
Translate the camera down.
HRESULT cameraTranslateRight()
Translate the camera right.
HRESULT cameraViewFront()
Move the camera to view the domain from the front.
void setRendering3DDihedrals(const bool &_flag)
HRESULT setDiffuseColor(const FVector3 &color)
Set the diffuse color.
std::unordered_map< std::string bool > cpu_info()
Get CPU info.
std::list< std::string > compile_flags()
Get compiler flags of this installation.
HRESULT cameraRotateByEulerAngle(const FVector3 &angles)
Rotate the camera by a set of Euler angles.
std::vector< std::string > colorMapperNames()
Get all available color mapper names.
HRESULT cameraViewBack()
Move the camera to view the domain from the back.
HRESULT cameraDisableLagging()
HRESULT cameraRollRight()
Rotate the camera right.
const bool getRendering3DAngles()
const bool getRendering3DDihedrals()
HRESULT cameraViewRight()
Move the camera to view the domain from the right.
HRESULT cameraRotateUp()
Rotate the camera up.
HRESULT cameraRollLeft()
Roll the camera left.
HRESULT cameraMoveTo(const FVector3 &eye, const FVector3 &center, const FVector3 &up)
Set the camera view parameters.
HRESULT cameraRotateToEulerAngle(const FVector3 &angles)
Rotate the camera to a set of Euler angles.
HRESULT cameraTranslateLeft()
Translate the camera left.
bool showingDiscretization()
Test whether discretization is current shown.
const FloatP_t getLineWidthMin()
FVector3 getSceneBoxColor()
Get the scene box color.
void setRendering3DBonds(const bool &_flag)
HRESULT cameraViewBottom()
Move the camera to view the domain from the bottm.
bool decorated()
Test whether the rendered scene is decorated.
void toggleRendering3DBonds()
HRESULT decorateScene(const bool &decorate)
Set flag to draw/not draw scene decorators (e.g., grid)
void setRendering3DAll(const bool &_flag)
const FloatP_t getLineWidth()
FVector3 getSpecularColor()
Get specular color.
HRESULT setLightColor(const FVector3 &color)
Set the light color.
HRESULT screenshot(const std::string &filePath)
Save a screenshot of the current scene.
HRESULT cameraRotateLeft()
Rotate the camera left.
FVector3 getLightColor()
Get the light color.
HRESULT cameraZoomIn()
Zoom the camera in.
struct rendering::UniverseRenderer * getRenderer()
Get the universe renderer.
HRESULT setDiscretizationColor(const FVector3 &color)
Set the color of the discretization grid.
HRESULT setAmbientColor(const FVector3 &color)
Set the ambient color.
int addRenderArrow(rendering::ArrowData *arrow)
Adds a vector visualization specification.
FVector3 getGridColor()
Get the grid color.
float cameraZoom()
Get the current camera zoom.
FQuaternion cameraRotation()
Get the current camera rotation.
rendering::ArrowData * getRenderArrow(const int &arrowId)
Gets a vector visualization specification.
FVector3 getLightDirection()
Get the light direction.
HRESULT setLineWidth(const FloatP_t &lineWidth)
FVector3 getDiscretizationColor()
Get the current color of the discretization grid.
FVector3 getDiffuseColor()
Get the diffuse color.
HRESULT cameraViewTop()
Move the camera to view the domain from the top.
HRESULT setBackgroundColor(const FVector3 &color)
Set the background color.
HRESULT removeRenderArrow(const int &arrowId)
Removes a vector visualization specification.
FVector3 cameraCenter()
Get the current camera view center position.
HRESULT setSpecularColor(const FVector3 &color)
Set the specular color.
HRESULT setShininess(const float &shininess)
Set the shininess.
HRESULT cameraZoomBy(const float &delta)
Zoom the camera by an increment in distance.
void toggleRendering3DAngles()
HRESULT setLightDirection(const FVector3 &lightDir)
Set the light direction.
HRESULT cameraToggleLagging()
HRESULT cameraSetLagging(const float &lagging)
std::string egl_info()
Get EGL info.
HRESULT cameraEnableLagging()
HRESULT cameraZoomTo(const float &distance)
Zoom the camera to a distance.
HRESULT setGridColor(const FVector3 &color)
Set the grid color.
HRESULT setSceneBoxColor(const FVector3 &color)
Set the scene box color.