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/SGReaderWriterOptions.hxx>
44 #include <simgear/scene/util/SGSceneFeatures.hxx>
46 #include "SGLightBin.hxx"
47 #include "SGDirectionalLightBin.hxx"
54 // Specify the way we want to draw directional point lights (assuming the
55 // appropriate extensions are available.)
57 inline void SGConfigureDirectionalLights( bool use_point_sprites,
58 bool enhanced_lighting,
59 bool distance_attenuation ) {
60 static SGSceneFeatures* sceneFeatures = SGSceneFeatures::instance();
61 sceneFeatures->setEnablePointSpriteLights(use_point_sprites);
62 sceneFeatures->setEnableDistanceAttenuationLights(distance_attenuation);
65 class SGLightFactory {
69 getLightDrawable(const SGLightBin::Light& light);
72 getLightDrawable(const SGDirectionalLightBin::Light& light);
75 * Return a drawable for a very simple point light that isn't
79 getLights(const SGLightBin& lights, unsigned inc = 1, float alphaOff = 0);
82 getLights(const SGDirectionalLightBin& lights);
85 getVasi(const SGVec3f& up, const SGDirectionalLightBin& lights,
86 const SGVec4f& red, const SGVec4f& white);
89 getSequenced(const SGDirectionalLightBin& lights, const simgear::SGReaderWriterOptions* options);
92 getOdal(const SGLightBin& lights, const simgear::SGReaderWriterOptions* options);
95 getHoldShort(const SGDirectionalLightBin& lights, const simgear::SGReaderWriterOptions* options);
98 getGuard(const SGDirectionalLightBin& lights, const simgear::SGReaderWriterOptions* options);
101 simgear::Effect* getLightEffect(float size, const osg::Vec3& attenuation,
102 float minSize, float maxSize, bool directional,
103 const simgear::SGReaderWriterOptions* options);
104 #endif // _SG_PT_LIGHTS_HXX