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 define the representation of a vertex for displaying purpose.
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
2008-04-30 15:41:54 +00:00
|
|
|
|
|
|
|
|
#include "Rep.h"
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2014-04-17 14:19:10 +09:00
|
|
|
class VertexRep : public Rep {
|
2008-04-30 15:41:54 +00:00
|
|
|
public:
|
2012-12-28 20:21:05 +00:00
|
|
|
inline VertexRep() : Rep()
|
|
|
|
|
{
|
|
|
|
|
_vid = 0;
|
|
|
|
|
_PointSize = 0.0f;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline VertexRep(real x, real y, real z, int id = 0) : Rep()
|
|
|
|
|
{
|
|
|
|
|
_coordinates[0] = x;
|
|
|
|
|
_coordinates[1] = y;
|
|
|
|
|
_coordinates[2] = z;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
_vid = id;
|
|
|
|
|
_PointSize = 0.0f;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-03-29 16:50:54 +02:00
|
|
|
inline ~VertexRep() {}
|
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)
|
|
|
|
|
{
|
|
|
|
|
Rep::accept(v);
|
|
|
|
|
v.visitVertexRep(*this);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Computes the rep bounding box. */
|
2012-12-28 20:21:05 +00:00
|
|
|
virtual void ComputeBBox();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** accessors */
|
2025-04-01 01:01:38 +00:00
|
|
|
inline int vid() const
|
2012-12-28 20:21:05 +00:00
|
|
|
{
|
|
|
|
|
return _vid;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const real *coordinates() const
|
|
|
|
|
{
|
|
|
|
|
return _coordinates;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline real x() const
|
|
|
|
|
{
|
|
|
|
|
return _coordinates[0];
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline real y() const
|
|
|
|
|
{
|
|
|
|
|
return _coordinates[1];
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline real z() const
|
|
|
|
|
{
|
|
|
|
|
return _coordinates[2];
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline float pointSize() const
|
|
|
|
|
{
|
|
|
|
|
return _PointSize;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** modifiers */
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setVid(int id)
|
|
|
|
|
{
|
|
|
|
|
_vid = id;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setX(real x)
|
|
|
|
|
{
|
|
|
|
|
_coordinates[0] = x;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setY(real y)
|
|
|
|
|
{
|
|
|
|
|
_coordinates[1] = y;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setZ(real z)
|
|
|
|
|
{
|
|
|
|
|
_coordinates[2] = z;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setCoordinates(real x, real y, real z)
|
|
|
|
|
{
|
|
|
|
|
_coordinates[0] = x;
|
|
|
|
|
_coordinates[1] = y;
|
|
|
|
|
_coordinates[2] = z;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setPointSize(float iPointSize)
|
|
|
|
|
{
|
|
|
|
|
_PointSize = iPointSize;
|
|
|
|
|
}
|
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
|
|
|
int _vid; // vertex id
|
|
|
|
|
real _coordinates[3];
|
|
|
|
|
float _PointSize;
|
2008-04-30 15:41:54 +00:00
|
|
|
};
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|