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/point_light_named.h"
28 // ***************************************************************************
29 CPointLightNamed::CPointLightNamed()
31 // copy setup from current
32 _DefaultAmbient
= getAmbient();
33 _DefaultDiffuse
= getDiffuse();
34 _DefaultSpecular
= getSpecular();
35 _UnAnimatedDiffuse
= getDiffuse();
39 // ***************************************************************************
40 void CPointLightNamed::setLightFactor(NLMISC::CRGBA nFactor
)
42 setLightFactor(nFactor
, nFactor
);
46 // ***************************************************************************
47 void CPointLightNamed::setLightFactor(NLMISC::CRGBA nAnimatedFactor
, NLMISC::CRGBA nUnAnimatedFactor
)
50 // setup current ambient.
51 col
.modulateFromColor(_DefaultAmbient
, nAnimatedFactor
);
53 // setup current diffuse.
54 col
.modulateFromColor(_DefaultDiffuse
, nAnimatedFactor
);
56 // setup current specular.
57 col
.modulateFromColor(_DefaultSpecular
, nAnimatedFactor
);
60 // special UnAnimatedDiffuse
61 col
.modulateFromColor(_DefaultDiffuse
, nUnAnimatedFactor
);
62 _UnAnimatedDiffuse
= col
;
66 // ***************************************************************************
67 void CPointLightNamed::serial(NLMISC::IStream
&f
)
69 sint ver
= f
.serialVersion(1);
72 CPointLight::serial(f
);
75 f
.serial(AnimatedLight
);
76 f
.serial(_DefaultAmbient
);
77 f
.serial(_DefaultDiffuse
);
78 f
.serial(_DefaultSpecular
);
83 // read: and copy default _UnAnimatedDiffuse
86 _UnAnimatedDiffuse
= getDiffuse();