public override void ProcessMainThread(ref TxEyesOutput result) { if (_processorThread == null || _processorThread.IsDone) { return; } if (!_inited) { _config = result.Configuration.CamerConfigurationsStr; } _InitTextures(result.Configuration.FrameSize); Process(); //if (_ready) _updateTextures(); result.Configuration.PixelShiftLeft.x = result.Configuration.PixelShiftLeft.y = 0; result.Configuration.PixelShiftRight.x = result.Configuration.PixelShiftRight.y = 0; { result.SetTexture(_textures [0], 0); result.SetTexture(_textures [1], 1); // _ready = false; } }
void Init() { _videoValues = new NetValueObject(); Output = new TxEyesOutput(); Output.Configuration = new CameraConfigurations(); // if (ParameterController != null) // ParameterController.TargetValueObject = _videoValues; }
public override void OnInputDisconnected(NodeBase src, string srcSlotName, string targetSlotName) { base.OnInputDisconnected(src, srcSlotName, targetSlotName); if (targetSlotName == "set_Eyes") { Eyes = null; } }
public override void ProcessMainThread(ref TxEyesOutput result) { if (_texture.StreamsCount == 0) { return; } Parameters.frameSize = result.Configuration.FrameSize; Texture srcTex = _texture.GetEyeTexture(0); if (srcTex == null) { return; } Texture[] tex = new Texture[4]; Texture[] tex2 = new Texture[4]; Rect texRect = new Rect(0, 0, 1, 0.25f); for (int i = 0; i < 4; ++i) { _SrcBlitter[i].ProcessingMaterial.SetVector("TextureRect", new Vector4(texRect.x, texRect.y, texRect.width, texRect.height)); tex[i] = _SrcBlitter[i].ProcessTextureSized(srcTex, (int)(texRect.width * srcTex.width), (int)(texRect.height * srcTex.height)); //CamTexture;// texRect.y += 0.25f; } InitResults(4); for (int i = 0; i < 4; ++i) { tex2[i] = BlitImage(tex[i], i, new Vector2(1, 0.5f)); } //combine textures if (CombinedTexture == null || CombinedTexture.width != Parameters.frameSize.x * 2 || CombinedTexture.height != Parameters.frameSize.y) { CombinedTexture = new RenderTexture((int)Parameters.frameSize.x * 2, (int)Parameters.frameSize.y, 24, RenderTextureFormat.Default); } RenderTexture.active = CombinedTexture; GL.Clear(true, true, Color.black); GL.PushMatrix(); GL.LoadPixelMatrix(0, CombinedTexture.width, CombinedTexture.height, 0); Graphics.DrawTexture(new Rect(0, 0, tex2[0].width, tex2[0].height), tex2[0], _blitMtrl); Graphics.DrawTexture(new Rect(tex2[0].width, 0, tex2[0].width, tex2[0].height), tex2[1], _blitMtrl); Graphics.DrawTexture(new Rect(0, tex2[0].height, tex2[0].width, tex2[0].height), tex2[2], _blitMtrl); Graphics.DrawTexture(new Rect(tex2[0].width, tex2[0].height, tex2[0].width, tex2[0].height), tex2[3], _blitMtrl); GL.PopMatrix(); RenderTexture.active = null; result.SetTexture(CombinedTexture, 0); //Texture2D resultTex= _wrapper.ConvertRenderTexture (CombinedTexture); //_ovrProcessor.processedTex = resultTex; //_ovrProcessor.ProcessMainThread (ref result); }
// Use this for initialization void Start() { if (OculusCamera == null) //Try to find OVRCameraRig component { OculusCamera = GameObject.FindObjectOfType <OVRCameraRig> (); } if (TargetMaterial == null) { TargetMaterial = new Material(Shader.Find("Telexistence/Demo/WebCamShader")); } _processed = new TxEyesOutput(); }
public override void ProcessMainThread(ref TxEyesOutput result) { if (_texture.StreamsCount == 0) { return; } Parameters.frameSize = result.Configuration.FrameSize; InitResults(_texture.CameraStreams); if (_SrcBlitter == null || _SrcBlitter.Length != result.Configuration.CameraStreams) { _SrcBlitter = new OffscreenProcessor[result.Configuration.CameraStreams]; for (int i = 0; i < result.Configuration.CameraStreams; ++i) { _SrcBlitter [i] = new OffscreenProcessor(); _SrcBlitter[i].ShaderName = "Image/Blitter"; _SrcBlitter[i].TargetFormat = RenderTextureFormat.Default; _SrcBlitter[i].TargetFormat = RenderTextureFormat.ARGB32; } } Rect texRect = new Rect(0, 0, 1, 1.0f / _texture.CameraStreams); var srcTex = _texture.GetEyeTexture(0); if (srcTex == null) { return; } Texture tex = srcTex; result.SetSourceTexture(srcTex, 0); for (int i = 0; i < _texture.CameraStreams; ++i) { if (_texture.CameraStreams > 1) { _SrcBlitter [i].ProcessingMaterial.SetVector("TextureRect", new Vector4(texRect.x, texRect.y, texRect.width, texRect.height)); tex = _SrcBlitter[i].ProcessTextureSized(srcTex, (int)(texRect.width * srcTex.width), (int)(texRect.height * srcTex.height)); texRect.y += texRect.height; } var t = BlitImage(tex, i, new Vector2(1, 1)); if (t != null) { result.SetTexture(t, i); } } }
public override void ProcessMainThread(ref TxEyesOutput result) { if (result.Configuration.SeparateStreams) { for (int i = 0; i < _texture.GetTexturesCount(); ++i) { result.SetTexture(_texture.GetEyeTexture(i), i); } } else { if (_texture.GetTexturesCount() == 0) { return; } if (_SrcBlitter == null || _SrcBlitter.Length != result.Configuration.CameraStreams) { _SrcBlitter = new OffscreenProcessor[result.Configuration.CameraStreams]; for (int i = 0; i < result.Configuration.CameraStreams; ++i) { _SrcBlitter [i] = new OffscreenProcessor(); _SrcBlitter[i].ShaderName = "Image/Blitter"; _SrcBlitter[i].TargetFormat = RenderTextureFormat.Default; _SrcBlitter[i].TargetFormat = RenderTextureFormat.ARGB32; } } Rect texRect = new Rect(0, 0, 1, 1.0f / (float)result.Configuration.CameraStreams); var tex = _texture.GetEyeTexture(0); for (int i = 0; i < result.Configuration.CameraStreams; ++i) { _SrcBlitter[i].ProcessingMaterial.SetVector("TextureRect", new Vector4(texRect.x, texRect.y, texRect.width, texRect.height)); var t = _SrcBlitter[i].ProcessTextureSized(tex, (int)(texRect.width * tex.width), (int)(texRect.height * tex.height)); //CamTexture;// result.SetTexture(t, i); texRect.y += texRect.height; } } }
public override void ProcessTextures(ref TxEyesOutput result) { }
public virtual void ProcessMainThread(ref TxEyesOutput result) { }
public virtual void ProcessTextures(ref TxEyesOutput result) { }
public override void ProcessTextures(ref TxEyesOutput result) { base.ProcessTextures(ref result); _ovrProcessor.ProcessTextures(ref result); }
void OnEyesOutputChanged(TxEyesOutput output) { CreateRenderers(); }