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