示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RendererConfiguration config = new RendererConfiguration
            {
                ShadowsEnabled = true, BloomEnabled = true, HDREnabled = true, PBREnabled = true
            };

            mViroView = new ViroViewARCore(this, this);
            SetContentView(mViroView);

            var    intent = Intent;
            string key    = intent.GetStringExtra(IntentProductKey);
            ProductApplicationContext context = new ProductApplicationContext();

            mSelectedProduct = context.GetProductDb().GetProductByName(key);

            View.Inflate(this, Resource.Layout.ar_hud, mViroView);
            mHudGroupView            = FindViewById <View>(Resource.Id.main_hud_layout);
            mHudGroupView.Visibility = ViewStates.Gone;
        }
示例#2
0
        public void OnHitTestFinished(ARHitTestResult[] p0)
        {
            if (p0 == null || p0.Length <= 0)
            {
                return;
            }

            // If we have found intersected AR Hit points, update views as needed, reset miss count.
            ViroViewARCore viewArView = mViroView;
            var            cameraPos  = viewArView.LastCameraPositionRealtime;

            // Grab the closest ar hit target
            float           closestDistance = float.MaxValue;
            ARHitTestResult result          = null;

            for (int i = 0; i < p0.Length; i++)
            {
                ARHitTestResult currentResult = p0[i];

                float distance = currentResult.Position.Distance(cameraPos);
                if (distance < closestDistance && distance > .3 && distance < 5)
                {
                    result          = currentResult;
                    closestDistance = distance;
                }
            }

            // Update the cross hair target location with the closest target.
            if (result != null)
            {
                mCrosshairModel.SetPosition(result.Position);
                mCrosshairModel.SetRotation(result.Rotation);
            }

            // Update State based on hit target
            SetTrackingStatus(result != null ? TrackStatus.SurfaceFound : TrackStatus.FindingSurface);
        }
示例#3
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     mViroView = new ViroViewARCore(this, this);
     SetContentView(mViroView);
 }