internal void EnableNetworkTimeWarp(bool enable) { if (isBoundToClient) { AXRServerPlugin.EnableNetworkTimeWarp(playerID, enable); } }
public void RecenterPose() { if (isBoundToClient) { AXRServerPlugin.RecenterPose(playerID); } }
public static void SendAudioFrame(AirXRCameraRig cameraRig, float[] data, int sampleCount, int channels, double timestamp) { if (cameraRig.isBoundToClient) { AXRServerPlugin.EncodeAudioFrame(cameraRig.playerID, data, data.Length / channels, channels, AudioSettings.dspTime); } }
void Start() { var streams = new List <AirXRServerStreamHandover.Streams>(); AirXRServerStreamHandover.TakeAllStreamsHandedOverInPrevScene(streams); foreach (var item in streams) { var selected = notifyCameraRigWillBeBound(item.playerID); if (selected != null) { _cameraRigList.RetainCameraRig(selected); selected.BindPlayer(item.playerID, item.mediaStream, item.inputStream); if (selected.isStreaming && Delegate != null) { Delegate.AirXRCameraRigActivated(selected); } } else { AXRServerPlugin.Disconnect(item.playerID); } } updateApplicationTargetFrameRate(); eventDispatcher.MessageReceived += onAirXRMessageReceived; }
public AirXRServerMediaStream(int playerID, AirXRClientConfig config, int cameraCount) { currentFramebufferIndex = 0; _cameraCount = cameraCount; _framebuffers = new RenderTexture[FramebufferCount * cameraCount]; IntPtr[] framebuffers = new IntPtr[FramebufferCount * cameraCount]; for (int f = 0; f < FramebufferCount; f++) { for (int t = 0; t < cameraCount; t++) { RenderTexture texture = new RenderTexture(config.videoWidth / cameraCount, config.videoHeight, 24); texture.antiAliasing = 1; texture.autoGenerateMips = false; texture.useMipMap = false; texture.filterMode = FilterMode.Bilinear; texture.anisoLevel = 0; texture.format = RenderTextureFormat.ARGB32; texture.Create(); _framebuffers[f * cameraCount + t] = texture; framebuffers[f * cameraCount + t] = texture.GetNativeTexturePtr(); } } AXRServerPlugin.RegisterFramebufferTextures(playerID, framebuffers, cameraCount, FramebufferCount); }
public void Disconnect() { if (isBoundToClient) { AXRServerPlugin.Disconnect(playerID); } }
protected override bool GetAxis2DImpl(byte device, byte control, ref Vector2 axis2D) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputAxis2D(owner.playerID, device, control, ref axis2D)); }
protected override bool GetByteAxisImpl(byte device, byte control, ref byte axis) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputByteAxis(owner.playerID, device, control, ref axis)); }
protected override bool GetTouch2DImpl(byte device, byte control, ref Vector2 position, ref byte state) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputTouch2D(owner.playerID, device, control, ref position, ref state)); }
protected override bool IsActiveImpl(byte device, byte control, AXRInputDirection direction) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.IsInputDirectionActive(owner.playerID, device, control, (byte)direction)); }
protected override void UpdateInputFrameImpl() { if (owner.isBoundToClient == false) { return; } AXRServerPlugin.UpdateInputFrame(owner.playerID); }
protected override bool GetPoseImpl(byte device, byte control, ref Vector3 position, ref Quaternion rotation) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputPose(owner.playerID, device, control, ref position, ref rotation)); }
protected override void PendStateImpl(byte device, byte control, byte state) { if (owner.isBoundToClient == false) { return; } AXRServerPlugin.PendInputState(owner.playerID, device, control, state); }
protected override void ClearInputImpl() { if (owner.isBoundToClient == false) { return; } AXRServerPlugin.ClearInput(owner.playerID); }
protected override void PendRaycastHitImpl(byte device, byte control, Vector3 origin, Vector3 hitPosition, Vector3 hitNormal) { if (owner.isBoundToClient == false) { return; } AXRServerPlugin.PendInputRaycastHit(owner.playerID, device, control, origin, hitPosition, hitNormal); }
protected override void PendVibrationImpl(byte device, byte control, float frequency, float amplitude) { if (owner.isBoundToClient == false) { return; } AXRServerPlugin.PendInputVibration(owner.playerID, device, control, frequency, amplitude); }
protected override bool GetStateImpl(byte device, byte control, ref byte state) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputState(owner.playerID, device, control, ref state)); }
protected override bool GetDeactivatedImpl(byte device, byte control, AXRInputDirection direction) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputDirectionDeactivated(owner.playerID, device, control, (byte)direction)); }
protected override bool GetActivatedImpl(byte device, byte control) { if (owner.isBoundToClient == false) { return(false); } return(AXRServerPlugin.GetInputActivated(owner.playerID, device, control)); }
public static AirXRClientConfig Get(int playerID) { string json = ""; if (AXRServerPlugin.GetConfig(playerID, ref json)) { return(JsonUtility.FromJson <AirXRClientConfig>(json)); } return(null); }
private void onAirXRMediaStreamStopped(AirXRServerMessage message) { onStopRender(); disableCameras(); _mediaStreamJustStopped = true; // StopCoroutine(_CallPluginEndOfFrame) executes the routine one more in the next frame after the call. // so use a flag to completely stop the routine. GL.IssuePluginEvent(AXRServerPlugin.ResetStreams_RenderThread_Func, AXRServerPlugin.RenderEventArg((uint)playerID)); inputStream.Stop(); }
private void onAirXRMediaStreamInitialized(AirXRServerMessage message) { Assert.IsNull(mediaStream); initializeCamerasForMediaStream(); AXRServerPlugin.SendCameraClipPlanes(playerID, cameras[0].nearClipPlane, cameras[0].farClipPlane); mediaStream = new AirXRServerMediaStream(playerID, _config, cameras.Length); GL.IssuePluginEvent(AXRServerPlugin.InitStreams_RenderThread_Func, AXRServerPlugin.RenderEventArg((uint)playerID)); inputStream.Init(); }
private void OnDestroy() { if (_startedUp) { GL.IssuePluginEvent(AXRServerPlugin.Shutdown_RenderThread_Func, 0); GL.Flush(); AXRServerPlugin.Shutdown(); } NetMQ.NetMQConfig.Cleanup(false); }
void Update() { AXRServerPlugin.Update(); eventDispatcher.DispatchEvent(); var cameraRigs = new List <AirXRCameraRig>(); _cameraRigList.GetAllCameraRigs(cameraRigs); foreach (var cameraRig in cameraRigs) { cameraRig.OnUpdate(); } }
public void SendUserData(byte[] data) { if (isBoundToClient) { IntPtr ptr = Marshal.AllocHGlobal(data.Length); try { Marshal.Copy(data, 0, ptr, data.Length); AXRServerPlugin.SendUserData(playerID, ptr, data.Length); } finally { Marshal.FreeHGlobal(ptr); } } }
private void onAirXRMediaStreamCleanedUp(AirXRServerMessage message) { Assert.IsNotNull(mediaStream); inputStream.Cleanup(); GL.IssuePluginEvent(AXRServerPlugin.CleanupStreams_RenderThread_Func, AXRServerPlugin.RenderEventArg((uint)playerID)); mediaStream.Destroy(); mediaStream = null; foreach (Camera cam in cameras) { cam.targetTexture = null; } }
private void onAirXRPlayerCreated(int playerID, AirXRServerMessage message) { var selected = notifyCameraRigWillBeBound(playerID); if (selected != null) { _cameraRigList.RetainCameraRig(selected); selected.BindPlayer(playerID); AXRServerPlugin.AcceptPlayer(playerID); var config = selected.GetConfig(); if (string.IsNullOrEmpty(config.profileReportEndpoint) == false && string.IsNullOrEmpty(config.motionOutputEndpoint) == false) { predictionEventHandler?.OnStartPrediction(selected, config.profileReportEndpoint, config.motionOutputEndpoint); } } else { AXRServerPlugin.Disconnect(playerID); } }
private IEnumerator CallPluginEndOfFrame() { yield return(new WaitForEndOfFrame()); Assert.IsNotNull(mediaStream); GL.IssuePluginEvent(AXRServerPlugin.EncodeVideoFrame_RenderThread_Func, AXRServerPlugin.RenderEventArg((uint)playerID, (uint)_viewNumber, (uint)mediaStream.currentFramebufferIndex)); // the first render event while (_mediaStreamJustStopped == false) { yield return(new WaitForEndOfFrame()); if (_mediaStreamJustStopped) { yield break; } else if (_encodeVideoFrameRequested) { Assert.IsNotNull(mediaStream); GL.IssuePluginEvent(AXRServerPlugin.EncodeVideoFrame_RenderThread_Func, AXRServerPlugin.RenderEventArg((uint)playerID, (uint)_viewNumber, (uint)mediaStream.currentFramebufferIndex)); _encodeVideoFrameRequested = false; } } }
protected override void SendPendingInputEventsImpl(long timestamp) { AXRServerPlugin.SendPendingInputs(owner.playerID, timestamp); }
protected override void BeginPendInputImpl(ref long timestamp) { AXRServerPlugin.BeginPendInput(owner.playerID, ref timestamp); }