V-ART
cylinder.h
Go to the documentation of this file.
1 
5 #ifndef VART_CYLINDER_H
6 #define VART_CYLINDER_H
7 
8 #include "vart/graphicobj.h"
9 #include "vart/material.h"
10 
11 namespace VART {
17 // It is up to the Draw methods to make the above statement true.
18  class Cylinder : public GraphicObj {
19  public:
25 
27  Cylinder();
28  Cylinder( const VART::Cylinder& cylinder );
29  VART::Cylinder & operator = (const VART::Cylinder& cylinder);
30 
33  virtual VART::SceneNode * Copy();
34 
35  Cylinder( float fHi, float fRad );
36  Cylinder( float fHi, float fRad, bool bS, bool bT, bool bB );
37 
39  virtual void ComputeBoundingBox();
40 
41  void SetHeight(float h);
43  void SetRadius( float r );
45  void SetTopRadius(float r) { topRadius = r; }
47  void SetBottomRadius(float r){ btRadius = r; }
48 
50  void SetMaterial(const Material& mat) { material = mat; }
51 
55  void SetPartsVisibility(PartsID parts);
56 
60  void TogglePartsVisibilty(PartsID parts);
61 
64 
66  void ShowSide( bool yesno );
68  void ShowTop( bool yesno );
70  void ShowBottom( bool yesno );
71  float GetHeight();
73  float GetTopRadius();
75  float GetBottomRadius();
77  Material GetMaterial() const { return material; }
79  bool ShowSide();
81  bool ShowTop();
83  bool ShowBottom();
84  private:
85  // PRIVATE METHODS
88  bool DrawInstanceOGL() const;
89  // PRIVATE ATTRIBUTES
90  float height;
91  float topRadius;
92  float btRadius;
93  bool sidesVisible;
94  bool topVisible;
95  bool bottomVisible;
96  Material material;
97  }; // end class declaration
98 } // end namespace
99 
100 // OPERATORS FOR PartsID
102  return VART::Cylinder::PartsID(static_cast<int>(a) & static_cast<int>(b));
103 }
104 
106  return VART::Cylinder::PartsID(static_cast<int>(a) | static_cast<int>(b));
107 }
108 
109 #endif
void SetPartsVisibility(PartsID parts)
Sets which parts are visible.
Definition: cylinder.cpp:87
VART::Cylinder & operator=(const VART::Cylinder &cylinder)
Definition: cylinder.cpp:27
Base class for objects that compose a scene graph.
Definition: scenenode.h:25
Header file for V-ART class "Material".
virtual void ComputeBoundingBox()
Computes the bounding box.
Definition: cylinder.cpp:66
void SetRadius(float r)
Sets the value of top and bottom radius.
Definition: cylinder.cpp:80
Header file for V-ART class "GraphicObj".
void SetMaterial(const Material &mat)
Material assignment.
Definition: cylinder.h:50
PartsID
Bitmask for cylinder parts.
Definition: cylinder.h:24
VART::Cylinder::PartsID operator|(VART::Cylinder::PartsID a, VART::Cylinder::PartsID b)
Definition: cylinder.h:105
void SetTopRadius(float r)
Sets the value of the top radius.
Definition: cylinder.h:45
bool ShowSide()
Definition: cylinder.cpp:143
void SetBottomRadius(float r)
Sets the value of the bottom radius.
Definition: cylinder.h:47
float GetBottomRadius()
Returns the bottom radius.
Definition: cylinder.cpp:138
bool ShowTop()
Definition: cylinder.cpp:149
A cylinder or cone.
Definition: cylinder.h:18
Material GetMaterial() const
Returns of copy of the cylinder's material.
Definition: cylinder.h:77
PartsID GetPartsVisibility()
Returns internal visibility state as PartsID.
Definition: cylinder.cpp:101
void SetHeight(float h)
Definition: cylinder.cpp:72
An scene node that is associated with a shape.
Definition: graphicobj.h:18
Material properties for graphical objects.
Definition: material.h:16
float GetHeight()
Definition: cylinder.cpp:128
void TogglePartsVisibilty(PartsID parts)
Toogle visibility of marked parts.
Definition: cylinder.cpp:94
VART::Cylinder::PartsID operator&(VART::Cylinder::PartsID a, VART::Cylinder::PartsID b)
Definition: cylinder.h:101
Cylinder()
Creates an uninitialized cylinder.
Definition: cylinder.cpp:18
float GetTopRadius()
Returns the top radius.
Definition: cylinder.cpp:133
bool ShowBottom()
Definition: cylinder.cpp:155
virtual VART::SceneNode * Copy()
Returns a copy of an cylinder. Every derived class must reimplements this method, to avoid errors wit...
Definition: cylinder.cpp:40