Merge branch 'ryzom/ark-features' into main/gingo-test
[ryzomcore.git] / nel / src / 3d / u_point_light.cpp
blob5f4d8da9788dbc7d5639f3bfa839652e43c4c257
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/misc/debug.h"
20 #include "nel/3d/u_point_light.h"
21 #include "nel/3d/point_light_model.h"
24 using namespace NLMISC;
26 #ifdef DEBUG_NEW
27 #define new DEBUG_NEW
28 #endif
30 namespace NL3D
33 // ***************************************************************************
35 void UPointLight::setAmbient (NLMISC::CRGBA ambient)
37 CPointLightModel *object = getObjectPtr();
38 object->PointLight.setAmbient(ambient);
41 // ***************************************************************************
43 void UPointLight::setDiffuse (NLMISC::CRGBA diffuse)
45 CPointLightModel *object = getObjectPtr();
46 object->PointLight.setDiffuse (diffuse);
49 // ***************************************************************************
51 void UPointLight::setSpecular (NLMISC::CRGBA specular)
53 CPointLightModel *object = getObjectPtr();
54 object->PointLight.setSpecular (specular);
57 // ***************************************************************************
59 void UPointLight::setColor (NLMISC::CRGBA color)
61 CPointLightModel *object = getObjectPtr();
62 object->PointLight.setColor (color);
65 // ***************************************************************************
67 NLMISC::CRGBA UPointLight::getAmbient () const
69 CPointLightModel *object = getObjectPtr();
70 return object->PointLight.getAmbient();
73 // ***************************************************************************
75 NLMISC::CRGBA UPointLight::getDiffuse () const
77 CPointLightModel *object = getObjectPtr();
78 return object->PointLight.getDiffuse ();
81 // ***************************************************************************
83 NLMISC::CRGBA UPointLight::getSpecular () const
85 CPointLightModel *object = getObjectPtr();
86 return object->PointLight.getSpecular();
89 // ***************************************************************************
91 void UPointLight::setupAttenuation(float attenuationBegin, float attenuationEnd)
93 CPointLightModel *object = getObjectPtr();
94 object->PointLight.setupAttenuation(attenuationBegin, attenuationEnd);
97 // ***************************************************************************
99 float UPointLight::getAttenuationBegin() const
101 CPointLightModel *object = getObjectPtr();
102 return object->PointLight.getAttenuationBegin();
105 // ***************************************************************************
107 float UPointLight::getAttenuationEnd() const
109 CPointLightModel *object = getObjectPtr();
110 return object->PointLight.getAttenuationEnd();
113 // ***************************************************************************
115 void UPointLight::enableSpotlight(bool enable)
117 CPointLightModel *object = getObjectPtr();
118 if(enable)
119 object->PointLight.setType(CPointLight::SpotLight);
120 else
121 object->PointLight.setType(CPointLight::PointLight);
124 // ***************************************************************************
126 bool UPointLight::isSpotlight() const
128 CPointLightModel *object = getObjectPtr();
129 return object->PointLight.getType() == CPointLight::SpotLight;
132 // ***************************************************************************
134 void UPointLight::setupSpotAngle(float spotAngleBegin, float spotAngleEnd)
136 CPointLightModel *object = getObjectPtr();
137 object->PointLight.setupSpotAngle(spotAngleBegin, spotAngleEnd);
140 // ***************************************************************************
142 float UPointLight::getSpotAngleBegin() const
144 CPointLightModel *object = getObjectPtr();
145 return object->PointLight.getSpotAngleBegin();
148 // ***************************************************************************
150 float UPointLight::getSpotAngleEnd() const
152 CPointLightModel *object = getObjectPtr();
153 return object->PointLight.getSpotAngleEnd();
156 // ***************************************************************************
158 void UPointLight::setDeltaPosToSkeletonWhenOutOfFrustum(const CVector &deltaPos)
160 CPointLightModel *object = getObjectPtr();
161 object->setDeltaPosToSkeletonWhenOutOfFrustum(deltaPos) ;
164 // ***************************************************************************
166 const CVector &UPointLight::getDeltaPosToSkeletonWhenOutOfFrustum() const
168 CPointLightModel *object = getObjectPtr();
169 return object->getDeltaPosToSkeletonWhenOutOfFrustum() ;
172 // ***************************************************************************
173 void UPointLight::setInfluenceLightMap(bool enable)
175 CPointLightModel *object = getObjectPtr();
176 object->setInfluenceLightMap(enable);
179 // ***************************************************************************
180 bool UPointLight::getInfluenceLightMap() const
182 CPointLightModel *object = getObjectPtr();
183 return object->getInfluenceLightMap() ;
187 } // NL3D