42 lines
919 B
C++
42 lines
919 B
C++
//
|
|
// Created by sebastian on 08.02.26.
|
|
//
|
|
|
|
#ifndef MODELCOMPONENT_H
|
|
#define MODELCOMPONENT_H
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
#include "Component.h"
|
|
#include "../../layer/entities/ModelStage.h"
|
|
#include "../../renderer/model/TexturedModel.h"
|
|
|
|
|
|
class ModelComponent: public Component {
|
|
public:
|
|
ModelComponent(const std::vector<ModelStage>& stages) : stages(stages) {};
|
|
ModelComponent(std::shared_ptr<TexturedModel> model) {
|
|
activeModel = std::move(model);
|
|
}
|
|
|
|
void updateStage() {
|
|
for (const auto& stage : stages) {
|
|
if (stage.isActive()) {
|
|
activeModel = stage.model;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
[[nodiscard]] std::shared_ptr<TexturedModel> getActiveModel() const {
|
|
return activeModel;
|
|
}
|
|
private:
|
|
std::vector<ModelStage> stages;
|
|
std::shared_ptr<TexturedModel> activeModel;
|
|
};
|
|
|
|
|
|
|
|
#endif //MODELCOMPONENT_H
|