jar2333 / mruby-ode

mruby bindings for the Open Dynamics Engine library
BSD 4-Clause "Original" or "Old" License
1 stars 0 forks source link

Object-oriented bindings for ODE API #1

Open jar2333 opened 1 year ago

jar2333 commented 1 year ago

The ODE API as described in the manual is very easy to express in an object oriented way, using objects and methods. Each dXID type in the ODE API can have a corresponding X Ruby class to wrap it, with each of the API functions bound to some method of that class. These are:

The C free function invoked by the GC that the mruby API requires for objects of these classes can just be a simple wrapper call over the appropriate ODE destroy functions. As such (I expect) these do not need to be exposed. Conversely, the create ODE functions are called in the corresponding Ruby initialize method.

The mathematical primitives which are implemented in ODE as type aliases of dReal array types should also be wrapped in Ruby classes:

For pointer arguments which are used to return multiple values at once, returning a Ruby array with the values might be the most idiomatic way of returning those values (open to correction).

Class aliases and an ode namespace can be added if deemed convenient/useful.

Ruby conventions for setters/getters should be respected.

jar2333 commented 1 year ago

This header of the ODE library provides the definitions of ODE types, which is useful to know for this project. All the dXID types are pointers, and the dReal type is either a float or double depending on the configuration or compiler definitions used when building ODE. The Quaternion, Matrix, and Vector definitions are shown in the manual, but knowledge of how these other types are implemented is assumed as well.

jar2333 commented 1 year ago

Once this issue is closed, the library can have its first release with barebones functionality (and bugs).

jar2333 commented 1 year ago

World class has been implemented