1 // pt_lights.hxx -- build a 'directional' light on the fly
3 // Written by Curtis Olson, started March 2002.
5 // Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _SG_PT_LIGHTS_HXX
25 #define _SG_PT_LIGHTS_HXX
29 # error This library requires C++
32 #include <simgear/compiler.h>
35 #include <vector> // STL
37 #include <osg/Drawable>
41 #include <simgear/math/sg_types.hxx>
42 #include <simgear/scene/material/matlib.hxx>
43 #include <simgear/scene/util/SGSceneFeatures.hxx>
45 #include "SGLightBin.hxx"
46 #include "SGDirectionalLightBin.hxx"
53 // Specify the way we want to draw directional point lights (assuming the
54 // appropriate extensions are available.)
56 inline void SGConfigureDirectionalLights( bool use_point_sprites,
57 bool enhanced_lighting,
58 bool distance_attenuation ) {
59 static SGSceneFeatures* sceneFeatures = SGSceneFeatures::instance();
60 sceneFeatures->setEnablePointSpriteLights(use_point_sprites);
61 sceneFeatures->setEnableDistanceAttenuationLights(distance_attenuation);
64 class SGLightFactory {
68 getLightDrawable(const SGLightBin::Light& light);
71 getLightDrawable(const SGDirectionalLightBin::Light& light);
74 * Return a drawable for a very simple point light that isn't
78 getLights(const SGLightBin& lights, unsigned inc = 1, float alphaOff = 0);
81 getLights(const SGDirectionalLightBin& lights);
84 getVasi(const SGVec3f& up, const SGDirectionalLightBin& lights,
85 const SGVec4f& red, const SGVec4f& white);
88 getSequenced(const SGDirectionalLightBin& lights);
91 getOdal(const SGLightBin& lights);
94 simgear::Effect* getLightEffect(float size, const osg::Vec3& attenuation,
95 float minSize, float maxSize, bool directional);
96 #endif // _SG_PT_LIGHTS_HXX