Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
light.h
Go to the documentation of this file.
1 #ifndef LIGHT_H
2 #define LIGHT_H
3 
4 #include "sceneobject.h"
5 
6 #include <QVector4D>
7 
8 namespace LangmuirView {
9 
13 class Light : public SceneObject
14 {
15  Q_OBJECT
16 public:
17  explicit Light(GLenum lightID, LangmuirViewer &viewer, QObject *parent = 0);
18  ~Light();
19 
23  const QColor& getAColor() const;
24 
28  const QColor& getDColor() const;
29 
33  const QColor& getSColor() const;
34 
38  GLenum getLightID() const;
39 
43  bool isEnabled() const;
44 
48  const QVector4D& getPosition() const;
49 
50 signals:
55  void positionChanged(QVector4D position);
56 
61  void aColorChanged(QColor color);
62 
67  void dColorChanged(QColor color);
68 
73  void sColorChanged(QColor color);
74 
79  void enabledChanged(bool enabled);
80 
85  void lightIDChanged(GLuint lightID);
86 
87 public slots:
91  virtual void makeConnections();
92 
100  void setPosition(float x, float y, float z, float w=0.0);
101 
106  void setPosition(QVector4D value);
107 
112  void setAColor(QColor color);
113 
118  void setDColor(QColor color);
119 
124  void setSColor(QColor color);
125 
130  void setLightID(GLuint lightID);
131 
136  void setEnabled(bool enabled);
137 
141  void toggle();
142 
144  void updatePosition();
145 
147  void updateAColor();
148 
150  void updateSColor();
151 
153  void updateDColor();
154 
155 protected:
159  virtual void init();
160 
164  virtual void draw();
165 
167  QVector4D m_position;
168 
170  QColor m_acolor;
171 
173  QColor m_dcolor;
174 
176  QColor m_scolor;
177 
179  GLenum m_lightID;
180 
182  bool m_enabled;
183 };
184 
185 }
186 
187 #endif // LIGHT_H
const QColor & getDColor() const
get diffuse color
void positionChanged(QVector4D position)
signal that the position changed
QColor m_dcolor
diffuse color
Definition: light.h:173
void setPosition(float x, float y, float z, float w=0.0)
set position of light
GLenum getLightID() const
get the OpenGL light id
Base class for objects in OpenGL scene.
Definition: sceneobject.h:22
void setAColor(QColor color)
set the ambient color
virtual void makeConnections()
make signal/slot connections
void sColorChanged(QColor color)
signal that the specular color of has changed
void enabledChanged(bool enabled)
signal that the light has been enabled/disabled
void setDColor(QColor color)
set the diffuse color
bool m_enabled
true if light is on
Definition: light.h:182
void updateDColor()
use OpenGL commands
void dColorChanged(QColor color)
signal that the diffuse color of has changed
void lightIDChanged(GLuint lightID)
signal that the OpenGL light ID has changed
Definition: axis.h:6
const QColor & getAColor() const
get ambient color
bool isEnabled() const
find out if the light is enabled
void updatePosition()
use OpenGL commands
QColor m_acolor
ambient color
Definition: light.h:170
void updateSColor()
use OpenGL commands
Widget to view Langmuir Simulation in real time.
Definition: langmuirviewer.h:47
void setSColor(QColor color)
set the specular color
const QVector4D & getPosition() const
get position of light
A class to represent a light source.
Definition: light.h:13
virtual void init()
initialize object
QColor m_scolor
specular color
Definition: light.h:176
void aColorChanged(QColor color)
signal that the ambient color of has changed
QVector4D m_position
location of light
Definition: light.h:167
GLenum m_lightID
OpenGL light ID.
Definition: light.h:179
void updateAColor()
use OpenGL commands
void toggle()
toggle the light between enabled/disabled
virtual void draw()
perform OpenGL drawing operations
const QColor & getSColor() const
get specular color
Light(GLenum lightID, LangmuirViewer &viewer, QObject *parent=0)
void setEnabled(bool enabled)
enabled or disable the light
void setLightID(GLuint lightID)
set the OpenGL light ID