Ejemplo n.º 1
0
        void UISimInit()
        {
            Vitaboy.Avatar.DefaultTechnique = GlobalSettings.Default.Lighting ? 3 : 0;
            Camera = new WorldCamera(GameFacade.GraphicsDevice)
            {
                Zoom       = Zoom,
                CenterTile = new Vector3(-1, -1, 0) * FSOEnvironment.DPIScaleFactor
            };
            Scene = new _3DTargetScene(GameFacade.GraphicsDevice, Camera,
                                       new Point((int)(140 * FSOEnvironment.DPIScaleFactor), (int)(200 * FSOEnvironment.DPIScaleFactor)),
                                       GlobalSettings.Default.AntiAlias ? 8 : 0)
            {
                ID = "UISim"
            };

            GameFacade.Game.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(GraphicsDevice_DeviceReset);

            Avatar = new AdultVitaboyModel
            {
                Scene = Scene
            };
            var scale = FSOEnvironment.DPIScaleFactor;

            Avatar.Scale = new Vector3(scale, scale, scale);

            Scene.Add(Avatar);
        }
Ejemplo n.º 2
0
 public void InitializeLot()
 {
     BodyAvatars = new VMAvatar[18];
     for (int i = 0; i < 18; i++)
     {
         BodyAvatars[i] = (VMAvatar)vm.Context.CreateObjectInstance(BaseGUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true).BaseObject;
         BodyAvatars[i].SetValue(FSO.SimAntics.Model.VMStackObjectVariable.Hidden, 1);
         Scene.Add(BodyAvatars[i].Avatar);
     }
 }
