Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
include/seq/renderer.h
1 
2 /* Copyright (c) 2011-2013, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQSEQUEL_RENDERER_H
19 #define EQSEQUEL_RENDERER_H
20 
21 #include <co/objectFactory.h> // interface
22 #include <seq/types.h>
23 
24 namespace seq
25 {
32 class Renderer : public co::ObjectFactory
33 {
34 public:
36  SEQ_API Renderer( Application& application );
37 
39  SEQ_API virtual ~Renderer();
40 
54  SEQ_API virtual bool init( co::Object* initData LB_UNUSED )
55  { return true; }
56 
66  SEQ_API virtual bool exit() { return true; }
67 
79  SEQ_API virtual bool initContext( co::Object* initData );
80 
89  SEQ_API virtual bool exitContext();
90 
98  SEQ_API virtual void clear( co::Object* frameData );
99 
107  virtual void draw( co::Object* frameData ) = 0;
108 
115  SEQ_API void updateNearFar( const Vector4f& boundingSphere );
116 
127  SEQ_API void setNearFar( const float nearPlane, const float farPlane );
128 
138  SEQ_API virtual void applyRenderContext();
139 
141  SEQ_API const RenderContext& getRenderContext() const;
142 
152  SEQ_API virtual void applyModelMatrix();
154 
157  detail::Renderer* getImpl() { return _impl; }
158  co::Object* getFrameData(); // @warning experimental
159 
161  Application& getApplication() { return app_; }
162 
164  const Application& getApplication() const { return app_; }
165 
176  SEQ_API virtual ViewData* createViewData();
177 
179  SEQ_API virtual void destroyViewData( ViewData* viewData );
180 
194  SEQ_API const GLEWContext* glewGetContext() const;
195 
197  SEQ_API const Frustumf& getFrustum() const;
198 
200  SEQ_API const Matrix4f& getViewMatrix() const;
201 
203  SEQ_API const Matrix4f& getModelMatrix() const;
205 
208  SEQ_API virtual co::Object* createObject( const uint32_t type );
209  SEQ_API virtual void destroyObject( co::Object* object,
210  const uint32_t type );
212 
213 private:
214  detail::Renderer* const _impl;
215  Application& app_;
216 };
217 }
218 #endif // EQSEQUEL_RENDERER_H
virtual SEQ_API ViewData * createViewData()
Create a new per-view data instance.
const Application & getApplication() const
virtual SEQ_API void clear(co::Object *frameData)
Clear the frame buffer.
virtual SEQ_API bool init(co::Object *initData 1)
Initialize the renderer.
SEQ_API const Matrix4f & getModelMatrix() const
virtual void draw(co::Object *frameData)=0
Render the scene.
virtual SEQ_API ~Renderer()
Destruct this renderer.
The main application object.
SEQ_API void updateNearFar(const Vector4f &boundingSphere)
Update the near and far planes to tightly enclose the given sphere.
SEQ_API const Frustumf & getFrustum() const
SEQ_API void setNearFar(const float nearPlane, const float farPlane)
Set the near and far planes.
virtual SEQ_API bool initContext(co::Object *initData)
Initialize a rendering context.
SEQ_API const GLEWContext * glewGetContext() const
Get the GLEW context for this renderer.
A renderer instance.
Stores per-view data.
Definition: viewData.h:29
virtual SEQ_API void applyRenderContext()
Apply the current rendering parameters to the rendering context.
Application & getApplication()
SEQ_API Renderer(Application &application)
Construct a new renderer.
SEQ_API const RenderContext & getRenderContext() const
virtual SEQ_API void destroyViewData(ViewData *viewData)
Delete the given view data.
SEQ_API const Matrix4f & getViewMatrix() const
virtual SEQ_API bool exit()
De-initialize the renderer.
virtual SEQ_API bool exitContext()
De-initialize a rendering context.
The context applied to a channel during rendering operations.
Definition: renderContext.h:38
virtual SEQ_API void applyModelMatrix()
Apply the current model matrix to the rendering context.