PCMRendererPlugin_impl.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  //
00029  // Getters & setters
00030  //
00031 
00032 inline const std::list < std::string > &RendererPlugin::getNeededOpenGLExts() const
00033 {
00034   return mNeededOpenGLExts;
00035 }
00036 
00037  /*-------------------------------------------------------------------------*/
00038 
00039  //
00040  // Methods
00041  //
00042 
00043 inline void RendererPlugin::resize(void *rendererHandle, const u32 & width, const u32 & height)
00044 {
00045   mLastError = mPcmOnResize(rendererHandle, width, height);
00046   _checkError();
00047 }
00048 
00049  /*----------------------------------------------------------------------*/
00050 
00051 inline s32 RendererPlugin::getSortOrder(void *rendererHandle)
00052 {
00053   // Call pcmGetSortOrder function if the plugin has it
00054   return mPcmGetSortOrder ? mPcmGetSortOrder(rendererHandle) : -1;
00055 }
00056 
00057  /*----------------------------------------------------------------------*/
00058 
00059 inline void RendererPlugin::render(void *rendererHandle, const double &time, const unsigned &frame)
00060 {
00061   mLastError = mPcmOnRender(rendererHandle, time, frame);
00062   _checkError();
00063 }
00064 
00065  /*-------------------------------------------------------------------------*/
00066 
00067  //
00068  // Methods
00069  //
00070 
00071 inline void RendererPlugin::setMiscParam(void *rendererHandle, const char *&name, const char *&value)
00072 {
00073   Assert(hasFunction("pcmSetMiscParam"), INVALID_NAME_ERROR, "RendererPlugin::setMiscParam()");
00074 
00075   pcmSetMiscParamType pcmSetMiscParam = (pcmSetMiscParamType) getFunction("pcmSetMiscParam");
00076 
00077   mLastError = pcmSetMiscParam(rendererHandle, name, value);
00078   _checkError();
00079 
00080   Logger::getInstance()->log(Logger::DEBUG,
00081                            std::string("Misc parameter (") + name + "=" + value + ") is set for renderer plugin `" +
00082                            mName + "\'.");
00083 }
00084 
00085  /*----------------------------------------------------------------------*/
00086 
00087 inline void RendererPlugin::setObjectSpaceBoundingBox(void *rendererHandle, const double &x0,
00088                                                   const double &y0, const double &z0,
00089                                                   const double &x1, const double &y1,
00090                                                   const double &z1)
00091 {
00092   Assert(hasFunction("pcmSetObjectSpaceBoundingBox"), INVALID_NAME_ERROR,
00093          "RendererPlugin::setObjectSpaceBoundingBox()");
00094 
00095   pcmSetObjectSpaceBoundingBoxType pcmSetObjectSpaceBoundingBox =
00096         (pcmSetObjectSpaceBoundingBoxType) getFunction("pcmSetObjectSpaceBoundingBox");
00097 
00098   mLastError = pcmSetObjectSpaceBoundingBox(rendererHandle, x0, y0, z0, x1, y1, z1);
00099   _checkError();
00100 
00101   Logger::getInstance()->log(Logger::DEBUG,
00102                            "Object space bounding box (" + StringConverter::toString(x0) + "," +
00103                            StringConverter::toString(y0) + "," + StringConverter::toString(z0) + ")-(" +
00104                            StringConverter::toString(x1) + "," + StringConverter::toString(y1) + "," +
00105                            StringConverter::toString(z1) + ") is set for renderer plugin `" + mName + "\'.");
00106 }
00107 
00108  /*----------------------------------------------------------------------*/
00109 
00110 inline void RendererPlugin::setObjectId(void *rendererHandle, const unsigned &objectId)
00111 {
00112   Assert(hasFunction("pcmSetObjectId"), INVALID_NAME_ERROR, "RendererPlugin::setObjectId()");
00113 
00114   pcmSetObjectIdType pcmSetObjectId = (pcmSetObjectIdType) getFunction("pcmSetMiscParam");
00115 
00116   mLastError = pcmSetObjectId(rendererHandle, objectId);
00117   _checkError();
00118 
00119   Logger::getInstance()->log(Logger::DEBUG,
00120                            "Object id #" + StringConverter::toString(objectId) + " is set for renderer plugin `" +
00121                            mName + "\'.");
00122 }
00123 
00124  /*----------------------------------------------------------------------*/
00125 
00126 inline void RendererPlugin::setScreenSpaceFramelet(void *rendererHandle, const double &u0, const double &v0,
00127                                                  const double &u1, const double &v1)
00128 {
00129   Assert(hasFunction("pcmSetScreenSpaceFramelet"), INVALID_NAME_ERROR, "RendererPlugin::setScreenSpaceFramelet()");
00130 
00131   pcmSetScreenSpaceFrameletType pcmSetScreenSpaceFramelet =
00132         (pcmSetScreenSpaceFrameletType) getFunction("pcmSetScreenSpaceFramelet");
00133 
00134   mLastError = pcmSetScreenSpaceFramelet(rendererHandle, u0, v0, u1, v1);
00135   _checkError();
00136 
00137   Logger::getInstance()->log(Logger::DEBUG,
00138                            "Screen space framelet (" + StringConverter::toString(u0) + "," +
00139                            StringConverter::toString(v0) + ")-(" + StringConverter::toString(u1) + "," +
00140                            StringConverter::toString(v1) + ") is set for renderer plugin `" + mName + "\'.");
00141 }
00142 
00143  /*----------------------------------------------------------------------*/
00144 
00145 inline void RendererPlugin::registerObjectSpaceBoundingBox(void *rendererHandle, const double &x0,
00146                                                          const double &y0, const double &z0,
00147                                                          const double &x1, const double &y1,
00148                                                          const double &z1)
00149 {
00150   Assert(hasFunction("pcmRegisterObjectSpaceBoundingBox"), INVALID_NAME_ERROR,
00151          "RendererPlugin::registerObjectSpaceBoundingBox()");
00152 
00153   pcmSetObjectSpaceBoundingBoxType pcmSetObjectSpaceBoundingBox =
00154         (pcmSetObjectSpaceBoundingBoxType) getFunction("pcmRegisterObjectSpaceBoundingBox");
00155 
00156   mLastError = pcmSetObjectSpaceBoundingBox(rendererHandle, x0, y0, z0, x1, y1, z1);
00157   _checkError();
00158 
00159   Logger::getInstance()->log(Logger::DEBUG,
00160                            "Register object space bounding box (" + StringConverter::toString(x0) + "," +
00161                            StringConverter::toString(y0) + "," + StringConverter::toString(z0) + ")-(" +
00162                            StringConverter::toString(x1) + "," + StringConverter::toString(y1) + "," +
00163                            StringConverter::toString(z1) + ") for renderer plugin `" + mName + "\'.");
00164 }
00165 
00166  /*----------------------------------------------------------------------*/