diff --git a/include/ishaders.h b/include/ishaders.h index 2b05d7b0fc..8502be8739 100644 --- a/include/ishaders.h +++ b/include/ishaders.h @@ -60,6 +60,7 @@ class Material PF_HasSortDefined = 1 << 0, // has a "sort" keyword in its definition PF_HasAmbientRimColour = 1 << 1, // has an "ambientRimColor" keyword in its definition PF_HasSpectrum = 1 << 2, // has a "spectrum" keyword in its definition + PF_HasDecalInfo = 1 << 3, // has a "decalinfo" keyword in its definition }; // Surface Flags diff --git a/install/ui/materialeditor.fbp b/install/ui/materialeditor.fbp index 9586a5fa4c..6694e389d4 100644 --- a/install/ui/materialeditor.fbp +++ b/install/ui/materialeditor.fbp @@ -595,11 +595,11 @@ -1 - + 12 wxEXPAND|wxLEFT 2 - + 1 1 1 @@ -650,16 +650,16 @@ wxTAB_TRAVERSAL - + bSizer62 wxVERTICAL none - + 6 wxEXPAND|wxRIGHT 1 - + bSizer8 wxVERTICAL @@ -932,11 +932,11 @@ - + 0 wxEXPAND 1 - + 1 1 1 @@ -3624,7 +3624,7 @@ Light - 1 + 0 1 1 @@ -4349,7 +4349,7 @@ 1 0 - 0 + 1 1 1 @@ -5009,153 +5009,16 @@ - - 0 - wxEXPAND - 1 - - - bSizer1413 - wxHORIZONTAL - none - - 0 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - shadowMapOffset - - 0 - - - 0 - - 1 - m_checkBox84113 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 0 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0 - 100 - - 0 - - -100 - - 0 - - 1 - MaterialEditorPolygonOffset1 - 1 - - - protected - 1 - - Resizable - 1 - 80,-1 - wxSP_ARROW_KEYS - - 0 - - - - - - - - - - + Decals - 0 - + 1 + 1 1 1 @@ -5206,16 +5069,16 @@ wxTAB_TRAVERSAL - + bSizer57121 wxVERTICAL none - + 5 wxEXPAND 1 - + bSizer79 wxVERTICAL @@ -5494,11 +5357,11 @@ - + 6 - wxEXPAND|wxRIGHT|wxTOP + wxEXPAND|wxRIGHT 0 - + bSizer78 wxHORIZONTAL @@ -5544,7 +5407,7 @@ 0 1 - m_checkBox2011111 + MaterialHasDecalInfo 1 @@ -5567,680 +5430,736 @@ - + 0 - wxALL|wxEXPAND + wxEXPAND | wxALL 1 - - 2 - wxBOTH - 0,1 - - 24 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - fgSizer14 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 8 - - 0 - wxEXPAND - 1 - - - bSizer7811 - wxHORIZONTAL - none - - 6 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Stay: - 0 - - 0 - - - 0 - - 1 - m_staticText4613 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + 1 + MaterialDecalInfoPanel + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + 2 + wxBOTH + 0,1 + + 24 + + fgSizer14 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 8 + + 0 + wxEXPAND + 1 + + + bSizer7811 + wxHORIZONTAL + none + + 6 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Stay: + 0 + + 0 + + + 0 + + 1 + m_staticText4613 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxALIGN_CENTER_VERTICAL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0 - 9999 - - 0 - - 0 - - 0 - - 1 - MaterialEditorDecalInfoStaySeconds2 - 1 - - - protected - 1 - - Resizable - 1 - 70,-1 - wxSP_ARROW_KEYS - - 0 - - - - - + + 6 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 2 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0.1 + 0 + 999999 + + 0 + + 0 + + 0 + + 1 + MaterialEditorDecalInfoStaySeconds + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + + + + + - - - 6 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - secs - 0 - - 0 - - - 0 - - 1 - m_staticText46112 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + + 6 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + secs + 0 + + 0 + + + 0 + + 1 + m_staticText46112 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxEXPAND - 1 - - - bSizer7812 - wxHORIZONTAL - none - - 24 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Fade: - 0 - - 0 - - - 0 - - 1 - m_staticText46122 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + + 0 + wxEXPAND + 1 + + + bSizer7812 + wxHORIZONTAL + none + + 24 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Fade: + 0 + + 0 + + + 0 + + 1 + m_staticText46122 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 0 - 9999 - - 0 - - 0 - - 0 - - 1 - MaterialEditorDecalInfoStaySeconds12 - 1 - - - public - 1 - - Resizable - 1 - 70,-1 - wxSP_ARROW_KEYS - - 0 - - - - - + + 6 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 2 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 0.1 + 0.200000 + 999999 + + 0 + + 0 + + 0 + + 1 + MaterialEditorDecalInfoFadeSeconds + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + + + + + - - - 6 - wxALIGN_CENTER_VERTICAL|wxALL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - secs - 0 - - 0 - - - 0 - - 1 - m_staticText461112 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + + 6 + wxALIGN_CENTER_VERTICAL|wxALL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + secs + 0 + + 0 + + + 0 + + 1 + m_staticText461112 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxEXPAND - 1 - - - bSizer78111 - wxHORIZONTAL - none - - 6 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Start RGB: - 0 - - 0 - - - 0 - - 1 - m_staticText46131 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + + 0 + wxEXPAND + 1 + + + bSizer78111 + wxHORIZONTAL + none + + 6 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Start RGB: + 0 + + 0 + + + 0 + + 1 + m_staticText46131 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textCtrl14 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - + + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + MaterialDecalInfoStartRgb + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + - - - 0 - wxEXPAND - 1 - - - bSizer781111 - wxHORIZONTAL - none - - 6 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - End RGB: - 0 - - 0 - - - 0 - - 1 - m_staticText461311 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 + + 0 + wxEXPAND + 1 + + + bSizer781111 + wxHORIZONTAL + none + + 6 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + End RGB: + 0 + + 0 + + + 0 + + 1 + m_staticText461311 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - - 0 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textCtrl141 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - + + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + MaterialDecalInfoEndRgb + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/install/ui/materialeditor.xrc b/install/ui/materialeditor.xrc index 13b859809c..37583831ad 100644 --- a/install/ui/materialeditor.xrc +++ b/install/ui/materialeditor.xrc @@ -588,7 +588,7 @@ - 1 + 0 @@ -698,7 +698,7 @@ 0 - 0 + 1 @@ -814,35 +814,6 @@ - - - wxEXPAND - 0 - - wxHORIZONTAL - - - wxALIGN_CENTER_VERTICAL - 0 - - - 0 - - - - - wxALIGN_CENTER_VERTICAL - 0 - - - 80,-1 - 0 - -100 - 100 - - - - @@ -850,7 +821,7 @@ - 0 + 1 @@ -912,7 +883,7 @@ - wxEXPAND|wxRIGHT|wxTOP + wxEXPAND|wxRIGHT 6 wxHORIZONTAL @@ -920,144 +891,149 @@ wxALL 6 - + 0 - wxALL|wxEXPAND + wxEXPAND | wxALL 0 - - 0 - 2 - 8 - 24 - 0,1 - - - - wxEXPAND - 0 - - wxHORIZONTAL - - - wxALIGN_CENTER_VERTICAL|wxRIGHT - 6 - - - -1 + + + + 0 + 2 + 8 + 24 + 0,1 + + + + wxEXPAND + 0 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxRIGHT + 6 + + + -1 + - - - - wxALIGN_CENTER_VERTICAL - 0 - - - 70,-1 - 0 - 0 - 9999 + + + wxALIGN_CENTER_VERTICAL + 6 + + + 0 + 0 + 999999 + 0.1 + 2 + - - - - wxALIGN_CENTER_VERTICAL|wxLEFT - 6 - - - -1 + + + wxALIGN_CENTER_VERTICAL|wxLEFT + 6 + + + -1 + - - - - wxEXPAND - 0 - - wxHORIZONTAL - - - wxALIGN_CENTER_VERTICAL - 24 - - - -1 + + + wxEXPAND + 0 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL + 24 + + + -1 + - - - - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - 70,-1 - 0 - 0 - 9999 + + + wxALIGN_CENTER_VERTICAL|wxLEFT + 6 + + + 0.200000 + 0 + 999999 + 0.1 + 2 + - - - - wxALIGN_CENTER_VERTICAL|wxALL|wxLEFT - 6 - - - -1 + + + wxALIGN_CENTER_VERTICAL|wxALL|wxLEFT + 6 + + + -1 + - - - - wxEXPAND - 0 - - wxHORIZONTAL - - - wxALIGN_CENTER_VERTICAL|wxRIGHT - 6 - - - -1 + + + wxEXPAND + 0 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxRIGHT + 6 + + + -1 + - - - - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - + + + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + - - - - wxEXPAND - 0 - - wxHORIZONTAL - - - wxALIGN_CENTER_VERTICAL|wxRIGHT - 6 - - - -1 + + + wxEXPAND + 0 + + wxHORIZONTAL + + + wxALIGN_CENTER_VERTICAL|wxRIGHT + 6 + + + -1 + - - - - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - + + + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + diff --git a/radiant/ui/materials/MaterialEditor.cpp b/radiant/ui/materials/MaterialEditor.cpp index 86124e40c0..72be802e10 100644 --- a/radiant/ui/materials/MaterialEditor.cpp +++ b/radiant/ui/materials/MaterialEditor.cpp @@ -370,12 +370,30 @@ void MaterialEditor::updateMaterialPropertiesFromMaterial() getControl("MaterialSpectrumValue")->Enable(hasSpectrum); getControl("MaterialSpectrumValue")->SetValue(_material->getSpectrum()); + bool hasDecalInfo = _material->getParseFlags() & Material::PF_HasDecalInfo; + getControl("MaterialHasDecalInfo")->SetValue(hasDecalInfo); + getControl("MaterialDecalInfoPanel")->Enable(hasDecalInfo); + + const auto& decalInfo = _material->getDecalInfo(); + getControl("MaterialEditorDecalInfoStaySeconds")->SetValue(decalInfo.stayMilliSeconds / 1000.0f); + getControl("MaterialEditorDecalInfoFadeSeconds")->SetValue(decalInfo.fadeMilliSeconds / 1000.0f); + getControl("MaterialDecalInfoStartRgb")->SetValue(fmt::format("({0} {1} {2} {3})", + decalInfo.startColour.x(), decalInfo.startColour.y(), decalInfo.startColour.z(), decalInfo.startColour.w())); + getControl("MaterialDecalInfoEndRgb")->SetValue(fmt::format("({0} {1} {2} {3})", + decalInfo.endColour.x(), decalInfo.endColour.y(), decalInfo.endColour.z(), decalInfo.endColour.w())); + // Surround the definition with curly braces, these are not included auto definition = fmt::format("{0}\n{{{1}}}", _material->getName(), _material->getDefinition()); _sourceView->SetValue(definition); } else { + getControl("MaterialHasDecalInfo")->SetValue(false); + getControl("MaterialEditorDecalInfoStaySeconds")->SetValue(0); + getControl("MaterialEditorDecalInfoFadeSeconds")->SetValue(0); + getControl("MaterialDecalInfoStartRgb")->SetValue(""); + getControl("MaterialDecalInfoEndRgb")->SetValue(""); + getControl("MaterialHasSpectrum")->SetValue(false); getControl("MaterialSpectrumValue")->SetValue(0); getControl("MaterialLightFalloffMap")->SetValue(""); diff --git a/radiantcore/shaders/ShaderTemplate.cpp b/radiantcore/shaders/ShaderTemplate.cpp index 1b04ce30fe..c4fa67d6fd 100644 --- a/radiantcore/shaders/ShaderTemplate.cpp +++ b/radiantcore/shaders/ShaderTemplate.cpp @@ -193,6 +193,8 @@ bool ShaderTemplate::parseShaderFlags(parser::DefTokeniser& tokeniser, } else if (token == "decalinfo") { + _parseFlags |= Material::PF_HasDecalInfo; + // Syntax: decalInfo [start rgb] [end rgb] // Example: decalInfo 10 5 ( 1 1 1 1 ) ( 0 0 0 0 ) _decalInfo.stayMilliSeconds = static_cast(string::convert(tokeniser.nextToken()) * 1000);