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(); } }
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); }
public UISelectSkinPanel(VMAvatar target, string type, VM vm) { this.vm = vm; if (target != null) { BaseGUID = target.Object.OBJ.GUID; CollectionType = type; var bodyStrings = target.Object.Resource.Get <FSO.Files.Formats.IFF.Chunks.STR>(target.Object.OBJ.BodyStringID); type = bodyStrings.GetString(1).Substring(4); type = type.Substring(0, type.IndexOf('_')); CurrentSkin = bodyStrings.GetString(14); } else { Pet = true; if (type == "cat") { BaseGUID = 0x7BEA0977; } else if (type == "dog") { BaseGUID = 0x4A70DF92; } } Camera = new BasicCamera(GameFacade.GraphicsDevice, new Vector3(5, 1, 0), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); Camera.NearPlane = 0.001f; Scene = new _3DTargetScene(GameFacade.GraphicsDevice, Camera, new Point(1030, 500), (GlobalSettings.Default.AntiAlias > 0)?8:0); Scene.Initialize(GameFacade.Scenes); InitializeLot(); PopulateSimType(type); OKButton = new UIBigButton(true); OKButton.Caption = GameFacade.Strings.GetString("142", "0"); OKButton.Position = new Microsoft.Xna.Framework.Vector2((515 + 300) - 137, 370); OKButton.OnButtonClick += (btn) => { OnResult?.Invoke(ResultInd); }; OKButton.Width = 275; Add(OKButton); CancelButton = new UIBigButton(true); CancelButton.Caption = GameFacade.Strings.GetString("142", "1"); CancelButton.Position = new Microsoft.Xna.Framework.Vector2((515 - 300) - 137, 370); CancelButton.OnButtonClick += (btn) => { OnResult?.Invoke(-1); }; CancelButton.Width = 275; Add(CancelButton); }
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)); }