示例#1
0
 public ShaderFile(VisualContext visualContext, ISynchronizeInvoke syncObject)
 {
     this.visualContext = visualContext;
     //establish watcher
     shaderWatcher.Changed += (object sender, FileSystemEventArgs e) => LoadShader(e.FullPath);
     shaderWatcher.SynchronizingObject = syncObject;
 }
 public static DemoModel Create(ISynchronizeInvoke syncObject)
 {
     var visualContext = new VisualContext();
     var shaders = new Shaders(visualContext, () => new ShaderFile(visualContext, syncObject));
     var textures = new Textures(visualContext);
     return new DemoModel(visualContext, shaders, textures, true);
 }
示例#3
0
        public DemoModel(VisualContext visualContext, IShaders shaders, ITextures textures, bool isLooping)
        {
            uniforms = new Uniforms();
            ShaderKeyframes = new ShaderKeyframes();
            TimeSource = new DemoTimeSource(isLooping);

            this.visualContext = visualContext;
            Shaders = shaders;
            Textures = textures;
        }
示例#4
0
        private MyApplication()
        {
            gameWindow.KeyDown += GameWindow_KeyDown;
            gameWindow.RenderFrame += game_RenderFrame;
            visualContext = new VisualContext();
            var textures = new Textures(visualContext);
            var shaders = new Shaders(visualContext, NewShaderFile);
            demo = new DemoModel(visualContext, shaders, textures, false);
            demo.TimeSource.OnTimeFinished += () => gameWindow.Close();

            var arguments = Environment.GetCommandLineArgs();
            if (3 > arguments.Length)
            {
                MessageBox.Show("DemoRecorder <configfile> <saveDirectory> [<resX> <resY> <frameRate>]"
                    + Environment.NewLine
                    + " Please give the demo config file name as application parameter followed by the render buffer resolution.");
                gameWindow.Close();
            }
            bufferWidth = gameWindow.Width;
            bufferHeight = gameWindow.Height;
            try
            {
                bufferWidth = int.Parse(arguments.ElementAt(3));
                bufferHeight = int.Parse(arguments.ElementAt(4));
            }
            catch
            {
                bufferWidth = gameWindow.Width;
                bufferHeight = gameWindow.Height;
            }
            try
            {
                frameRate = int.Parse(arguments.ElementAt(5));
            }
            catch
            {
                frameRate = 25;
            }
            try
            {
                DemoLoader.LoadFromFile(demo, arguments.ElementAt(1));
                saveDirectory = Directory.CreateDirectory(arguments.ElementAt(2)).FullName;
                saveDirectory += Path.DirectorySeparatorChar;
                saveDirectory += DateTime.Now.ToString("yyyyMMdd HHmmss");
                saveDirectory += Path.DirectorySeparatorChar;
                Directory.CreateDirectory(saveDirectory);
                fileNumber = 0;
            }
            catch (Exception e)
            {
                MessageBox.Show("Error loading demo '" + arguments.ElementAt(1) + '"'
                    + Environment.NewLine + e.Message);
                gameWindow.Close();
            }
        }
示例#5
0
        private MyApplication()
        {
            gameWindow.Load += GameWindow_Load;
            gameWindow.KeyDown += GameWindow_KeyDown;
            gameWindow.RenderFrame += game_RenderFrame;
            visualContext = new VisualContext();
            var textures = new Textures(visualContext);
            var shaders = new Shaders(visualContext, NewShaderFile);
            demo = new DemoModel(visualContext, shaders, textures, false);
            demo.TimeSource.OnTimeFinished += () => gameWindow.Close();

            var arguments = Environment.GetCommandLineArgs();
            if (1 == arguments.Length)
            {
                MessageBox.Show("DemoPlayer <configfile> [<resX> <resY>]"
                    + Environment.NewLine
                    + " Please give the demo config file name you wish to play as application parameter followed by the render buffer resolution.");
                gameWindow.Close();
            }
            bufferWidth = gameWindow.Width;
            bufferHeight = gameWindow.Height;
            try
            {
                bufferWidth = int.Parse(arguments.ElementAt(2));
                bufferHeight = int.Parse(arguments.ElementAt(3));
            }
            catch
            {
                bufferWidth = gameWindow.Width;
                bufferHeight = gameWindow.Height;
            }
            try
            {
                DemoLoader.LoadFromFile(demo, arguments.ElementAt(1));
            }
            catch (Exception e)
            {
                MessageBox.Show("Error loading demo '" + arguments.ElementAt(1) + '"'
                    + Environment.NewLine + e.Message);
                gameWindow.Close();
            }
        }
示例#6
0
 public ShaderFile(VisualContext visualContext)
 {
     this.visualContext = visualContext;
 }
示例#7
0
 public void Dispose()
 {
     visual = null;
     shaderCreator = null;
 }
示例#8
0
 public Shaders(VisualContext visual, ShaderFileCreator shaderCreator)
 {
     this.visual = visual;
     this.shaderCreator = shaderCreator;
 }