Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGTileLoadBalancer.inl

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *                     Copyright 2000-2002 by OpenSG Forum                   *
00006  *                                                                           *
00007  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00008  *                                                                           *
00009 \*---------------------------------------------------------------------------*/
00010 /*---------------------------------------------------------------------------*\
00011  *                                License                                    *
00012  *                                                                           *
00013  * This library is free software; you can redistribute it and/or modify it   *
00014  * under the terms of the GNU Library General Public License as published    *
00015  * by the Free Software Foundation, version 2.                               *
00016  *                                                                           *
00017  * This library is distributed in the hope that it will be useful, but       *
00018  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00020  * Library General Public License for more details.                          *
00021  *                                                                           *
00022  * You should have received a copy of the GNU Library General Public         *
00023  * License along with this library; if not, write to the Free Software       *
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00025  *                                                                           *
00026 \*---------------------------------------------------------------------------*/
00027 /*---------------------------------------------------------------------------*\
00028  *                                Changes                                    *
00029  *                                                                           *
00030  *                                                                           *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #include <OSGConfig.h>
00038 
00039 OSG_BEGIN_NAMESPACE
00040 
00043 inline TileLoadBalancer::RegionLoad::RegionLoad(TileGeometryLoad *load):
00044     _load(load)
00045 {
00046 }
00047 
00050 inline void TileLoadBalancer::RegionLoad::updateCost(const Int32 wmin[2],
00051                                                    const Int32 wmax[2])
00052 {
00053     Real32 faces  =Real32(_load->getFaces());
00054     Real32 visible;
00055     Int32 vismin[2];
00056     Int32 vismax[2];
00057 
00058     visible=_load->getVisibleFraction(wmin,wmax,vismin,vismax);
00059     if(visible)
00060     {
00061         _visibleFaces=faces*visible;
00062         _invisibleFaces=faces-_visibleFaces;
00063         _pixel=Real32(
00064             (vismax[0] - vismin[0] + 1)*
00065             (vismax[1] - vismin[1] + 1));
00066     }
00067     else
00068     {
00069         _pixel=0;
00070         _invisibleFaces=0;
00071         _visibleFaces=0;
00072     }
00073 }
00074 
00079 inline Real32 TileLoadBalancer::RegionLoad::getCost(const RenderNode &renderNode)
00080 {
00081     return renderNode.estimatePerformance(_invisibleFaces,
00082                                           _visibleFaces,
00083                                           _pixel);
00084 }
00085 
00092 inline Real32 TileLoadBalancer::RegionLoad::getCost(const RenderNode &renderNode,
00093                                                     const Int32 wmin[2],
00094                                                     const Int32 wmax[2]) const
00095 {
00096     Int32 vismin[2];
00097     Int32 vismax[2];
00098     Real32 visibleFaces;
00099     Real32 invisibleFaces;
00100     Real32 visible;
00101 
00102     Real32 faces  =Real32(_load->getFaces());
00103     visible=_load->getVisibleFraction(wmin,wmax,vismin,vismax);
00104     if(visible==0.0)
00105         return 0.0;
00106     visibleFaces=faces*visible;
00107     invisibleFaces=faces-visibleFaces;
00108     Real32 pixel=Real32(
00109         (vismax[0] - vismin[0] + 1)*
00110         (vismax[1] - vismin[1] + 1));
00111     return renderNode.estimatePerformance(invisibleFaces,
00112                                           visibleFaces,
00113                                           pixel);
00114 }
00115 
00118 inline TileGeometryLoad * TileLoadBalancer::RegionLoad::getLoad(void)
00119 {
00120     return _load;
00121 }
00122 
00123 OSG_END_NAMESPACE
00124 
00125 #define OSG_TILE_LOAD_BALANCER_INLINE_CVSID "@(#)$Id:$"
00126 
00127 
00128 
00129 
00130 

Generated on Thu Aug 25 04:11:43 2005 for OpenSG by  doxygen 1.4.3