#ifndef EDITSCENE_RENDERABLEEDITOR_HPP
#define EDITSCENE_RENDERABLEEDITOR_HPP
#pragma once
#include "ComponentEditor.hpp"
#include "../components/Renderable.hpp"
#include <OgreSceneManager.h>
#include <vector>
#include <string>

/**
 * Editor for RenderableComponent
 */
class RenderableEditor : public ComponentEditor<RenderableComponent> {
public:
	explicit RenderableEditor(Ogre::SceneManager *sceneMgr);

	const char *getName() const override { return "Renderable"; }

protected:
	bool renderComponent(flecs::entity entity,
			     RenderableComponent &renderable) override;

private:
	void scanMeshFiles();
	void loadMesh(RenderableComponent &renderable, flecs::entity entity);
	bool matchesSearch(const std::string &meshName, const std::string &search);

	Ogre::SceneManager *m_sceneMgr;
	std::vector<std::string> m_meshFiles;
	bool m_meshesScanned = false;
	static char s_meshNameBuffer[256];
	static char s_searchBuffer[256];
	static bool s_showMeshBrowser;
};

#endif // EDITSCENE_RENDERABLEEDITOR_HPP
