Beispiel #1
0
        private void OnRenderCreate()
        {
            // Create the base ARScene
            mScene = new ARScene();
            mScene.SetListener(this);
            mViroView.Scene = mScene;

            // Create an ARImageTarget for the Tesla logo
            var teslaLogoTargetBmp = GetBitmapFromAssets("logo.png");
            var teslaTarget        = new ARImageTarget(teslaLogoTargetBmp, ARImageTarget.Orientation.Up, 0.188f);

            mScene.AddARImageTarget(teslaTarget);

            // Build the Tesla car Node and add it to the Scene. Set it to invisible: it will be made
            // visible when the ARImageTarget is found.
            var teslaNode = new Node();

            InitCarModel(teslaNode);
            InitColorPickerModels(teslaNode);
            InitSceneLights(teslaNode);
            teslaNode.Visible = false;
            mScene.RootNode.AddChildNode(teslaNode);

            // Link the Node with the ARImageTarget, such that when the image target is
            // found, we'll render the Node.
            LinkTargetWithNode(teslaTarget, teslaNode);
        }
Beispiel #2
0
        private void DisplayScene()
        {
            mScene = new ARScene();
            // Add a listener to the scene so we can update the 'AR Initialized' text.
            mScene.SetListener(new ARSceneListener(this, mViroView));
            // Add a light to the scene so our models show up
            mScene.RootNode.AddLight(new AmbientLight(Color.White, 1000f));
            mViroView.Scene = mScene;

            var view = View.Inflate(this, Resource.Layout.viro_view_ar_hit_test_hud, mViroView);

            view.FindViewById <ImageButton>(Resource.Id.imageButton).Click += delegate { showPopup(); };
        }
Beispiel #3
0
        private void DisplayScene()
        {
            // Create the 3D AR scene, and display the point cloud
            mScene = new ARScene();
            mScene.DisplayPointCloud(true);

            // Create a TrackedPlanesController to visually display identified planes.
            var controller = new TrackedPlanesController(this, mViroView);

            // Spawn a 3D Droid on the position where the user has clicked on a tracked plane.
            controller.AddOnPlaneClickListener(new ClickListener2(this));

            mScene.SetListener(controller);

            // Add some lights to the scene; this will give the Android's some nice illumination.
            var rootNode       = mScene.RootNode;
            var lightPositions = new List <Vector>
            {
                new Vector(-10, 10, 1), new Vector(10, 10, 1)
            };

            const float intensity   = 300;
            var         lightColors = new List <Color> {
                Color.White, Color.White
            };

            for (var i = 0; i < lightPositions.Count; i++)
            {
                var light = new OmniLight
                {
                    Color    = lightColors[i],
                    Position = lightPositions[i],
                    AttenuationStartDistance = 20,
                    AttenuationEndDistance   = 30,
                    Intensity = intensity
                };
                rootNode.AddLight(light);
            }

            //Add an HDR environment map to give the Android's more interesting ambient lighting.
            var environment =
                Texture.LoadRadianceHDRTexture(Android.Net.Uri.Parse("file:///android_asset/ibl_newport_loft.hdr"));

            mScene.LightingEnvironment = environment;

            mViroView.Scene = mScene;
        }
Beispiel #4
0
        private void DisplayScene()
        {
            // Create the ARScene within which to load our ProductAR Experience
            mScene     = new ARScene();
            mMainLight = new AmbientLight(Color.ParseColor("#606060"), 400);
            mMainLight.InfluenceBitMask = 3;
            mScene.RootNode.AddLight(mMainLight);

            // Setup our 3D and HUD controls
            InitArCrosshair();
            Init3DModelProduct();
            InitArHud();

            // Start our tracking UI when the scene is ready to be tracked
            mScene.SetListener(this);

            // Finally set the arScene on the renderer
            mViroView.Scene = mScene;
        }
Beispiel #5
0
 private void TrackImageNodeTargets()
 {
     mScene.SetListener(this);
 }