leocad/common/lc_traintrack.h

48 lines
1.1 KiB
C
Raw Normal View History

2024-11-03 03:34:22 +01:00
#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;
2024-11-27 00:53:50 +01:00
static std::optional<lcMatrix44> GetPieceInsertTransform(lcPiece* CurrentPiece, PieceInfo* Info);
2024-11-30 21:29:15 +01:00
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);
2024-11-30 21:29:15 +01:00
static int GetPieceConnectionIndex(const lcPiece* Piece1, int ConnectionIndex1, const lcPiece* Piece2);
2024-11-03 03:34:22 +01:00
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);