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 OnRenderCreate()
        {
            // Create the base ARScene
            mScene = new ARScene();

            // Create an ARImageTarget out of the Black Panther poster
            Bitmap blackPantherPoster = getBitmapFromAssets("logo.jpg");

            mImageTarget = new ARImageTarget(blackPantherPoster, ARImageTarget.Orientation.Up, 0.188f);
            mScene.AddARImageTarget(mImageTarget);

            // Create a Node containing the Black Panther model
            mBlackPantherNode = initBlackPantherNode();
            mBlackPantherNode.AddChildNode(initLightingNode());
            mScene.RootNode.AddChildNode(mBlackPantherNode);

            mViroView.Scene = mScene;
            TrackImageNodeTargets();
        }
Beispiel #3
0
        /*
         * Link the given ARImageTarget with the provided Node. When the ARImageTarget is
         * found in the scene (by onAnchorFound below), the Node will be made visible and
         * the target's transformations will be applied to the Node, thereby rendering the
         * Node over the target.
         */
        private void LinkTargetWithNode(ARImageTarget imageToDetect, Node nodeToRender)
        {
            var key = imageToDetect.Id;

            mTargetedNodesMap.Add(key, new KeyValuePair <ARImageTarget, Node>(imageToDetect, nodeToRender));
        }