# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

light_user.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_LIGHT_USER_H
00027 #define NL_LIGHT_USER_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/3d/u_light.h"
00031 #include "3d/light.h"
00032 
00033 #define NL3D_MEM_LIGHT                                          NL_ALLOC_CONTEXT( 3dLight )
00034 
00035 namespace NL3D 
00036 {
00037 
00038 class   CDriverUser;
00039 
00040 
00041 // ***************************************************************************
00048 class CLightUser : public ULight
00049 {
00050 protected:
00051         CLight                  _Light;
00052         friend class    CDriverUser;
00053 
00054 public:
00055 
00057 
00058 
00060         void setupDirectional (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& direction,
00061                                                         float constant=1, float linear=0, float quadratic=0)
00062         {
00063                 NL3D_MEM_LIGHT
00064                 _Light.setupDirectional (ambiant, diffuse, specular, direction, constant, linear, quadratic);
00065         }
00066         
00068         void setupPointLight (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& position, 
00069                                                 const NLMISC::CVector& direction, float constant=1, float linear=0, float quadratic=0)
00070         {
00071                 NL3D_MEM_LIGHT
00072                 _Light.setupPointLight (ambiant, diffuse, specular, position, direction, constant, linear, quadratic);
00073         }
00074 
00076         void setupSpotLight (const NLMISC::CRGBA& ambiant, const NLMISC::CRGBA& diffuse, const NLMISC::CRGBA& specular, const NLMISC::CVector& position, 
00077                                                 const NLMISC::CVector& direction, float exponent, float cutoff, float constant=1, float linear=0, float quadratic=0)
00078         {
00079                 NL3D_MEM_LIGHT
00080                 _Light.setupSpotLight (ambiant, diffuse, specular, position, direction, exponent, cutoff, constant, linear, quadratic);
00081         }
00082 
00089         void setupAttenuation (float farAttenuationBegin, float farAttenuationEnd)
00090         {
00091                 NL3D_MEM_LIGHT
00092                 _Light.setupAttenuation (farAttenuationBegin, farAttenuationEnd);
00093         }
00094 
00101         void setNoAttenuation ()
00102         {
00103                 NL3D_MEM_LIGHT
00104                 _Light.setNoAttenuation ();
00105         }
00106 
00113         void setupSpotExponent (float hotSpotAngle)
00114         {
00115                 NL3D_MEM_LIGHT
00116                 _Light.setupSpotExponent (hotSpotAngle);
00117         }
00118 
00120 
00121 
00123 
00124         
00128         void setMode (ULight::TLightMode mode)
00129         {
00130                 NL3D_MEM_LIGHT
00131                 _Light.setMode ((CLight::TLightMode)(uint32)mode);
00132         }
00133         
00137         void setAmbiant (const NLMISC::CRGBA& ambiant)
00138         {
00139                 NL3D_MEM_LIGHT
00140                 _Light.setAmbiant (ambiant);
00141         }
00142 
00146         void setDiffuse (const NLMISC::CRGBA& diffuse)
00147         {
00148                 NL3D_MEM_LIGHT
00149                 _Light.setDiffuse (diffuse);
00150         }
00151 
00155         void setSpecular (const NLMISC::CRGBA& specular)
00156         {
00157                 NL3D_MEM_LIGHT
00158                 _Light.setSpecular (specular);
00159         }
00160 
00164         void setPosition (const NLMISC::CVector& position)
00165         {
00166                 NL3D_MEM_LIGHT
00167                 _Light.setPosition (position);
00168         }
00169 
00173         void setDirection (const NLMISC::CVector& direction)
00174         {
00175                 NL3D_MEM_LIGHT
00176                 _Light.setDirection (direction);
00177         }
00178 
00182         void setExponent (float exponent)
00183         {
00184                 NL3D_MEM_LIGHT
00185                 _Light.setExponent (exponent);
00186         }
00187 
00191         void setCutoff (float cutoff)
00192         {
00193                 NL3D_MEM_LIGHT
00194                 _Light.setCutoff (cutoff);
00195         }
00196 
00204         void setConstantAttenuation (float constant)
00205         {
00206                 NL3D_MEM_LIGHT
00207                 _Light.setConstantAttenuation (constant);
00208         }
00209 
00217         void setLinearAttenuation (float linear)
00218         {
00219                 NL3D_MEM_LIGHT
00220                 _Light.setLinearAttenuation (linear);
00221         }
00222 
00230         void setQuadraticAttenuation (float quadratic)
00231         {
00232                 NL3D_MEM_LIGHT
00233                 _Light.setQuadraticAttenuation (quadratic);
00234         }
00235 
00237 
00239 
00240                 
00244         ULight::TLightMode getMode () const
00245         {
00246                 NL3D_MEM_LIGHT
00247                 return (ULight::TLightMode)(uint32)_Light.getMode ();
00248         }
00249 
00253         NLMISC::CRGBA getAmbiant () const
00254         {
00255                 NL3D_MEM_LIGHT
00256                 return _Light.getAmbiant ();
00257         }
00258 
00262         NLMISC::CRGBA getDiffuse () const
00263         {
00264                 NL3D_MEM_LIGHT
00265                 return _Light.getDiffuse ();
00266         }
00267 
00271         NLMISC::CRGBA getSpecular () const
00272         {
00273                 NL3D_MEM_LIGHT
00274                 return _Light.getSpecular ();
00275         }
00276 
00280         NLMISC::CVector getPosition () const
00281         {
00282                 NL3D_MEM_LIGHT
00283                 return _Light.getPosition ();
00284         }
00285 
00289         NLMISC::CVector getDirection () const
00290         {
00291                 NL3D_MEM_LIGHT
00292                 return _Light.getDirection ();
00293         }
00294 
00298         float getExponent () const
00299         {
00300                 NL3D_MEM_LIGHT
00301                 return _Light.getExponent ();
00302         }
00303 
00307         float getCutoff () const
00308         {
00309                 NL3D_MEM_LIGHT
00310                 return _Light.getCutoff ();
00311         }
00312 
00320         float getConstantAttenuation () const
00321         {
00322                 NL3D_MEM_LIGHT
00323                 return _Light.getConstantAttenuation ();
00324         }
00325 
00333         float getLinearAttenuation () const
00334         {
00335                 NL3D_MEM_LIGHT
00336                 return _Light.getLinearAttenuation ();
00337         }
00338 
00346         float getQuadraticAttenuation () const
00347         {
00348                 NL3D_MEM_LIGHT
00349                 return _Light.getQuadraticAttenuation ();
00350         }
00351 
00353 };
00354 
00355 
00356 } // NL3D
00357 
00358 
00359 #endif // NL_LIGHT_USER_H
00360 
00361 /* End of light_user.h */