OSGRenderPartition.inl

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042
00043 OSG_BEGIN_NAMESPACE
00044
00045 /***************************************************************************\
00046  *                               Types                                     *
00047 \***************************************************************************/
00048
00049
00050 /***************************************************************************\
00051  *                           Class variables                               *
00052 \***************************************************************************/
00053
00054
00055 /***************************************************************************\
00056  *                           Class methods                                 *
00057 \***************************************************************************/
00058
00059
00060 /*-------------------------------------------------------------------------*\
00061  -  public                                                                 -
00062 \*-------------------------------------------------------------------------*/
00063
00064 /*-------------------------------------------------------------------------*\
00065  -  protected                                                              -
00066 \*-------------------------------------------------------------------------*/
00067
00068
00069 /*-------------------------------------------------------------------------*\
00070  -  private                                                                -
00071 \*-------------------------------------------------------------------------*/
00072
00073
00074 /***************************************************************************\
00075  *                           Instance methods                              *
00076 \***************************************************************************/
00077
00078 /*-------------------------------------------------------------------------*\
00079  -  public                                                                 -
00080 \*-------------------------------------------------------------------------*/
00081
00082 inline
00083 DrawEnv &RenderPartition::getDrawEnv(void)
00084 {
00085     return _oDrawEnv;
00086 }
00087
00088 /*------------- constructors & destructors --------------------------------*/
00089
00090 /*------------------------------ access -----------------------------------*/
00091
00092 /*---------------------------- properties ---------------------------------*/
00093
00094 inline
00095 void RenderPartition::setViewportDimension(Int32 iPixelLeft,
00096                                            Int32 iPixelBottom,
00097                                            Int32 iPixelRight,
00098                                            Int32 iPixelTop,
00099                                            bool  bFull       )
00100 {
00101     _oDrawEnv.setViewportDimension(iPixelLeft,
00102                                    iPixelBottom,
00103                                    iPixelRight,
00104                                    iPixelTop,
00105                                    bFull);
00106 }
00107
00108 inline
00109 Int32 RenderPartition::getViewportWidth(void)
00110 {
00111     return _oDrawEnv.getPixelWidth();
00112 }
00113
00114 inline
00115 Int32 RenderPartition::getViewportHeight(void)
00116 {
00117     return _oDrawEnv.getPixelHeight();
00118 }
00119
00120 inline
00121 void RenderPartition::setSetupMode(UInt32 uiSetupMode)
00122 {
00123     _uiSetupMode = uiSetupMode;
00124 }
00125
00126 inline
00127 void RenderPartition::addSetupModeBit(UInt32 uiSetupModeBit)
00128 {
00129     _uiSetupMode |= uiSetupModeBit;
00130 }
00131
00132 inline
00133 void RenderPartition::subSetupMode(UInt32 uiSetupModeBit)
00134 {
00135     _uiSetupMode &= ~uiSetupModeBit;
00136 }
00137
00138 inline
00139 void RenderPartition::setNodePool(RenderTreeNodePool *pNodePool)
00140 {
00141     _pNodePool = pNodePool;
00142 }
00143
00144 inline
00145 void RenderPartition::setStatePool(StateOverridePool *pStatePool)
00146 {
00147     _pStatePool = pStatePool;
00148 }
00149
00150 inline
00151 void RenderPartition::setTreeBuilderPool(TreeBuilderPool *pTreeBuilderPool)
00152 {
00153     _pTreeBuilderPool = pTreeBuilderPool;
00154 }
00155
00156 inline
00157 void RenderPartition::setStatCollector(StatCollectorP pStatCollector)
00158 {
00159     _oDrawEnv.setStatCollector(pStatCollector);
00160 }
00161
00162 inline
00163 StatCollectorP RenderPartition::getStatCollector(void)
00164 {
00165     return _oDrawEnv.getStatCollector();
00166 }
00167
00168 #if 0
00169 inline
00170 void RenderPartition::setViewport(Viewport *pViewport)
00171 {
00172     _oDrawEnv.setViewport(pViewport);
00173 }
00174
00175 inline
00176 Viewport *RenderPartition::getViewport(void)
00177 {
00178     return _oDrawEnv.getViewport();
00179 }
00180 #endif
00181 
00182 inline
00183 void RenderPartition::setWindow(Window *pWindow)
00184 {
00185     _oDrawEnv.setWindow(pWindow);
00186 }
00187
00188 inline
00189 Window *RenderPartition::getWindow(void)
00190 {
00191     return _oDrawEnv.getWindow();
00192 }
00193
00194 inline
00195 void RenderPartition::setBackground(Background *pBackground)
00196 {
00197     _pBackground = pBackground;
00198 }
00199
00200 inline
00201 void RenderPartition::setupProjection(const Matrix4f &projection,
00202                                       const Matrix4f &translation)
00203 {
00204     _oDrawEnv.setupProjection(projection, translation);
00205 }
00206
00207 inline
00208 const Matrix4f &RenderPartition::getFullProjection(void)
00209 {
00210     return _oDrawEnv.getCameraFullProjection();
00211 }
00212
00213 inline
00214 const Matrix4f &RenderPartition::getProjection(void)
00215 {
00216     return _oDrawEnv.getCameraProjection();
00217 }
00218
00219 inline
00220 const Matrix4f &RenderPartition::getProjectionTrans(void)
00221 {
00222     return _oDrawEnv.getCameraProjectionTrans();
00223 }
00224
00225 inline
00226 const Matrix4f &RenderPartition::getVPFullProjection(void)
00227 {
00228     return _oDrawEnv.getVPCameraFullProjection();
00229 }
00230
00231 inline
00232 const Matrix4f &RenderPartition::getVPProjection(void)
00233 {
00234     return _oDrawEnv.getVPCameraProjection();
00235 }
00236
00237 inline
00238 const Matrix4f &RenderPartition::getVPProjectionTrans(void)
00239 {
00240     return _oDrawEnv.getVPCameraProjectionTrans();
00241 }
00242
00243 inline
00244 void RenderPartition::setupViewing(const Matrix4f &matrix)
00245 {
00246     _oDrawEnv.setupViewing(matrix);
00247
00248 #ifndef OSG_ENABLE_DOUBLE_MATRIX_STACK
00249     _modelViewMatrix.second = matrix;
00250 #else
00251     Matrix4d temp;
00252     temp.convertFrom(matrix);
00253     _modelViewMatrix.second = temp;
00254 #endif
00255 
00256     _modelMatrix.setIdentity();
00257     _modelMatrixValid = true;
00258 }
00259
00260 template<class MatrixType> inline
00261 void RenderPartition::pushMatrix(const MatrixType &matrix)
00262 {
00263     _modelViewMatrixStack.push_back(_modelViewMatrix);
00264
00265     _modelViewMatrix.first = ++_uiMatrixId;
00266     _modelViewMatrix.second.mult(matrix);
00267
00268     _modelMatrixValid = false;
00269 }
00270
00271 inline
00272 const Matrix &RenderPartition::getModelMatrix(void) const
00273 {
00274     updateModelMatrix();
00275
00276     return _modelMatrix;
00277 }
00278
00279 inline
00280 const Matrix &RenderPartition::getModelViewMatrix(void) const
00281 {
00282     return _modelViewMatrix.second;
00283 }
00284
00285 inline
00286 const Matrix4f &RenderPartition::getViewing(void)
00287 {
00288     return _oDrawEnv.getCameraViewing();
00289 }
00290
00291 inline
00292 const Matrix4f &RenderPartition::getCameraToWorld(void)
00293 {
00294     return _oDrawEnv.getCameraToWorld();
00295 }
00296
00297 inline
00298 const Matrix4f &RenderPartition::getVPViewing(void)
00299 {
00300     return _oDrawEnv.getVPCameraViewing();
00301 }
00302
00303 inline
00304 const Matrix4f &RenderPartition::getVPCameraToWorld(void)
00305 {
00306     return _oDrawEnv.getCameraToWorld();
00307 }
00308
00309 inline
00310 void RenderPartition::addPartition(RenderPartition *pPart)
00311 {
00312     _vGroupStore.push_back(pPart);
00313 }
00314
00315 inline
00316 void RenderPartition::setNear(Real32 camNear)
00317 {
00318     _oDrawEnv.setCameraNear(camNear);
00319 }
00320
00321 inline
00322 void RenderPartition::setFar (Real32 camFar)
00323 {
00324     _oDrawEnv.setCameraFar(camFar);
00325 }
00326
00327 inline
00328 Real32 RenderPartition::getNear(void)
00329 {
00330     return _oDrawEnv.getCameraNear();
00331 }
00332
00333 inline
00334 Real32 RenderPartition::getFar(void)
00335 {
00336     return _oDrawEnv.getCameraFar();
00337 }
00338
00339 inline
00340 void RenderPartition::setKeyGen(UInt32 uiKeyGen)
00341 {
00342     _uiKeyGen = uiKeyGen;
00343 }
00344
00345
00346 inline
00347 Material *RenderPartition::getMaterial(void)
00348 {
00349     return _pMaterial;
00350 }
00351
00352 inline
00353 void RenderPartition::setRenderTarget(FrameBufferObject *pTarget)
00354 {
00355     _pRenderTarget = pTarget;
00356 }
00357
00358 inline
00359 FrameBufferObject *RenderPartition::getRenderTarget(void)
00360 {
00361     return _pRenderTarget;
00362 }
00363
00364 inline
00365 void RenderPartition::setDrawBuffer(GLenum eBuffer)
00366 {
00367     _eDrawBuffer = eBuffer;
00368 }
00369
00370 inline
00371 bool RenderPartition::getFrustumCulling(void) const
00372 {
00373     return _bFrustumCulling;
00374 }
00375
00376 inline
00377 void RenderPartition::setFrustumCulling(bool val)
00378 {
00379     _bFrustumCulling = val;
00380 }
00381
00382 inline
00383 bool RenderPartition::getVolumeDrawing(void) const
00384 {
00385     return _bVolumeDrawing;
00386 }
00387
00388 inline
00389 void RenderPartition::setVolumeDrawing(bool val)
00390 {
00391     _bVolumeDrawing = val;
00392 }
00393
00394 inline
00395 const FrustumVolume &RenderPartition::getFrustum(void) const
00396 {
00397     return _oFrustum;
00398 }
00399
00400 inline
00401 void RenderPartition::setFrustum(FrustumVolume &frust)
00402 {
00403     _oFrustum = frust;
00404 }
00405
00406 inline
00407 void RenderPartition::disable(void)
00408 {
00409     _bDone = true;
00410 }
00411
00412 inline
00413 void RenderPartition::dropFunctor(SimpleDrawCallback &oSimpleCallback)
00414 {
00415     _oSimpleDrawCallback = oSimpleCallback;
00416 }
00417
00418 inline
00419 UInt32 RenderPartition::getNumMatrixChanges(void)
00420 {
00421     return _uiNumMatrixChanges;
00422 }
00423
00424 inline
00425 UInt32 RenderPartition::getNumStateChanges(void)
00426 {
00427     return _oDrawEnv.getNumStateChanges();
00428 }
00429
00430 inline
00431 UInt32 RenderPartition::getNumShaderChanges(void)
00432 {
00433     return _oDrawEnv.getNumShaderChanges();
00434 }
00435
00436 inline
00437 UInt32 RenderPartition::getNumShaderParamChanges(void)
00438 {
00439     return _oDrawEnv.getNumShaderParamChanges();
00440 }
00441
00442 inline
00443 UInt32 RenderPartition::getNumTriangles(void)
00444 {
00445     return _uiNumTriangles;
00446 }
00447
00448 inline
00449 void RenderPartition::addPreRenderCallback (const RenderFunctor &oCallback)
00450 {
00451     _vPreRenderCallbacks.push_back(oCallback);
00452 }
00453
00454 inline
00455 void RenderPartition::addPostRenderCallback(const RenderFunctor &oCallback)
00456 {
00457     _vPostRenderCallbacks.push_back(oCallback);
00458 }
00459
00460 /*-------------------------- your_category---------------------------------*/
00461
00462 #ifdef OSG_DEBUG
00463 inline
00464 void RenderPartition::setDebugString(std::string szDebugString)
00465 {
00466     _szDebugString = szDebugString;
00467 }
00468 #endif
00469 
00470 /*-------------------------- assignment -----------------------------------*/
00471
00472 /*-------------------------- comparison -----------------------------------*/
00473
00474 /*-------------------------------------------------------------------------*\
00475  -  protected                                                              -
00476 \*-------------------------------------------------------------------------*/
00477
00478 inline
00479 void  RenderPartition::setNode(Node *pNode)
00480 {
00481     _pNode = pNode;
00482 }
00483
00484 inline
00485 Node *RenderPartition::getNode(void)
00486 {
00487     return _pNode;
00488 }
00489
00490 /*-------------------------------------------------------------------------*\
00491  -  private                                                                -
00492 \*-------------------------------------------------------------------------*/
00493
00494 OSG_END_NAMESPACE