#pragma once #include "lc_math.h" #include "piece.h" enum class lcSynthType { HOSE_FLEXIBLE, FLEX_SYSTEM_HOSE, RIBBED_HOSE, FLEXIBLE_AXLE, STRING_BRAIDED, SHOCK_ABSORBER, ACTUATOR }; 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& ControlPoints) const; int InsertControlPoint(lcArray& ControlPoints, const lcVector3& Start, const lcVector3& End) const; lcMesh* CreateMesh(const lcArray& ControlPoints) const; protected: float GetSectionTwist(const lcMatrix44& StartTransform, const lcMatrix44& EndTransform) const; using SectionCallbackFunc = std::function; void CalculateCurveSections(const lcArray& ControlPoints, lcArray& Sections, SectionCallbackFunc SectionCallback) const; void CalculateLineSections(const lcArray& ControlPoints, lcArray& Sections, SectionCallbackFunc SectionCallback) const; void AddHoseFlexibleParts(lcMemFile& File, const lcArray& Sections) const; void AddFlexHoseParts(lcMemFile& File, lcLibraryMeshData& MeshData, const lcArray& Sections) const; void AddRibbedHoseParts(lcMemFile& File, const lcArray& Sections) const; void AddFlexibleAxleParts(lcMemFile& File, lcLibraryMeshData& MeshData, const lcArray& Sections) const; void AddStringBraidedParts(lcMemFile& File, lcLibraryMeshData& MeshData, lcArray& Sections) const; void AddShockAbsorberParts(lcMemFile& File, lcArray& Sections) const; void AddActuatorParts(lcMemFile& File, lcArray& Sections) const; PieceInfo* mPieceInfo; lcSynthType mType; lcSynthComponent mStart; lcSynthComponent mMiddle; lcSynthComponent mEnd; bool mCurve; float mLength; float mCenterLength; int mNumSections; bool mRigidEdges; }; void lcSynthInit();