Example #1
0
 //Record one frame of the head camera for each user
 public void RecordVision()
 {
     foreach (var item in visual_recorders)
     {
         RefID         user_id       = item.Key;
         VideoRecorder videoRecorder = item.Value;
         if (videoRecorder != null && cameras[user_id] != null)
         {
             Task task = metagen_comp.StartTask((Func <Task>)(async() =>
             {
                 Bitmap2D bmp = await cameras[user_id].RenderToBitmap(camera_resolution);
                 visual_recorders[user_id].WriteFrame(bmp.ConvertTo(CodeX.TextureFormat.BGRA32).RawData);
                 //UniLog.Log(DateTime.UtcNow.ToMillisecondTimeString());
             }));
             //TODO: sync video
             //task.Wait();
             //World currentWorld = metagen_comp.World;
             //FrooxEngine.RenderSettings renderSettings = cameras[user_id].GetRenderSettings(camera_resolution);
             //byte[] data = currentWorld.Render.Connector.Render(renderSettings).Result;
             //Bitmap2D bmp = new Bitmap2D(data, renderSettings.size.x, renderSettings.size.y, renderSettings.textureFormat, false, true, (string)null);
             //visual_recorders[user_id].WriteFrame(bmp.ConvertTo(CodeX.TextureFormat.BGRA32).RawData);
         }
         else
         { //something was null:P
             bool vis_rec_null = false;
             bool camera_null  = false;
             if (visual_recorders[user_id] == null)
             {
                 vis_rec_null = true;
             }
             if (cameras[user_id] == null)
             {
                 camera_null = true;
             }
             UniLog.Log("OwO. These things were null: " + (camera_null ? "Camera" : "") + (vis_rec_null ? "Visual recorder" : ""));
         }
     }
 }
 public void StartInteracting()
 {
     metagen_comp.StartTask(async() => this.StartInteractingInternal());
 }