public override void PreDraw(UISpriteBatch batch) { base.PreDraw(batch); Camera.Position = new Vector3(10f, 4f, 0); Camera.Target = new Vector3(4f, Pet?0f:0.8f, 0); GameFacade.GraphicsDevice.RasterizerState = Microsoft.Xna.Framework.Graphics.RasterizerState.CullCounterClockwise; Scene.Draw(GameFacade.GraphicsDevice); GameFacade.GraphicsDevice.RasterizerState = Microsoft.Xna.Framework.Graphics.RasterizerState.CullNone; }
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 override void PreDraw(UISpriteBatch batch) { base.PreDraw(batch); if (!UISpriteBatch.Invalidated) { if (!_3DScene.IsInvalidated) { batch.Pause(); Scene.Draw(GameFacade.GraphicsDevice); batch.Resume(); DrawLocalTexture(batch, Scene.Target, new Vector2()); } } }
public void Draw() { RecalcBounds(); RotationX += RotationSpeed; RotationSpeed += (0.01f - RotationSpeed) / 20; var mat = Microsoft.Xna.Framework.Matrix.CreateRotationY(RotationX); Camera.Position = Ctr + Vector3.Transform(new Vector3(4, 3, 0) * (0.1f + Size * 0.2f), mat); Camera.Target = Ctr + new Vector3(0, 0, 0); var old = GameFacade.GraphicsDevice.BlendState; GameFacade.GraphicsDevice.BlendState = BlendState.NonPremultiplied; Scene.Draw(GameFacade.GraphicsDevice); GameFacade.GraphicsDevice.BlendState = old; }
public override void PreDraw(UISpriteBatch batch) { HeadScene.Draw(GameFacade.GraphicsDevice); base.PreDraw(batch); }
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)); }