Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
linesegment.hpp
1 //////////////////////////////
2 //
3 // File: lxs/coregraphics/linesegment.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Feb 27 2013
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 
15 #ifndef __LXS_SEGMENT
16 #define __LXS_SEGMENT
17 #include<vector>
18 #include "lxs/coregraphics/renderable.hpp"
19 #include "helper/opengl.hpp"
20 #include "lxs/coregraphics/shader.hpp"
21 #include <boost/shared_ptr.hpp>
22 namespace LxS
23 {
24  namespace CoreGraphics
25  {
26  //! class representing line segment
27  class LineSegment: public Renderable
28  {
29  protected:
30  //! display shader
31  boost::shared_ptr<Shader> p_ShaderForReal;
32  //! vertices (two of them)
33  std::vector <GLfloat> vertices;
34  //! vertex indices
35  std::vector <GLshort>indices;
36  //! color (red channel)
37  float r;
38  //! color (green channel)
39  float g;
40  //! color (blue channel)
41  float b;
42  //! initialize colour
43  void InitColor();
44  public:
45  LineSegment();
46  virtual ~LineSegment() {}
47  //! set colour of line segment
48  void SetColor(float _r, float _g, float _b) {r=_r;g=_g;b=_b;InitColor();}
49  virtual void Initialize(); // load and set up some resources
50  virtual void Render(Rendermode mode) ;
51  virtual void UnloadResources() ;
52  // dt=delta time in seconds since last call to animate;
53  virtual void Animate(float dt) ;
54  virtual unsigned long GetTexelsCount() ;
55  virtual unsigned long GetFacesCount() ;
56  //! set coordinates of first end
57  virtual void SetA(float x, float y, float z);
58  //! set coordinates of second end
59  virtual void SetB(float x, float y, float z);
60  };
61  //end of class LineSegment
62  }
63 }
64 #endif