Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
NipscanRenderer.h
Go to the documentation of this file.
1#pragma once
2#include "ktm/Nipscan.h"
7#include <xgl/Axes.h>
8#include <xgl/Cone.h>
9#include <xgl/Cube.h>
10#include <xgl/Cylinder.h>
11#include <xgl/Disk.h>
12#include <xgl/Dynamic.h>
13#include <xgl/Line.h>
14#include <xgl/Normals.h>
15#include <xgl/ShaderProgram.h>
16#include <xgl/Sphere.h>
17#include <xgl/Tube.h>
18#include <xgl/VertexArray.h>
19
20namespace sf::xgl
21{
22
24{
25 Q_OBJECT
26 Q_PROPERTY(QColor lightColor READ getLightColor WRITE setLightColor)
27 Q_PROPERTY(float cutoffAngle READ getCutoffAngle WRITE setCutoffAngle)
28 Q_PROPERTY(float ambientStrength READ getAmbientStrength WRITE setAmbientStrength)
29 Q_PROPERTY(float diffuseStrength READ getDiffuseStrength WRITE setDiffuseStrength)
30 Q_PROPERTY(float specularStrength READ getSpecularStrength WRITE setSpecularStrength)
31 Q_PROPERTY(float shininess READ getShininess WRITE setShininess)
32 Q_PROPERTY(FragmentProgram fragmentProgram READ getFragmentProgram WRITE setFragmentProgram)
33
34 public:
39
43 ~NipscanRenderer() override;
44
48 enum FragmentProgram : int
49 {
54 };
55 Q_ENUM(FragmentProgram)
56
57 SF_DECL_PROP_GS(QColor, LightColor)
58 SF_DECL_PROP_GS(float, CutoffAngle)
59 SF_DECL_PROP_GS(float, AmbientStrength)
60 SF_DECL_PROP_GS(float, DiffuseStrength)
61 SF_DECL_PROP_GS(float, SpecularStrength)
62 SF_DECL_PROP_GS(float, Shininess)
63 SF_DECL_PROP_GS(FragmentProgram, FragmentProgram)
64
65
69
77 void setHandler(const HandlerType& handler);
78
83
88
90 void setIndexValue(int index, QVariant value) override;
91
93 void changedProperty() override;
94
95 protected:
97 void generate() override;
98
100 void paint() override;
101
104
106 void draw() override;
107
108 void renderNipscan(bool solid, double x_axis, double y_axis, double z_axis, double a_axis, double b_axis, double c_axis) const;
109
110 private:
114 void generateNipscan(VertexArrayBase*);
115
120 void notify(const void* member);
121
125 bool _flagPaint;
129 bool _flagObjects;
135 QColor _lightColor;
143 float _cutoffAngle;
150 float _ambientStrength;
158 float _diffuseStrength;
162 float _specularStrength;
166 float _shininess;
170 FragmentProgram _fragmentProgram;
174 ShaderProgram* _shaderProgram;
176 std::array<double, 6> _indexValues;
178 Matrix44 _indexSurface;
180 HandlerType _handler;
182 Dynamic* _nipscan;
184 NipscanPose _pose;
186 ToolInformation _toolInfo;
187 // Element information.
188 ElementInformation _elementInfo;
189 //
190 Normals* _testNormals;
191 Line* _testLine;
192 Axes* _xyxAxes;
193 Axes* _focusAxes;
194 Axes* _surfaceAxes;
195 Cone* _lightCone;
196 Tube* _zAxisTube;
197 Disk* _zAxisDisk;
198 Sphere* _zAxisSphere;
199 Cylinder* _bAxisCylinder;
200 Cylinder* _soundBeamCylinder;
201};
202
203}// namespace sf::xgl
Holds the information on the transducer.
Definition ElementInformation.h:12
OpenGLRenderer(OpenGLWidget *widget, QOpenGLShaderProgram *sp)
Constructor passing the widget which has the OpenGL context. The owner is the shader program object.
Widget for rendering an OpenGL scene.
Definition OpenGLWidget.h:30
Encapsulates the std::function() template.
Definition TClosure.h:14
Holds all the necessary information on a tool to make calculations.
Definition ToolInformation.h:13
Class to render axis lines in OpenGL. Length is both positive and negative direction.
Definition Axes.h:14
Class to render a cone in OpenGL. Height of the cone is along the Z-axis where the tip is at (0,...
Definition Cone.h:13
Class to render a cylinder in OpenGL. Has a single color. The height of the cone is along the Z-axis ...
Definition Cylinder.h:14
Class to render a disk in OpenGL.
Definition Disk.h:11
Dynamic object .
Definition Dynamic.h:14
Class to render a line in OpenGL.
Definition Line.h:11
void renderNipscan(bool solid, double x_axis, double y_axis, double z_axis, double a_axis, double b_axis, double c_axis) const
NipscanRenderer(OpenGLWidget *widget, ShaderProgram *sp)
Initializing constructor.
void changedProperty() override
Overridden from base class.
float diffuseStrength
Definition NipscanRenderer.h:29
float specularStrength
Definition NipscanRenderer.h:30
void setHandler(const HandlerType &handler)
Callback function for setting the axis positions and sizing the element and tool. Code to create an i...
FragmentProgram fragmentProgram
Definition NipscanRenderer.h:32
void generate() override
Overridden from base class.
FragmentProgram
Enumeration of available shader inner programs passed to ShaderProgram::Uniform::uProgram uniform.
Definition NipscanRenderer.h:49
@ fpSpotlight
Definition NipscanRenderer.h:53
@ fpPassthrough
Definition NipscanRenderer.h:51
float cutoffAngle
Definition NipscanRenderer.h:27
float ambientStrength
Definition NipscanRenderer.h:28
void renderObjects()
Overridden from base class.
void draw() override
Overridden from base class.
void paint() override
Overridden from base class.
void setElementInformation(const ElementInformation &)
Sets the element information.
void setToolInformation(const ToolInformation &info)
Sets the tool information.
void setIndexValue(int index, QVariant value) override
Overridden from base class.
QColor lightColor
Definition NipscanRenderer.h:26
float shininess
Definition NipscanRenderer.h:31
TClosure< void, NipscanRenderer * > HandlerType
Closure type to handle rendering.
Definition NipscanRenderer.h:68
Class to render Normals from another vertex array.
Definition Normals.h:12
Shader program having a default vertex and fragment shader.
Definition ShaderProgram.h:13
Class to render a sphere in OpenGL. The center of the sphere is in (0,0,0). Has a single color.
Definition Sphere.h:14
Class to render a cylinder in OpenGL. Height of the cone is along the Z-axis where the tip is at (0,...
Definition Tube.h:13
Base class for vertex-array derived classes.
Definition VertexArrayBase.h:15
#define SF_DECL_PROP_GS(Type, Name)
Declares unreferenced getter and unreferenced setter for a property.
Definition misc/qt/Macros.h:8
Definition DemoRenderer.h:6
std::array< T, N > array(QVector3D vect, T value=1)
Template function to get an 'std::array' type from a Vector3D. This function is to pass a 3D vector w...
#define _SCN_NIPSCAN_CLASS
Definition scn/nipscan/global.h:35
Pose of the Nipscan manipulator comprising all relevant axis.
Definition Nipscan.h:15