Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/netp4/src/orxonox/tools/DynamicLines.h @ 3113

Last change on this file since 3113 was 3089, checked in by landauf, 15 years ago

merged map branch back to trunk

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1#ifndef _DYNAMIC_LINES_H_
2#define _DYNAMIC_LINES_H_
3
4#include "DynamicRenderable.h"
5#include <vector>
6
7namespace orxonox
8{
9class 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;
16
17public:
18  /// Constructor - see setOperationType() for description of argument.
19  DynamicLines(OperationType opType=Ogre::RenderOperation::OT_LINE_STRIP);
20  virtual ~DynamicLines();
21
22  /// Add a point to the point list
23  void addPoint(const Ogre::Vector3 &p);
24  /// Add a point to the point list
25  void addPoint(Real x, Real y, Real z);
26
27  /// Change the location of an existing point in the point list
28  void setPoint(unsigned short index, const Vector3 &value);
29
30  /// Return the location of an existing point in the point list
31  const Vector3& getPoint(unsigned short index) const;
32
33  /// Return the total number of points in the point list
34  unsigned short getNumPoints(void) const;
35
36  /// Remove all points from the point list
37  void clear();
38
39  /// Call this to update the hardware buffer after making changes.
40  void update();
41
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;
54
55protected:
56  /// Implementation DynamicRenderable, creates a simple vertex-only decl
57  virtual void createVertexDeclaration();
58  /// Implementation DynamicRenderable, pushes point list out to hardware memory
59  virtual void fillHardwareBuffers();
60
61private:
62  std::vector<Vector3> mPoints;
63  bool mDirty;
64};
65}
66
67#endif
Note: See TracBrowser for help on using the repository browser.