Reduce asset header dependencies

Keep library source storage details in the implementation and move the primitive constructor out of line so the library header no longer needs string helpers. Use shared forward declarations and asset types in loader and manager headers, keeping the full texture definition in its implementation.
This commit is contained in:
Leonardo Zide committed 2026-10-20 21:31:31 -07:00
1 parent 9db02183c8
commit 3d1091492e
8 files changed
+38 -53

No files matched your search

-6
View File
@@ -2,13 +2,7 @@
#include "lc_assettypes.h"
class lcPieceData;
class lcPiecesLibrary;
class lcPiece;
struct lcPieceControlPoint;
class lcMesh;
class lcSynthInfo;
class lcTexture;
// Owned by lcPiecesLibrary. Instance methods run on the UI thread and schedule private worker builds;
// UI-thread completion processing resolves colors, uploads textures, and publishes meshes.
+2
View File
@@ -84,6 +84,8 @@ enum class lcLightAreaShape;
class lcGroup;
class lcModelHistory;
class lcPieceData;
class lcSynthInfo;
class lcTrainTrackInfo;
typedef std::map<const lcPieceData*, std::map<int, int>> lcPartsList;
struct lcModelPartsEntry;
struct lcMinifig;
+32
View File
@@ -39,6 +39,38 @@ enum class lcLibraryCacheFlag : quint32
Directory = 0x0002
};
enum class lcLibrarySourceType
{
Library,
StudStyle
};
struct lcLibrarySource
{
lcLibrarySource() = default;
lcLibrarySource(const lcLibrarySource&) = delete;
lcLibrarySource(lcLibrarySource&&) = delete;
lcLibrarySource& operator=(const lcLibrarySource&) = delete;
lcLibrarySource& operator=(lcLibrarySource&&) = delete;
lcLibrarySourceType Type;
std::map<std::string, std::unique_ptr<lcLibraryPrimitive>> Primitives;
};
lcLibraryPrimitive::lcLibraryPrimitive(QString&& FileName, const char* Name, lcZipFileType ZipFileType, quint32 ZipFileIndex, bool Stud, bool StudStyle, bool SubFile)
: mFileName(std::move(FileName))
{
lcstrcpy(mName, Name);
mZipFileType = ZipFileType;
mZipFileIndex = ZipFileIndex;
mState = lcPrimitiveState::NotLoaded;
mStud = Stud;
mStudStyle = StudStyle;
mSubFile = SubFile;
}
lcPiecesLibrary::lcPiecesLibrary(lcStudStyle StudStyle, bool StudCylinderColorEnabled)
: mStudStyle(StudStyle), mStudCylinderColorEnabled(StudCylinderColorEnabled)
{
+2 -39
View File
@@ -1,20 +1,13 @@
#pragma once
#include "lc_context.h"
#include "lc_math.h"
#include "lc_meshloader.h"
#include "lc_result.h"
#include "lc_assettypes.h"
#include "lc_string.h"
class lcPieceData;
class lcPiece;
class lcMesh;
class lcTrainTrackInfo;
struct lcTrainTrackConnectionType;
class lcZipFile;
class lcLibraryMeshData;
struct lcEmbeddedData;
struct lcLibrarySource;
enum class lcStudStyle
{
@@ -59,18 +52,7 @@ enum class lcPrimitiveState
class lcLibraryPrimitive
{
public:
explicit lcLibraryPrimitive(QString&& FileName, const char* Name, lcZipFileType ZipFileType, quint32 ZipFileIndex, bool Stud, bool StudStyle, bool SubFile)
: mFileName(std::move(FileName))
{
lcstrcpy(mName, Name);
mZipFileType = ZipFileType;
mZipFileIndex = ZipFileIndex;
mState = lcPrimitiveState::NotLoaded;
mStud = Stud;
mStudStyle = StudStyle;
mSubFile = SubFile;
}
explicit lcLibraryPrimitive(QString&& FileName, const char* Name, lcZipFileType ZipFileType, quint32 ZipFileIndex, bool Stud, bool StudStyle, bool SubFile);
void SetZipFile(lcZipFileType ZipFileType, quint32 ZipFileIndex)
{
@@ -97,25 +79,6 @@ public:
QString mLoadError;
};
enum class lcLibrarySourceType
{
Library,
StudStyle
};
struct lcLibrarySource
{
lcLibrarySource() = default;
lcLibrarySource(const lcLibrarySource&) = delete;
lcLibrarySource(lcLibrarySource&&) = delete;
lcLibrarySource& operator=(const lcLibrarySource&) = delete;
lcLibrarySource& operator=(lcLibrarySource&&) = delete;
lcLibrarySourceType Type;
std::map<std::string, std::unique_ptr<lcLibraryPrimitive>> Primitives;
};
// Coordinates asset sources, loading, settings and shared render buffers.
// Piece/texture managers own identities and references; the loader owns pending work.
// Acquisition, scheduling and publication run on the UI thread; workers use source snapshots.
-5
View File
@@ -1,6 +1,5 @@
#pragma once
#include <stdio.h>
#include "lc_assettypes.h"
#include "lc_math.h"
@@ -15,10 +14,6 @@ struct lcModelPartsEntry
int ColorIndex;
};
class lcSynthInfo;
class lcTrainTrackInfo;
enum class lcZipFileType;
class lcPieceData
{
public:
+1
View File
@@ -2,6 +2,7 @@
#include "lc_texturemanager.h"
#include "lc_file.h"
#include "lc_string.h"
#include "lc_texture.h"
lcTextureManager::~lcTextureManager()
{
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include "lc_texture.h"
#include "lc_assettypes.h"
// Creates and reuses textures, tracks their references, and prepares image data.
// The asset loader handles scheduling, OpenGL uploads, and retries.
-2
View File
@@ -2,8 +2,6 @@
#include "lc_assettypes.h"
class lcPiecesLibrary;
struct lcPartThumbnail
{
QPixmap Pixmap;