예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.WorldSpace.AddDrawableGroup(new ControllerDrawableGroup(1, "Controller", this.RenderContext));
            this.KeyPreview = true;
            //BasicGrid grid=new BasicGrid();
            //grid.Load(RenderContext);
            Controller = new TransformController(this.RenderContext, this.ScreenContext.HitChekcer);
            this.WorldSpace.AddResource(Controller, "Controller");

            //If (!String.IsNullOrEmpty(Settings.Default.InitLoadModel))
            //{
            //    MMDModel model = MMDModelWithPhysics.OpenLoad(Settings.Default.InitLoadModel, RenderContext);
            //    WorldSpace.AddResource(model);
            //    if (!String.IsNullOrEmpty(Settings.Default.InitLoadMotion))
            //    {
            //        model.MotionManager.ApplyMotion(model.MotionManager.AddMotionFromFile(Settings.Default.InitLoadMotion, false));
            //    }
            //}
            //World spaces that need to be updated and added to UpdateRequireWorlds must be b。
            //PlaneBoard bill = new PlaneBoard(RenderContext, resourceView, new Vector2(800, 800));
            //WorldSpace.AddResource(bill);
            //Bill.Transformer.Position = new Vector3(0, 0, 20);

            //format = SpriteBatch.CreateTextformat("Meiriyo", 30, FontWeight.ExtraBold);
            //brush = SpriteBatch.CreateRadialGradientBrush(g,
            //    new RadialGradientBrushProperties() {CenterPoint = new PointF(100,100),GradientOriginOffset = new PointF(0,0),HorizontalRadius = 100f,VerticalRadius = 200f}).Brush;
            //brush = SpriteBatch.CreateSolidColorBrush(Color.Aquamarine);

            this.ScreenContext.CameraMotionProvider = new BasicCameraControllerMotionProvider(this, this);

            BasicGrid gird = new BasicGrid {
                Visibility = true
            };

            gird.Load(this.RenderContext);

            this.ScreenContext.WorldSpace.AddResource(gird);
            //be sure to add child window into the world of texture。
            ControlForm controlForm = new ControlForm(this.RenderContext, this.ScreenContext, null)
            {
                Size          = this.Size,
                StartPosition = this.StartPosition,
            };

            controlForm.Show(this);

            //OpenFileDialog ofd = new OpenFileDialog();
            //If (ofd.ShowDialog() == DialogResult.OK)
            //{
            //    VMDCameraMotionProvider camMotion=VMDCameraMotionProvider.OpenFile(ofd.FileName);
            //    ScreenContext.CameraMotionProvider = camMotion;
            //    camMotion.Start();
            //}
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            leftTop.Initialize();
            BasicGrid grid = new BasicGrid();

            grid.Load(leftTop.RenderContext);
            leftTop.WorldSpace.AddResource(grid);
            rightTop.Initialize(leftTop.RenderContext);
            rightBottom.Initialize(leftTop.RenderContext);
            leftBottom.Initialize(leftTop.RenderContext);
            rightTop.WorldSpace    = leftTop.WorldSpace;
            rightBottom.WorldSpace = leftTop.WorldSpace;
            leftBottom.WorldSpace  = leftTop.WorldSpace;
            leftTop.ScreenContext.CameraMotionProvider     = new BasicCameraControllerMotionProvider(leftTop, this);
            rightTop.ScreenContext.CameraMotionProvider    = new SideCameraMotionProvider(leftTop.ScreenContext.CameraMotionProvider, Quaternion.RotationAxis(new Vector3(0, 1, 0), (float)(Math.PI)));
            leftBottom.ScreenContext.CameraMotionProvider  = new SideCameraMotionProvider(leftTop.ScreenContext.CameraMotionProvider, Quaternion.RotationAxis(new Vector3(0, 1, 0), (float)(Math.PI / 2)));
            rightBottom.ScreenContext.CameraMotionProvider = new SideCameraMotionProvider(leftTop.ScreenContext.CameraMotionProvider, Quaternion.RotationAxis(new Vector3(0, 1, 0), -(float)(Math.PI / 2)));
            ControlForm form = new ControlForm(leftTop.RenderContext, leftTop.ScreenContext, leftTop.ScreenContext, null);

            form.Show();
        }
예제 #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            WorldSpace.AddDrawableGroup(new ControllerDrawableGroup(1, "Controller", RenderContext));
            KeyPreview = true;
            KinectDeviceManager dev = null;

            //BasicGrid grid=new BasicGrid();
            //grid.Load(RenderContext);
            Controller = new TransformController(RenderContext, ScreenContext.HitChekcer);
            WorldSpace.AddResource(Controller, "Controller");
            //if (!String.IsNullOrEmpty(Settings.Default.InitLoadModel))
            //{
            //    MMDModel model = MMDModelWithPhysics.OpenLoad(Settings.Default.InitLoadModel, RenderContext);
            //    WorldSpace.AddResource(model);
            //    if (!String.IsNullOrEmpty(Settings.Default.InitLoadMotion))
            //    {
            //        model.MotionManager.ApplyMotion(model.MotionManager.AddMotionFromFile(Settings.Default.InitLoadMotion, false));
            //    }
            //}
            //更新する必要のあるワールドスペースは、UpdateRequireWorldsに追加しなけれbなりません。
            //PlaneBoard bill = new PlaneBoard(RenderContext, resourceView, new Vector2(800, 800));
            //WorldSpace.AddResource(bill);
            //bill.Transformer.Position = new Vector3(0, 0, 20);
            #region Kinectテストコード

#if KINECT
            OpenNIManager.Initialize();
            dev = OpenNIManager.getDevice();

            ColTexture = new ColorTexture(RenderContext, dev);
            tex2       = new DepthTexture(RenderContext, 1000, dev);
#endif

            #endregion

            //format = SpriteBatch.CreateTextformat("Meiriyo", 30, FontWeight.ExtraBold);


            //brush = SpriteBatch.CreateRadialGradientBrush(g,
            //    new RadialGradientBrushProperties() {CenterPoint = new PointF(100,100),GradientOriginOffset = new PointF(0,0),HorizontalRadius = 100f,VerticalRadius = 200f}).Brush;
            //brush = SpriteBatch.CreateSolidColorBrush(Color.Aquamarine);
            ScreenContext.CameraMotionProvider = new BasicCameraControllerMotionProvider(this, this);
            BasicGrid gird = new BasicGrid();
            gird.Visibility = true;
            gird.Load(RenderContext);

            ScreenContext.WorldSpace.AddResource(gird);
            //textureの世界には、childウィンドウに追加からできるようにしてあります。
            ControlForm controlForm = new ControlForm(RenderContext, ScreenContext, null, dev);
            controlForm.Show(this);

            //OpenFileDialog ofd = new OpenFileDialog();
            //if (ofd.ShowDialog() == DialogResult.OK)
            //{
            //    VMDCameraMotionProvider camMotion=VMDCameraMotionProvider.OpenFile(ofd.FileName);
            //    ScreenContext.CameraMotionProvider = camMotion;
            //    camMotion.Start();
            //}


            #region Kinectテストコード
#if KINECT
            PlaneBoard bill = new PlaneBoard(RenderContext, ColTexture.TextureResourceView);
            bill.Transformer.Position = new Vector3(0, 0, 50);
            //bill.Transformer.Rotation *= Quaternion.RotationAxis(new Vector3(0,1,0),(float) (Math.PI));
            form.WorldSpace.AddResource(bill);
            form.WorldSpace.AddDynamicTexture(ColTexture);
#endif

            #endregion
        }