This commit is contained in:
milek7
2019-08-15 15:08:17 +02:00
parent 7f0dfa708e
commit 878b8621f0
3 changed files with 3 additions and 52 deletions

View File

@@ -15,5 +15,7 @@ class scenerylist_panel : public ui_panel
private:
scenery_scanner scanner;
scenery_desc const *selected_scenery = nullptr;
vehicles_bank &bank;
};
} // namespace ui

View File

@@ -1,41 +1,7 @@
#include "stdafx.h"
#include "textures_scanner.h"
#include "renderer.h"
#include "utilities.h"
GLuint ui::deferred_image::get() const
{
if (!path.empty()) {
image = GfxRenderer.Fetch_Texture(path, true);
path.clear();
}
if (image != null_handle) {
opengl_texture &tex = GfxRenderer.Texture(image);
tex.create();
if (tex.is_ready)
return tex.id;
}
return -1;
}
ui::deferred_image::operator bool() const
{
return image != null_handle || !path.empty();
}
glm::ivec2 ui::deferred_image::size() const
{
if (image != null_handle) {
opengl_texture &tex = GfxRenderer.Texture(image);
return glm::ivec2(tex.width(), tex.height());
}
return glm::ivec2();
}
void ui::vehicles_bank::scan_textures()
{
for (auto &f : std::filesystem::recursive_directory_iterator("dynamic")) {

View File

@@ -1,6 +1,6 @@
#pragma once
#include "Texture.h"
#include "deferred_image.h"
namespace ui {
enum class vehicle_type {
@@ -22,23 +22,6 @@ enum class vehicle_type {
unknown
};
class deferred_image {
public:
deferred_image() = default;
deferred_image(const std::string &p) : path(p) { }
deferred_image(const deferred_image&) = delete;
deferred_image(deferred_image&&) = default;
deferred_image &operator=(deferred_image&&) = default;
operator bool() const;
GLuint get() const;
glm::ivec2 size() const;
private:
mutable std::string path;
mutable texture_handle image = 0;
};
struct skin_set {
std::vector<std::filesystem::path> skins;
deferred_image mini;