Vertex shader can now be modified in the material inspector

This commit is contained in:
Kah Wei 2022-11-19 23:22:54 +08:00
parent 61acbdc34e
commit a988c45d52
1 changed files with 12 additions and 3 deletions

View File

@ -172,11 +172,20 @@ namespace SHADE
// Shader // Shader
bool shaderChanged = false; bool shaderChanged = false;
const auto* SHADER_INFO = SHAssetManager::GetData<SHShaderAsset>(currentMatSpec->fragShader); const auto* VERT_SHADER_INFO = SHAssetManager::GetData<SHShaderAsset>(currentMatSpec->vertexShader);
const std::string SHADER_NAME = SHADER_INFO ? SHADER_INFO->name : "Unknown Shader"; const std::string VERT_SHADER_NAME = VERT_SHADER_INFO ? VERT_SHADER_INFO->name : "Unknown Shader";
isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID> isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID>
( (
"Fragment Shader", SHADER_NAME.data(), "Fragment Shader", VERT_SHADER_NAME.data(),
[this]() { return currentMatSpec->vertexShader; },
[this](const AssetID& id) { currentMatSpec->vertexShader = id; },
SHDragDrop::DRAG_RESOURCE
);
const auto* FRAG_SHADER_INFO = SHAssetManager::GetData<SHShaderAsset>(currentMatSpec->fragShader);
const std::string FRAG_SHADER_NAME = FRAG_SHADER_INFO ? FRAG_SHADER_INFO->name : "Unknown Shader";
isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID>
(
"Fragment Shader", FRAG_SHADER_NAME.data(),
[this]() { return currentMatSpec->fragShader; }, [this]() { return currentMatSpec->fragShader; },
[this](const AssetID& id) { currentMatSpec->fragShader = id; }, [this](const AssetID& id) { currentMatSpec->fragShader = id; },
SHDragDrop::DRAG_RESOURCE SHDragDrop::DRAG_RESOURCE