Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3166 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
RevLine 
[3130]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 */
[2942]28
[3130]29#ifndef _DynamicLines_H__
30#define _DynamicLines_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include <vector>
[2942]35#include "DynamicRenderable.h"
36
[3130]37namespace Ogre
[3089]38{
[3130]39    class DynamicLines : public DynamicRenderable
40    {
41        typedef RenderOperation::OperationType OperationType;
[2942]42
[3130]43    public:
44        /// Constructor - see setOperationType() for description of argument.
45        DynamicLines(OperationType opType = RenderOperation::OT_LINE_STRIP);
46        virtual ~DynamicLines();
[2942]47
[3130]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);
[2942]52
[3130]53        /// Change the location of an existing point in the point list
54        void setPoint(unsigned short index, const Vector3 &value);
[2942]55
[3130]56        /// Return the location of an existing point in the point list
57        const Vector3& getPoint(unsigned short index) const;
[2942]58
[3130]59        /// Return the total number of points in the point list
60        unsigned short getNumPoints(void) const;
[2942]61
[3130]62        /// Remove all points from the point list
63        void clear();
[2942]64
[3130]65        /// Call this to update the hardware buffer after making changes.
66        void update();
[2942]67
[3130]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;
[2942]83
[3130]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();
[2942]89
[3130]90    private:
91        std::vector<Vector3> mPoints;
92        bool mDirty;
93    };
[3089]94}
[2942]95
[3130]96#endif /* _DynamicLines_H__ */
Note: See TracBrowser for help on using the repository browser.