16 #ifndef SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
17 #define SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
23 #include <GLUT/glut.h>
45 virtual void draw()
const = 0;
68 GlutRenderObject(), planeDirectionX(planeDirectionX), planeDirectionY(planeDirectionY),
69 halfSize(halfSize), color(color)
74 virtual void draw()
const;
94 virtual void draw()
const;
109 radius(radius), color(color),
quadratic(gluNewQuadric())
114 virtual void draw()
const;
125 std::vector< std::shared_ptr<GlutRenderObject> >
children;
133 virtual void draw()
const;
184 static void setCamera(std::shared_ptr<GlutCamera> camera)
191 static void addObject(std::shared_ptr<GlutRenderObject>
object)
205 static std::vector< std::shared_ptr<GlutRenderObject> >
m_objects;
211 static void reshape(GLint width, GLint height)
215 glViewport(0, 0, m_width, m_height);
224 for (
auto it = m_objects.cbegin(); it != m_objects.cend(); ++it)
232 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H
virtual void draw() const
Draws the group with Glut and iterates through its children to draw them.
Definition: GlutRenderer.cpp:127
float width
Width of each axis, in pixels.
Definition: GlutRenderer.h:84
Definition: DriveElementFromInputBehavior.cpp:27
double length
Length of each axis, in meters.
Definition: GlutRenderer.h:82
Axes with center at local origin, red axis along the local X-axis, green axis along the local Y-axis...
Definition: GlutRenderer.h:79
virtual void draw() const =0
Pure virtual draw method for subclasses to define how to draw themselves with Glut.
GlutGroup()
Constructor. The group is initialized with no children.
Definition: GlutRenderer.h:128
static std::vector< std::shared_ptr< GlutRenderObject > > m_objects
Objects in the scene.
Definition: GlutRenderer.h:205
double halfSize
One half of the edge length of the square, in meters.
Definition: GlutRenderer.h:56
double zNear
Near clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:148
GLUquadric * quadratic
GLU quadric object for the quadric operations required to build the sphere.
Definition: GlutRenderer.h:118
virtual void draw() const
Draws the axes with Glut.
Definition: GlutRenderer.cpp:76
SurgSim::Math::Vector3d up
Up direction.
Definition: GlutRenderer.h:144
double radius
Radius of the sphere, in meters.
Definition: GlutRenderer.h:101
static void reshape(GLint width, GLint height)
Glut reshape function which handles the resizing of the window.
Definition: GlutRenderer.h:211
SurgSim::Math::Vector3d planeDirectionX
The unit direction along one of the pairs edges of the square.
Definition: GlutRenderer.h:52
static void display()
Glut display function which handles the drawing of the scene.
Definition: GlutRenderer.cpp:167
virtual void draw() const
Draws the sphere with Glut.
Definition: GlutRenderer.cpp:109
GlutCamera(const SurgSim::Math::Vector3d &eye_, const SurgSim::Math::Vector3d ¢er_, const SurgSim::Math::Vector3d &up_, const double fovY_, double zNear_, double zFar_)
Constructor.
Definition: GlutRenderer.h:159
virtual void draw() const
Draws the square with Glut.
Definition: GlutRenderer.cpp:36
static int m_height
Height of the window.
Definition: GlutRenderer.h:200
double zFar
Far clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:150
Square with center at local origin.
Definition: GlutRenderer.h:49
static void drawObjects()
Iterates through the scene objects to draw them.
Definition: GlutRenderer.h:222
double fovY
Field of view angle (in degrees) in the vertical direction.
Definition: GlutRenderer.h:146
Abstract definition of an object that can render itself with Glut.
Definition: GlutRenderer.h:32
Simple static class renderer built on Glut.
Definition: GlutRenderer.h:172
SurgSim::Math::Vector3d color
Color of the sphere.
Definition: GlutRenderer.h:103
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Camera which controls the view of the scene.
Definition: GlutRenderer.h:137
SurgSim::Math::Vector3d eye
Eye position.
Definition: GlutRenderer.h:140
static void addObject(std::shared_ptr< GlutRenderObject > object)
Adds an object to the scene.
Definition: GlutRenderer.h:191
SurgSim::Math::Vector3d color
Color of the square.
Definition: GlutRenderer.h:58
Definitions of small fixed-size vector types.
virtual ~GlutRenderObject()
Definition: GlutRenderer.cpp:32
SurgSim::Math::RigidTransform3d pose
Pose (rotation and translation) of the object.
Definition: GlutRenderer.h:35
static void initialize()
Initializes the Glut window.
Definition: GlutRenderer.cpp:143
Sphere with center at local origin.
Definition: GlutRenderer.h:98
GlutSphere(double radius, const SurgSim::Math::Vector3d &color)
Constructor.
Definition: GlutRenderer.h:108
GlutRenderObject()
Constructor initializes pose as identity (no rotation or translation)
Definition: GlutRenderer.h:38
SurgSim::Math::Vector3d center
Center (look at) position.
Definition: GlutRenderer.h:142
SurgSim::Math::Vector3d planeDirectionY
The unit direction along the other pair of edges of the square.
Definition: GlutRenderer.h:54
GlutSquare(double halfSize, const SurgSim::Math::Vector3d &color, const SurgSim::Math::Vector3d &planeDirectionX=SurgSim::Math::Vector3d(1.0, 0.0, 0.0), const SurgSim::Math::Vector3d &planeDirectionY=SurgSim::Math::Vector3d(0.0, 1.0, 0.0))
Constructor.
Definition: GlutRenderer.h:65
GlutAxes(double length, float width)
Constructor.
Definition: GlutRenderer.h:89
static std::shared_ptr< GlutCamera > m_camera
Camera which controls the view of the scene.
Definition: GlutRenderer.h:203
std::vector< std::shared_ptr< GlutRenderObject > > children
Children of this group.
Definition: GlutRenderer.h:125
Group of objects which provides a transform hierarchy.
Definition: GlutRenderer.h:122
static void setCamera(std::shared_ptr< GlutCamera > camera)
Sets the camera used to control the view of the scene.
Definition: GlutRenderer.h:184
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:56
static void run()
Initializes and runs the Glut main loop. This function will block until the Glut graphics window is c...
Definition: GlutRenderer.h:176
static int m_width
Width of the window.
Definition: GlutRenderer.h:198