Ejemplo n.º 3
0
        public UI3DThumb(VMEntity ent)
        {
            Camera           = new BasicCamera(GameFacade.GraphicsDevice, new Vector3(3, 1, 0), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
            Camera.NearPlane = 0.001f;
            Scene            = new _3DTargetScene(GameFacade.GraphicsDevice, Camera, new Point(150, 150), 0);
            Scene.Initialize(GameFacade.Scenes);

            if (Comp3D != null)
            {
                foreach (var e in Comp3D)
                {
                    e.Dispose();
                    Scene.Remove(e);
                }
            }
            Comp3D = new List <Debug3DDGRPComponent>();

            BoundingBox?total = null;
            var         pos   = ent.MultitileGroup.GetBasePositions();
            var         i     = 0;

            foreach (var obj in ent.MultitileGroup.Objects)
            {
                var c    = new Debug3DDGRPComponent();
                var dgrp = ((ObjectComponent)obj.WorldUI).DGRP;
                c.Mesh = (dgrp == null) ? null : Content.Content.Get().RCMeshes.Get(dgrp, obj.Object.OBJ); //new DGRP3DMesh(((ObjectComponent)obj.WorldUI).DGRP, obj.Object.OBJ, GameFacade.GraphicsDevice, null);
                Scene.Add(c);
                if (c.Mesh == null)
                {
                    i++;
                    continue;
                }

                var vp = pos[i++];
                c.Position = new Vector3((vp.X - 0.5f), vp.Z, (vp.Y - 0.5f));
                if (total == null)
                {
                    total = OffsetBox(c.Mesh.Bounds ?? new BoundingBox(), c.Position);
                }
                else
                {
                    total = BoundingBox.CreateMerged(total.Value, OffsetBox(c.Mesh.Bounds ?? new BoundingBox(), c.Position));
                }
                c.Initialize();
                Comp3D.Add(c);
            }

            if (total != null)
            {
                Ctr = new Vector3((total.Value.Max.X + total.Value.Min.X) / 2, (total.Value.Max.Y + total.Value.Min.Y) / 2, (total.Value.Max.Z + total.Value.Min.Z) / 2);
                var diag = total.Value.Max - total.Value.Min;
                Size = diag.Length();
            }
        }
Ejemplo n.º 4
0
        public static Texture2D GenHeadTex(VMAvatar ava)
        {
            var m_Head = new SimAvatar(ava.Avatar); //talk about confusing...

            m_Head.StripAllButHead();


            var HeadCamera = new BasicCamera(GameFacade.GraphicsDevice, new Vector3(0.0f, 7.0f, -17.0f), Vector3.Zero, Vector3.Up);

            var pos2 = m_Head.Skeleton.GetBone("HEAD").AbsolutePosition;

            pos2.Y += 0.1f;
            HeadCamera.Position         = new Vector3(0, pos2.Y, 12.5f);
            HeadCamera.FOV              = (float)Math.PI / 3f;
            HeadCamera.Target           = pos2;
            HeadCamera.ProjectionOrigin = new Vector2(74 / 2, 74 / 2);

            var HeadScene = new _3DTargetScene(GameFacade.GraphicsDevice, HeadCamera, new Point(74, 74), (GlobalSettings.Default.AntiAlias > 0) ? 8 : 0);

            HeadScene.ID = "UIPieMenuHead";

            m_Head.Scene = HeadScene;
            m_Head.Scale = new Vector3(1f);

            HeadCamera.Zoom = 13f;

            //rotate camera, similar to pie menu

            double xdir = Math.Atan(50 / 100.0);
            double ydir = Math.Atan(-50 / 100.0);

            Vector3 off = new Vector3(0, 0, 13.5f);
            Matrix  mat = Microsoft.Xna.Framework.Matrix.CreateRotationY((float)xdir) * Microsoft.Xna.Framework.Matrix.CreateRotationX((float)ydir);

            HeadCamera.Position = new Vector3(0, pos2.Y, 0) + Vector3.Transform(off, mat);

            if (ava.IsPet)
            {
                HeadCamera.Zoom *= 1.5f;
            }
            //end rotate camera

            HeadScene.Initialize(GameFacade.Scenes);
            HeadScene.Add(m_Head);

            HeadScene.Draw(GameFacade.GraphicsDevice);
            var copy = TextureUtils.CopyAccelerated(GameFacade.GraphicsDevice, HeadScene.Target);

            HeadScene.Dispose();
            return(copy);
        }
Ejemplo n.º 5
0
        private void UISimInit()
        {
            Camera            = new WorldCamera(GameFacade.GraphicsDevice);
            Camera.Zoom       = LotView.WorldZoom.Near;
            Camera.CenterTile = new Vector2(-1, -1);
            Scene             = new _3DTargetScene(GameFacade.Game.GraphicsDevice, Camera, new Point(140, 200), (GlobalSettings.Default.AntiAlias)?8:0);
            Scene.ID          = "UISim";

            GameFacade.Game.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(GraphicsDevice_DeviceReset);

            Avatar       = new AdultVitaboyModel();
            Avatar.Scene = Scene;

            Scene.Add(Avatar);
        }
Ejemplo n.º 6
0
        private void initSimHead()
        {
            HeadCamera = new BasicCamera(GameFacade.GraphicsDevice, new Vector3(0.0f, 7.0f, -17.0f), Vector3.Zero, Vector3.Up);

            HeadCamera.Position = new Vector3(0, 5.2f, 12.5f);
            HeadCamera.Target   = new Vector3(0, 5.2f, 0.0f);

            HeadScene    = new _3DTargetScene(GameFacade.Game.GraphicsDevice, HeadCamera, new Point((int)(200 * TrueScale), (int)(200 * TrueScale)), (GlobalSettings.Default.AntiAlias) ? 8 : 0);
            HeadScene.ID = "UIPieMenuHead";

            m_Head.Scene = HeadScene;
            m_Head.Scale = new Vector3(1f);

            HeadCamera.Zoom = 0f;
            HeadScene.Add(m_Head);
            GameFacade.Scenes.AddExternal(HeadScene); //AddExternal(HeadScene);
        }
Ejemplo n.º 7
0
        private void UISimInit()
        {
            Vitaboy.Avatar.DefaultTechnique = (GlobalSettings.Default.Lighting) ? 3 : 0;
            Camera            = new WorldCamera(GameFacade.GraphicsDevice);
            Camera.Zoom       = Zoom;
            Camera.CenterTile = new Vector3(-1, -1, 0) * FSOEnvironment.DPIScaleFactor;
            Scene             = new _3DTargetScene(GameFacade.GraphicsDevice, Camera,
                                                   new Point(140 * FSOEnvironment.DPIScaleFactor, 200 * FSOEnvironment.DPIScaleFactor),
                                                   (GlobalSettings.Default.AntiAlias)?8:0);
            Scene.ID = "UISim";

            GameFacade.Game.GraphicsDevice.DeviceReset += new EventHandler <EventArgs>(GraphicsDevice_DeviceReset);

            Avatar       = new AdultVitaboyModel();
            Avatar.Scene = Scene;
            var scale = FSOEnvironment.DPIScaleFactor;

            Avatar.Scale = new Vector3(scale, scale, scale);

            Scene.Add(Avatar);
        }
Ejemplo n.º 8
0
        public static Texture2D GenHeadTex(Outfit headOft, string name)
        {
            var      skels = Content.Content.Get().AvatarSkeletons;
            Skeleton skel  = null;
            bool     pet   = false;

            if (name.StartsWith("uaa"))
            {
                //pet
                if (name.Contains("cat"))
                {
                    skel = skels.Get("cat.skel");
                }
                else
                {
                    skel = skels.Get("dog.skel");
                }
                pet = true;
            }
            else
            {
                skel = skels.Get("adult.skel");
            }

            var m_Head = new SimAvatar(skel);

            m_Head.Head = headOft;
            m_Head.ReloadSkeleton();
            //m_Head.StripAllButHead();

            var HeadCamera = new BasicCamera(GameFacade.GraphicsDevice, new Vector3(0.0f, 7.0f, -17.0f), Vector3.Zero, Vector3.Up);

            var pos2 = m_Head.Skeleton.GetBone("HEAD").AbsolutePosition;

            pos2.Y += (pet)?((name.Contains("dog"))?0.16f:0.1f):0.12f;
            HeadCamera.Position = new Vector3(0, pos2.Y, 12.5f);
            //HeadCamera.FOV = (float)Math.PI / 3f;
            HeadCamera.Target           = pos2;
            HeadCamera.ProjectionOrigin = new Vector2(66 / 2, 66 / 2);

            var HeadScene = new _3DTargetScene(GameFacade.GraphicsDevice, HeadCamera, new Point(66, 66), 0);// (GlobalSettings.Default.AntiAlias) ? 8 : 0);

            HeadScene.ID = "UIPieMenuHead";
            //HeadScene.ClearColor = new Color(49, 65, 88);

            m_Head.Scene = HeadScene;
            m_Head.Scale = new Vector3(1f);

            HeadCamera.Zoom = 19.5f;

            //rotate camera, similar to pie menu

            double xdir = 0; //Math.Atan(0);
            double ydir = 0; //Math.Atan(0);

            Vector3 off = new Vector3(0, 0, 13.5f);
            Matrix  mat = Microsoft.Xna.Framework.Matrix.CreateRotationY((float)xdir) * Microsoft.Xna.Framework.Matrix.CreateRotationX((float)ydir);

            HeadCamera.Position = new Vector3(0, pos2.Y, 0) + Vector3.Transform(off, mat);

            if (pet)
            {
                HeadCamera.Zoom *= 1.3f;
            }
            //end rotate camera

            HeadScene.Initialize(GameFacade.Scenes);
            HeadScene.Add(m_Head);

            HeadScene.Draw(GameFacade.GraphicsDevice);
            return(Common.Utils.TextureUtils.Decimate(HeadScene.Target, GameFacade.GraphicsDevice, 2, true));
        }