Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public static void StopMethodTimerAndPrintResult(string name)
 {
     if (timers.ContainsKey(name))
     {
         timers[name].Stop();
         FearLog.Log("Time to execute " + name + ";\t" + timers[name].ElapsedMilliseconds + "ms");
     }
 }
 public void UpdateInformation(string key, string value)
 {
     if (information.ContainsKey(key))
     {
         information[key] = value;
     }
     else
     {
         FearLog.Log("Key not found in Information layout. No information updated.", LogPriority.HIGH);
     }
 }
 protected void AddInformation(string key, string value)
 {
     if (information.ContainsKey(key))
     {
         FearLog.Log("Key already present. No information added.", LogPriority.HIGH);
     }
     else
     {
         information[key] = value;
     }
 }
Exemplo n.º 5
0
        private int GetOffsetForTriangleSourceInput(VertexInfoType inputType)
        {
            foreach (Grendgine_Collada_Input_Shared inp in meshData.Triangles[0].Input)
            {
                if (VertexData.MapSemanticStringToVertexInfoType(inp.Semantic.ToString()) == inputType)
                {
                    return(inp.Offset);
                }
            }

            FearLog.Log("Could not find an offset for the inputType " + inputType.ToString(), LogPriority.ALWAYS);
            return(0);
        }
Exemplo n.º 6
0
        protected override void OnExiting(object sender, EventArgs args)
        {
            FearLog.Log("On Exiting.");

            game.Shutdown();

            resourceManager.Shutdown();

            //if (SharpDX.Diagnostics.ObjectTracker.FindActiveObjects().Count > 0)
            //{
            //FearLog.Log("Active Objects; " + SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects());
            //throw new UnleasedObjectsException();
            //}
        }
Exemplo n.º 7
0
        public void StoreInformation(ResourceInformation information)
        {
            List <string> lines = GetFileLines();

            RemoveEntryByName(lines, information.Name);

            List <string> newEntry = CreateFileEntryFromInfo(information);

            lines.InsertRange(2, newEntry);

            try
            {
                File.WriteAllLines(filePath, lines.ToArray());
            }
            catch (Exception e)
            {
                FearLog.Log(e.Message, LogPriority.EXCEPTION);
            }
        }
Exemplo n.º 8
0
        public ResourceDirectory(string rootResourcePath, ResourceFileFactory fileFactory)
        {
            if (!System.IO.Directory.Exists(rootResourcePath))
            {
                FearLog.Log("No Resource Directory Found, Creating One", LogPriority.EXCEPTION);
                System.IO.Directory.CreateDirectory(rootResourcePath);
            }

            resourcesPath = System.IO.Path.Combine(rootResourcePath, directoryName);
            if (!System.IO.Directory.Exists(resourcesPath))
            {
                System.IO.Directory.CreateDirectory(resourcesPath);
            }

            var values = Enum.GetValues(typeof(ResourceType));

            resourceFiles = new Dictionary <ResourceType, ResourceFile>();
            foreach (ResourceType type in values)
            {
                resourceFiles[type] = fileFactory.createResourceFile(type, resourcesPath);
            }

            FearLog.Log("Current Resource Directory; " + rootResourcePath);
        }
Exemplo n.º 9
0
        public void ExitGame()
        {
            this.Exit();

            FearLog.Log("Exit Game");
        }