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);
            }
        }
Example #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;
     }
 }
Example #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);
        }
Example #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();
            //}
        }
Example #7
0
        protected override void Initialize()
        {
            Window.Title = title;

            base.Initialize();

            if (Initialised != null)
            {
                Initialised(this);
            }

            FearLog.Initialise();

            SharpDX.ViewportF viewport = new SharpDX.Viewport(0, 0, (int)DEFAULT_WIDTH, (int)DEFAULT_HEIGHT, 0.0f, 1.0f);
            graphicsDeviceManager.GraphicsDevice.SetViewport(viewport);

            game.Startup(this);
        }
Example #8
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);
            }
        }
Example #9
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);
        }
Example #10
0
        public void ExitGame()
        {
            this.Exit();

            FearLog.Log("Exit Game");
        }