Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pch/src/orxonox/tools/DynamicLines.h @ 3130

Last change on this file since 3130 was 3130, checked in by rgrieder, 15 years ago

Cleaned out DynamicLines and DynamicRenderable classes and put them in the Ogre namespace since that's where they came from (OGRE wiki).

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Baxissimo, Emmeran, DWORD, EtherDrive (OGRE Wiki)
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _DynamicLines_H__
30#define _DynamicLines_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include <vector>
35#include "DynamicRenderable.h"
36
37namespace Ogre
38{
39    class DynamicLines : public DynamicRenderable
40    {
41        typedef RenderOperation::OperationType OperationType;
42
43    public:
44        /// Constructor - see setOperationType() for description of argument.
45        DynamicLines(OperationType opType = RenderOperation::OT_LINE_STRIP);
46        virtual ~DynamicLines();
47
48        /// Add a point to the point list
49        void addPoint(const Vector3 &p);
50        /// Add a point to the point list
51        void addPoint(Real x, Real y, Real z);
52
53        /// Change the location of an existing point in the point list
54        void setPoint(unsigned short index, const Vector3 &value);
55
56        /// Return the location of an existing point in the point list
57        const Vector3& getPoint(unsigned short index) const;
58
59        /// Return the total number of points in the point list
60        unsigned short getNumPoints(void) const;
61
62        /// Remove all points from the point list
63        void clear();
64
65        /// Call this to update the hardware buffer after making changes.
66        void update();
67
68        /**
69        @brief
70            Set the type of operation to draw with.
71        @param opType
72            Can be one of
73                - RenderOperation::OT_LINE_STRIP
74                - RenderOperation::OT_LINE_LIST
75                - RenderOperation::OT_POINT_LIST
76                - RenderOperation::OT_TRIANGLE_LIST
77                - RenderOperation::OT_TRIANGLE_STRIP
78                - RenderOperation::OT_TRIANGLE_FAN
79            The default is OT_LINE_STRIP.
80        */
81        void setOperationType(OperationType opType);
82        OperationType getOperationType() const;
83
84    protected:
85        /// Implementation DynamicRenderable, creates a simple vertex-only decl
86        virtual void createVertexDeclaration();
87        /// Implementation DynamicRenderable, pushes point list out to hardware memory
88        virtual void fillHardwareBuffers();
89
90    private:
91        std::vector<Vector3> mPoints;
92        bool mDirty;
93    };
94}
95
96#endif /* _DynamicLines_H__ */
Note: See TracBrowser for help on using the repository browser.