16 #ifndef SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H 17 #define SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H 19 #include <Eigen/Geometry> 24 #include <GLUT/glut.h> 26 #define GLUT_NO_LIB_PRAGMA 1 49 virtual void draw() = 0;
72 GlutRenderObject(), planeDirectionX(planeDirectionX), planeDirectionY(planeDirectionY),
73 halfSize(halfSize), color(color)
113 radius(radius), color(color), quadratic(gluNewQuadric())
135 explicit GlutImage(
const Eigen::AlignedBox<double, 2>& bounds) :
159 std::vector< std::shared_ptr<GlutRenderObject> >
children;
218 static void setCamera(std::shared_ptr<GlutCamera> camera)
225 static void addObject(std::shared_ptr<GlutRenderObject>
object)
227 m_objects.push_back(
object);
239 static std::vector< std::shared_ptr<GlutRenderObject> >
m_objects;
242 static void initialize();
245 static void reshape(GLint width, GLint height)
249 glViewport(0, 0, m_width, m_height);
253 static void display();
258 for (
auto it = m_objects.cbegin(); it != m_objects.cend(); ++it)
266 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_GLUTRENDERER_H float width
Width of each axis, in pixels.
Definition: GlutRenderer.h:88
virtual void draw()=0
Pure virtual draw method for subclasses to define how to draw themselves with Glut.
Definition: CompoundShapeToGraphics.cpp:29
double length
Length of each axis, in meters.
Definition: GlutRenderer.h:86
A templated Image class.
Definition: Image.h:33
bool m_firstRun
Is this the fist run of draw.
Definition: GlutRenderer.h:152
Axes with center at local origin, red axis along the local X-axis, green axis along the local Y-axis...
Definition: GlutRenderer.h:83
Eigen::AlignedBox< double, 2 > m_bounds
Window coordinates to draw the image.
Definition: GlutRenderer.h:146
GlutGroup()
Constructor. The group is initialized with no children.
Definition: GlutRenderer.h:162
static std::vector< std::shared_ptr< GlutRenderObject > > m_objects
Objects in the scene.
Definition: GlutRenderer.h:239
double halfSize
One half of the edge length of the square, in meters.
Definition: GlutRenderer.h:60
double zNear
Near clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:182
GLUquadric * quadratic
GLU quadric object for the quadric operations required to build the sphere.
Definition: GlutRenderer.h:122
SurgSim::Math::Vector3d up
Up direction.
Definition: GlutRenderer.h:178
double radius
Radius of the sphere, in meters.
Definition: GlutRenderer.h:105
static void reshape(GLint width, GLint height)
Glut reshape function which handles the resizing of the window.
Definition: GlutRenderer.h:245
SurgSim::Math::Vector3d planeDirectionX
The unit direction along one of the pairs edges of the square.
Definition: GlutRenderer.h:56
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:193
static int m_height
Height of the window.
Definition: GlutRenderer.h:234
double zFar
Far clipping plane distance from camera, in meters.
Definition: GlutRenderer.h:184
GlutImage(const Eigen::AlignedBox< double, 2 > &bounds)
Constuctor.
Definition: GlutRenderer.h:135
Square with center at local origin.
Definition: GlutRenderer.h:53
An Image drawn to the screen.
Definition: GlutRenderer.h:126
static void drawObjects()
Iterates through the scene objects to draw them.
Definition: GlutRenderer.h:256
unsigned int m_texture
Texture used for holding the image.
Definition: GlutRenderer.h:149
double fovY
Field of view angle (in degrees) in the vertical direction.
Definition: GlutRenderer.h:180
Abstract definition of an object that can render itself with Glut.
Definition: GlutRenderer.h:36
Simple static class renderer built on Glut.
Definition: GlutRenderer.h:206
SurgSim::Math::Vector3d color
Color of the sphere.
Definition: GlutRenderer.h:107
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
SurgSim::Framework::LockedContainer< ImageType > image
The image to draw.
Definition: GlutRenderer.h:131
Camera which controls the view of the scene.
Definition: GlutRenderer.h:171
SurgSim::Math::Vector3d eye
Eye position.
Definition: GlutRenderer.h:174
static void addObject(std::shared_ptr< GlutRenderObject > object)
Adds an object to the scene.
Definition: GlutRenderer.h:225
SurgSim::Math::Vector3d color
Color of the square.
Definition: GlutRenderer.h:62
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:39
A simple thread-safe data container that can support multiple writers and readers.
Definition: LockedContainer.h:54
Sphere with center at local origin.
Definition: GlutRenderer.h:102
GlutSphere(double radius, const SurgSim::Math::Vector3d &color)
Constructor.
Definition: GlutRenderer.h:112
GlutRenderObject()
Constructor initializes pose as identity (no rotation or translation)
Definition: GlutRenderer.h:42
SurgSim::Math::Vector3d center
Center (look at) position.
Definition: GlutRenderer.h:176
SurgSim::Math::Vector3d planeDirectionY
The unit direction along the other pair of edges of the square.
Definition: GlutRenderer.h:58
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:69
GlutAxes(double length, float width)
Constructor.
Definition: GlutRenderer.h:93
static std::shared_ptr< GlutCamera > m_camera
Camera which controls the view of the scene.
Definition: GlutRenderer.h:237
std::vector< std::shared_ptr< GlutRenderObject > > children
Children of this group.
Definition: GlutRenderer.h:159
Group of objects which provides a transform hierarchy.
Definition: GlutRenderer.h:156
static void setCamera(std::shared_ptr< GlutCamera > camera)
Sets the camera used to control the view of the scene.
Definition: GlutRenderer.h:218
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
static void run()
Initializes and runs the Glut main loop. This function will block until the Glut graphics window is c...
Definition: GlutRenderer.h:210
static int m_width
Width of the window.
Definition: GlutRenderer.h:232
SurgSim::DataStructures::Image< float > ImageType
Definition: GlutRenderer.h:128