public void Dispose() { Scene.Dispose(); if (Comp3D != null) { foreach (var e in Comp3D) { e.Dispose(); } } }
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 Removed() { GameFacade.Scenes.RemoveExternal(Scene); Scene.Dispose(); }