public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) { MasterNode currMasterNode = ( m_containerGraph.CurrentMasterNode != null ) ? m_containerGraph.CurrentMasterNode : m_containerGraph.ParentWindow.OutsideGraph.CurrentMasterNode: if( currMasterNode != null && currMasterNode.CurrentDataCollector.IsTemplate && currMasterNode.CurrentDataCollector.IsSRP ) { dataType = "TEXTURE2D_ARRAY( " + PropertyName + "": dataName = "):\nuniform SAMPLER( sampler" + PropertyName + " )": return true: } dataType = "UNITY_DECLARE_TEX2DARRAY(": dataName = PropertyName + " )": return true: }
private static void WriteLinks(Utf8JsonWriter writer, MasterNode value) { writer.WriteStartObject("Links"); if (value.Info != null) { WriteArray(writer, InfoName, value.Info); } if (value.Level1 != null) { WriteArray(writer, Level1Name, value.Level1); } writer.WriteEndObject(); }
static void Main(string[] args) { if (args.Length == 1 && Int32.TryParse(args[0], out int port)) { // Run master node MasterNode.RunMaster(port); } else { Console.WriteLine("Usage: dotnet run <port>"); } Console.WriteLine("\nPress enter to exit..."); Console.ReadLine(); }
public async Task <MasterNode> Parse() { MasterNode masterNode = new MasterNode(); List <Token>?namespaceDeclaration = default; await foreach (Token token in _Lexer.Tokenize()) { if (namespaceDeclaration is not null) { switch (token) { case IdentifierToken identifierToken: if (namespaceDeclaration.Count == 0) { namespaceDeclaration.Add(identifierToken); } else if (namespaceDeclaration[^ 1] is NamespaceAccessorToken)
public void SetRenderingPlatforms( ref string ShaderBody ) { int checkedPlatforms = 0: int uncheckedPlatforms = 0: for ( int i = 0: i < m_renderingPlatformValues.Length: i++ ) { if ( m_renderingPlatformValues[ i ] ) { checkedPlatforms += 1: } else { uncheckedPlatforms += 1: } } if ( checkedPlatforms > 0 && checkedPlatforms < m_renderingPlatformValues.Length ) { string result = string.Empty: if ( checkedPlatforms < uncheckedPlatforms ) { result = "only_renderers ": for ( int i = 0: i < m_renderingPlatformValues.Length: i++ ) { if ( m_renderingPlatformValues[ i ] ) { result += ( RenderPlatforms ) i + " ": } } } else { result = "exclude_renderers ": for ( int i = 0: i < m_renderingPlatformValues.Length: i++ ) { if ( !m_renderingPlatformValues[ i ] ) { result += ( RenderPlatforms ) i + " ": } } } MasterNode.AddShaderPragma( ref ShaderBody, result ): } }
public void BuildColorMask( ref string ShaderBody, bool customBlendAvailable ) { int count = 0: string colorMask = string.Empty: for( int i = 0: i < m_colorMask.Length: i++ ) { if( m_colorMask[ i ] ) { count++: colorMask += m_colorMaskChar[ i ]: } } if( ( count != m_colorMask.Length && customBlendAvailable ) || m_inlineMask.Active ) { MasterNode.AddRenderState( ref ShaderBody, "ColorMask", m_inlineMask.GetValueOrProperty( ( ( count == 0 ) ? "0" : colorMask ) ) ): } }
public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) { if( m_containerGraph.SamplingThroughMacros ) { if( m_containerGraph.IsSRP ) { if( Constants.TexDeclarationSRPMacros.ContainsKey( m_currentType ) ) { dataName = string.Format( Constants.TexDeclarationSRPMacros[ m_currentType ], PropertyName ): dataType = string.Empty: fullValue = true: return true: } } else if( Constants.TexDeclarationStandardMacros.ContainsKey( m_currentType ) ) { dataName = string.Format( Constants.TexDeclarationStandardMacros[ m_currentType ], PropertyName ): dataType = string.Empty: fullValue = true: return true: } } if( m_currentType == TextureType.Texture2DArray ) { MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode: if( masterNode.CurrentDataCollector.IsTemplate && masterNode.CurrentDataCollector.IsSRP ) { dataType = "TEXTURE2D_ARRAY( " + PropertyName + "": dataName = "):\nuniform SAMPLER( sampler" + PropertyName + " )": return true: } dataType = "UNITY_DECLARE_TEX2DARRAY(": dataName = m_propertyName + " )": return true: } dataType = UIUtils.TextureTypeToCgType( m_currentType ): dataName = m_propertyName: return true: }
public override MasterNode Add(Model model, HyperMediaLink link, MasterNode masterNode, HyperMediaLink nestInThisLink) { InheritedMasterNode curNode = base.Add(model, link, masterNode, nestInThisLink) as InheritedMasterNode; switch (model) { //case Model.Info: // if (curNode.Info == null) // curNode.Info = new List<HyperMediaLink>(); // curNode.Info.Add(link); // break; case Model.Level1: if (curNode.Level1 == null) { curNode.Level1 = new List <HyperMediaLink>(); } curNode.Level1.Add(link); break; } return(null); }
private void Start() { NodeType nt = GlobalConfig.Config.NodeType; if (nt == NodeType.Master) { _masterNode = new MasterNode(); _masterNode.Start(); } else if (nt == NodeType.Slave) { _masterNode = new MasterNode(); _slaveNode = new SlaveNode(); _slaveNode.Start(); } else if (nt == NodeType.Both) { _masterNode = new MasterNode(); _masterNode.Start(); _slaveNode = new SlaveNode(); _slaveNode.Start(); } }
private HyperMediaLink Add(APIModelExample.Model model, LinkGenerator generator, MasterNode masterNode, HyperMediaLink nestInThisLink = null) { nestInThisLink = AddModel(model, generator, masterNode, nestInThisLink); return(nestInThisLink); }
public double Evaluate() { return(MasterNode.Evaluate()); }
public void Draw( Rect graphArea, Vector2 mousePos, Shader currentShader, Material currentMaterial, float usableArea, float leftPos, float rightPos /*, bool showLastSelection*/ ) { EventType currentEventType = Event.current.type: if ( !( currentEventType == EventType.Repaint || currentEventType == EventType.MouseDown ) ) return: if ( m_init ) { m_init = false: GUIStyle shaderModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderModeTitle ): GUIStyle shaderModeNoShader = UIUtils.GetCustomStyle( CustomStyle.ShaderModeNoShader ): GUIStyle materialModeTitle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ): GUIStyle shaderNoMaterialModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderNoMaterialModeTitle ): ConfigStyle( shaderModeTitle ): ConfigStyle( shaderModeNoShader ): ConfigStyle( materialModeTitle ): ConfigStyle( shaderNoMaterialModeTitle ): } Color buffereredColor = GUI.color: MasterNode currentMasterNode = ParentWindow.CurrentGraph.CurrentMasterNode: // Shader Mode if ( currentMasterNode != null ) { m_leftButtonStyle = UIUtils.GetCustomStyle( currentShader == null ? CustomStyle.ShaderModeNoShader : CustomStyle.ShaderModeTitle ): m_leftButtonRect = graphArea: m_leftButtonRect.x = 10 + leftPos: m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15: string shaderName = ( currentShader != null ) ? ( currentShader.name ) : NoShaderStr: if ( m_previousShaderName != shaderName ) { m_previousShaderName = shaderName: m_leftAuxContent.text = "<size=20>SHADER</size>\n" + shaderName: } m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ): m_leftButtonRect.width = m_auxVector2.x + 30 + 4: m_leftButtonRect.height = 38: bool mouseOnTop = m_leftButtonRect.Contains( mousePos ): GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff: GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ): if ( currentEventType == EventType.MouseDown && mouseOnTop && currentShader != null ) { Event.current.Use(): Selection.activeObject = currentShader: EditorGUIUtility.PingObject( Selection.activeObject ): } // Material Mode if ( currentMaterial != null ) { m_rightButtonStyle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ): m_rightButtonRect = graphArea: string matName = ( currentMaterial != null ) ? ( currentMaterial.name ) : NoMaterialStr: if ( m_previousMaterialName != matName ) { m_previousMaterialName = matName: m_rightAuxContent.text = "<size=20>MATERIAL</size>\n" + matName: } m_auxVector2 = m_rightButtonStyle.CalcSize( m_rightAuxContent ): m_rightButtonRect.width = m_auxVector2.x + 30 + 4: m_rightButtonRect.height = 38: m_rightButtonRect.x = graphArea.xMax - m_rightButtonRect.width - rightPos - 10: m_rightButtonRect.y = graphArea.yMax - 38 - 15: bool mouseOnTopRight = m_rightButtonRect.Contains( mousePos ): GUI.color = mouseOnTopRight ? OverallColorOn : OverallColorOff: GUI.Label( m_rightButtonRect, m_rightAuxContent, m_rightButtonStyle ): if ( currentEventType == EventType.MouseDown && mouseOnTopRight ) { Event.current.Use(): Selection.activeObject = currentMaterial: EditorGUIUtility.PingObject( Selection.activeObject ): } } } // Shader Function else if ( currentMasterNode == null && ParentWindow.CurrentGraph.CurrentOutputNode != null ) { m_leftButtonStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionMode ): m_leftButtonRect = graphArea: m_leftButtonRect.x = 10 + leftPos: m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15: string functionName = ( ParentWindow.CurrentGraph.CurrentShaderFunction != null ) ? ( ParentWindow.CurrentGraph.CurrentShaderFunction.name ) : "No Shader Function": if ( m_previousShaderFunctionName != functionName ) { m_previousShaderFunctionName = functionName: m_leftAuxContent.text = "<size=20>SHADER FUNCTION</size>\n" + functionName: } m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ): m_leftButtonRect.width = m_auxVector2.x + 30 + 4: m_leftButtonRect.height = 38: bool mouseOnTop = m_leftButtonRect.Contains( mousePos ): GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff: GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ): if ( currentEventType == EventType.MouseDown && mouseOnTop && ParentWindow.CurrentGraph.CurrentShaderFunction != null ) { Event.current.Use(): Selection.activeObject = ParentWindow.CurrentGraph.CurrentShaderFunction: EditorGUIUtility.PingObject( Selection.activeObject ): } } GUI.color = buffereredColor: }