示例#1
0
 private void SetFrom(RendererShader source)
 {
     Handle                 = source.Handle;
     SourceHash             = source.SourceHash;
     Compilations           = source.Compilations;
     SharedUniformValues    = source.SharedUniformValues;
     _uniformLocations      = source._uniformLocations;
     _uniformBlockLocations = source._uniformBlockLocations;
 }
        public VertexLayoutBinded BindToShader(RendererShader shader)
        {
            var layout = new VertexLayoutBinded();

            layout._Stride = _Stride;
            foreach (var srcAttr in Attributes)
            {
                var attr = layout.CreateAttributeInstance() as VertexLayoutBindedAttribute;
                srcAttr.CopyTo(attr);
                attr.Index = shader.GetAttribLocation(shader.AttributeNameForField(attr.Name));
                layout.AddAttribute(attr);
            }
            return(layout);
        }
示例#3
0
        public void Reload()
        {
            try
            {
                var sh = new RendererShader();
                foreach (var comp in Compilations)
                {
                    foreach (var src in comp.Sources)
                    {
                        sh.AddSource(src.Path, comp.Type);
                    }
                }

                sh.Compile();
                SetFrom(sh);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }