Skip to content

Commit

Permalink
add model class names
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz-h committed Nov 9, 2024
1 parent 0c274ca commit 444b8f1
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 35 deletions.
2 changes: 1 addition & 1 deletion map/src/MapWindow/DataView/DataView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Satisfactory3DMap::DataView::openSave(const std::filesystem::path& file) {
actorTransformations.push_back(glmCast(obj->actorHeader().Transform));
actorBufferPositions_.emplace(actorId, actorListOffset);

const auto& [modelType, idx] = manager_->classifyActor(*obj);
const auto& [modelType, idx] = manager_->classifyActor(obj->baseHeader().ClassName);

if (modelType == ModelManager::ModelType::None) {
// do nothing
Expand Down
157 changes: 125 additions & 32 deletions map/src/MapWindow/DataView/ModelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,58 +25,153 @@ Satisfactory3DMap::ModelManager::ModelManager(std::shared_ptr<SatisfactorySave::
// First entry in list for fallback
modelPathList models{
{"models/cube.glb", {""}},
{"models/foundation_8x4.glb",
{"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x4_01.Build_Foundation_8x4_01_C"}},
{"models/foundation_8x2.glb",
{"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x2_01.Build_Foundation_8x2_01_C"}},
{"models/foundation_8x1.glb",
{"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x1_01.Build_Foundation_8x1_01_C"}},
{"models/ramp_8x4.glb", {"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x4_01.Build_Ramp_8x4_01_C"}},
{"models/ramp_8x2.glb", {"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x2_01.Build_Ramp_8x2_01_C"}},
{"models/ramp_8x1.glb", {"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x1_01.Build_Ramp_8x1_01_C"}},
{"models/doubleramp_8x4.glb",
{"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x8x8.Build_Ramp_8x8x8_C"}},
{"models/doubleramp_8x2.glb",
{"/Game/FactoryGame/Buildable/Building/Ramp/Build_RampDouble.Build_RampDouble_C"}},
{"models/doubleramp_8x1.glb",
{"/Game/FactoryGame/Buildable/Building/Ramp/Build_RampDouble_8x1.Build_RampDouble_8x1_C"}},
{"models/wall.glb", {"/Game/FactoryGame/Buildable/Building/Wall/Build_Wall_8x4_01.Build_Wall_8x4_01_C"}},
{"models/powerpole.glb",
{"/Game/FactoryGame/Buildable/Factory/PowerPoleMk1/Build_PowerPoleMk1.Build_PowerPoleMk1_C",
{
"models/foundation_8x4.glb",
{
"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x4_01.Build_Foundation_8x4_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Foundation_Concrete_8x4.Build_Foundation_Concrete_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Foundation_Metal_8x4.Build_Foundation_Metal_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Foundation_ConcretePolished_8x4.Build_Foundation_ConcretePolished_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Foundation_Asphalt_8x4.Build_Foundation_Asphalt_8x4_C",
},
},
{
"models/foundation_8x2.glb",
{
"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x2_01.Build_Foundation_8x2_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Foundation_Concrete_8x2.Build_Foundation_Concrete_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Foundation_Metal_8x2.Build_Foundation_Metal_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Foundation_ConcretePolished_8x2_2.Build_Foundation_ConcretePolished_8x2_2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Foundation_Asphalt_8x2.Build_Foundation_Asphalt_8x2_C",
},
},
{
"models/foundation_8x1.glb",
{
"/Game/FactoryGame/Buildable/Building/Foundation/Build_Foundation_8x1_01.Build_Foundation_8x1_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Foundation_Concrete_8x1.Build_Foundation_Concrete_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Foundation_Metal_8x1.Build_Foundation_Metal_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Foundation_ConcretePolished_8x1.Build_Foundation_ConcretePolished_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Foundation_Asphalt_8x1.Build_Foundation_Asphalt_8x1_C",
},
},
{
"models/ramp_8x4.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x4_01.Build_Ramp_8x4_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Ramp_Concrete_8x4.Build_Ramp_Concrete_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Ramp_Metal_8x4.Build_Ramp_Metal_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Ramp_Polished_8x4.Build_Ramp_Polished_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Ramp_Asphalt_8x4.Build_Ramp_Asphalt_8x4_C",
},
},
{
"models/ramp_8x2.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x2_01.Build_Ramp_8x2_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Ramp_Concrete_8x2.Build_Ramp_Concrete_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Ramp_Metal_8x2.Build_Ramp_Metal_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Ramp_Polished_8x2.Build_Ramp_Polished_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Ramp_Asphalt_8x2.Build_Ramp_Asphalt_8x2_C",
},
},
{
"models/ramp_8x1.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x1_01.Build_Ramp_8x1_01_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_Ramp_Concrete_8x1.Build_Ramp_Concrete_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_Ramp_Metal_8x1.Build_Ramp_Metal_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_Ramp_Polished_8x1.Build_Ramp_Polished_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_Ramp_Asphalt_8x1.Build_Ramp_Asphalt_8x1_C",
},
},
{
"models/doubleramp_8x4.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_Ramp_8x8x8.Build_Ramp_8x8x8_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_RampDouble_Concrete_8x4.Build_RampDouble_Concrete_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_RampDouble_Metal_8x4.Build_RampDouble_Metal_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_RampDouble_Polished_8x4.Build_RampDouble_Polished_8x4_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_RampDouble_Asphalt_8x4.Build_RampDouble_Asphalt_8x4_C",
},
},
{
"models/doubleramp_8x2.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_RampDouble.Build_RampDouble_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_RampDouble_Concrete_8x2.Build_RampDouble_Concrete_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_RampDouble_Metal_8x2.Build_RampDouble_Metal_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_RampDouble_Polished_8x2.Build_RampDouble_Polished_8x2_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_RampDouble_Asphalt_8x2.Build_RampDouble_Asphalt_8x2_C",
},
},
{
"models/doubleramp_8x1.glb",
{
"/Game/FactoryGame/Buildable/Building/Ramp/Build_RampDouble_8x1.Build_RampDouble_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/ConcreteSet/Build_RampDouble_Concrete_8x1.Build_RampDouble_Concrete_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/GripMetal/Build_RampDouble_Metal_8x1.Build_RampDouble_Metal_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/PolishedConcreteSet/Build_RampDouble_Polished_8x1.Build_RampDouble_Polished_8x1_C",
"/Game/FactoryGame/Buildable/Building/Foundation/AsphaltSet/Build_RampDouble_Asphalt_8x1.Build_RampDouble_Asphalt_8x1_C",
},
},
{
"models/wall.glb",
{
"/Game/FactoryGame/Buildable/Building/Wall/Build_Wall_8x4_01.Build_Wall_8x4_01_C",
},
},
{
"models/powerpole.glb",
{
"/Game/FactoryGame/Buildable/Factory/PowerPoleMk1/Build_PowerPoleMk1.Build_PowerPoleMk1_C",
"/Game/FactoryGame/Buildable/Factory/PowerPoleMk2/Build_PowerPoleMk2.Build_PowerPoleMk2_C",
"/Game/FactoryGame/Buildable/Factory/PowerPoleMk3/Build_PowerPoleMk3.Build_PowerPoleMk3_C"}},
{"models/splitter.glb",
{"/Game/FactoryGame/Buildable/Factory/CA_Merger/"
"Build_ConveyorAttachmentMerger.Build_ConveyorAttachmentMerger_C",
"/Game/FactoryGame/Buildable/Factory/PowerPoleMk3/Build_PowerPoleMk3.Build_PowerPoleMk3_C",
},
},
{
"models/splitter.glb",
{
"/Game/FactoryGame/Buildable/Factory/CA_Merger/"
"Build_ConveyorAttachmentMerger.Build_ConveyorAttachmentMerger_C",
"/Game/FactoryGame/Buildable/Factory/CA_Splitter/"
"Build_ConveyorAttachmentSplitter.Build_ConveyorAttachmentSplitter_C",
"/Game/FactoryGame/Buildable/Factory/CA_SplitterSmart/"
"Build_ConveyorAttachmentSplitterSmart.Build_ConveyorAttachmentSplitterSmart_C",
"/Game/FactoryGame/Buildable/Factory/CA_SplitterProgrammable/"
"Build_ConveyorAttachmentSplitterProgrammable.Build_ConveyorAttachmentSplitterProgrammable_C"}},
"Build_ConveyorAttachmentSplitterProgrammable.Build_ConveyorAttachmentSplitterProgrammable_C",
},
},
};

