changed: gcc8 base update
[opensg.git] / Source / System / Cluster / Window / SortFirst / OSGTileGeometryLoad.inl
blobd1659414944467e56f7ed31214d03f1e45da8341
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                     Copyright 2000,2001 by OpenSG Forum                   *
6  *                                                                           *
7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  * This library is free software; you can redistribute it and/or modify it   *
14  * under the terms of the GNU Library General Public License as published    *
15  * by the Free Software Foundation, version 2.                               *
16  *                                                                           *
17  * This library is distributed in the hope that it will be useful, but       *
18  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
20  * Library General Public License for more details.                          *
21  *                                                                           *
22  * You should have received a copy of the GNU Library General Public         *
23  * License along with this library; if not, write to the Free Software       *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28  *                                Changes                                    *
29  *                                                                           *
30  *                                                                           *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35 \*---------------------------------------------------------------------------*/
37 OSG_BEGIN_NAMESPACE
39 inline Real32 TileGeometryLoad::getFaceDistribution(UInt32 dir,Real32 cut)
41     if(cut<=0)
42     {
43         return 0.0;
44     }
46     if(cut >=1.0)
47     {
48         return 1.0;
49     }
50     cut *= FACE_DISTRIBUTION_SAMPLING_COUNT - 1;
51     
52     UInt32 a = UInt32(floor(cut));
53     Real32 f = cut - a;
55     return 
56         _faceDistribution[dir][a] +
57             (_faceDistribution[dir][a+1] - _faceDistribution[dir][a]) * f;
60 OSG_END_NAMESPACE