PCMRenderer.h

Go to the documentation of this file.
00001 
00002 //
00003 // This source file is a part of ParCompMark
00004 // Parallel Compositing Benchmark Framework
00005 //
00006 // for latest info see http://parcompmark.sourceforge.net
00007 
00008 //
00009 // Copyright (C) 2006 IT2 ParCompMark Dev. Team
00010 // 
00011 // This program is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License
00013 // as published by the Free Software Foundation; either version 2
00014 // of the License, or (at your option) any later version.
00015 // 
00016 // This program is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 // GNU General Public License for more details.
00020 // 
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 
00027 
00028 #ifndef __PCM_RENDERER_H__
00029 #  define __PCM_RENDERER_H__
00030 
00031 //
00032 // Inner includes
00033 //
00034 
00035 #  include "PCMPremeditations.h"
00036 
00037 #  include "PCMException.h"
00038 
00039 #  include "PCMLogger.h"
00040 
00041 #  include "PCMPointer.h"
00042 
00043 #  include "PCMRendererPlugin.h"
00044 
00045 #  include "PCMOpenGLRenderingEngine.h"
00046 
00047 #  include "PCMProcess.h"
00048 
00049 //
00050 // Scripting bind includes (for Squirrel)
00051 //
00052 
00053 #  include <squirrel/squirrel.h>
00054 #  include <squirrel/sqstdio.h>
00055 #  include <squirrel/sqstdaux.h>
00056 #  include <squirrel/sqplus.h>
00057 
00058 namespace ParCompMark
00059 {
00060 
00065   class Renderer
00066   {
00067 
00068         //
00069         // Unit test class
00070         //
00071 #  ifdef PARCOMPMARK_TEST
00072         friend class ParCompMarkTest::TestRenderer;
00073 #  endif
00074 
00075         //
00076         // Scripting binding (for Squirrel)
00077         //
00078 
00080 
00081 
00089    public:static void squirrelGlue()
00090         {
00091          ::SqPlus::SQClassDef < Renderer > (_T("Renderer")).func(&Renderer::render,
00092                                                                  _T("render")).func(&Renderer::setMiscParam,
00093                                                                                    _T("setMiscParam")).
00094                 func(&Renderer::setObjectSpaceBoundingBox, _T("setObjectSpaceBoundingBox")).func(&Renderer::setObjectId,
00095                                                                                                  _T("setObjectId")).
00096                 func(&Renderer::setScreenSpaceFramelet,
00097                   _T("setScreenSpaceFramelet")).func(&Renderer::registerObjectSpaceBoundingBox,
00098                                                         _T("registerObjectSpaceBoundingBox")).
00099                 func(&Renderer::getAutoRenderOrder, _T("getAutoRenderOrder")).func(&Renderer::setAutoRenderOrder,
00100                                                                                  _T("setAutoRenderOrder"));
00101         }
00102 
00104 
00105         //
00106         // Typedefs
00107         //
00108 
00109    public:
00110 
00112         typedef ParCompMark::Pointer < Renderer,
00113         Mutex > Pointer;
00114 
00115         //
00116         // Class constants
00117         //
00118 
00120 
00121 
00122    public:
00123 
00129         static const s32 NOAUTORENDERING;
00130 
00132 
00133         //
00134         // Variables
00135         //
00136 
00138 
00139 
00140    protected:
00141 
00147         void *mRendererHandle;
00148 
00154         RendererPlugin *mRendererPlugin;
00155 
00161         OpenGLRenderingEngine *mParent;
00162 
00168         bool mInitialized;
00169 
00175         s32 mAutoRenderOrder;
00176 
00178 
00179         //
00180         // Constructors & destructor
00181         //
00182 
00184 
00185 
00186    public:
00187 
00191         Renderer();
00192 
00199         Renderer(RendererPlugin * rendererPlugin, void *rendererHandle, OpenGLRenderingEngine * parent);
00200 
00204         virtual ~ Renderer();
00205 
00207 
00208         //
00209         // Getters & setters
00210         //
00211 
00213 
00214 
00215    public:
00216 
00222         void *getRendererHandle() const;
00223 
00229         void setRendererHandle(const void *rendererhandle);
00230 
00236         OpenGLRenderingEngine *getParent() const;
00237 
00243         const bool & getInitialized() const;
00244 
00250         s32 & getAutoRenderOrder();
00251 
00257         void setAutoRenderOrder(const s32 autorenderorder);
00258 
00260 
00261         //
00262         // Methods
00263         //
00264 
00266 
00267 
00268    public:
00269 
00273         virtual void initialize();
00274 
00278         virtual void finalize();
00279 
00285         virtual void resize(const u32 width, const u32 height);
00286 
00291         virtual s32 getSortOrder();
00292 
00296         virtual void render();
00297 
00303         virtual void setMiscParam(const char *name, const char *value);
00304 
00314         virtual void setObjectSpaceBoundingBox(const double x0, const double y0, const double z0,
00315                                            const double x1, const double y1, const double z1);
00316 
00321         virtual void setObjectId(const unsigned objectId);
00322 
00330         virtual void setScreenSpaceFramelet(const double u0, const double v0, const double u1,
00331                                          const double v1);
00332 
00342         virtual void registerObjectSpaceBoundingBox(const double x0, const double y0, const double z0,
00343                                                  const double x1, const double y1,
00344                                                  const double z1);
00345 
00347 
00348   };
00349 
00350   //
00351   // Include header implementation
00352   //
00353 
00354 #  include "PCMRenderer_impl.h"
00355 
00356 }
00357 
00358 // Declare Renderer class (and its enums) for SqPlus binding
00360 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Renderer, Renderer);
00361 
00362 #endif