// Use this for initialization void Start() { _rightObj = _rightHand.GetComponent <SteamVR_TrackedObject>(); _leftObj = _leftHand.GetComponent <SteamVR_TrackedObject>(); setupRightPointer(); setupLeftPointer(); _annotationManager = null; DisableRightPointer(); DisableLeftPointer(); _menu = MenuOpened.None; _video = null; _playSpeed = 1; _slider = GameObject.Find("Timeline"); _representation = "Full"; annotationManagerByVideo = new Dictionary <CloudVideoPlayer, AnnotationManager>(); _annotationManager = new AnnotationManager(); _annotationManager.init(); itemSelected = false; spriteButtonSelected = (Sprite)Resources.Load("Textures/white", typeof(Sprite)); spriteButton = (Sprite)Resources.Load("Textures/border2", typeof(Sprite)); }
void Start() { _rightObj = _rightHand.GetComponent <SteamVR_TrackedObject>(); _leftObj = _leftHand.GetComponent <SteamVR_TrackedObject>(); setupRightPointer(); setupLeftPointer(); _annotationManager = null; //GameObject annotationManagerGO = GameObject.Find("AnnotationManager"); //_annotationManager = annotationManagerGO.GetComponent<AnnotationManager>(); //_annotationManager.SetRightHand(_rightHand); DisableRightPointer(); DisableLeftPointer(); _menu = MenuOpened.None; _video = null; _playSpeed = 1; _slider = GameObject.Find("Timeline"); _controlDataset = Instantiate(Resources.Load("Prefabs/ControlDataset")) as GameObject; _controlDataset.SetActive(false); _representation = "Full"; annotationManagerByVideo = new Dictionary <CloudVideoPlayer, AnnotationManager>(); itemSelected = false; }
public SpeechAnnotation(CloudVideoPlayer video, GameObject rightHand, SteamVR_Controller.Device rightController, GameObject head) : base(video, rightHand, rightController, head) { videoName = video.configFile; audioSourceGO = MonoBehaviour.Instantiate(Resources.Load("Prefabs/AudioSourcePrefab")) as GameObject; audioSource = audioSourceGO.GetComponent <AudioSource>(); IsActive = false; triggerPressed = false; audioVisualCueGO = null; }
public MarkAnnotation(CloudVideoPlayer video, GameObject rightHand, SteamVR_Controller.Device rightController, GameObject head) : //, GameObject rightPointer) : base(video, rightHand, rightController, head) { IsActive = false; triggerPressed = false; //_rightPointer = rightPointer; _head = head; _markGO = null; markNotPlaced = false; }
public VisualEffectAnnotation(CloudVideoPlayer video, GameObject rightHand, SteamVR_Controller.Device rightController, GameObject head, Color c, string effectName) : base(video, rightHand, rightController, head) { effectColor = c; IsActive = false; triggerPressed = false; _head = head; _effectName = effectName; _effectGO = null; }
public StaticAnnotation(CloudVideoPlayer video, GameObject rightHand, SteamVR_Controller.Device rightController, GameObject head) { _video = video; _rightHand = rightHand; _rightController = rightController; _id = 0; _start = 0.0f; _duration = 3.0f; _hasBeenCreated = false; _editing = false; _head = head; }
void SelectDataset() { Ray raycast = new Ray(_leftHand.transform.position, _leftHand.transform.forward); RaycastHit hit; bool bHit = Physics.Raycast(raycast, out hit); if (hit.transform != null) { Button b = hit.transform.gameObject.GetComponent <Button>(); if (b != null) { b.Select(); if (_leftController.GetPress(SteamVR_Controller.ButtonMask.Trigger)) { if (b.name == "PlaySpeed") { SetPlaybackSpeed(float.Parse(b.GetComponent <VRUIItem>().value)); return; } if (b.name == "Representation") { SetRepresentation(b.GetComponent <VRUIItem>().value); return; } if (_video != null && _video.configFile == b.name) { return; } else if (_video != null && _video.configFile != b.name) { _video.Close(); } _video = new CloudVideoPlayer(b.name, this); if (!annotationManagerByVideo.ContainsKey(_video)) { _annotationManager = new AnnotationManager(); _annotationManager.init(); _annotationManager.SetCloudVideo(_video); annotationManagerByVideo.Add(_video, _annotationManager); } CloseAllMenus(); DisableLeftPointer(); _menu = MenuOpened.None; } } } }
public ScribblerAnnotation(CloudVideoPlayer video, GameObject rightHand, SteamVR_Controller.Device rightController, Color c, GameObject head) : base(video, rightHand, rightController, head) { _myPoints = new List <PositionFrame>(); IsActive = false; triggerPressed = false; midPoint = Vector3.zero; lineRendererGO = MonoBehaviour.Instantiate(Resources.Load("Prefabs/LineRendererPrefab")) as GameObject; lineRenderer = lineRendererGO.GetComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Legacy Shaders/Particles/Additive")); lineRenderer.startColor = c; lineRenderer.endColor = c;//new Color(c.r / 0.2f, c.g / 0.2f, c.b / 0.2f); lineRenderer.positionCount = 0; }
void SelectDataset(GameObject hit) { if (buttonSelected != null) { Image buttonImg = buttonSelected.GetComponent <Image>(); buttonImg.sprite = spriteButton; } if (_video != null) { _video.Close(); SaveAnnotations(); } _video = new CloudVideoPlayer(hit.name, this); buttonSelected = hit.transform.gameObject.GetComponent <Button>(); Image img = buttonSelected.GetComponent <Image>(); img.sprite = spriteButtonSelected; LoadAnnotations(); _annotationManager.SetCloudVideo(_video); }
public void initStructs(uint id, string colorVideo, string depthVideo, GameObject cloudGameobj, CloudVideoPlayer mainPlayer) { _id = id; _depthTex = new Texture2D(_width, _height, TextureFormat.BGRA32, false); _depthTex.filterMode = FilterMode.Point; _depthBytes = new byte[_width * _height * 4]; _cloudGameobj = cloudGameobj; _mainPlayer = mainPlayer; //Setup color // VideoClip clip = Resources.Load<VideoClip>(colorVideo) as VideoClip; VideoPlayer play = cloudGameobj.AddComponent <VideoPlayer>(); play.playOnAwake = false; //play.clip = clip; play.url = colorVideo; play.targetTexture = new RenderTexture(_width, _height, 24, RenderTextureFormat.BGRA32); play.sendFrameReadyEvents = true; play.frameReady += this.OnNewFrame; play.errorReceived += this.errorReceived; // play.seekCompleted += this.VideoSeekCompleted; play.skipOnDrop = false; _player = play; _player.Prepare(); //setup depth _decoder = new RVLDecoder(depthVideo, _width, _height); // StartCoroutine(_decoder.Prepare()); _decoder.Prepare(); if (_objs != null) { foreach (GameObject g in _objs) { GameObject.Destroy(g); } } _objs = new List <GameObject>(); List <Vector3> points = new List <Vector3>(); List <int> ind = new List <int>(); int n = 0; int i = 0; for (float w = 0; w < _width; w++) { for (float h = 0; h < _height; h++) { Vector3 p = new Vector3(w / _width, h / _height, 0); points.Add(p); ind.Add(n); n++; if (n == 65000) { GameObject a = new GameObject("cloud" + i); MeshFilter mf = a.AddComponent <MeshFilter>(); MeshRenderer mr = a.AddComponent <MeshRenderer>(); mr.material = _mat; mr.material.SetTexture("_ColorTex", play.targetTexture); mf.mesh = new Mesh(); mf.mesh.vertices = points.ToArray(); mf.mesh.SetIndices(ind.ToArray(), MeshTopology.Points, 0); mf.mesh.bounds = new Bounds(new Vector3(0, 0, 4.5f), new Vector3(5, 5, 5)); a.transform.parent = cloudGameobj.transform; a.transform.localPosition = Vector3.zero; a.transform.localRotation = Quaternion.identity; a.transform.localScale = new Vector3(1, 1, 1); n = 0; i++; _objs.Add(a); points = new List <Vector3>(); ind = new List <int>(); } } } GameObject afinal = new GameObject("cloud" + i); MeshFilter mfinal = afinal.AddComponent <MeshFilter>(); MeshRenderer mrfinal = afinal.AddComponent <MeshRenderer>(); mrfinal.material = _mat; mfinal.mesh = new Mesh(); mfinal.mesh.vertices = points.ToArray(); mfinal.mesh.SetIndices(ind.ToArray(), MeshTopology.Points, 0); afinal.transform.parent = cloudGameobj.transform; afinal.transform.localPosition = Vector3.zero; afinal.transform.localRotation = Quaternion.identity; afinal.transform.localScale = new Vector3(1, 1, 1); n = 0; i++; _objs.Add(afinal); points = new List <Vector3>(); ind = new List <int>(); }
public void SetCloudVideo(CloudVideoPlayer video) { _video = video; }
void Start() { _video = new CloudVideoPlayer(cloudConfig, parent); _trackedobj = hand.GetComponent <SteamVR_TrackedObject>(); }