public MainWindow()
        {
            InitializeComponent();

            this.Loaded  += new RoutedEventHandler(MainWindow_Loaded);
            this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);

            m_HandVirtualiozationExecuter = new HandVirtualiozationExecuter();

            /*
             * IConfigurationManager ConfigurationManager = ConfigurationManagerFactory.CreateDefault();
             * using (var root = new Root("Game1.log"))
             * {
             *  if (ConfigurationManager.ShowConfigDialog(root))
             *  {
             *      RenderWindow window = root.Initialize(true);
             *      ResourceGroupManager.Instance.AddResourceLocation("media", "Folder", true);
             *      SceneManager scene = root.CreateSceneManager(SceneType.Generic);
             *      Camera camera = scene.CreateCamera("cam1");
             *      Viewport viewport = window.AddViewport(camera);
             *      TextureManager.Instance.DefaultMipmapCount = 5;
             *      ResourceGroupManager.Instance.InitializeAllResourceGroups();
             *      Entity penguin = scene.CreateEntity("bob", "penguin.mesh");
             *      SceneNode penguinNode = scene.RootSceneNode.CreateChildSceneNode();
             *      penguinNode.AttachObject(penguin);
             *      camera.Move(new Vector3(0, 0, 300));
             *      camera.LookAt(penguin.BoundingBox.Center);
             *      root.RenderOneFrame();
             *  }
             * }
             */
        }
Exemplo n.º 2
0
        public bool Create(Guid cameraGuid, HandVirtualiozationExecuter executer)
        {
            m_executer = executer;
            int w = 0, h = 0;

            _camera = CLEyeCreateCamera(cameraGuid, ColorMode, Resolution, Framerate);
            if (_camera == IntPtr.Zero)
            {
                return(false);
            }
            bool x = CLEyeCameraGetFrameDimensions(_camera, ref w, ref h);

            if (ColorMode == CLEyeCameraColorMode.CLEYE_COLOR_PROCESSED || ColorMode == CLEyeCameraColorMode.CLEYE_COLOR_RAW)
            {
                uint imageSize = (uint)w * (uint)h * 4;
                // create memory section and map
                _section     = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, 0x04, 0, imageSize, null);
                _map         = MapViewOfFile(_section, 0xF001F, 0, 0, imageSize);
                BitmapSource = Imaging.CreateBitmapSourceFromMemorySection(_section, w, h, PixelFormats.Bgr32, w * 4, 0) as InteropBitmap;
            }
            else
            {
                uint imageSize = (uint)w * (uint)h;
                // create memory section and map
                _section     = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, 0x04, 0, imageSize, null);
                _map         = MapViewOfFile(_section, 0xF001F, 0, 0, imageSize);
                BitmapSource = Imaging.CreateBitmapSourceFromMemorySection(_section, w, h, PixelFormats.Gray8, w, 0) as InteropBitmap;
            }
            // Invoke event
            if (BitmapReady != null)
            {
                BitmapReady(this, null);
            }
            BitmapSource.Invalidate();
            return(true);
        }