internal void addSubRenderers(PaintersAlgorithmRenderer paintersAlgorithmRenderer) { // No direct renderers here, the skeleton does it }
/// <summary> /// Initializes a new instance of the TDVBasicGame class. /// </summary> public TDVBasicGame() { defaultGame = this; this.IsFixedTimeStep = false; this.IsMouseVisible = true; this.Window.Title = "Happy Birthday"; this.graphics = new GraphicsDeviceManager(this); this.graphics.PreferredBackBufferWidth = Width; this.graphics.PreferredBackBufferHeight = Height; this.graphics.PreparingDeviceSettings += this.GraphicsDevicePreparingDeviceSettings; this.graphics.SynchronizeWithVerticalRetrace = true; this.viewPortRectangle = new Rectangle(0,0, Width, Height); Content.RootDirectory = "Content"; for (int i = 0; i < players.Length; i++) { players[i] = new TDVPlayer(); } // The Kinect sensor will use 640x480 for both streams // To make your app handle multiple Kinects and other scenarios, // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit this.chooser = new KinectChooser(this, ColorImageFormat.RgbResolution640x480Fps30, DepthImageFormat.Resolution640x480Fps30); this.Services.AddService(typeof(KinectChooser), this.chooser); this.paintersAlgorithmRenderer = new PaintersAlgorithmRenderer(this); this.Components.Add(this.chooser); this.previousKeyboard = Keyboard.GetState(); }
internal void addSubRenderers(PaintersAlgorithmRenderer par) { if (false == this.initialized) { this.Initialize(); } // If the map texture isn't loaded, load all the content if (null == this.frontMidField) { this.LoadContent(); } if (null == skeletonData || null == this.mapMethod) { return; } par.addSubRenderer(new BillboardSubrenderer(backField, BACK_FIELD_Z)); par.addSubRenderer(new BillboardSubrenderer(midField, MIDFIELD_Z)); par.addSubRenderer(new BillboardSubrenderer(frontMidField, FRONT_MIDFIELD_Z)); par.addSubRenderer(new BillboardSubrenderer(frontField, FRONT_FIELD_Z)); par.addSubRenderer(new TDVGUISubRenderer(((TDVBasicGame)Game).PlayerID)); par.addSubRenderer(new DirtAndScratchesSubrenderer()); int playerID = 1; foreach (var skeleton in skeletonData) { if (skeleton.TrackingState == SkeletonTrackingState.Tracked) { TextureSet ts = ((TDVBasicGame)Game).getPlayer(playerID - 1).Textures; // DS switched order, refactored FrontCharacterElements from SkeletonElements and added BackSkeletonElements // so that video cutout is in front of head shape and behind other drawn elements // These are sorted afterwards - Annie 8cD par.addSubRenderer(new BackCharacterElements(this, skeleton, ts)); par.addSubRenderer(new LiveElements(this.playerImageRenderer, skeleton, this.playerImageRenderer.SkeletonToColorMap, playerID)); par.addSubRenderer(new FrontCharacterElements(this, skeleton, ts)); } playerID++; } skeletonDrawn = true; }