Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
              spriteBatch = new SpriteBatch(GraphicsDevice);

              // Create a new model
              DataPoint[] data = new DataPoint[360 * 180];
              for (int lng = 0; lng < 360; lng ++) {
            for (int lat = 0; lat < 180; lat ++) {
              int ind = lng * 180 + lat;
              data[ind] = new DataPoint(lat - 90, lng - 180, 0);
            }
              }
              List<DataPoint> dataList = new List<DataPoint>();

              //model = new GlobeModel(Content, GraphicsDevice, Matrix.CreateTranslation(offsetX, offsetY, offsetZ));

              //string line;
              //StreamReader file = new StreamReader("earthquake.tsv");
              //while ((line = file.ReadLine()) != null) {
              //  string[] parts = line.Split(' ');
              //  int lat = (int)(float.Parse(parts[0]) + .5f);
              //  int lng = (int)(float.Parse(parts[1]) + .5f);
              //  int ind = (lng >= 180 ? 0 : lng + 180) * 180 + (lat + 90);
              //  data[ind].value++;
              //  dataList.Add(new DataPoint(float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]) / 9.5f));
              //}
              //dataList.Clear();
              //dataList.Add(new DataPoint(35.673343f, 139.710388f, 1));
              //data = dataList.ToArray();
              //model.setData(data);

              aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

              // Set cullmode
              RasterizerState rs = new RasterizerState();
              rs.CullMode = CullMode.CullCounterClockwiseFace;
              GraphicsDevice.RasterizerState = rs;

              if (ENABLE_KINECT) {
            manager = new KinectManager("out.txt", CONTINUE_TRACK);
              }
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            largerTarget = new RenderTarget2D(GraphicsDevice, KinectManager.IMG_WIDTH, KinectManager.IMG_HEIGHT, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
              renderTarget = new RenderTarget2D(GraphicsDevice, KinectManager.IMG_WIDTH / 2, KinectManager.IMG_HEIGHT / 2, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
              writer = new JpgWriter(KinectManager.IMG_WIDTH / 2, KinectManager.IMG_HEIGHT / 2);

              cameraFeed = new Texture2D(graphics.GraphicsDevice, KinectManager.IMG_WIDTH, KinectManager.IMG_HEIGHT);
              overlay = new Texture2D(graphics.GraphicsDevice, 1, 1);
              overlay.SetData<Microsoft.Xna.Framework.Color>(new Microsoft.Xna.Framework.Color[] { new Microsoft.Xna.Framework.Color(1, 1, 1, .1f) });
              fromBytes = new Texture2D(graphics.GraphicsDevice, KinectManager.IMG_WIDTH, KinectManager.IMG_HEIGHT);

              quad = new Quad(graphics.GraphicsDevice, cameraFeed);

              // Create a new SpriteBatch, which can be used to draw textures.
              spriteBatch = new SpriteBatch(GraphicsDevice);
              aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

              if (ENABLE_KINECT) {
            manager = new KinectManager("out.txt", CONTINUE_TRACK);
              }

              font = Content.Load<SpriteFont>("text");

              model = Content.Load<Model>(MODEL);
              sphere = Content.Load<Model>("sphere");
              cup_bottom = Content.Load<Model>("cup_bottom");
              cup_top = Content.Load<Model>("cup_top");
              bodies1 = new RpcBody(sphere, new Vector3(0, 0, 1), "sphere");
              bodies2 = new RpcBody(sphere, new Vector3(1, 0, 0), "sphere");

              modelBody = new StaticBody(model, transform(true), "wall", true);
              cupTopBody = new StaticBody(cup_top, transform(), "cup_top", false);
              cupBottomBody = new StaticBody(cup_bottom, transform(), "cup_bottom", false);

              new Thread(new ThreadStart(tcpPhysics)).Start();
              if (!OBSERVER) {
            new Thread(new ThreadStart(tcpPhone)).Start();
              }
        }