Vertex shader can now be modified in the material inspector #230

Merged
Pycorax merged 1 commits from SP3-1-VertexSwitch into main 2022-11-20 15:33:56 +08:00
1 changed files with 12 additions and 3 deletions
Showing only changes of commit a988c45d52 - Show all commits

View File

@ -172,11 +172,20 @@ namespace SHADE
// Shader
bool shaderChanged = false;
const auto* SHADER_INFO = SHAssetManager::GetData<SHShaderAsset>(currentMatSpec->fragShader);
const std::string SHADER_NAME = SHADER_INFO ? SHADER_INFO->name : "Unknown Shader";
const auto* VERT_SHADER_INFO = SHAssetManager::GetData<SHShaderAsset>(currentMatSpec->vertexShader);
const std::string VERT_SHADER_NAME = VERT_SHADER_INFO ? VERT_SHADER_INFO->name : "Unknown Shader";
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](const AssetID& id) { currentMatSpec->fragShader = id; },
SHDragDrop::DRAG_RESOURCE