Ejemplo n.º 1
0
        public void Bind()
        {
            GLProg.Bind();
            GL.BindVertexArray(ID);

            if (Tex != null)
            {
                if (GLProg.SetUniform("TEX", Tex))
                {
                    Tex.Bind();
                }
            }
            if (Tex2 != null)
            {
                if (GLProg.SetUniform("TEX2", Tex2))
                {
                    Tex2.Bind();
                }
            }

            GLProg.SetUniform("u_modelview", ref ModelMatrix);
            GLProg.SetUniform("u_projection", ref Camera.Projection);
            GLProg.SetUniform("u_view", ref Camera.View);
            GLProg.SetUniform("u_viewrot", ref Camera.Rotation);
            GLProg.SetUniform("Time", (float)Program.SWatch.ElapsedMilliseconds / 1000);
            GLProg.SetUniform("Resolution", Camera.ScreenRes);
            GLProg.SetUniform("Settings", new Vector4(Settings.FXAA ? 1 : 0, Settings.Wireframe ? 1 : 0, 0, 0));

            Indices.Bind();
            Verts.Bind();
            Colors.BindOnAttrib(GLProg.Attrib("Color"));
            UVs.BindOnAttrib(GLProg.Attrib("UV"));
            BlockData.BindOnAttrib(GLProg.Attrib("Data"));
        }
Ejemplo n.º 2
0
 public Bind(IBindable target)
 {
     context = target;
     if (null != context)
     {
         context.Bind();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the binding and binds it.
        /// </summary>
        public void Add(IBindable bindable)
        {
            if (bindable == null)
            {
                throw new ArgumentNullException("bindable");
            }

            this.bindables.Add(bindable);
            bindable.Bind();
        }
Ejemplo n.º 4
0
        public static List <TObjectToBind> Bind <TObjectToBind>(IBindable <TObjectToBind> binder, DataTable dt)
        {
            List <TObjectToBind> col = new List <TObjectToBind>();

            foreach (DataRow dr in dt.Rows)
            {
                TObjectToBind item = binder.Bind(dr);
                col.Add(item);
            }
            return(col);
        }
Ejemplo n.º 5
0
        public bool SetUniform(string K, IBindable V)
        {
            int U = Uniform(K);

            if (U == -1)
            {
                return(false);
            }
            V.Bind();
            GL.Uniform1(U, V.GetID);
            return(true);
        }
Ejemplo n.º 6
0
        public static bool TryBind <T> (object target, T controller)
        {
            IBindable <T> bindTarget = target as IBindable <T>;

            if (bindTarget != null)
            {
                bindTarget.Bind(controller);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 7
0
 void Bind(string path, IBindingProperty prop)
 {
     if (m_Disposed)
     {
         return;
     }
     for (int i = 0; i < m_BindingCount; i++)
     {
         IBindable bind = m_Binding[i];
         if (bind.Path == path && bind.IsActive)
         {
             bind.Bind(prop);
         }
     }
 }
Ejemplo n.º 8
0
 public static void Bind <T>(this IBindable <T, IPEndPoint> bindable, IPAddress ipAddress, int port)
 {
     Ensure.ArgumentNotNull(ipAddress, "ipAddress");
     bindable.Bind(new IPEndPoint(ipAddress, port));
 }
Ejemplo n.º 9
0
 public static void Bind <T>(this IBindable <T, IPEndPoint> bindable, string ipAddress, int port)
 {
     Ensure.ArgumentNotNull(ipAddress, "ipAddress");
     bindable.Bind(IPAddress.Parse(ipAddress), port);
 }
Ejemplo n.º 10
0
 public Bind(IBindable asset)
 {
     _asset = asset;
     _asset.Bind();
 }
Ejemplo n.º 11
0
 public BindingContext(IBindable bind)
 {
     Element = bind ?? throw new ArgumentNullException(nameof(bind));
     Element.Bind();
 }
Ejemplo n.º 12
0
 public Bind(IBindable asset)
 {
     _asset = asset;
     _asset.Bind();
 }