# 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  

animated_lightmap.cpp

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 #include "std3d.h"
00027 
00028 #include "3d/animated_lightmap.h"
00029 #include "nel/misc/common.h"
00030 
00031 using namespace NLMISC;
00032 
00033 namespace NL3D
00034 {
00035 
00036 
00037 // ***************************************************************************
00038 // ***************************************************************************
00039 // ***************************************************************************
00040 // ***************************************************************************
00041 
00042 
00043 // ***************************************************************************
00044 CAnimatedLightmap::CAnimatedLightmap()
00045 {
00046         // IAnimatable.
00047         IAnimatable::resize( AnimValueLast );
00048 
00049         _DefaultFactor.setValue( CRGBA(255,0,255,255) );
00050         _Factor.affect( _DefaultFactor.getValue() );
00051 }
00052 
00053 // ***************************************************************************
00054 /*void  CAnimatedLightmap::update()
00055 {
00056         if( isTouched(OwnerBit) )
00057         {
00058                 // well, just update all...  :)
00059 
00060                 // diffuse part.
00061                 CRGBA   diff= _Diffuse.Value;
00062                 sint c= (sint)(_Opacity.Value*255);
00063                 clamp(c, 0, 255);
00064                 diff.A= c;
00065 
00066                 // setup material.
00067                 _Lightmap->setLighting(true, _Emissive.Value, _Ambient.Value, diff, _Specular.Value, _Shininess.Value);
00068 
00069                 // clear flags.
00070                 clearFlag(AmbientValue);
00071                 clearFlag(DiffuseValue);
00072                 clearFlag(SpecularValue);
00073                 clearFlag(ShininessValue);
00074                 clearFlag(EmissiveValue);
00075                 clearFlag(OpacityValue);
00076 
00077 
00078                 // Texture Anim.
00079                 if(isTouched(TextureValue))
00080                 {
00081                         nlassert(_LightmapBase);
00082 
00083                         uint32  id= _Texture.Value;
00084                         if(_LightmapBase->validAnimatedTexture(id))
00085                         {
00086                                 _Lightmap->setTexture(0, _LightmapBase->getAnimatedTexture(id) );
00087                         }
00088                         clearFlag(TextureValue);
00089                 }
00090 
00091 
00092                 // We are OK!
00093                 IAnimatable::clearFlag(OwnerBit);
00094         }
00095 }*/
00096 
00097 
00098 // ***************************************************************************
00099 IAnimatedValue* CAnimatedLightmap::getValue (uint valueId)
00100 {
00101         switch(valueId)
00102         {
00103         case FactorValue: return &_Factor;
00104         };
00105 
00106         // should not be here!!
00107         nlstop;
00108         return NULL;
00109 }
00110 // ***************************************************************************
00111 const char *CAnimatedLightmap::getValueName (uint valueId) const
00112 {
00113         switch(valueId)
00114         {
00115         case FactorValue: nlstop; return "???";
00116         };
00117 
00118         // should not be here!!
00119         nlstop;
00120         return "";
00121 }
00122 // ***************************************************************************
00123 ITrack* CAnimatedLightmap::getDefaultTrack (uint valueId)
00124 {
00125         //nlassert(_LightmapBase);
00126 
00127         switch(valueId)
00128         {
00129         case FactorValue: return        &_DefaultFactor;
00130         };
00131 
00132         // should not be here!!
00133         nlstop;
00134         return NULL;
00135 }
00136 // ***************************************************************************
00137 void    CAnimatedLightmap::registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix)
00138 {
00139         // For CAnimatedLightmap, channels are detailled (Lightmap rendered after clip)!
00140         addValue(chanMixer, FactorValue, OwnerBit, prefix, true);
00141 
00142 }
00143 
00144 
00145 } // NL3D