Пример #1
0
        public Effect(ShaderSection effect)
        {
            this.device = GlobalRenderSettings.Instance.Device;

            this.effect    = effect;
            this.paramData = effect.FindChild <PramChunk>();

            this.Shaders = new List <ShaderInfo>();
            List <ShaderChunk> shaderChunks = effect.GetChildrenOfType <ShaderChunk>();

            foreach (ShaderChunk chunk in shaderChunks)
            {
                List <FileChunk> files = chunk.GetChildrenOfType <FileChunk>();
                foreach (FileChunk file in files)
                {
                    if (file.Name.EndsWith("vpo"))
                    {
                        var shaderInfo = new VertexShaderInfo(file);
                        this.Shaders.Add(shaderInfo);
                        this.VertexShaderInfo = shaderInfo;
                        this.VertexShader     = shaderInfo.Shader;
                    }
                    else
                    {
                        var shaderInfo = new PixelShaderInfo(file);
                        this.Shaders.Add(shaderInfo);
                        this.PixelShaderInfo = shaderInfo;
                        this.PixelShader     = shaderInfo.Shader;
                    }
                }
            }

            this.Path = effect.ResourcePath;
            this.Name = System.IO.Path.GetFileNameWithoutExtension(this.Path);

            InitVertexConstantSetters();
            InitPixelConstantSetters();
        }
Пример #2
0
        public Effect(ShaderSection effect)
        {
            this.device = GlobalRenderSettings.Instance.Device;

            this.effect = effect;
            this.paramData = effect.FindChild<PramChunk>();

            this.Shaders = new List<ShaderInfo>();
            List<ShaderChunk> shaderChunks = effect.GetChildrenOfType<ShaderChunk>();
            foreach (ShaderChunk chunk in shaderChunks)
            {
                List<FileChunk> files = chunk.GetChildrenOfType<FileChunk>();
                foreach (FileChunk file in files)
                {
                    if (file.Name.EndsWith("vpo"))
                    {
                        var shaderInfo = new VertexShaderInfo(file);
                        this.Shaders.Add(shaderInfo);
                        this.VertexShaderInfo = shaderInfo;
                        this.VertexShader = shaderInfo.Shader;
                    }
                    else
                    {
                        var shaderInfo = new PixelShaderInfo(file);
                        this.Shaders.Add(shaderInfo);
                        this.PixelShaderInfo = shaderInfo;
                        this.PixelShader = shaderInfo.Shader;
                    }
                }
            }

            this.Path = effect.ResourcePath;
            this.Name = System.IO.Path.GetFileNameWithoutExtension(this.Path);

            InitVertexConstantSetters();
            InitPixelConstantSetters();
        }