Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfOrientationRenderer.h
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
20#ifndef _SOURCE_RENDERING_TFORIENTATIONRENDERER_H_
21#define _SOURCE_RENDERING_TFORIENTATIONRENDERER_H_
22
23#include "tfSubRenderer.h"
24#include "tfArrowRenderer.h"
25
26#include <shaders/tfPhong.h>
27#include "tfStyle.h"
28
29#include <Magnum/GL/Mesh.h>
30#include <Magnum/Math/Color.h>
31#include <Magnum/Mesh.h>
32
33#include <utility>
34#include <vector>
35
36
37namespace TissueForge::rendering {
38
39
46 struct OrientationRenderer : SubRenderer {
47
48 // Arrow inventory
49 std::vector<ArrowData *> arrows;
50
51 OrientationRenderer();
52 ~OrientationRenderer();
53
54 HRESULT start(const std::vector<fVector4> &clipPlanes) override;
55 HRESULT draw(ArcBallCamera *camera, const iVector2 &viewportSize, const fMatrix4 &modelViewMat) override;
56 void setAmbientColor(const Magnum::Color3& color) override;
57 void setDiffuseColor(const Magnum::Color3& color) override;
58 void setSpecularColor(const Magnum::Color3& color) override;
59 void setShininess(float shininess) override;
60 void setLightDirection(const fVector3& lightDir) override;
61 void setLightColor(const Magnum::Color3 &color) override;
62
70 static OrientationRenderer *get();
71
72 void showAxes(const bool &show) {
73 _showAxes = show;
74 }
75
76 private:
77
78 int _arrowDetail = 10;
79 int _showAxes;
80
81 Magnum::GL::Buffer _bufferHead{Corrade::Containers::NoCreate};
82 Magnum::GL::Buffer _bufferCylinder{Corrade::Containers::NoCreate};
83 Magnum::GL::Buffer _bufferOrigin{Corrade::Containers::NoCreate};
84 Magnum::GL::Mesh _meshHead{Corrade::Containers::NoCreate};
85 Magnum::GL::Mesh _meshCylinder{Corrade::Containers::NoCreate};
86 Magnum::GL::Mesh _meshOrigin{Corrade::Containers::NoCreate};
87 shaders::Phong _shader{Corrade::Containers::NoCreate};
88
89 fMatrix4 modelViewMat;
90 fMatrix4 staticTransformationMat;
91
92 ArrowData *arrowx=NULL, *arrowy=NULL, *arrowz=NULL;
93
94 };
95
96};
97
98#endif // _SOURCE_RENDERING_TFORIENTATIONRENDERER_H_
Definition tfArcBallCamera.h:66
Tissue Forge rendering and visualization.
Definition tfAngle.h:38
HRESULT show()
Shows any windows that were specified in the config. Does not start the universe time propagation unl...
void setSpecularColor(const Magnum::Color3 &color) override
Set the specular color.
HRESULT draw(ArcBallCamera *camera, const iVector2 &viewportSize, const fMatrix4 &modelViewMat) override
Updates visualization.
void setDiffuseColor(const Magnum::Color3 &color) override
Set the diffuse color.
HRESULT start(const std::vector< fVector4 > &clipPlanes) override
Starts the renderer.
void setAmbientColor(const Magnum::Color3 &color) override
Sets the ambient color.
void setLightDirection(const fVector3 &lightDir) override
Sets the light direction.
void setShininess(float shininess) override
Sets the shininess.
static OrientationRenderer * get()
Gets the global instance of the renderer.
void setLightColor(const Magnum::Color3 &color) override
Sets the light color.
Definition tfSubRenderer.h:34
int32_t HRESULT
Definition tf_port.h:255