public Resource Load(ResourceInformation info)
        {
            EffectCompiler compiler = new EffectCompiler();

            EffectCompilerFlags flags = EffectCompilerFlags.None;

            if (enableDebug)
            {
                flags = EffectCompilerFlags.Debug | EffectCompilerFlags.OptimizationLevel0 | EffectCompilerFlags.SkipOptimization;
            }

            var effectResult = compiler.CompileFromFile(info.Filepath, flags);

            if (effectResult.HasErrors)
            {
                FearLog.Log("ERROR Compiling effect; " + info.Filepath, LogPriority.EXCEPTION);
                foreach (SharpDX.Toolkit.Diagnostics.LogMessage message in effectResult.Logger.Messages)
                {
                    FearLog.Log("\t" + message.Text, LogPriority.EXCEPTION);
                }

                return(new FearMaterial());
            }
            else
            {
                Effect effect = new Effect(device, effectResult.EffectData);
                effect.CurrentTechnique = effect.Techniques[info.GetString("Technique")];

                FearMaterial mat = new FearMaterial(info.Name, effect);
                return(mat);
            }
        }
Exemple #2
0
        private List <string> CreateFileEntryFromInfo(ResourceInformation info)
        {
            List <string> newEntry = new List <string>();

            newEntry.Add("   <" + GetTypeString() + ">");
            foreach (string key in info.InformationKeys)
            {
                newEntry.Add("      <" + key + ">" + info.GetString(key) + "</" + key + ">");
            }
            newEntry.Add("   </" + GetTypeString() + ">");
            return(newEntry);
        }