2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-12-28 20:21:05 +00:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief Class to represent a light node
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Node.h"
|
|
|
|
|
|
|
|
|
|
#include "../geometry/Geom.h"
|
|
|
|
|
|
|
|
|
|
#include "../system/FreestyleConfig.h"
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
using namespace Geometry;
|
|
|
|
|
|
2014-04-17 14:19:10 +09:00
|
|
|
class NodeLight : public Node {
|
2008-04-30 15:41:54 +00:00
|
|
|
public:
|
2018-06-17 17:05:14 +02:00
|
|
|
NodeLight();
|
2012-12-28 20:21:05 +00:00
|
|
|
NodeLight(NodeLight &iBrother);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-03-29 16:50:54 +02:00
|
|
|
virtual ~NodeLight() {}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Accept the corresponding visitor */
|
2012-12-28 20:21:05 +00:00
|
|
|
virtual void accept(SceneVisitor &v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Accessors for the light properties */
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const float *ambient() const
|
|
|
|
|
{
|
|
|
|
|
return Ambient;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const float *diffuse() const
|
|
|
|
|
{
|
|
|
|
|
return Diffuse;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const float *specular() const
|
|
|
|
|
{
|
|
|
|
|
return Specular;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const float *position() const
|
|
|
|
|
{
|
|
|
|
|
return Position;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline bool isOn() const
|
|
|
|
|
{
|
|
|
|
|
return on;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline int number() const
|
|
|
|
|
{
|
|
|
|
|
return _number;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
private:
|
2012-12-28 20:21:05 +00:00
|
|
|
// Data members
|
|
|
|
|
// ============
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** on=true, the light is on */
|
2012-12-28 20:21:05 +00:00
|
|
|
bool on;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** The color definition */
|
2012-12-28 20:21:05 +00:00
|
|
|
float Ambient[4];
|
|
|
|
|
float Diffuse[4];
|
|
|
|
|
float Specular[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Light position. if w = 0, the light is placed at infinite. */
|
2012-12-28 20:21:05 +00:00
|
|
|
float Position[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** used to manage the number of lights */
|
|
|
|
|
/** numberOfLights
|
2012-12-28 20:21:05 +00:00
|
|
|
* the number of lights in the scene.
|
|
|
|
|
* Initially, 0.
|
|
|
|
|
*/
|
|
|
|
|
static int numberOfLights;
|
2021-07-05 12:47:46 +10:00
|
|
|
/** The current light number */
|
2012-12-28 20:21:05 +00:00
|
|
|
int _number;
|
2008-04-30 15:41:54 +00:00
|
|
|
};
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|