Beispiel #1
0
        public ScalingWidget(Box targetObject)
            : base(3)
        {
            box = targetObject;

            YArrow = new Arrow(ArrowBase, ArrowLength, ArrowLineLength, ArrowLineWidth)
            {
                Name = "YArrow"
            };
            XArrow = new Arrow(ArrowBase, ArrowLength, ArrowLineLength, ArrowLineWidth) {

                Name = "XArrow"
            };
            ZArrow = new Arrow(ArrowBase, ArrowLength, ArrowLineLength, ArrowLineWidth)
            {
                Name = "ZArrow"
            };

            Objects[0] = YArrow;
            Objects[1] = XArrow;
            Objects[2] = ZArrow;

            scaling = targetObject.ScalingValues;

            Material = new PhongMaterial() { DiffuseColor = Color.Yellow, AmbientCoefficient=1f};
            YArrow.PositionV3 = new Vector3(-scaling.X / 2 - ArrowLineWidth / 2, scaling.Y / 2, -scaling.Z / 2 - ArrowLineWidth / 2);
            XArrow.PositionV3 = new Vector3(scaling.X / 2 + ArrowLineWidth / 2, -scaling.Y / 2 + ArrowLineWidth / 2, -scaling.Z / 2 - ArrowLineWidth / 2);
            ZArrow.PositionV3 = new Vector3(-scaling.X / 2 - ArrowLineWidth / 2, -scaling.Y / 2 + ArrowLineWidth / 2, scaling.Z / 2 + ArrowLineWidth / 2);

            //YArrow.PositionV3 = new Vector3(-box.Scaling / 2 - ArrowLineWidth / 2, box.Height / 2, -box.Depth / 2 - ArrowLineWidth / 2);
            //XArrow.PositionV3 = new Vector3(box.Width / 2 + ArrowLineWidth / 2, -box.Height / 2 + ArrowLineWidth / 2, -box.Depth / 2 - ArrowLineWidth / 2);
            //ZArrow.PositionV3 = new Vector3(-box.Width / 2 - ArrowLineWidth / 2, -box.Height / 2 + ArrowLineWidth / 2, box.Depth / 2 + ArrowLineWidth / 2);
        }
Beispiel #2
0
        protected override void OnInit(object sender, EventArgs e)
        {
            Camera.LookAt(Vector3.Zero, new Vector3(0, 0, -10f));

            Box box = new Box(1, 1, 1);
            Sphere sphere = new Sphere(1, 16);
            Arrow arrow = new Arrow(1, 1, 3, 0.5f) { PositionV3 = new Vector3(-2.5f, 0, 0) };
            AvengersUtd.Odyssey.Graphics.Meshes.BoundingBox bbox = new AvengersUtd.Odyssey.Graphics.Meshes.BoundingBox(4);
            sphere.PositionV3= new Vector3(0f, 3f, 0);
            RenderableNode rNodeBox = new RenderableNode(box) { Label = "RBox" };
            RenderableNode rNodeSPhere = new RenderableNode(sphere);
            RenderableNode rNodeBBox = new RenderableNode(bbox);
            FixedNode fNodeGrid = new FixedNode { Label = "fGrid", Position = Vector3.Zero };

            CameraAnchorNode coNode = new CameraAnchorNode();
            Scene.Tree.RootNode.AppendChild(fNodeGrid);
            Scene.Tree.RootNode.AppendChild(coNode);
             fNodeGrid.AppendChild(rNodeSPhere);
            fNodeGrid.AppendChildren(arrow.ToNodes());
            fNodeGrid.AppendChildren(bbox.ToNodes());

            DeviceContext.Immediate.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            Hud = Hud.FromDescription(Game.Context.Device,
                new HudDescription(
                    width: Game.Context.Settings.ScreenWidth,
                    height: Game.Context.Settings.ScreenHeight,
                    zNear: Game.CurrentRenderer.Camera.NearClip,
                    zFar: Game.CurrentRenderer.Camera.FarClip,
                    cameraEnabled: true,
                    multithreaded: true
                    ));
            OdysseyUI.CurrentHud = Hud;
            Game.Logger.Init();
            Hud.BeginDesign();

            Game.Logger.Log("Prova1");
            Game.Logger.Log("Prova2");
            Game.Logger.Log("Prova3");
            Game.Logger.Log("Prova4");
            Game.Logger.Log("Prova5");

            Button bConnect = new Button()
            {
                Size = new System.Drawing.Size(120, 30),
                //Content = "Start",
                Position = new Vector2(1800, 0)
            };

            Button bTracking = new Button()
            {
                Size = new System.Drawing.Size(120, 30),
                //Content = "Start",
                Position = new Vector2(1800, 40)
            };

            //bConnect.MouseClick += (sender, e) => { tracker.Connect(); };
            //bTracking.MouseClick += (sender, e) => { tracker.StartTracking(); };

            //TouchRayPanel rp = new TouchRayPanel { Size = Hud.Size, Camera = this.Camera };
            //Hud.Add(rp);

            //rp.Add(bConnect);
            //rp.Add(bTracking);
            //rp.SetTracker(tracker);

            Game.Logger.Activate();
            Hud.Init();
            Hud.EndDesign();

            //Scene.BuildRenderScene();
            //Hud.AddToScene(this, Scene);
            IsInited = true;
            //tracker.StartBrowsing();
        }
