Beispiel #1
0
        private void OnHandleCreated(WinFormsD3DControl win)
        {
            Window = new GameWindow(win, input);
            game   = new D3DEngine(Window, Context, notify);

            var includes = new System.Collections.Generic.Dictionary <string, IIncludeResourse>();

            var sdx = typeof(GraphicsDevice).Assembly;
            var app = typeof(Scene).Assembly;

            includes.Add("Game", new IncludeResourse(sdx, "Game", "D3DLab.SDX.Engine.Rendering.Shaders.Game.hlsl"));
            includes.Add("Light", new IncludeResourse(sdx, "Light", "D3DLab.SDX.Engine.Rendering.Shaders.Light.hlsl"));
            includes.Add("Math", new IncludeResourse(sdx, "Math", "D3DLab.SDX.Engine.Rendering.Shaders.Math.hlsl"));
            includes.Add("Common", new IncludeResourse(app, "Common", "D3DLab.Wpf.Engine.App.D3D.Animation.Shaders.Common.hlsl"));

            game.Graphics.Device.Compilator.AddInclude(new D3DLab.SDX.Engine.Shader.D3DIncludeAdapter(includes));

            game.SetOctree(new OctreeImp(Context, BoundingBox.Create(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000)), 5));
            game.Initialize += Initializing;
            game.Run(notify);

            // Initializing();

            RenderStarted();
        }
Beispiel #2
0
 protected void OnHandleCreated(WinFormsD3DControl win)
 {
     lock (loker) {
         input   = CreateInputObserver(win, overlay);
         Surface = new WpfWindows(win, host, input);
         engine  = RenderEngine.Create(Surface, Surface.InputManager, Context, notify);
         engine.Run(notify);
     }
     SceneInitialization(Context, engine, engine.CameraTag);
 }
Beispiel #3
0
        public GameWindow(WinFormsD3DControl win, CurrentInputObserver input)
        {
            this.win     = win;
            Width        = (float)Application.Current.MainWindow.Width;
            Height       = (float)Application.Current.MainWindow.Height;
            InputManager = new InputManager(input);

            //win.Resize += OnResize;
            Application.Current.MainWindow.SizeChanged += OnSizeChanged;
        }
Beispiel #4
0
        public void SurfaceCreated(WinFormsD3DControl obj)
        {
            if (Scene != null)
            {
                Scene.ReCreate(obj);
                return;
            }

            Scene = new WFScene(host, overlay, context, notificator);
            //Scene.Init(obj);
            //Scene.InitContext();
        }
Beispiel #5
0
        public WpfWindows(WinFormsD3DControl control, WindowsFormsHost host, DefaultInputObserver input)
        {
            InputManager         = new InputManager(input);
            this.control         = control;
            this.control.Resize += OnControlResized;
            this.control.Paint  += OnControlPaint;
            host.SizeChanged    += OnHostSizeChanged;

            var width  = (float)control.Width;
            var height = (float)control.Height;

            Size = new SurfaceSize(width, height);
        }
Beispiel #6
0
        internal void ReCreate(WinFormsD3DControl obj)
        {
            base.Dispose();

            foreach (var com in Context.GetComponentManager().GetComponents <D3DRenderComponent>())
            {
                com.ClearBuffers();
            }

            foreach (var sys in Context.GetSystemManager().GetSystems <RenderSystem>())
            {
                sys.Init(engine.Graphics);
            }

            OnHandleCreated(obj);
        }
Beispiel #7
0
 protected override DefaultInputObserver CreateInputObserver(WinFormsD3DControl win, FrameworkElement overlay)
 {
     publisher = new WinFormInputPublisher(win);
     //publisher = new WPFInputPublisher(overlay);
     return(new ViewerInputObserver(overlay, publisher, new EmptyHandler()));
 }
Beispiel #8
0
 protected abstract DefaultInputObserver CreateInputObserver(WinFormsD3DControl win, FrameworkElement overlay);