mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-23 20:47:45 +00:00
Add level of detail selection in mdlviewer
This commit is contained in:
parent
6c691ae630
commit
7ec107dfd8
4 changed files with 17 additions and 4 deletions
|
@ -71,6 +71,7 @@ private:
|
|||
std::vector<GearInfo*> loadedGears;
|
||||
|
||||
Race currentRace = Race::HyurMidlanderMale;
|
||||
int currentLod = 0;
|
||||
|
||||
GameData& data;
|
||||
|
||||
|
|
|
@ -174,6 +174,18 @@ MainWindow::MainWindow(GameData& data) : data(data) {
|
|||
|
||||
controlLayout->addWidget(raceCombo);
|
||||
|
||||
auto lodCombo = new QComboBox();
|
||||
lodCombo->addItem("0");
|
||||
lodCombo->addItem("1");
|
||||
lodCombo->addItem("2");
|
||||
|
||||
connect(lodCombo, qOverload<int>(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
currentLod = index;
|
||||
refreshModel();
|
||||
});
|
||||
|
||||
controlLayout->addWidget(lodCombo);
|
||||
|
||||
QPushButton* exportButton = new QPushButton("Export");
|
||||
|
||||
connect(exportButton, &QPushButton::clicked, [this] {
|
||||
|
@ -212,7 +224,7 @@ void MainWindow::refreshModel() {
|
|||
data.extractFile(resolvedModelPath.toStdString(), "top.mdl");
|
||||
|
||||
#ifndef USE_STANDALONE_WINDOW
|
||||
vkWindow->models.push_back(renderer->addModel(parseMDL("top.mdl")));
|
||||
vkWindow->models.push_back(renderer->addModel(parseMDL("top.mdl"), currentLod));
|
||||
#else
|
||||
standaloneWindow->models.push_back(renderer->addModel(parseMDL("top.mdl")));
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
bool initSwapchain(VkSurfaceKHR surface, int width, int height);
|
||||
void resize(VkSurfaceKHR surface, int width, int height);
|
||||
|
||||
RenderModel addModel(const Model& model);
|
||||
RenderModel addModel(const Model& model, int lod);
|
||||
|
||||
void render(std::vector<RenderModel> models);
|
||||
|
||||
|
|
|
@ -508,11 +508,11 @@ uint32_t Renderer::findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags pro
|
|||
return -1;
|
||||
}
|
||||
|
||||
RenderModel Renderer::addModel(const Model& model) {
|
||||
RenderModel Renderer::addModel(const Model& model, int lod) {
|
||||
RenderModel renderModel;
|
||||
renderModel.model = model;
|
||||
|
||||
for(auto part : model.lods[0].parts) {
|
||||
for(auto part : model.lods[lod].parts) {
|
||||
RenderPart renderPart;
|
||||
|
||||
size_t vertexSize = part.vertices.size() * sizeof(Vertex);
|
||||
|
|
Loading…
Add table
Reference in a new issue