/// <summary>
        /// Initializes a new instance of the <see cref="SWFWindowImplementation"/> class.
        /// </summary>
        /// <param name="pp">The presentation parameters of the window</param>
        /// <param name="title">The title of the window</param>
        /// <param name="isPrimaryWindow">True if the window is primary, false otherwise. Primary windows can be run inside a window host. Secondary windows
        /// can be added to existing GUI applications.</param>
        /// <exception cref="Tesla.Core.TeslaException">Thrown if there was an error creating the underlying control.</exception>
        public SWFWindowImplementation(PresentationParameters pp, String title, bool isPrimaryWindow)
        {
            _preferredWidth  = pp.BackBufferWidth;
            _preferredHeight = pp.BackBufferHeight;
            _isPrimaryWindow = isPrimaryWindow;
            _isDisposed      = false;
            _isFullScreen    = false;

            if (isPrimaryWindow)
            {
                RenderForm f = new RenderForm(title, pp.BackBufferWidth, pp.BackBufferHeight);
                f.Resume  += new EventHandler(OnResume);
                f.Suspend += new EventHandler(OnSuspend);
                f.ApplicationActivated   += new EventHandler(OnActivated);
                f.ApplicationDeactivated += new EventHandler(OnDeactivated);
                _control = f;
            }
            else
            {
                _control = new RenderControl(title, pp.BackBufferWidth, pp.BackBufferHeight);
            }
            _control.UserResized += new EventHandler(OnClientSizeChanged);

            bool fullScreen = pp.IsFullScreen;

            pp.IsFullScreen = false;
            _swapChain      = new SwapChain(_control.Handle, pp);
            if (fullScreen)
            {
                IsFullScreen = fullScreen;
            }
        }
        public bool TryCreateControl(string assemblyName, IEnumerable<string> dependencies,
            out IRenderControl control)
        {
            if (!ReflectionHelper.TryCreateControl(assemblyName, dependencies, out control))
            {
                return false;
            }

            return control is Control;
        }
Exemple #3
0
        public bool TryCreateControl(string assemblyName, IEnumerable <string> dependencies,
                                     out IRenderControl control)
        {
            if (!ReflectionHelper.TryCreateControl(assemblyName, dependencies, out control))
            {
                return(false);
            }

            return(control is Control);
        }
Exemple #4
0
        public void Initialize(IRenderControl control, IRenderer renderer)
        {
            this.zoom = new Projection(control.ClientRectangle);

            this.context = new RenderContext(zoom, ColorManager.Default());

            this.renderer         = renderer;
            this.renderer.Context = context;

            this.control = control;
            this.control.Initialize();
            this.control.Renderer = renderer;
        }
        public void Initialize(IRenderControl control, IRenderer renderer)
        {
            this.zoom = new Projection(control.ClientRectangle);

            this.context = new RenderContext(zoom, ColorManager.Default());

            this.renderer = renderer;
            this.renderer.Context = context;

            this.control = control;
            this.control.Initialize();
            this.control.Renderer = renderer;
        }
Exemple #6
0
        static IModRef <BackendConfiguration> SetScene(IRenderControl win)
        {
            var view        = CameraView.LookAt(new V3d(2.0, 2.0, 2.0), V3d.Zero, V3d.OOI);
            var perspective =
                win.Sizes.Select(s => FrustumModule.perspective(60.0, 0.1, 10.0, ((float)s.X / (float)s.Y)));


            var viewTrafo = DefaultCameraController.control(win.Mouse, win.Keyboard, win.Time, view);

            var index     = new[] { 0, 1, 2, 0, 2, 3 };
            var positions = new[] { new V3f(-1, -1, 0), new V3f(1, -1, 0), new V3f(1, 1, 0), new V3f(-1, 1, 0) };

            var attributes = new SymbolDict <Array>()
            {
                { DefaultSemantic.Positions, positions }
            };

            var quad = new IndexedGeometry(IndexedGeometryMode.TriangleList,
                                           (Array)index,
                                           attributes,
                                           new SymbolDict <Object>());

            var quadSg = quad.ToSg();

            var whiteShader = Effects.ConstantColor.Effect(C4f.White);

            var trafo = Effects.Trafo.Effect;

            var sg =
                quadSg
                .WithEffects(new[] { trafo, whiteShader })
                .ViewTrafo(viewTrafo.Select(t => t.ViewTrafo))
                .ProjTrafo(perspective.Select(t => t.ProjTrafo()));

            var config = new ModRef <BackendConfiguration>(BackendConfigurationModule.UnmanagedOptimized);
            var task   = ((Aardvark.Rendering.GL.Runtime)win.Runtime).CompileRender(win.FramebufferSignature, config, Aardvark.SceneGraph.Semantics.RenderObjectSemantics.Semantic.renderObjects(sg));

            win.RenderTask = DefaultOverlays.withStatistics(task);

            return(config);
        }
