59 #ifndef ACG_LIGHT_NODE_HH 60 #define ACG_LIGHT_NODE_HH 65 #include <ACG/Scenegraph/BaseNode.hh> 68 #include <ACG/GL/gl.hh> 69 #include <ACG/GL/GLPrimitives.hh> 108 void position(
Vec3d _pos);
115 Vec3d position()
const;
122 bool directional()
const;
128 Vec3d direction()
const;
135 void direction(
Vec3d _pos);
144 bool enabled()
const;
150 void spotDirection(
Vec3d _pos);
156 Vec3d spotDirection( )
const;
159 void ambientColor(
Vec4f _color);
162 Vec4f ambientColor()
const;
165 void diffuseColor(
Vec4f _color);
168 Vec4f diffuseColor()
const;
171 void specularColor(
Vec4f _color);
174 Vec4f specularColor()
const;
176 void setColor(
const Vec4f& _ambient,
const Vec4f& _diffuse,
const Vec4f& _specular);
179 void fixedPosition(
bool _state);
181 bool fixedPosition()
const;
183 void spotExponent(
float _exponent);
185 float spotExponent()
const;
187 void spotCutoff(
float _cutoff);
189 float spotCutoff()
const;
191 void constantAttenuation(
float _constantAttenuation);
193 float constantAttenuation()
const;
195 void linearAttenuation(
float _linearAttenuation);
197 float linearAttenuation()
const;
199 void quadraticAttenuation(
float _quadraticAttenuation);
201 float quadraticAttenuation()
const;
203 void brightness(
const float _brightness);
205 float brightness()
const;
219 void radius(
const float _radius) { radius_ = _radius; }
230 Vec4f specularColor_;
232 Vec3d spotDirection_;
233 Vec3d realSpotDirection_;
236 Vec4f initialPosition_;
237 Vec3d initialSpotDirection_;
238 bool initialPositionInit_;
242 float constantAttenuation_;
243 float linearAttenuation_;
244 float quadraticAttenuation_;
262 const std::string& _name =
"<LightNode>");
275 void getLightSourceViewSpace(
LightSource* _light)
const;
299 void visualize(
bool _visualize) { visualize_ = _visualize; }
309 void setParameters(GLenum _index,
LightSource& _light);
312 void getParameters(GLenum _index,
LightSource& _light);
349 if (OpenFlipper::Options::gui())
350 glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
354 for(
int i = 0; i < maxLights; ++i) {
355 lights_.insert(std::pair<GLenum, LightNode*>(GL_LIGHT0 + i, (
LightNode*)0 ));
360 GLenum light = GL_INVALID_ENUM;
361 for(std::map<GLenum, LightNode*>::iterator it = lights_.begin();
362 it != lights_.end(); ++it) {
364 if(it->second == 0) {
365 lights_[it->first] = _node;
374 for(std::map<GLenum, LightNode*>::iterator it = lights_.begin();
375 it != lights_.end(); ++it) {
377 if(it->second == _node) {
378 lights_[it->first] = 0;
385 std::map<GLenum, LightNode*> lights_;
392 #endif // ACG_LIGHT_NODE_HH defined
GLenum lightId_
Internal light id.
float radius() const
Get light source radius.
LightSource light_
store LightSources of this node
bool visualize_
Indicates whether light node should be visualized or not.
PickTarget
What target to use for picking.
void setLightSource(LightSource _light)
Set the light source parameters.
ACG::SceneGraph::LightSource LightSource
Simple Name for the LightSource.
Namespace providing different geometric functions concerning angles.
void radius(const float _radius)
Set light source radius.
void visualize(bool _visualize)
Set whether node should be visualized.
LightSource transformedLight_
pretransformed light position and direction in view space
bool visualize()
Should node be visualized?
ACG::SceneGraph::LightNode LightNode
Simple Name for PlaneNode.
LightSource lightSave_
save old LightSources
Structure to hold options for one LightSource.