Changeset 3130 for code/branches/pch/src/orxonox/tools/DynamicLines.h
- Timestamp:
- Jun 9, 2009, 7:51:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/orxonox/tools/DynamicLines.h
r3089 r3130 1 #ifndef _DYNAMIC_LINES_H_ 2 #define _DYNAMIC_LINES_H_ 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 */ 3 28 29 #ifndef _DynamicLines_H__ 30 #define _DynamicLines_H__ 31 32 #include "OrxonoxPrereqs.h" 33 34 #include <vector> 4 35 #include "DynamicRenderable.h" 5 #include <vector>6 36 7 namespace orxonox37 namespace Ogre 8 38 { 9 class DynamicLines : public DynamicRenderable 10 { 11 typedef Ogre::Vector3 Vector3; 12 typedef Ogre::Quaternion Quaternion; 13 typedef Ogre::Camera Camera; 14 typedef Ogre::Real Real; 15 typedef Ogre::RenderOperation::OperationType OperationType; 39 class DynamicLines : public DynamicRenderable 40 { 41 typedef RenderOperation::OperationType OperationType; 16 42 17 public:18 /// Constructor - see setOperationType() for description of argument.19 DynamicLines(OperationType opType=Ogre::RenderOperation::OT_LINE_STRIP);20 virtual ~DynamicLines();43 public: 44 /// Constructor - see setOperationType() for description of argument. 45 DynamicLines(OperationType opType = RenderOperation::OT_LINE_STRIP); 46 virtual ~DynamicLines(); 21 47 22 /// Add a point to the point list23 void addPoint(const Ogre::Vector3 &p);24 /// Add a point to the point list25 void addPoint(Real x, Real y, Real z);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); 26 52 27 /// Change the location of an existing point in the point list28 void setPoint(unsigned short index, const Vector3 &value);53 /// Change the location of an existing point in the point list 54 void setPoint(unsigned short index, const Vector3 &value); 29 55 30 /// Return the location of an existing point in the point list31 const Vector3& getPoint(unsigned short index) const;56 /// Return the location of an existing point in the point list 57 const Vector3& getPoint(unsigned short index) const; 32 58 33 /// Return the total number of points in the point list34 unsigned short getNumPoints(void) const;59 /// Return the total number of points in the point list 60 unsigned short getNumPoints(void) const; 35 61 36 /// Remove all points from the point list37 void clear();62 /// Remove all points from the point list 63 void clear(); 38 64 39 /// Call this to update the hardware buffer after making changes.40 void update();65 /// Call this to update the hardware buffer after making changes. 66 void update(); 41 67 42 /** Set the type of operation to draw with. 43 * @param opType Can be one of 44 * - RenderOperation::OT_LINE_STRIP 45 * - RenderOperation::OT_LINE_LIST 46 * - RenderOperation::OT_POINT_LIST 47 * - RenderOperation::OT_TRIANGLE_LIST 48 * - RenderOperation::OT_TRIANGLE_STRIP 49 * - RenderOperation::OT_TRIANGLE_FAN 50 * The default is OT_LINE_STRIP. 51 */ 52 void setOperationType(OperationType opType); 53 OperationType getOperationType() const; 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; 54 83 55 protected:56 /// Implementation DynamicRenderable, creates a simple vertex-only decl57 virtual void createVertexDeclaration();58 /// Implementation DynamicRenderable, pushes point list out to hardware memory59 virtual void fillHardwareBuffers();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(); 60 89 61 private:62 std::vector<Vector3> mPoints;63 bool mDirty;64 };90 private: 91 std::vector<Vector3> mPoints; 92 bool mDirty; 93 }; 65 94 } 66 95 67 #endif 96 #endif /* _DynamicLines_H__ */
Note: See TracChangeset
for help on using the changeset viewer.