2016-02-29 21:13:54 +01:00
|
|
|
#ifndef _LC_SYNTH_H_
|
|
|
|
#define _LC_SYNTH_H_
|
|
|
|
|
|
|
|
#include "lc_math.h"
|
|
|
|
#include "piece.h"
|
2016-03-04 04:18:23 +01:00
|
|
|
|
|
|
|
enum lcSynthType
|
|
|
|
{
|
|
|
|
LC_SYNTH_PIECE_RIBBED_HOSE,
|
2016-04-04 07:11:29 +02:00
|
|
|
LC_SYNTH_PIECE_FLEXIBLE_AXLE,
|
2016-05-01 02:20:37 +02:00
|
|
|
LC_SYNTH_PIECE_STRING_BRAIDED,
|
|
|
|
LC_SYNTH_PIECE_SHOCK_ABSORBER
|
2016-03-04 04:18:23 +01:00
|
|
|
};
|
2016-02-29 21:13:54 +01:00
|
|
|
|
|
|
|
struct lcSynthComponent
|
|
|
|
{
|
|
|
|
lcMatrix44 Transform;
|
|
|
|
float Length;
|
|
|
|
};
|
|
|
|
|
2016-04-11 17:45:08 +02:00
|
|
|
class lcLibraryMeshData;
|
|
|
|
|
2016-03-04 04:18:23 +01:00
|
|
|
class lcSynthInfo
|
2016-02-29 21:13:54 +01:00
|
|
|
{
|
2016-03-04 04:18:23 +01:00
|
|
|
public:
|
2016-05-01 02:20:37 +02:00
|
|
|
lcSynthInfo(lcSynthType Type, float Length, int NumSections, PieceInfo* Info);
|
|
|
|
|
|
|
|
bool CanAddControlPoints() const
|
|
|
|
{
|
|
|
|
return mCurve;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCurve() const
|
|
|
|
{
|
|
|
|
return mCurve;
|
|
|
|
}
|
2016-03-04 04:18:23 +01:00
|
|
|
|
|
|
|
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:
|
2016-04-19 18:30:29 +02:00
|
|
|
float GetSectionTwist(const lcMatrix44& StartTransform, const lcMatrix44& EndTransform) const;
|
2016-05-01 02:20:37 +02:00
|
|
|
void CalculateCurveSections(const lcArray<lcPieceControlPoint>& ControlPoints, lcArray<lcMatrix44>& Sections, void(*SectionCallback)(const lcVector3& CurvePoint, int SegmentIndex, float t, void* Param), void* CallbackParam) const;
|
|
|
|
void CalculateLineSections(const lcArray<lcPieceControlPoint>& ControlPoints, lcArray<lcMatrix44>& Sections, void(*SectionCallback)(const lcVector3& CurvePoint, int SegmentIndex, float t, void* Param), void* CallbackParam) const;
|
2016-03-04 04:18:23 +01:00
|
|
|
void AddRibbedHoseParts(lcMemFile& File, const lcArray<lcMatrix44>& Sections) const;
|
2016-04-16 22:35:16 +02:00
|
|
|
void AddFlexibleAxleParts(lcMemFile& File, lcLibraryMeshData& MeshData, const lcArray<lcMatrix44>& Sections) const;
|
2016-04-19 20:37:50 +02:00
|
|
|
void AddStringBraidedParts(lcMemFile& File, lcLibraryMeshData& MeshData, lcArray<lcMatrix44>& Sections) const;
|
2016-05-01 02:20:37 +02:00
|
|
|
void AddShockAbsorberParts(lcMemFile& File, lcArray<lcMatrix44>& Sections) const;
|
2016-03-04 04:18:23 +01:00
|
|
|
|
2016-05-01 02:20:37 +02:00
|
|
|
PieceInfo* mPieceInfo;
|
2016-03-04 04:18:23 +01:00
|
|
|
lcSynthType mType;
|
|
|
|
lcSynthComponent mStart;
|
|
|
|
lcSynthComponent mMiddle;
|
|
|
|
lcSynthComponent mEnd;
|
2016-05-01 02:20:37 +02:00
|
|
|
bool mCurve;
|
2016-03-04 04:18:23 +01:00
|
|
|
float mLength;
|
|
|
|
int mNumSections;
|
2016-04-04 07:11:29 +02:00
|
|
|
bool mRigidEdges;
|
2016-02-29 21:13:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void lcSynthInit();
|
|
|
|
|
|
|
|
#endif // _LC_SYNTH_H_
|