コード例 #1
0
ファイル: SampleGame.cs プロジェクト: sjb8100/C3DE
 protected override void UnloadContent()
 {
     base.UnloadContent();
     this.leftHandPose.Dispose();
     this.rightHandPose.Dispose();
     this.headPose.Dispose();
     context.Dispose();
     leftHandPose  = null;
     rightHandPose = null;
     headPose      = null;
     context       = null;
 }
コード例 #2
0
ファイル: SampleGame.cs プロジェクト: sjb8100/C3DE
        void DrawPose(Color color, OSVR.ClientKit.IInterface <XnaPose> pose, Vector3 calibrationOffset, Matrix view, Matrix projection)
        {
            var poseState     = pose.GetState();
            var yRotation     = Microsoft.Xna.Framework.Quaternion.CreateFromYawPitchRoll(rotationY, 0, 0);
            var rotation      = yRotation * poseState.Value.Rotation;
            var leftHandWorld =
                Matrix.CreateFromQuaternion(rotation)
                * Matrix.CreateTranslation(position + Vector3.Transform(calibrationOffset + poseState.Value.Position, yRotation));

            axes.Draw(
                size: .1f,
                color: color,
                view: view,
                world: leftHandWorld,
                projection: projection,
                graphicsDevice: GraphicsDevice);
        }
コード例 #3
0
ファイル: SampleGame.cs プロジェクト: sjb8100/C3DE
        protected override void Initialize()
        {
            context = new ClientContext("osvr.monogame.Sample");

            leftHandPose  = new XnaPoseInterface(context.GetPoseInterface("/me/hands/left"));
            rightHandPose = new XnaPoseInterface(context.GetPoseInterface("/me/hands/right"));
            leftEye2D     = new XnaPosition2DInterface(context.GetEyeTracker2DInterface("/me/eyes/left"));

            // You should always be using "/me/head" for HMD orientation tracking,
            // but we're mocking HMD head tracking with either hand tracking (e.g. Hydra controllers)
            // or with mouselook. You can cycle through them with the O key.
            headPose = new XnaPoseInterface(context.GetPoseInterface("/me/head"));

            // Mouselook emulation of the head-tracking orientation interface
            mouselook = new MouselookInterface(GraphicsDevice.Viewport);

            vrHead = new VRHead(graphics, context, headPose);
            base.Initialize();
        }