3 #include <Core/Asset/AssetData.hpp>
4 #include <Core/RaCore.hpp>
5 #include <Core/Utils/Color.hpp>
6 #include <Core/Utils/Log.hpp>
29 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
38 DIRECTIONAL_LIGHT = 1 << 3,
51 constant( c ), linear( l ), quadratic( q ) {}
78 inline void setName(
const std::string& name );
84 inline const Eigen::Matrix<Scalar, 4, 4>& getFrame()
const;
90 inline void setFrame(
const Eigen::Matrix<Scalar, 4, 4>& frame );
101 const Eigen::Matrix<Scalar, 3, 1>& direction );
111 const Eigen::Matrix<Scalar, 3, 1>& position,
123 const Eigen::Matrix<Scalar, 3, 1>& position,
124 const Eigen::Matrix<Scalar, 3, 1>& direction,
138 const Eigen::Matrix<Scalar, 3, 1>& cog,
139 const Eigen::Matrix<Scalar, 3, 3>& spatialCov,
140 const Eigen::Matrix<Scalar, 3, 3>& normalCov,
151 inline bool isPointLight()
const;
156 inline bool isSpotLight()
const;
161 inline bool isDirectionalLight()
const;
166 inline bool isAreaLight()
const;
171 inline void displayInfo()
const;
185 Eigen::Matrix<Scalar, 3, 1> direction;
188 Eigen::Matrix<Scalar, 3, 1> position;
189 LightAttenuation attenuation;
192 Eigen::Matrix<Scalar, 3, 1> position;
193 Eigen::Matrix<Scalar, 3, 1> direction;
196 LightAttenuation attenuation;
200 Eigen::Matrix<Scalar, 3, 1> position;
201 Eigen::Matrix<Scalar, 3, 3> spatialCovariance;
202 Eigen::Matrix<Scalar, 3, 3> normalCovariance;
203 LightAttenuation attenuation;
208 PointLight m_pointlight;
209 SpotLight m_spotlight;
210 AreaLight m_arealight;
239 const Eigen::Matrix<Scalar, 3, 1>& direction ) {
240 m_type = DIRECTIONAL_LIGHT;
242 m_dirlight.direction = direction;
247 const Eigen::Matrix<Scalar, 3, 1>& position,
249 m_type = POINT_LIGHT;
251 m_pointlight.position = position;
252 m_pointlight.attenuation = attenuation;
257 const Eigen::Matrix<Scalar, 3, 1>& position,
258 const Eigen::Matrix<Scalar, 3, 1>& direction,
264 m_spotlight.position = position;
265 m_spotlight.direction = direction;
266 m_spotlight.innerAngle = inAngle;
267 m_spotlight.outerAngle = outAngle;
268 m_spotlight.attenuation = attenuation;
273 const Eigen::Matrix<Scalar, 3, 1>& cog,
274 const Eigen::Matrix<Scalar, 3, 3>& spatialCov,
275 const Eigen::Matrix<Scalar, 3, 3>& normalCov,
279 m_arealight.position = cog;
280 m_arealight.spatialCovariance = spatialCov;
281 m_arealight.normalCovariance = normalCov;
282 m_arealight.attenuation = attenuation;
287 return ( m_type == POINT_LIGHT );
291 return ( m_type == SPOT_LIGHT );
295 return ( m_type == DIRECTIONAL_LIGHT );
299 return ( m_type == AREA_LIGHT );
304 using namespace Core::Utils;
308 type =
"POINT LIGHT";
313 case DIRECTIONAL_LIGHT:
314 type =
"DIRECTIONAL LIGHT";
324 LOG( logINFO ) <<
"======== LIGHT INFO ========";
325 LOG( logINFO ) <<
" Name : " << m_name;
326 LOG( logINFO ) <<
" Type : " << type;
void setLight(const Core::Utils::Color &color, const Eigen::Matrix< Scalar, 3, 1 > &direction)
construct a directional light
void displayInfo() const
DEBUG.
bool isPointLight() const
QUERY.
void setName(const std::string &name)
LIGHT DATA ///.
Eigen::Matrix< Scalar, 4, 4 > m_frame
VARIABLE.
const Eigen::Matrix< Scalar, 4, 4 > & getFrame() const
FRAME.
bool isDirectionalLight() const
LightType getType() const
TYPE.
void setFrame(const Eigen::Matrix< Scalar, 4, 4 > &frame)