using Godot; using System.Reflection; using System.Collections.Generic; namespace Rokojori { public class Shaders { public static List GetUniformMembers( Shader shader ) { var list = new List(); var uniforms = shader.GetShaderUniformList(); foreach ( var u in uniforms ) { var d = u.AsGodotDictionary(); var member = new UniformMember(); member.name = d[ "name" ].AsString(); member.type = (Variant.Type) d[ "type" ].AsInt32(); member.hint = (PropertyHint) d[ "hint" ].AsInt32(); member.hintString = d[ "hint_string" ].AsString(); member.usage = d[ "usage" ].AsInt32(); list.Add( member ); } return list; } public static List GetUniformNames( Shader shader ) { var list = new List(); var uniforms = shader.GetShaderUniformList(); foreach ( var p in uniforms ) { var d = p.AsGodotDictionary(); var name = d[ "name" ].ToString(); list.Add( name ); } return list; } } }