public void OnNewFrame(Astra.ColorizedBodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } if (_lastFrameIndex == frame.FrameIndex) { return; } _lastFrameIndex = frame.FrameIndex; EnsureTexture(frame.Width, frame.Height); _texture.LoadRawTextureData(frame.DataPtr, (int)frame.ByteLength); // .material.SetTexture("_MainTex", _texture); MeshRenderer mr = GetComponent <MeshRenderer>(); MaterialPropertyBlock mpb = new MaterialPropertyBlock(); mr.GetPropertyBlock(mpb); mpb.SetFloat("_Outline", true ? 1f : 0); mpb.SetColor("_OutlineColor", new Color(0, 0, 0)); mr.SetPropertyBlock(mpb); _texture.Apply(); }
public void OnNewFrame(Astra.ColorizedBodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } if (_lastFrameIndex == frame.FrameIndex) { return; } _lastFrameIndex = frame.FrameIndex; EnsureTexture(frame.Width, frame.Height); _texture.LoadRawTextureData(frame.DataPtr, (int)frame.ByteLength); _texture.Apply(); }
public void OnNewColorizedBodyFrame(Astra.ColorizedBodyFrame frame) { if (frame.Width == 0 || frame.Height == 0) { return; } //This is default, but I would assume astra only calls "onNewFrame" once fram index has changed in the first place?? if (_lastFrameIndex == frame.FrameIndex) { //return; } _lastFrameIndex = frame.FrameIndex; //print("Mask frame x: " + frame.Width + "y: " + frame.Height); //EnsureTexture(frame.Width, frame.Height); _texture.LoadRawTextureData(frame.DataPtr, (int)frame.ByteLength); // _texture.Apply(); }