Ejemplo n.º 1
0
        public Shader LoadShader(string name, string vert, string frag)
        {
            if (shaderDictionary.ContainsKey(name))
            {
                return(shaderDictionary[name]);
            }
            Shader shdr = new ShaderMain(vert, frag);

            shdr.ApplyShader();
            shdr.SetUniform(0, "material.texture_difuse");
            shdr.SetUniform(1, "material.texture_toon");

            shdr.SetUniform(10, "shadowMap");

            shaderDictionary.Add(name, shdr);

            return(shdr);
        }
Ejemplo n.º 2
0
        static BackgroundSkybox()
        {
            string path = "shaders.";
            string vs   = ResourcesManager.ReadFromInternalResource(path + "Skybox.vsh");
            string fs   = ResourcesManager.ReadFromInternalResource(path + "Skybox.fsh");

            backgroundShader = new ShaderMain(vs, fs);
            backgroundShader.ApplyShader();
            backgroundShader.SetUniform(0, "skybox");
        }
Ejemplo n.º 3
0
        Shader Creator()
        {
            Shader shdr = null;

            try
            {
                shdr = new ShaderMain(rawVertex, rawFragment);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e.Source);
            }

            //binding buffers
            var ubm = UniformBufferManager.GetInstance;
            var ubs = ubm.GetBuffer("skeleton");

            shdr.SetUBO(ubs.BufferIndex, "skeleton");
            var ubsp = ubm.GetBuffer("space");

            shdr.SetUBO(ubsp.BufferIndex, "space");
            var ubl = ubm.GetBuffer("light");

            shdr.SetUBO(ubl.BufferIndex, "light");

            var ubsy = ubm.GetBuffer("system");

            shdr.SetUBO(ubsy.BufferIndex, "system");

            //bind textures
            shdr.ApplyShader();

            shdr.SetUniform((int)TextureType.ShadowMap, "shadowMap");
            shdr.SetUniform((int)TextureType.Diffuse, "material.texture_diffuse");
            shdr.SetUniform((int)TextureType.Toon, "material.texture_toon");
            shdr.SetUniform((int)TextureType.Specular, "material.texture_specular");
            shdr.SetUniform((int)TextureType.Sphere, "material.texture_spere");

            return(shdr);
        }