/// <summary> /// Get a DepthFrame in the form of Texture2D. /// For platforms with ComputeShader support, it may be slower than GetRenderTexture. /// If possible, use GetRenderTexture. /// </summary> /// <param name="gradient"> Gradient for depth coloring, where the light at 0 corresponds to the nearest /// point to the sensor, at 1 further point from the sensor.</param> /// <param name="textureCache">(optional) If you want to get a separate copy of the texture, /// and not a cached version, pass a reference to the local texture (may affect performance)</param> /// <returns>DepthFrame converted to Texture2D</returns> public static Texture2D ToTexture2D(this DepthFrame frame, Gradient gradient = null, TextureCache textureCache = null) { return(FrameUtils.DepthToTexture.GetTexture2D(frame, gradient, textureCache)); }
/// <summary> /// See the method description: <see cref="FrameToTexture{T, U}.GetTexture(T, TextureCache)"/> /// </summary> /// <param name="textureCache">(optional) If you want to get a separate copy of the texture, /// and not a cached version, pass a reference to the local texture (may affect performance)</param> /// <returns>Texture = (RenderTexture or Texture2D)</returns> public static Texture ToTexture(this ColorFrame frame, TextureCache textureCache = null) { return(FrameUtils.RGBToTexture.GetTexture(frame, textureCache)); }
/// <summary> /// Get the DepthFrame as a RenderTexture. /// Recommended method for platforms with ComputeShader support. /// </summary> /// <param name="gradient"> Gradient for depth coloring, where the light at 0 corresponds to the nearest /// point to the sensor, at 1 further point from the sensor.</param> /// <param name="textureCache">(optional) If you want to get a separate copy of the texture, /// and not a cached version, pass a reference to the local texture (may affect performance)</param> /// <returns>DepthFrame converted to RenderTexture</returns> public static RenderTexture ToRenderTexture(this DepthFrame frame, Gradient gradient = null, TextureCache textureCache = null) { return(FrameUtils.DepthToTexture.GetRenderTexture(frame, gradient, textureCache)); }
Texture2D GetCPUTexture(UserFrame frame, TextureCache textureCache, Color[] userColors = null) { ref Texture2D destTexture = ref textureCache.texture2D;
Texture2D GetCPUTexture(ColorFrame frame, TextureCache textureCache) { ref Texture2D destTexture = ref textureCache.texture2D;
Texture2D GetCPUTexture(DepthFrame frame, TextureCache textureCache, Gradient gradient) { ref Texture2D destTexture = ref textureCache.texture2D;
/// <summary> /// Get the frame as a RenderTexture. /// Recommended method for platforms with ComputeShader support. /// </summary> /// <param name="SourceFrame">Source frame of nuitrack.Frame</param> /// <param name="textureCache">(optional) If you want to get a separate copy of the texture, /// and not a cached version, pass a reference to the local texture (may affect performance)</param> /// <returns>Frame converted to RenderTexture</returns> public abstract RenderTexture GetRenderTexture(T SourceFrame, TextureCache textureCache = null);
/// <summary> /// Get a frame in the form of Texture2D. /// For platforms with ComputeShader support, it may be slower than GetRenderTexture. /// If possible, use GetRenderTexture. /// </summary> /// <param name="SourceFrame">Source frame of nuitrack.Frame</param> /// <param name="textureCache">(optional) If you want to get a separate copy of the texture, /// and not a cached version, pass a reference to the local texture (may affect performance)</param> /// <returns>Frame converted to Texture2D</returns> public abstract Texture2D GetTexture2D(T SourceFrame, TextureCache textureCache = null);