ShaderNode: Add texture support

This commit is contained in:
Lynix
2020-05-22 15:39:10 +02:00
parent effaa9b88f
commit 33c8fe2562
20 changed files with 493 additions and 260 deletions

View File

@@ -18,21 +18,26 @@ class ShaderGraph
ShaderGraph();
~ShaderGraph() = default;
void AddTexture(std::string name, Nz::ShaderAst::ExpressionType type);
Nz::ShaderAst::StatementPtr Generate();
std::size_t AddTexture(std::string name, Nz::ShaderAst::ExpressionType type);
inline QtNodes::FlowScene& GetScene();
inline const TextureEntry& GetTexture(std::size_t textureIndex) const;
inline const std::vector<TextureEntry>& GetTextures();
NazaraSignal(OnTextureListUpdate, ShaderGraph*);
Nz::ShaderAst::StatementPtr ToAst();
void UpdateTexturePreview(std::size_t texture, QImage preview);
struct TextureEntry
{
std::string name;
Nz::ShaderAst::ExpressionType type;
QImage preview;
};
NazaraSignal(OnTextureListUpdate, ShaderGraph*);
NazaraSignal(OnTexturePreviewUpdate, ShaderGraph*, std::size_t /*textureIndex*/);
private:
std::shared_ptr<QtNodes::DataModelRegistry> BuildRegistry();