Beispiel #3
0
 public void SetColor(Arrow arrow, Color color)
 {
     if (arrow != null)
         foreach (IRenderable rObject in arrow.Objects)
             ((IColorMaterial)rObject.Material).DiffuseColor = color;
 }
Beispiel #4
0
        protected override void OnInit(object sender, EventArgs e)
        {
            //AvengersUtd.Odyssey.Text.TextManager.DrawText("prova");

            Camera.LookAt(Vector3.Zero, new Vector3(0,5,-10f));

            Box box = new Box(1, 1, 1);
            Sphere sphere = new Sphere(1, 16);
            Arrow arrow = new Arrow(1, 1, 3, 0.5f) { PositionV3 = new Vector3(-2.5f, 0, 0) };
            AvengersUtd.Odyssey.Graphics.Meshes.BoundingBox bbox = new AvengersUtd.Odyssey.Graphics.Meshes.BoundingBox(4);
            sphere.PositionV3 = new Vector3(0f, 3f, 0);
            RenderableNode rNodeBox = new RenderableNode(box) { Label = "RBox" };
            RenderableNode rNodeSPhere = new RenderableNode(sphere);
            RenderableNode rNodeBBox = new RenderableNode(bbox);
            FixedNode fNodeGrid = new FixedNode { Label = "fGrid", Position = Vector3.Zero };

            CameraAnchorNode coNode = new CameraAnchorNode();
            Scene.Tree.RootNode.AppendChild(fNodeGrid);
            Scene.Tree.RootNode.AppendChild(coNode);
            fNodeGrid.AppendChild(rNodeSPhere);
            fNodeGrid.AppendChildren(arrow.ToNodes());
            fNodeGrid.AppendChildren(bbox.ToNodes());

            DeviceContext.Immediate.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            Hud = Hud.FromDescription(Game.Context.Device,
                new HudDescription(
                    width: Game.Context.Settings.ScreenWidth,
                    height: Game.Context.Settings.ScreenHeight,
                    zNear: Game.CurrentRenderer.Camera.NearClip,
                    zFar: Game.CurrentRenderer.Camera.FarClip,
                    cameraEnabled: true,
                    multithreaded: true
                    ));
            OdysseyUI.CurrentHud = Hud;
            Hud.BeginDesign();

            Game.Logger.Log("Prova1");
            Game.Logger.Log("Prova2");
            Game.Logger.Log("Prova3");
            Game.Logger.Log("Prova4");
            Game.Logger.Log("Prova5");
            //Game.Logger.Log("Prova1");
            //Game.Logger.Log("Prova2");
            //Game.Logger.Log("Prova3");
            //Game.Logger.Log("Prova4");
            //Game.Logger.Log("Prova5");
            //Game.Logger.Log("U MAD?");
            //Game.Logger.Log("PROBLEM?");
            LogEvent.UserInterface.Write("U MAD?");
            LogEvent.Engine.Write("YO DAWG");

            TexturedIcon crosshair = new TexturedIcon
            {
                Position = new Vector2(512f, 512f),
                Size = new Size(64, 64),
                Texture = Texture2D.FromFile(Game.Context.Device, "Resources/Textures/crosshair.png")

            };

            Hud.Add(crosshair);

            //Hud.Add(new Panel
            //{
            //    Position = new Vector2(500f, 175f),
            //    Size = new Size(200, 200)
            //});

            Hud.Add(new DecoratorButton
                        {
                            Position = new Vector2(550f, 300f),
                        });

            Hud.Add(new RayPickingPanel { Size = Hud.Size, Camera = this.Camera });
            Game.Logger.Activate();
            Hud.Init();
            Hud.EndDesign();

            //Scene.BuildRenderScene();
            //Hud.AddToScene(this, Scene);
            //
            //lightSphere.SetBehaviour(new FreeMovementGamepadBehaviour(50));

            IsInited = true;
        }