Code Monkey home page Code Monkey logo

sharpphysx's Introduction

SharpPhysX

Status

Current state: Works. API not stable yet.

Track progress here. Items in the Review column are implemented and generally safe to use.

Screenshot

Building

The projects SharpPhysX and DebugRenderer are .NET Standard 2.0, so you can include them in any standard compliant project. The project LibSharpPhysX is a C++ project to build the native C wrapper library, but prebuilt (win32 x86-64) binaries are provided so you don't have to do that.

There are sample projects preconfigured to build and copy the dependencies to the output folder.

.NET Framework

  • Check the project Samples to see how to build.

.NET Core

  • CoreCLR : Check the project Samples.Core. You can build from Visual Studio.
  • CoreRT (AOT): Run the command dotnet publish -r win-x64 -c debug /p:CoreRT=True from the Samples.Core directory (cd into it). Change debug to release in order to produce a release build.

Description

Nvidia PhysX 4 bindings partially generated using my general-purpose C++ binder minBND.

API FAQ

minBND Documentation

Most of the SharpPhysX wrappers and bindings are generated using minBND. For general information about the automatically generated bindings please refer to the minBND bindings user documentation.

TODO CLEAR THIS UP - Why are there SomeTypePtr using directives in auto generated code that seem mostly redundant/useless?

Pointer holder structs are effectively pointers (AKA opaque pointers). These exist to link generated code and catch pointers to pointers. They don't affect user code in any shape or form.

Platforms Support

The bindings are .NET Standard 2.0 and the native wrapper should be compilable with any modern C/C++ compiler. Currently there's a VS solution because of bugs with the CMake integration I don't have time or patience to deal with. Only supported platform is 64-bit, I don't plan to support 32-bit but that should be very trivial if you need that. Attention is paid to keep object binary structure compatible. Objects with inheritance are handled as pointers for increase compatibility due to lack of ABI standardization.

Usage Tips

Use unmanaged references instead of values for performance

Copying values isn't fast. All operations on blittable types have an overload that takes a pointer, using those overloads should be generally faster than passing by value, so for example instead of calling somePxVec3.maximum(someOtherVec3), call the overload with an unmanaged reference (unsafe code): somePxVec3.maximum(&someOtherVec3). Internally SharpPhysX already uses references for maximum performance, the overload that takes a value is there for convenience (so you can for example new them in place), but for maximum performance you can avoid that value copying. Please note that this can be considered micro-optimization, and since the blittables in SharpPhysX aren't large anyway the difference is certainly going to be very marginal in any real-world scenario (think <0.5%).

Future Plans

EasyPhysy

This is going to be a high-level abstraction that makes it very easy to use the library. Not only a very simplified API is planned, but also fully automatic memory management.

sharpphysx's People

Contributors

alan-fgr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharpphysx's Issues

Memory

auto ret = *(new std::remove_pointer<PxGroupsMaskPtr>::type());
auto heap = new char[sizeof PxGroupsMask];

There are many similar writing methods in the code, wouldn't this cause a memory leak?

Ded?

Is this ded? @Alan-FGR r u ded? No activity for while. No answer on gitter. I hope ur ok.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.