Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglPositionalLight.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglPositionalLight.hpp
00021  *   Author: Scott McMillan
00022  *  Created: 9 December 2000
00023  *  Summary: encapsulates a positional (local?) light source
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_POSITIONAL_LIGHT_HPP
00027 #define __SGL_POSITIONAL_LIGHT_HPP
00028 
00029 #include <sgl.h>
00030 #include <sglLight.hpp>
00031 
00032 //----------------------------------------------------------------------------
00033 
00064 class SGL_DLL_API sglPositionalLight : public sglLight
00065 {
00066 public:
00068    sglPositionalLight();
00070    virtual ~sglPositionalLight();
00071 
00076    void setPosition(const sglVec3f &pos);
00077 
00081    void getPosition(sglVec3f &pos) const;
00082 
00090    void setAttenuation(float constant, float linear, float quadratic);
00091 
00100    void getAttenuation(float &constant, float &linear, float &quadratic) const;
00101 
00109    void setFalloff(float falloff);
00110 
00114    float getFalloff() const { return 1.0f/m_falloff_inverse; }
00115 
00116    // See sglLight::setup() for details.
00117    virtual void setup(GLenum gl_light_number) const;
00118 
00119    // See sglNode::clone(..) for details.
00120    virtual sglNode *clone(unsigned int mode) const;
00121 
00122    // See sglObject::printInfo() for details.
00123    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00124 
00125 protected:
00126    virtual void computeBound();
00127 
00128    void copyTo(sglPositionalLight *dst, unsigned int mode) const;
00129 
00130 private: // methods - not implemented
00131    sglPositionalLight(const sglPositionalLight &);
00132    sglPositionalLight &operator=(const sglPositionalLight &);
00133 
00134 protected: // variables
00135    sglVec4f m_position;
00136 
00137    float    m_attenuation_constant;
00138    float    m_attenuation_linear;
00139    float    m_attenuation_quadratic;
00140 
00141    float    m_falloff_inverse;
00142 };
00143 
00144 #endif

Generated at Mon Jul 1 18:00:05 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001