modelPathList splineModels{
{"models/spline_mesh/conveyor_belt.glb",
{
"models/spline_mesh/conveyor_belt.glb",
{
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C",
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C",
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C",
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C",
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C",
}},
{"models/spline_mesh/pipe.glb",
"/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk6/Build_ConveyorBeltMk6.Build_ConveyorBeltMk6_C",
},
},
{
"models/spline_mesh/pipe.glb",
{
"/Game/FactoryGame/Buildable/Factory/Pipeline/Build_Pipeline.Build_Pipeline_C",
"/Game/FactoryGame/Buildable/Factory/PipelineMk2/Build_PipelineMK2.Build_PipelineMK2_C",
"/Game/FactoryGame/Buildable/Factory/PipeHyper/Build_PipeHyper.Build_PipeHyper_C",
}},
{"models/spline_mesh/track.glb",
},
},
{
"models/spline_mesh/track.glb",
{
"/Game/FactoryGame/Buildable/Factory/Train/Track/Build_RailroadTrack.Build_RailroadTrack_C",
"/Game/FactoryGame/Buildable/Factory/Train/Track/"
"Build_RailroadTrackIntegrated.Build_RailroadTrackIntegrated_C",
}},
},
},
};

for (const auto& entry : models) {
Expand All @@ -90,9 +185,7 @@ Satisfactory3DMap::ModelManager::ModelManager(std::shared_ptr<SatisfactorySave::
}

std::pair<Satisfactory3DMap::ModelManager::ModelType, int32_t> Satisfactory3DMap::ModelManager::classifyActor(
const SatisfactorySave::SaveObject& a) {

const auto& className = a.baseHeader().ClassName;
const std::string& className) {

if (pakManager_ != nullptr) {
const auto& pakModel = findPakModel(className);
Expand Down
3 changes: 1 addition & 2 deletions map/src/MapWindow/DataView/ModelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <glm/mat4x4.hpp>
#include <glowl/glowl.h>

#include "SatisfactorySave/GameTypes/Save/SaveObject.h"
#include "SatisfactorySave/GameTypes/Structs/Base/Struct.h"
#include "SatisfactorySave/Pak/PakManager.h"
#include "SatisfactorySave/Pak/Serialization/StaticMesh.h"
Expand Down Expand Up @@ -42,7 +41,7 @@ namespace Satisfactory3DMap {
explicit ModelManager(std::shared_ptr<SatisfactorySave::PakManager> pakManager);
~ModelManager() = default;

std::pair<ModelType, int32_t> classifyActor(const SatisfactorySave::SaveObject& actor);
std::pair<ModelType, int32_t> classifyActor(const std::string& className);

[[nodiscard]] const std::vector<MeshModel>& pakModels() const {
return pakModels_;
Expand Down

0 comments on commit 444b8f1

Please sign in to comment.