9#include <QGLViewer/manipulatedFrame.h>
38 Color specular_color =
Color( 1.0, 1.0, 1.0 ) )
40 material( ambient_color, diffuse_color, specular_color ),
54 glMatrixMode(GL_MODELVIEW);
60 std::cout <<
"Init light at " <<
position << std::endl;
63 std::cout <<
"Init manipulator for light at " <<
position << std::endl;
65 viewer.setMouseTracking(
true );
80 pos[0] = float(pos2.x);
81 pos[1] = float(pos2.y);
82 pos[2] = float(pos2.z);
86 glLightfv(
number, GL_POSITION, pos);
103 if (
position[ 3 ] == 0.0 )
return pos / pos.norm() ;
106 return pos / pos.norm();
void drawSomeLight(GLenum light) const
To call the protected method drawLight.
Lights are used to give lights in a scene.
Color diffuse
diffuse color
Color ambient
ambient color
Color specular
specular color
GLenum number
Specifies which OpenGL light it is (necessary for draw())
PointLight(GLenum light_number, Point4 pos, Color emission_color, Color ambient_color=Color(0.0, 0.0, 0.0), Color diffuse_color=Color(1.0, 1.0, 1.0), Color specular_color=Color(1.0, 1.0, 1.0))
qglviewer::ManipulatedFrame * manipulator
Used to store a manipulator to move the light in space.
Point4 position
The position of the light in homogeneous coordinates.
Color emission
The emission color of the light.
Material material
The material (global to the light).
void init(Viewer &viewer)
void draw(Viewer &viewer)
Vector3 direction(const Vector3 &p) const
Given the point p, returns the normalized direction to this light.
Color color(const Vector3 &) const