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

sglFog.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: sglFog.hpp
00021  *   Author: Scott McMillan and Michael Morrison.
00022  *  Created: 28 November 2000
00023  *  Summary: sglStatelet to encapsulate fog functionality.
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_FOG_HPP
00027 #define __SGL_FOG_HPP
00028 
00029 #include <sgl.h>
00030 #include <sglStatelet.hpp>
00031 #include <sglVector.hpp>
00032 
00033 //----------------------------------------------------------------------------
00034 
00060 class SGL_DLL_API sglFog : public sglStatelet
00061 {
00062 public:
00064    enum ModeEnum
00065    {
00067       eOFF    = 0,
00068 
00070       eEXP    = GL_EXP,
00071 
00073       eEXP2   = GL_EXP2,
00074 
00076       eLINEAR = GL_LINEAR
00077    };
00078 
00080    enum DistanceEqEnum
00081    {
00083       eEYE_PLANE_ABSOLUTE = GL_EYE_PLANE_ABSOLUTE_NV,
00084 
00086       eEYE_RADIAL = GL_EYE_RADIAL_NV
00087    };
00088 
00089 
00090 public:
00092    sglFog();
00093 
00095    virtual ~sglFog();
00096 
00100    void setMode(ModeEnum mode);
00101 
00105    ModeEnum getMode() const { return m_mode; }
00106 
00111    void setDistanceEquation(DistanceEqEnum eq);
00112 
00116    DistanceEqEnum getDistanceEquation() const { return m_distance_equation; }
00117 
00124    void setExtent(float start, float end);
00125 
00130    void getExtent(float &start, float &end) const
00131       { start = m_start; end = m_end; }
00132 
00137    void setDensity(float density);
00138 
00142    float getDensity() const { return m_density; }
00143 
00148    void setColor(const sglVec4f &color) { m_color = color; }
00149 
00156    void setColor(float r, float g, float b, float a) { m_color.set(r,g,b,a); }
00157 
00161    const sglVec4f &getColor() const { return m_color; }
00162 
00163    // See sglStatelet::apply() for details.
00164    void apply(sglCurrState*) const;
00165 
00166    // See sglStatelet::getSorted() for details.
00167    virtual bool getSorted() const { return true; }
00168 
00169    // See sglObject::printInfo() for details.
00170    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00171 
00172 protected:
00173 
00174 private: // methods - not implemented
00175    sglFog(const sglFog &);
00176    sglFog &operator=(const sglFog &);
00177 
00178    void setIndex() { m_index = ((m_mode == eOFF) ? 0 : UINT_MAX); }
00179 
00180 protected: // variables
00181    ModeEnum m_mode;
00182 
00183    float    m_start;
00184    float    m_end;
00185    float    m_density;
00186    DistanceEqEnum m_distance_equation;
00187 
00188    sglVec4f m_color;
00189 };
00190 
00191 #endif

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