Project text origin on object surface when use surface is set. When no intersection thans closest point is selected

(@vojta wants it)
This commit is contained in:
Filip Sykala - NTB T15p 2022-12-15 19:27:58 +01:00
parent 043c4c5e90
commit e8e50b50f1
7 changed files with 194 additions and 63 deletions

View file

@ -65,8 +65,9 @@ public:
struct Hit: public SurfacePoint
{
TrKey tr_key;
Hit(TrKey tr_key, Vec3f position, Vec3f normal)
using Key = TrKey;
Key tr_key;
Hit(Key tr_key, Vec3f position, Vec3f normal)
: SurfacePoint(position, normal), tr_key(tr_key)
{}
};
@ -102,6 +103,23 @@ public:
const Camera &camera,
const ISkip *skip = nullptr) const;
/// <summary>
/// Unproject Ray(point direction) on mesh by MeshRaycasters
/// </summary>
/// <param name="point">Start point for ray</param>
/// <param name="direction">Direction of ray</param>
/// <param name="skip">Define which caster will be skipped, null mean no skip</param>
/// <returns>Position on surface, normal direction and transformation key, which define hitted object instance</returns>
std::optional<Hit> unproject(const Vec3d &point, const Vec3d &direction, const ISkip *skip = nullptr) const;
/// <summary>
/// Search of closest point
/// </summary>
/// <param name="point">Point</param>
/// <param name="skip">Define which caster will be skipped, null mean no skip</param>
/// <returns></returns>
std::optional<Hit> closest(const Vec3d &point, const ISkip *skip = nullptr) const;
/// <summary>
/// Getter on transformation
/// </summary>