changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Geometry / Util / OSGIntersectKDTreeNode.inl
blobcf0b265e02eac6675522ae7627b6b3e4a57b7c65
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                Copyright (C) 2011 by the OpenSG Forum                     *
6  *                                                                           *
7  *                            www.opensg.org                                 *
8  *                                                                           *
9  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
10  *                                                                           *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13  *                                License                                    *
14  *                                                                           *
15  * This library is free software; you can redistribute it and/or modify it   *
16  * under the terms of the GNU Library General Public License as published    *
17  * by the Free Software Foundation, version 2.                               *
18  *                                                                           *
19  * This library is distributed in the hope that it will be useful, but       *
20  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
22  * Library General Public License for more details.                          *
23  *                                                                           *
24  * You should have received a copy of the GNU Library General Public         *
25  * License along with this library; if not, write to the Free Software       *
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
27  *                                                                           *
28 \*---------------------------------------------------------------------------*/
30 OSG_BEGIN_NAMESPACE
32 inline void
33 IntersectKDTreeNode::setLeaf(UInt32 triCount, UInt32 triOffset)
35     _flags     = Leaf;
36     _count     = triCount;
37     _triOffset = triOffset;
40 inline void
41 IntersectKDTreeNode::setInterior(FlagsE axis, UInt32 childOffset, Real32 split)
43     _flags = axis;
44     _count = childOffset;
45     _split = split;
48 inline bool
49 IntersectKDTreeNode::isLeaf(void) const
51     return (_flags == Leaf);
54 inline UInt32
55 IntersectKDTreeNode::getChildOffset(void) const
57     return _count;
60 inline UInt32
61 IntersectKDTreeNode::getSplitAxis(void) const
63     return _flags;
66 inline Real32
67 IntersectKDTreeNode::getSplit(void) const
69     return _split;
72 inline UInt32
73 IntersectKDTreeNode::getTriCount(void) const
75     return _count;
78 inline UInt32
79 IntersectKDTreeNode::getTriOffset(void) const
81     return _triOffset;
84 inline bool
85 operator==(const IntersectKDTreeNode &lhs, const IntersectKDTreeNode &rhs)
87     bool result = false;
89     if(lhs.isLeaf() == rhs.isLeaf())
90     {
91         if(lhs.getTriOffset() == rhs.getTriOffset())
92         {
93             result = (lhs.getTriCount() == rhs.getTriCount());
94         }
95     }
96     else
97     {
98         if(lhs.getChildOffset() == rhs.getChildOffset())
99         {
100             if(lhs.getSplitAxis() == rhs.getSplitAxis())
101             {
102                 result = (lhs.getSplit() == rhs.getSplit());
103             }
104         }
105     }
107     return result;
110 OSG_END_NAMESPACE