leocad/common/lc_traintrack.h
Leonardo Zide abcef7a536
Some checks failed
LeoCAD CI / build-ubuntu (push) Has been cancelled
LeoCAD CI / build-macos (push) Has been cancelled
Show train track insert gizmo on all open connections of the focused piece.
2024-12-20 17:18:33 -08:00

47 lines
1.1 KiB
C++

#pragma once
#include "lc_math.h"
class lcPiece;
class lcPiecesLibrary;
struct lcTrainTrackConnection
{
lcMatrix44 Transform;
};
enum class lcTrainTrackType
{
Straight,
Left,
Right,
BranchLeft,
BranchRight,
Count
};
class lcTrainTrackInfo
{
public:
lcTrainTrackInfo() = default;
static std::optional<lcMatrix44> GetPieceInsertTransform(lcPiece* CurrentPiece, PieceInfo* Info, quint32 Section);
static std::optional<lcMatrix44> GetConnectionTransform(lcPiece* CurrentPiece, quint32 CurrentConnectionIndex, PieceInfo* Info, quint32 NewConnectionIndex);
static std::optional<lcMatrix44> CalculateTransformToConnection(const lcMatrix44& ConnectionTransform, PieceInfo* Info, quint32 ConnectionIndex);
static int GetPieceConnectionIndex(const lcPiece* Piece1, int ConnectionIndex1, const lcPiece* Piece2);
void AddConnection(const lcTrainTrackConnection& TrainTrackConnection)
{
mConnections.emplace_back(TrainTrackConnection);
}
const std::vector<lcTrainTrackConnection>& GetConnections() const
{
return mConnections;
}
protected:
std::vector<lcTrainTrackConnection> mConnections;
};
void lcTrainTrackInit(lcPiecesLibrary* Library);