예제 #1
0
 protected override void InitializeAR()
 {
     arCore = scene.CreateComponent <ARCoreComponent>();
     arCore.ARFrameUpdated  += OnARFrameUpdated;
     arCore.ConfigRequested += OnConfigRequested;
     arCore.Run();
 }
예제 #2
0
파일: MyApp.Droid.cs 프로젝트: elix22/urho
 void SetupAR()
 {
     ArCore = Scene.CreateComponent <ARCoreComponent>();
     ArCore.ARFrameUpdated  += OnARFrameUpdated;
     ArCore.ConfigRequested += ArCore_ConfigRequested;
     ArCore.Run();
 }
예제 #3
0
        protected override void Start()
        {
            // 3d scene with octree and ambient light
            var scene  = new Scene(Context);
            var octree = scene.CreateComponent <Octree>();

            zone = scene.CreateComponent <Zone>();
            zone.AmbientColor = new Color(1, 1, 1) * 0.2f;

            // Camera
            var cameraNode = scene.CreateChild(name: "Camera");
            var camera     = cameraNode.CreateComponent <Urho.Camera>();

            // Light
            var lightNode = cameraNode.CreateChild();

            lightNode.SetDirection(new Vector3(1f, -1.0f, 1f));
            var light = lightNode.CreateComponent <Light>();

            light.Range             = 10;
            light.LightType         = LightType.Directional;
            light.CastShadows       = true;
            Renderer.ShadowMapSize *= 4;

            // Viewport
            viewport = new Viewport(Context, scene, camera, null);
            Renderer.SetViewport(0, viewport);

            // ARCore component
            ArCore = scene.CreateComponent <ARCoreComponent>();
            ArCore.ARFrameUpdated  += OnARFrameUpdated;
            ArCore.ConfigRequested += ArCore_ConfigRequested;
            ArCore.Run();

            // Mutant
            mutantNode          = scene.CreateChild();
            mutantNode.Position = new Vector3(0, -0.5f, 0.5f); // 50cm Y, 50cm Z
            mutantNode.SetScale(0.3f);
            var model = mutantNode.CreateComponent <AnimatedModel>();

            model.CastShadows = true;
            model.Model       = ResourceCache.GetModel("Models/Mutant.mdl");
            model.Material    = ResourceCache.GetMaterial("Materials/mutant_M.xml");
            var ani = mutantNode.CreateComponent <AnimationController>();

            ani.Play("Animations/Mutant_HipHop1.ani", 0, true, 1f);

            fps = new MonoDebugHud(this);
            fps.Show(Color.Blue, 20);

            // Add some post-processing (also, see CorrectGamma())
            viewport.RenderPath.Append(CoreAssets.PostProcess.FXAA2);

            Input.TouchBegin += OnTouchBegin;
            Input.TouchEnd   += OnTouchEnd;
        }
예제 #4
0
        protected override void Start()
        {
            var scene  = new Scene(Context);
            var octree = scene.CreateComponent <Octree>();

            var cameraNode = scene.CreateChild(name: "Camera");
            var camera     = cameraNode.CreateComponent <Urho.Camera>();

            zone = scene.CreateComponent <Zone>();
            zone.AmbientColor = new Color(1, 1, 1) * 0.2f;

            var lightNode = cameraNode.CreateChild();

            lightNode.SetDirection(new Vector3(1f, -1.0f, 1f));
            var light = lightNode.CreateComponent <Light>();

            light.Range             = 10;
            light.LightType         = LightType.Directional;
            light.CastShadows       = true;
            Renderer.ShadowMapSize *= 4;

            // Viewport
            viewport = new Viewport(Context, scene, camera, null);
            Renderer.SetViewport(0, viewport);

            // ARCore component
            ArCore = scene.CreateComponent <ARCoreComponent>();
            ArCore.ARFrameUpdated  += OnARFrameUpdated;
            ArCore.ConfigRequested += ArCore_ConfigRequested;
            ArCore.Run();

            var mutantNode = scene.CreateChild();

            mutantNode.Position = new Vector3(0, -0.5f, 0.5f); // 50cm Y, 50cm Z
            mutantNode.SetScale(0.3f);
            var model = mutantNode.CreateComponent <StaticModel>();

            model.CastShadows = true;
            model.Model       = ResourceCache.GetModel("Models/Box.mdl");
            model.Material    = ResourceCache.GetMaterial("Materials/DefaultGrey.xml");


            fps         = new MonoDebugHud(this);
            fps.FpsOnly = true;
            fps.Show(Color.Blue, 25);
        }
예제 #5
0
        protected override async void Start()
        {
            base.Start();

            arCore = Scene.CreateComponent <ARCoreComponent>();

            var boxNode = Scene.CreateChild();

            boxNode.Position = new Vector3(0, 0, 0.5f);
            boxNode.CreateComponent <Pyramid>();
            boxNode.SetScale(0.1f);

            hud = new MonoDebugHud(this);
            hud.Show(Color.Green, 40);

            Input.TouchEnd += Input_TouchEnd;
            await arCore.Run(Camera);
        }