SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
axes.h
Go to the documentation of this file.
1#ifndef AXES_H
2#define AXES_H
3
4#include <memory.h>
5
6#include <bondRenderer.h>
7
12class Axes
13{
14
15public:
16
17 Axes(const Camera & camera)
18 : camera({3.5, M_PI*0.5f, M_PI}, camera.getResX(), camera.getResY()),
19 renderer(axes, axesPoints, axes.size())
20 {
21 renderer.setBondScale(0.33f);
22 renderer.setClipCorrection(3.0f);
23 }
24
30 void updateCamera(const Camera & camera)
31 {
32 glm::vec3 pos = camera.position(true);
33 pos.x = this->camera.position(true).x;
34 this->camera.setPosition(pos);
35 this->camera.setUp(camera.getUp());
36 renderer.updateCamera(this->camera);
37 }
38
44 void draw(glm::ivec4 viewport = {10, 10, 85, 85})
45 {
46 GLint currentViewPort[4];
47 glGetIntegerv(GL_VIEWPORT, currentViewPort);
48 glViewport(viewport.x, viewport.y, viewport.z, viewport.w);
49 renderer.draw();
50 glViewport
51 (
52 currentViewPort[0],
53 currentViewPort[1],
54 currentViewPort[2],
55 currentViewPort[3]
56 );
57 }
58
59private:
60
61 const std::vector<Atom> axesPoints =
62 {
63 {Element::Unknown, {0,0,0}, 1.0f, {1.0f,1.0,1.0,1.0}},
64 {Element::Unknown, {1,0,0}, 1.0f, {1.0f,0.0,0.0,1.0}},
65 {Element::Unknown, {0,1,0}, 1.0f, {0.0f,1.0,0.0,1.0}},
66 {Element::Unknown, {0,0,1}, 1.0f, {0.0f,0.0,1.0,1.0}}
67 };
68
69 const std::map<uint64_t, std::set<uint64_t>> axes {{0, {1, 2, 3}}};
70
71 Camera camera;
72
73 BondRenderer renderer;
74};
75
76#endif /* AXES_H */
Render the coordinate axes.
Definition axes.h:13
void updateCamera(const Camera &camera)
Update renderer from a Camera.
Definition axes.h:30
void draw(glm::ivec4 viewport={10, 10, 85, 85})
Draw the coordinate axes.
Definition axes.h:44
Axes(const Camera &camera)
Definition axes.h:17
Render Bonds as ray-traced cylinders.
Definition bondRenderer.h:18
void updateCamera(const Camera &camera)
Update shaders from a Camera.
Definition bondRenderer.h:128
void setClipCorrection(float correction)
Set the clip correction.
Definition bondRenderer.h:81
void setBondScale(float scale)
Set the uniform radii of bonds.
Definition bondRenderer.h:155
void draw(uint64_t count)
Draw the bonds.
Definition bondRenderer.h:218
A 3D projective camera centered on a focus moving on a sphere.
Definition camera.h:30
void setPosition(glm::vec3 positionSpherical)
Set the camera's position.
Definition camera.h:150
void setUp(float up)
Set the up direction.
Definition camera.h:174
glm::vec3 position(bool spherical=false) const
Return the cartesian position vector.
Definition camera.h:163
float getUp() const
Get the up direction.
Definition camera.h:181