本文整理汇总了C#中IRenderer.SetSourceCode方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.SetSourceCode方法的具体用法?C# IRenderer.SetSourceCode怎么用?C# IRenderer.SetSourceCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.SetSourceCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updatePreview
private void updatePreview()
{
Image img = PreviewImage;
if (ir0 != null)
{
ir0.Destroy();
img.Source = null;
ir0 = null;
}
//
if (!FilesManager.Instance.ActiveFile.ActiveState.IsComplete)
return;
FileState altState = new FileState(FilesManager.Instance.ActiveFile.ActiveState, false);
// Find output
Node outputNode = null;
foreach (Node node in altState.Nodes)
{
if (node.inode.IsOutputNode())
{
outputNode = node;
break;
}
}
// Find selected node
oldSelectedVariable = parent.InputVariable;
Node selectedNode = altState.dictionaryOldToNew[oldSelectedVariable.Node];
int oldIndex = oldSelectedVariable.Node.Variables.IndexOf(oldSelectedVariable);
Variable selectedVariable = selectedNode.Variables[oldIndex];
// Remove output input if it was linked
if (outputNode.Variables[0].InputType == Variable.InputTypes.Link)
{
outputNode.Variables[0].GetLinks()[0].removeConnection();
}
// Find var output if it was linked
if (selectedVariable.GetLinks().Count > 0 && FilesManager.Instance.ActiveFile.ActiveState.Renderer != null)
{
Variable outputVariable = selectedVariable.GetLinks()[0].OutputVariable;
// Create a new connection
Connection c = new Connection();
c.OutputVariable = outputVariable;
c.InputVariable = outputNode.Variables[0];
// Compile source
HLSLCompiler comp = new HLSLCompiler(altState);
comp.Compile();
ir0 = FilesManager.Instance.ActiveFile.ActiveState.Renderer.Create();
ImageSource images = ir0.Initialize();
ir0.SetSourceCode(comp.SourceCode);
img.Source = images;
}
}