Skip to content

Instantly share code, notes, and snippets.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace OVROSX {
public class HeadTracking : MonoBehaviour {
public static HeadTracking instance { get; private set; }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace OVROSX {
class MouseMoveTracker {
private float baseV = 0.0f;
private float diffV = 0.0f;
private float baseH = 0.0f;
static OVRInput()
{
controllers = new List<OVRControllerBase>
{
#if UNITY_ANDROID && !UNITY_EDITOR
new OVRControllerGamepadAndroid(),
new OVRControllerTouchpad(),
new OVRControllerLTrackedRemote(),
new OVRControllerRTrackedRemote(),
#elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
public static ControllerState4 GetControllerState4(uint controllerMask)
{
#if UNITY_EDITOR
if (controllerMask == (uint)OVRInput.Controller.RTrackedRemote) {
ControllerState4 state = new ControllerState4();
state.ConnectedControllers = (uint)Controller.RTrackedRemote;
state.RIndexTrigger = OVROSX.JoyconTracker.Instance.GetTriggerState() ? 1.0f : 0.0f;
return state;
} else {
ControllerState4 controllerState = new ControllerState4();
OVRPose tracker = OVRManager.tracker.GetPose();
trackerAnchor.localRotation = tracker.orientation;
#if UNITY_EDITOR_OSX
// OS X Editorの時は、カメラの向き設定を差し替える
centerEyeAnchor.localRotation = OVROSX.JoyconTracker.Instance.GetLeftOrientation();
leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;
#elif UNITY_2017_2_OR_NEWER
private var channelListener: SoraAudioChannel.Listener = object : SoraAudioChannel.Listener {
override fun onConnect(channel: SoraAudioChannel) {
ui?.changeStateText("CONNECTED")
}
override fun onClose(channel: SoraAudioChannel) {
ui?.changeStateText("CLOSED")
close()
bool PeerConnection::AddStream(MediaStreamInterface* local_stream) {
TRACE_EVENT0("webrtc", "PeerConnection::AddStream");
if (IsClosed()) {
return false;
}
if (!CanAddLocalMediaStream(local_streams_, local_stream)) {
return false;
}
local_streams_->AddStream(local_stream);
@lyokato
lyokato / WebRTCFilterExample.m
Created June 12, 2017 15:35
WebRTC Filter Example
- (instancetype)initWithSource:(RTCVideoSource *)source {
if (self = [super init]) {
self.source = source;
// CI ContextとColorSpaceを準備しておく
self.context =
[CIContext contextWithOptions:@{kCIContextUseSoftwareRenderer: @NO}];
_colorSpace = CGColorSpaceCreateDeviceRGB();
self.filters = @[].mutableCopy;
}
@lyokato
lyokato / WebRTCLocalVideoExample2.m
Created June 12, 2017 15:13
WebRTC Local Video Setup With Filter
RTCVideoSource *source = [factory videoSource];
// VideoSourceからFilterを準備し
MyVideoSourceFilter *filter = [[MyVideoSourceFilter alloc] initWithSource:source];
// Capturerには、Filterを渡す
RTCVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:filter];
RTCVideoTrack *trakc = [factory videoTrackWithSource:source trackId:trackId];
@lyokato
lyokato / WebRTCLocalVideoExample.m
Created June 12, 2017 15:11
WebRTC Loal Video Setup Example (without filter)
// ...
RTCVideoSource *source = [factory videoSource];
RTCVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
RTCVideoTrack *trakc = [factory videoTrackWithSource:source trackId:trackId];
// ...