OpenWalnut  1.5.0dev
WGESubdividedPlane.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WGESUBDIVIDEDPLANE_H
26 #define WGESUBDIVIDEDPLANE_H
27 
28 #include <osg/Geode>
29 
30 /**
31  * Represents a plane which is subdivided into quads where each quad primitive is colorable.
32  */
33 class WGESubdividedPlane : public osg::Geode
34 {
35 public:
36  /**
37  * For each quad primitive, the center point is computed and stored in \ref m_quadCenters.
38  *
39  * \param centers the vertex array of the center points of each quad in same order as the quads
40  */
41  void setCenterArray( osg::ref_ptr< osg::Vec3Array > centers );
42 
43  /**
44  * Gives the reference to the centerpoints of the quads this plane is representing.
45  *
46  * \return Const reference to the center points
47  */
48  osg::ref_ptr< const osg::Vec3Array > getCenterArray() const;
49 
50 protected:
51 private:
52  /**
53  * Stores the center points of each quad. This is saved in this geode, so the center points are
54  * available before transformation.
55  */
56  osg::ref_ptr< osg::Vec3Array > m_quadCenters;
57 };
58 
59 inline void WGESubdividedPlane::setCenterArray( osg::ref_ptr< osg::Vec3Array > centers )
60 {
61  // TODO(math): do some constraint checks
62  m_quadCenters = centers;
63 }
64 
65 inline osg::ref_ptr< const osg::Vec3Array > WGESubdividedPlane::getCenterArray() const
66 {
67  return m_quadCenters;
68 }
69 
70 #endif // WGESUBDIVIDEDPLANE_H
Represents a plane which is subdivided into quads where each quad primitive is colorable.
void setCenterArray(osg::ref_ptr< osg::Vec3Array > centers)
For each quad primitive, the center point is computed and stored in m_quadCenters.
osg::ref_ptr< const osg::Vec3Array > getCenterArray() const
Gives the reference to the centerpoints of the quads this plane is representing.
osg::ref_ptr< osg::Vec3Array > m_quadCenters
Stores the center points of each quad.