1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
19 #include "nel/3d/animated_lightmap.h"
20 #include "nel/3d/scene.h"
21 #include "nel/misc/common.h"
23 using namespace NLMISC
;
33 // ***************************************************************************
34 // ***************************************************************************
35 // ***************************************************************************
36 // ***************************************************************************
39 // ***************************************************************************
40 CAnimatedLightmap::CAnimatedLightmap (uint lightmapGroup
)
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... :)
58 CRGBA diff= _Diffuse.Value;
59 sint c= (sint)(_Opacity.Value*255);
64 _Lightmap->setLighting(true, _Emissive.Value, _Ambient.Value, diff, _Specular.Value, _Shininess.Value);
67 clearFlag(AmbientValue);
68 clearFlag(DiffuseValue);
69 clearFlag(SpecularValue);
70 clearFlag(ShininessValue);
71 clearFlag(EmissiveValue);
72 clearFlag(OpacityValue);
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);
90 IAnimatable::clearFlag(OwnerBit);
95 // ***************************************************************************
96 IAnimatedValue
* CAnimatedLightmap::getValue (uint valueId
)
100 case FactorValue
: return &_Factor
;
103 // should not be here!!
107 // ***************************************************************************
108 const char *CAnimatedLightmap::getValueName (uint valueId
) const
112 case FactorValue
: nlstop
; return "???";
115 // should not be here!!
119 // ***************************************************************************
120 ITrack
* CAnimatedLightmap::getDefaultTrack (uint valueId
)
122 //nlassert(_LightmapBase);
126 case FactorValue
: return &_DefaultFactor
;
129 // should not be here!!
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
)
146 const uint count
= scene
.getNumLightGroup ();
147 _GroupColor
.resize (count
);
149 for (i
=0; i
<count
; i
++)
151 _GroupColor
[i
].modulateFromColor (scene
.getLightmapGroupColor (i
), _Factor
.Value
);
155 // ***************************************************************************