Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# & Unity Development #3285

Merged
merged 6 commits into from Feb 21, 2019
Merged

Conversation

ogoshen
Copy link
Contributor

@ogoshen ogoshen commented Feb 19, 2019

Changes

  • Major (Breaking) Change ⚠️

    Added Is(Extension) and As<T> for casting

    This means that the following are no longer supported and evaluate to true:

    GetStream(Stream.Color) as VideoStreamProfile == null;
    FirstOrDefault(Stream.Depth) as DepthFrame == null;
    WaitForFrame() as VideoFrame == null;

    You should either explicitly cast the results:

    GetStream(Stream.Color).As<VideoStreamProfile>();
    FirstOrDefault(Stream.Depth).As<DepthFrame>();
    WaitForFrame().As<VideoFrame>();

    Or better yet, look for a generic version, these are usually more optimized:

    GetStream<VideoStreamProfile>(Stream.Color);
    FirstOrDefault<DepthFrame>(Stream.Depth);
    WaitForFrame<VideoFrame>();

    ❗ These changes won't be caught at compile-time and failing to update your code will result in runtime exceptions

    There are several reasons for doing this:

    • Explicit is better than implicit
    • No more branching guess-work to figure out the proper type
    • Similarity to C++ API
  • Added motion and pose support (D435i, T265 & software device)

  • Added frame metadata support

  • Took pools out of individual types and added ObjectPool

  • Added math types to Intel.RealSense.Math

  • Points.CopyTo(Vertex[] array) changed to Points.CopyVertices<T>(T[] vertices) for better support of external types like UnityEngine.Vector3, System.Numerics.Vector3 (SIMD) or plain old float[]. Same for texture coordinates.

  • Removed IEnumerable<Frame> from Pipeline and FrameQueue

    Implementation was wrong and it didn't make much sense anyway...
    What we really want is probably IAsyncEnumerable \ AsyncEnumerator \ System.Reactive extensions.

  • Runtime platform detection for memcpy on Linux \ Android (MacOS untesed)

  • Continued refactoring classes and folders

@dorodnic dorodnic added the .NET label Feb 19, 2019
@ogoshen
Copy link
Contributor Author

ogoshen commented Feb 19, 2019

Should solve advanced mode & json loading issues in #2854, #3250, #3275

@dorodnic
Copy link
Contributor

Tested with Visual Studio 2015
LGTM

@dorodnic dorodnic merged commit 2f9c899 into IntelRealSense:development Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants