added optional web component UI control
This commit is contained in:
@@ -181,6 +181,27 @@ inline void WriteFeedbackJson(JsonWriter& writer, const FeedbackSettings& feedba
|
||||
writer.EndObject();
|
||||
}
|
||||
|
||||
inline std::string ShaderAssetUrl(const std::string& shaderId, const std::string& assetPath)
|
||||
{
|
||||
return "/shader-assets/" + shaderId + "/" + assetPath;
|
||||
}
|
||||
|
||||
inline void WriteShaderUiJson(JsonWriter& writer, const std::string& shaderId, const ShaderUiDefinition& ui)
|
||||
{
|
||||
if (!ui.enabled)
|
||||
{
|
||||
writer.Null();
|
||||
return;
|
||||
}
|
||||
|
||||
writer.BeginObject();
|
||||
writer.KeyString("type", ui.type);
|
||||
writer.KeyString("entry", ui.entryPath);
|
||||
writer.KeyString("tag", ui.customElementTag);
|
||||
writer.KeyString("assetUrl", ShaderAssetUrl(shaderId, ui.entryPath));
|
||||
writer.EndObject();
|
||||
}
|
||||
|
||||
inline const char* RuntimeLayerBuildStateName(RuntimeLayerBuildState state)
|
||||
{
|
||||
switch (state)
|
||||
@@ -276,6 +297,8 @@ inline void WriteShaderCatalogJson(JsonWriter& writer, const SupportedShaderCata
|
||||
writer.KeyString("category", shader.category);
|
||||
writer.KeyBool("available", true);
|
||||
writer.KeyNull("error");
|
||||
writer.Key("ui");
|
||||
WriteShaderUiJson(writer, shader.id, shader.ui);
|
||||
writer.EndObject();
|
||||
}
|
||||
writer.EndArray();
|
||||
@@ -304,6 +327,11 @@ inline void WriteRuntimeShaderLayersJson(
|
||||
writer.KeyString("buildState", RuntimeLayerBuildStateName(layer.buildState));
|
||||
writer.KeyBool("renderReady", layer.renderReady);
|
||||
writer.KeyString("message", layer.message);
|
||||
writer.Key("ui");
|
||||
if (shaderPackage)
|
||||
WriteShaderUiJson(writer, shaderPackage->id, shaderPackage->ui);
|
||||
else
|
||||
writer.Null();
|
||||
writer.Key("temporal");
|
||||
if (shaderPackage)
|
||||
WriteTemporalJson(writer, shaderPackage->temporal);
|
||||
|
||||
Reference in New Issue
Block a user