Newton 4.00

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 4.00

Postby JernejL » Thu Oct 08, 2020 8:10 am

I can make a wrapper on pascal side when that is done, but the implementation of methods to use wrapper has to be most definetly be done in c++
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 08, 2020 10:13 am

we can combine effort, I start teh ndNewtonC library
this is hwo it can be set in CMake for making the c library only.
Untitled.png
Untitled.png (38.99 KiB) Viewed 11913 times


this will create a c interface in the and the Install place in the win32sdk
or whatever destination the user specify.

is does no generate any c export yet, later I will start form teh top with the ndWorld, and maybe the KinematicBody. then after that teh people interested it can extend by adding the C Wrapper class and c file and provide cmake patched.

I though I automatic conversion using Swig but that's makes too complicated. It is better to make a hand made C wrapper and is more legible and more efficient.
this time will will make one header one file, rather thet the one long file it was with 3.14

I think this way is more flexible and eassy to maintain since C is compatible with all languages, and C Make make eassy to do teh export.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 08, 2020 10:14 am

the C interface will be a single dll, with not option for static library since is intended for wrappers or language that do not interface eassy with cpp

I added the first c interface, the one that create and destroy teh world.

people interested in pascal and delfi can try and see if this is a good solution for making the wrapper simpler to implement.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 08, 2020 10:42 am

ok now there is a mockup of a beginning of the C project.
It allows to create and destroy the world, and that's it, but is good for seeing if this is a possible solution before we move on.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby JernejL » Thu Oct 08, 2020 1:41 pm

the biggest problems would be probably callbacks, returning objects as pointers are of no issue, but if a callback requires an object, it's probably not possible to implement in C interface like that.

A userdata pointer system like it was in use for pointers can work.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 08, 2020 2:35 pm

how was done in 3.14? for example how the force and torque call back worked before?

I added a sample that set a memory allocation callback.
can you see if that would work?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 08, 2020 10:59 pm

JernejL wrote:the biggest problems would be probably callbacks, returning objects as pointers are of no issue, but if a callback requires an object, ...


ok I believe this answer the callback question.
for a body the transform and forceand torque are set liek this

Code: Select all
   typedef void* ndBodyDynamicC;
   typedef void(*ndForceAndTorque) (ndBodyDynamicC body, dFloat32 timestep);
   typedef void(*ndSetTransform) (ndBodyDynamicC body, const dFloat32* const matrix);

   NEWTON_API void ndBodyDynamicSetCallbacks(ndBodyDynamicC body, void* const usedData, ndForceAndTorque forceAndTorque, ndSetTransform transform);


and the basics demo show hwo they are set like this.
Code: Select all
static void ForceAndTorqueCallback (ndBodyDynamicC body, dFloat32 timestep)
{
}

static void SetTransformCallback(ndBodyDynamicC body, const dFloat32* const matrix)
{
}

ndBodyDynamicSetCallbacks(body, nullptr, ForceAndTorqueCallback, SetTransformCallback);



if you sync and you buidl the NewtonC you can see the demo. teh use dat is set to null because there are no use dat in teh demo, but could be any pointer like is was in 3.14

if this scan be translate to Pascal, then we can we can follow the same method for all other call backs. the cool part is that any one can extend it however the like.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby Dave Gravel » Fri Oct 09, 2020 1:17 am

It work good for me, Currently it is pretty much like 3.14 implementation cool.
https://sites.google.com/site/oxnewton/ox3d_newton4.pas
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Newton 4.00

Postby Julio Jerez » Fri Oct 09, 2020 12:39 pm

ok the c interface with a demo in now in.
I like to think is simper to set up than 3.14
at least the code is spread on multiple files, so that is easier to track and maintain functionality.

I am now going back to the main engine and later I will add more stuff but any one can add funtionality and provide patch that I can integrate.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby staseg » Sun Oct 11, 2020 9:23 am

I want to take part in Newton 4 developement. I am C++ dev, I have graphics/rendering background with vector math, game programming with UE4. Can you give me some advice? Steps to learn first, etc...
My public repo is old, anyway: https://github.com/smarchevsky/
staseg
 
Posts: 4
Joined: Sun Jun 17, 2018 2:01 pm

Re: Newton 4.00

Postby staseg » Sun Oct 11, 2020 9:27 am

And I have a question, why you don't create a separate repository for Newton 4?
staseg
 
Posts: 4
Joined: Sun Jun 17, 2018 2:01 pm

Re: Newton 4.00

Postby Julio Jerez » Mon Oct 12, 2020 11:44 am

all you have to do is download the sdk and try. you can make your branch and experiment with it, if you feel like you have something to contribute you can send me a patch.
if it is useful I can integrated it.

I like to keep track of the old system. Until now each version of the engine is as been a continue re write on top of the existing version and is difficult to trace back milestones.

now I am keeping the two version separate so that they can diverge at some point. they are still on the same archive so that is eassy to compere versions. and copy funtionality from one to the other.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 4.00

Postby Leadwerks » Sat Oct 17, 2020 4:34 am

C++11 shared and weak pointers have been a godsend for me, they're extremely fast, and they work extremely well with multithreading. There's no way I would be able to write my current software without them.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Newton 4.00

Postby Slick » Thu Oct 22, 2020 8:30 am

How much work will It be to switch to the 4.0 branch? I'm sure that I will at some point.

It looks to me that most items are already in 4.0.
Slick
 
Posts: 330
Joined: Sat Feb 07, 2004 7:24 pm
Location: LA last and France now

Re: Newton 4.00

Postby Julio Jerez » Thu Oct 22, 2020 10:44 am

I estimate abpout 60% is already in.
teh big missing feature are the Collsion tree (in progress), terrain collision and soem oeth lesser use shapes. then the Joints, and the listeners.
then some other stuff like the fracture and mesh utility but are use by few people.

you can try it out, and tell me your impression.
I'd like to think is an easier api to used.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests