00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027
00028 #ifndef __PCM_RENDERERPLUGIN_H__
00029 # define __PCM_RENDERERPLUGIN_H__
00030
00031
00032
00033
00034
00035 # include "PCMPremeditations.h"
00036
00037 # include "PCMPlugin.h"
00038
00039 # include "PCMException.h"
00040
00041 # include "PCMLogger.h"
00042
00043 # include "PCMPointer.h"
00044
00045 # include "PCMGLXRenderWindow.h"
00046
00047 # include "PCMStringConverter.h"
00048
00049
00050
00051
00052
00053 # include <X11/Xlib.h>
00054
00055 # include <GL/glew.h>
00056
00057 # include <GL/glx.h>
00058
00059 # include <list>
00060
00061 namespace ParCompMark
00062 {
00063
00068 class RendererPlugin:public Plugin
00069 {
00070
00071
00072
00073
00074 # ifdef PARCOMPMARK_TEST
00075 friend class ParCompMarkTest::TestRendererPlugin;
00076 # endif
00077
00078
00079
00080
00081
00082 public:
00083
00085 typedef struct
00086 {
00087 unsigned left;
00088 unsigned top;
00089 unsigned width;
00090
00091 unsigned height;
00092 unsigned char *colour;
00093 } PluginBuffer;
00094
00096 typedef ParCompMark::Pointer < RendererPlugin,
00097 Mutex > Pointer;
00098
00100 typedef int (*pcmSetMiscParamType) (void *, const char *, const char *);
00101
00103 typedef int (*pcmSetObjectSpaceBoundingBoxType) (void *, double, double, double, double, double, double);
00104
00106 typedef int (*pcmregisterObjectSpaceBoundingBoxType) (void *, double, double, double, double, double, double);
00107
00109 typedef int (*pcmSetObjectIdType) (void *, unsigned);
00110
00112 typedef int (*pcmSetScreenSpaceFrameletType) (void *, double, double, double, double);
00113
00115 typedef int (*pcmOnResizeType) (void *, unsigned, unsigned);
00116
00118 typedef int (*pcmGetSortOrderType) (void *);
00119
00121 typedef int (*pcmOnRenderType) (void *, double, unsigned);
00122
00123 protected:
00124
00126 typedef void (*bufferGetterType) (const void *, const char *, void *);
00127
00129 typedef const char **(*pcmGetNeededOpenGLExtsType) ();
00130
00132 typedef void *(*pcmOnCreateRendererType) (void *, Display *, Window, XVisualInfo *, GLXContext);
00133
00135 typedef int (*pcmOnDestroyRendererType) (void *);
00136
00138 typedef int (*pcmSetBufferGetterType) (bufferGetterType);
00139
00140
00141
00142
00143
00145
00146
00147 protected:
00148
00154 std::list < std::string > mNeededOpenGLExts;
00155
00161 RendererPlugin::pcmOnResizeType mPcmOnResize;
00162
00168 RendererPlugin::pcmGetSortOrderType mPcmGetSortOrder;
00169
00175 RendererPlugin::pcmOnRenderType mPcmOnRender;
00176
00178
00179
00180
00181
00182
00184
00185
00186 public:
00187
00194 RendererPlugin(const Plugin::PluginType & type, const std::string & name,
00195 const std::string & filename);
00196
00200 virtual ~ RendererPlugin();
00201
00203
00204
00205
00206
00207
00209
00210
00211 public:
00212
00218 const std::list < std::string > &getNeededOpenGLExts() const;
00219
00221
00222
00223
00224
00225
00227
00228
00229 protected:
00230
00244 static void _bufferGetter(const void *pRenderer, const char *bufferName, void *pBufferData);
00245
00247
00248
00249
00250
00251
00253
00254
00255 public:
00256
00263 virtual Renderer * createRenderer(GLXRenderWindow::Pointer window, OpenGLRenderingEngine * parent);
00264
00269 virtual void destroyRenderer(Renderer * renderer);
00270
00277 virtual void resize(void *rendererHandle, const u32 & width, const u32 & height);
00278
00284 virtual s32 getSortOrder(void *rendererHandle);
00285
00292 virtual void render(void *rendererHandle, const double &time, const unsigned &frame);
00293
00300 virtual void setMiscParam(void *rendererHandle, const char *&name, const char *&value);
00301
00312 virtual void setObjectSpaceBoundingBox(void *rendererHandle, const double &x0, const double &y0,
00313 const double &z0, const double &x1, const double &y1,
00314 const double &z1);
00315
00321 virtual void setObjectId(void *rendererHandle, const unsigned &objectId);
00322
00331 virtual void setScreenSpaceFramelet(void *rendererHandle, const double &u0, const double &v0,
00332 const double &u1, const double &v1);
00333
00344 virtual void registerObjectSpaceBoundingBox(void *rendererHandle, const double &x0,
00345 const double &y0, const double &z0,
00346 const double &x1, const double &y1,
00347 const double &z1);
00348
00349 protected:
00350
00354 virtual void _initializeSpecific();
00355
00359 virtual void _finalizeSpecific();
00360
00364 virtual void _setBufferGetter();
00365
00369 virtual void _getNeededOpenGLExts();
00370
00374 virtual void _initFastFunctions();
00375
00377
00378 };
00379
00380
00381
00382
00383
00384 # include "PCMRendererPlugin_impl.h"
00385
00386 }
00387
00388 #endif