Merge branch 'ryzom/ark-features' into main/gingo-test
[ryzomcore.git] / nel / src / 3d / animated_lightmap.cpp
blob0c35649697378a2cfb78ca6510232fbd77f98aa7
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "std3d.h"
19 #include "nel/3d/animated_lightmap.h"
20 #include "nel/3d/scene.h"
21 #include "nel/misc/common.h"
23 using namespace NLMISC;
25 #ifdef DEBUG_NEW
26 #define new DEBUG_NEW
27 #endif
29 namespace NL3D
33 // ***************************************************************************
34 // ***************************************************************************
35 // ***************************************************************************
36 // ***************************************************************************
39 // ***************************************************************************
40 CAnimatedLightmap::CAnimatedLightmap (uint lightmapGroup)
42 // IAnimatable.
43 IAnimatable::resize( AnimValueLast );
45 _DefaultFactor.setDefaultValue( CRGBA(255,0,255,255) );
46 _Factor.Value= _DefaultFactor.getDefaultValue();
47 _GroupColor.resize (lightmapGroup, CRGBA::White);
50 // ***************************************************************************
51 /*void CAnimatedLightmap::update()
53 if( isTouched(OwnerBit) )
55 // well, just update all... :)
57 // diffuse part.
58 CRGBA diff= _Diffuse.Value;
59 sint c= (sint)(_Opacity.Value*255);
60 clamp(c, 0, 255);
61 diff.A= c;
63 // setup material.
64 _Lightmap->setLighting(true, _Emissive.Value, _Ambient.Value, diff, _Specular.Value, _Shininess.Value);
66 // clear flags.
67 clearFlag(AmbientValue);
68 clearFlag(DiffuseValue);
69 clearFlag(SpecularValue);
70 clearFlag(ShininessValue);
71 clearFlag(EmissiveValue);
72 clearFlag(OpacityValue);
75 // Texture Anim.
76 if(isTouched(TextureValue))
78 nlassert(_LightmapBase);
80 uint32 id= _Texture.Value;
81 if(_LightmapBase->validAnimatedTexture(id))
83 _Lightmap->setTexture(0, _LightmapBase->getAnimatedTexture(id) );
85 clearFlag(TextureValue);
89 // We are OK!
90 IAnimatable::clearFlag(OwnerBit);
92 }*/
95 // ***************************************************************************
96 IAnimatedValue* CAnimatedLightmap::getValue (uint valueId)
98 switch(valueId)
100 case FactorValue: return &_Factor;
103 // should not be here!!
104 nlstop;
105 return NULL;
107 // ***************************************************************************
108 const char *CAnimatedLightmap::getValueName (uint valueId) const
110 switch(valueId)
112 case FactorValue: nlstop; return "???";
115 // should not be here!!
116 nlstop;
117 return "";
119 // ***************************************************************************
120 ITrack* CAnimatedLightmap::getDefaultTrack (uint valueId)
122 //nlassert(_LightmapBase);
124 switch(valueId)
126 case FactorValue: return &_DefaultFactor;
129 // should not be here!!
130 nlstop;
131 return NULL;
133 // ***************************************************************************
134 void CAnimatedLightmap::registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix)
136 // For CAnimatedLightmap, channels are detailled (Lightmap rendered after clip)!
137 addValue(chanMixer, FactorValue, OwnerBit, prefix, true);
141 // ***************************************************************************
143 void CAnimatedLightmap::updateGroupColors (class NL3D::CScene &scene)
145 // For each colors
146 const uint count = scene.getNumLightGroup ();
147 _GroupColor.resize (count);
148 uint i;
149 for (i=0; i<count; i++)
151 _GroupColor[i].modulateFromColor (scene.getLightmapGroupColor (i), _Factor.Value);
155 // ***************************************************************************
157 } // NL3D