Files
leocad/common/lc_synth.h
T
Leonardo Zide 4129788f95 Build piece and synth meshes in one worker job
Color finalization no longer requires a UI-thread handoff between parsing and mesh conversion. Have the library and synth build services return converted private meshes, removing intermediate request/result mesh data and conversion requeue paths.

Fall back to source parsing immediately when a cached mesh cannot be decoded, eliminating SkipCache and the UI retry branch. Simplify paused staging cleanup and document the combined worker lifecycle; section finalization and publication remain on the UI thread.
2026-10-15 14:37:07 -07:00

57 lines
1.6 KiB
C++

#pragma once
#include "lc_math.h"
#include "piece.h"
class lcLibraryMeshData;
class lcMesh;
class lcSynthInfo
{
public:
explicit lcSynthInfo(float Length);
virtual ~lcSynthInfo() = default;
lcSynthInfo(const lcSynthInfo&) = delete;
lcSynthInfo(lcSynthInfo&&) = delete;
lcSynthInfo& operator=(const lcSynthInfo&) = delete;
lcSynthInfo& operator=(lcSynthInfo&&) = delete;
bool CanAddControlPoints() const
{
return mCurve;
}
bool IsCurve() const
{
return mCurve;
}
bool IsUnidirectional() const
{
return mUnidirectional;
}
bool IsNondirectional() const
{
return mNondirectional;
}
virtual void GetDefaultControlPoints(std::vector<lcPieceControlPoint>& ControlPoints) const = 0;
virtual void VerifyControlPoints(std::vector<lcPieceControlPoint>& ControlPoints) const = 0;
int InsertControlPoint(std::vector<lcPieceControlPoint>& ControlPoints, const lcVector3& Start, const lcVector3& End) const;
std::unique_ptr<lcMesh> BuildMesh(const std::vector<lcPieceControlPoint>& ControlPoints, const std::atomic_bool& Cancelled) const;
protected:
using SectionCallbackFunc = std::function<void(const lcVector3& CurvePoint, quint32 SegmentIndex, float t)>;
virtual void CalculateSections(const std::vector<lcPieceControlPoint>& ControlPoints, std::vector<lcMatrix44>& Sections, SectionCallbackFunc SectionCallback, const std::atomic_bool* Cancelled) const = 0;
virtual void AddParts(lcMemFile& File, lcLibraryMeshData& MeshData, const std::vector<lcMatrix44>& Sections, const std::atomic_bool* Cancelled) const = 0;
bool mCurve = false;
bool mUnidirectional = false;
bool mNondirectional = false;
float mLength;
};
void lcSynthInit();