2017-07-19 23:20:32 +02:00
|
|
|
#pragma once
|
2016-10-05 23:28:52 +02:00
|
|
|
|
|
|
|
#include "lc_math.h"
|
|
|
|
#include "piece.h"
|
|
|
|
|
2017-04-14 03:12:10 +02:00
|
|
|
enum class lcSynthType
|
2016-10-05 23:28:52 +02:00
|
|
|
{
|
2019-02-21 01:52:50 +01:00
|
|
|
HOSE_FLEXIBLE,
|
|
|
|
FLEX_SYSTEM_HOSE,
|
2017-04-14 03:12:10 +02:00
|
|
|
RIBBED_HOSE,
|
|
|
|
FLEXIBLE_AXLE,
|
|
|
|
STRING_BRAIDED,
|
|
|
|
SHOCK_ABSORBER,
|
|
|
|
ACTUATOR
|
2016-10-05 23:28:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lcSynthComponent
|
|
|
|
{
|
|
|
|
lcMatrix44 Transform;
|
|
|
|
float Length;
|
|
|
|
};
|
|
|
|
|
|
|
|
class lcLibraryMeshData;
|
|
|
|
|
|
|
|
class lcSynthInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcSynthInfo(lcSynthType Type, float Length, int NumSections, PieceInfo* Info);
|
|
|
|
|
|
|
|
bool CanAddControlPoints() const
|
|
|
|
{
|
|
|
|
return mCurve;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCurve() const
|
|
|
|
{
|
|
|
|
return mCurve;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetDefaultControlPoints(lcArray<lcPieceControlPoint>& ControlPoints) const;
|
|
|
|
int InsertControlPoint(lcArray<lcPieceControlPoint>& ControlPoints, const lcVector3& Start, const lcVector3& End) const;
|
|
|
|
lcMesh* CreateMesh(const lcArray<lcPieceControlPoint>& ControlPoints) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float GetSectionTwist(const lcMatrix44& StartTransform, const lcMatrix44& EndTransform) const;
|
2019-01-13 19:48:37 +01:00
|
|
|
using SectionCallbackFunc = std::function<void(const lcVector3& CurvePoint, int SegmentIndex, float t)>;
|
|
|
|
void CalculateCurveSections(const lcArray<lcPieceControlPoint>& ControlPoints, lcArray<lcMatrix44>& Sections, SectionCallbackFunc SectionCallback) const;
|
|
|
|
void CalculateLineSections(const lcArray<lcPieceControlPoint>& ControlPoints, lcArray<lcMatrix44>& Sections, SectionCallbackFunc SectionCallback) const;
|
2019-02-21 01:52:50 +01:00
|
|
|
void AddHoseFlexibleParts(lcMemFile& File, const lcArray<lcMatrix44>& Sections) const;
|
2019-02-20 03:05:30 +01:00
|
|
|
void AddFlexHoseParts(lcMemFile& File, lcLibraryMeshData& MeshData, const lcArray<lcMatrix44>& Sections) const;
|
2016-10-05 23:28:52 +02:00
|
|
|
void AddRibbedHoseParts(lcMemFile& File, const lcArray<lcMatrix44>& Sections) const;
|
|
|
|
void AddFlexibleAxleParts(lcMemFile& File, lcLibraryMeshData& MeshData, const lcArray<lcMatrix44>& Sections) const;
|
|
|
|
void AddStringBraidedParts(lcMemFile& File, lcLibraryMeshData& MeshData, lcArray<lcMatrix44>& Sections) const;
|
|
|
|
void AddShockAbsorberParts(lcMemFile& File, lcArray<lcMatrix44>& Sections) const;
|
2017-03-17 23:37:20 +01:00
|
|
|
void AddActuatorParts(lcMemFile& File, lcArray<lcMatrix44>& Sections) const;
|
2016-10-05 23:28:52 +02:00
|
|
|
|
|
|
|
PieceInfo* mPieceInfo;
|
|
|
|
lcSynthType mType;
|
|
|
|
lcSynthComponent mStart;
|
|
|
|
lcSynthComponent mMiddle;
|
|
|
|
lcSynthComponent mEnd;
|
|
|
|
bool mCurve;
|
|
|
|
float mLength;
|
2019-02-21 01:52:50 +01:00
|
|
|
float mCenterLength;
|
2016-10-05 23:28:52 +02:00
|
|
|
int mNumSections;
|
|
|
|
bool mRigidEdges;
|
|
|
|
};
|
|
|
|
|
|
|
|
void lcSynthInit();
|
|
|
|
|