Exemple #7
0
        public Graph(MainWindow window)
        {
            myGui         = window;
            renderManager = new RenderManager();
            control       = new TriangleNet.Rendering.GDI.RenderControl();
            Options       = new ConstraintOptions();
            Options.ConformingDelaunay = false;
            Options.SegmentSplitting   = 0;


            if (control != null)
            {
                InitializeRenderControl((Control)control);
                renderManager.Initialize(control);
                control.Refresh();
            }
            else
            {
                MessageBox.Show("Error", "Failed to initialize renderer.");
            }
        }
        public static bool TryCreateControl(string assemblyName, IEnumerable<string> dependencies,
            string className, out IRenderControl control)
        {
            control = null;

            if (!FilesExist(assemblyName, dependencies))
            {
                return false;
            }

            assemblyName = Path.GetFileNameWithoutExtension(assemblyName);

            // Try create render control instance.
            try
            {
                // Load the assembly into the current application domain.
                var assembly = Assembly.Load(assemblyName);

                // Get all types implementing the IRenderControl interface.
                var type = typeof(IRenderControl);
                var matches = assembly.GetTypes().Where(s => type.IsAssignableFrom(s));

                var match = string.IsNullOrEmpty(className) ? matches.FirstOrDefault()
                    : matches.Where(s => s.Name == className).FirstOrDefault();

                if (match != null)
                {
                    // Create an instance.
                    control = (IRenderControl)Activator.CreateInstance(match);
                }
            }
            catch (Exception)
            {
                return false;
            }

            // Return true if render control was successfully created.
            return (control != null);
        }
Exemple #9
0
        public static bool TryCreateControl(string assemblyName, IEnumerable <string> dependencies,
                                            string className, out IRenderControl control)
        {
            control = null;

            if (!FilesExist(assemblyName, dependencies))
            {
                return(false);
            }

            assemblyName = Path.GetFileNameWithoutExtension(assemblyName);

            // Try create render control instance.
            try
            {
                // Load the assembly into the current application domain.
                var assembly = Assembly.Load(assemblyName);

                // Get all types implementing the IRenderControl interface.
                var type    = typeof(IRenderControl);
                var matches = assembly.GetTypes().Where(s => type.IsAssignableFrom(s));

                var match = string.IsNullOrEmpty(className) ? matches.FirstOrDefault()
                    : matches.Where(s => s.Name == className).FirstOrDefault();

                if (match != null)
                {
                    // Create an instance.
                    control = (IRenderControl)Activator.CreateInstance(match);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            // Return true if render control was successfully created.
            return(control != null);
        }
 public static bool TryCreateControl(string assemblyName, IEnumerable<string> dependencies,
     out IRenderControl control)
 {
     return TryCreateControl(assemblyName, dependencies, null, out control);
 }
Exemple #11
0
 public void Initialize(IRenderControl control)
 {
     Initialize(control, new LayerRenderer());
 }
Exemple #12
0
 public RenderManager(IRenderControl control, IRenderer renderer)
 {
     Initialize(control, renderer);
 }
Exemple #13
0
 public RenderManager(IRenderControl control)
 {
     Initialize(control);
 }
Exemple #14
0
 public static bool TryCreateControl(string assemblyName, IEnumerable <string> dependencies,
                                     out IRenderControl control)
 {
     return(TryCreateControl(assemblyName, dependencies, null, out control));
 }
Exemple #15
0
 public ImageRenderer(IRenderControl control)
 {
     _control = control;
 }
 public RenderManager(IRenderControl control)
 {
     Initialize(control);
 }
 public RenderManager(IRenderControl control, IRenderer renderer)
 {
     Initialize(control, renderer);
 }
 public void Initialize(IRenderControl control)
 {
     Initialize(control, new LayerRenderer());
 }