Official Pascal-Header (SDK 2.0)

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Official Pascal-Header (SDK 2.0)

Postby Julio Jerez » Mon Feb 21, 2011 3:50 pm

I agree that soudn lie a good idea
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Official Pascal-Header (SDK 2.0)

Postby JernejL » Tue Feb 22, 2011 4:17 am

Julio: maybe you can add a "wrappers" directory in svn we can use for other programming language headers & wrappers.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Official Pascal-Header (SDK 2.0)

Postby ledahut » Tue Feb 22, 2011 5:00 am

NewtonWorldConvexCast is a function in newton.h and wiki (return int the number of contact).
In Pascal header this function is declared as procedure.
-----
Headers on SVN --> yes in condition that every commit have comments in svn.
Actually Julio does not comment each revision because they are maybe minors update.
But if you (sascha, stucuk...) could be more rigorous and also write history in file, this will be good. (If some days SVN server crash and loose every comments, they will be save in file).
ex: https://glscene.svn.sourceforge.net/svn ... LState.pas
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France

Re: Official Pascal-Header (SDK 2.0)

Postby Sascha Willems » Tue Feb 22, 2011 7:36 am

As for the header being "merged" into the SVN : I'd happily do this, though you need to realize that I won't always be able to update it as quickly as possible (you know, real life is taking of my spare time), but I also think it would be a good idea to directly put it into the SVN so that Delphi/Pascal users also get it when they download the latest release.

ledahut wrote:NewtonWorldConvexCast is a function in newton.h and wiki (return int the number of contact).
In Pascal header this function is declared as procedure.

Thanks for the info. I fixed this and reuploaded to header.

ledahut wrote:Headers on SVN --> yes in condition that every commit have comments in svn.
Actually Julio does not comment each revision because they are maybe minors update.
But if you (sascha, stucuk...) could be more rigorous and also write history in file, this will be good. (If some days SVN server crash and loose every comments, they will be save in file).
ex: https://glscene.svn.sourceforge.net/svn ... LState.pas

Well, I document every change within the header itself and als within the readme.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Re: Official Pascal-Header (SDK 2.0)

Postby ledahut » Tue Feb 22, 2011 8:43 am

Well, I document every change within the header itself and als within the readme.

Yes sorry I forgot the readme :)
Its fine like that, if the readme is on the depot as well.
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France

Re: Official Pascal-Header (SDK 2.0)

Postby Julio Jerez » Tue Feb 22, 2011 9:15 am

gives me a few more days until everything stabilizes a litle more in source control,
I am still adding the Mac stuff and some directories structures may still change as I found out that source control is very, very different from client to client.

hopefully this week all will be completed.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Tue Feb 22, 2011 1:55 pm

Delfi wrote:Here is a suggestion: the delphi header could be now merged and added & distributed with the offical newton SVN repository.

This will proberly surprise you, but i think its a good idea since it localizes everything related to Newton to one thing. See, i don't hate SVN, just think its pointless for only a header by its self.

@History: I think i have always logged changes in the Readme, not 100% sure if i did every time.

Sascha Willems wrote:As for the header being "merged" into the SVN : I'd happily do this, though you need to realize that I won't always be able to update it as quickly as possible (you know, real life is taking of my spare time)

Once i get back to making my game i will start to help, currently what i am working on doesn't use Newton, so i haven't touched the headers.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Sascha Willems » Tue Feb 22, 2011 2:16 pm

Julio Jerez wrote:give a few more day ontil everything stabilize a litle more in sorce control,
I am still adding the Mac stuff and some directory structure may still change as I found out that source control in very, very different from client to client.

hopefully this week all will be completed.


Just take your time Julio. Though as far as I can see the pascal crowd is pretty excited. Actually almost everybody doing something with physics in the delphi/pascal community is using Newton, so going open source and getting more updates is a well received news, though most people wont' be able to use the source, they'd surely welcome seing the delphi/pascal header being added to the official repository.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Thu Feb 24, 2011 3:30 am

Sascha Willems wrote:Actually almost everybody doing something with physics in the delphi/pascal community is using Newton

And the other physics libraries can blame you for there loss. Its all down to your Delphi Newton Physics Tutorials and generally upto date headers imo. At least thats why i started using Newton.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Mon Mar 28, 2011 1:36 pm

Sascha if you upload your header to the SVN either modify my first post in this topic(I think you have the forum permissions to do so) to tell people they can get the latest from the SVN or inform me and ill modify it.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Sascha Willems » Mon Apr 04, 2011 7:54 am

I just updated the headers to 2.33, you can grab them over here.

Note : I noticed Julio added a lot of additional consts to many of the functions. I don't think its' necessary (or gains any speed) in delphi as most parameters are declared as const anyway. So I didn't add those changes, but if someone knows more about wether i'd be a good idea to add these changes or not, drop me a line and I'll see if I'll change it.

Changelog :
Code: Select all
  Changes on 04.04.2011 by Sascha Willems (SW)
   + Updated to 2.33
      - Added NewtonSceneSetProxyUserData
      - Added NewtonSceneGetProxyUserData
      - Added NewtonMeshCreateFirstLayer
      - Added NewtonMeshCreateNextLayer
      - Added NewtonMeshConvexDecomposition
      - Added NewtonMeshVoronoiDecomposition
   + Added NewtonSceneGetFirstProxy (missed in previous release)
   + Added NewtonSceneGetNextProxy (missed in previous release)
   + Added NewtonUserJointSetFeedbackCollectorCallback (missed in previous release)
   + Fixed declaration for NewtonCollisionSetMaxBreakImpactImpulse
   + Fixed several minor spelling errors
   + Some cosmetic changes
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Re: Official Pascal-Header (SDK 2.0)

Postby Julio Jerez » Mon Apr 04, 2011 8:43 am

the cosnt in c++ ar imprtant for platform other tha intel cpu.

for example say you have a loop

Code: Select all
void function (int * array)
{
    // this is promp to poiter alias sinc ein c++ pointe are simpel vareables
   // althoght micorcrosoft compiler is caplable of generating good code for this
   // in more compel loop with mor evariable anr registe spill, this code becoem less efficnt
   for (i = 0; i < 100; i ++) {
  {
       // ok on older x86 CPU, but very bad on any risk CPU
       *array++ = i;
  }
}


this funtion in c++ will be the same in for x86
but on a platform with an IBM g5 or ARM, or any of those Movile CPUs the function will be less inificient because the rules of C++ allow the the array itselft to be modified

if the function is writen like this
Code: Select all
void function (int* const array)
{
    // this will be generate better inner loop sinc eth copiler is free to cache array int a resister wjith oput worrie of pointer alias
   // any compiler generate and very tight code for this or any loop whe the pointer are const.
   // more complex loop with more evariable and register spill, this even teh mocrosft compiler produce very Registe assigment, knwoing which veriable are very candidate for caching in registers
   for (i = 0; i < 100; i ++) {
  {
        // this is now a compiler error
       //*array++ = i;         

       // this much beter code generation on must modern CPUs, specilly Risk
       array[i] = i;
  }
}


the compile is free to put array int a register and in the loop never worried to reload constant again.
this, even an intel of GCC copiler for smalll funtion is campable of generating better ABA code when the argument are const,
that way they compiler do not have to guess wht veriable are condidate to cache in register without the risk of pointer aliasing.

microsoft prouced the C++ strict extension bu tat is onlt a microsft thing and dos no really work very well
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Official Pascal-Header (SDK 2.0)

Postby Sascha Willems » Mon Apr 04, 2011 9:05 am

Thanks for that info Julio, but that's not exactly what I was refering to. What I actually mean is this :

2.32 :
Code: Select all
typedef void (*NewtonDestroyWorld) (const NewtonWorld* newtonWorld);


2.33 :
Code: Select all
typedef void (*NewtonDestroyWorld) (const NewtonWorld* const newtonWorld);


You added a second const to man of the parameters, and that's what I was asking about. I know that using const in Delphi at least may give some performance benefit cause it basically makes parameters read-only. But what I wonder is the second const, something I've never seen and I'm not sure wether it's even possible in Delphi.

So that's what I was wondering about, cause now you added that second const to many of the functions. Does that have the same reason, aka differen plattforms than Intel?
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Re: Official Pascal-Header (SDK 2.0)

Postby Julio Jerez » Mon Apr 04, 2011 10:16 am

the secund const is what make the code better.

the fist const mean teh data is read only, and that is also cool

but the secund const is the most imporant because it mean the variable the holding the pointer will not change via any indirect assigment.
alwing teh compiler to freelly cache it into a register, and never reload it.

with the veriable you cna set teh copiler optimization to be veru agresive, liek assume No aliasing whin in visual studio most teh time generate bogus code.
I did not use very agregrasive in 200 yet, but I am doing it in sdk 300, those changes you see in 200 are because wnat I make a change in 300 tha can be benfiacl to 200 I merge the file wih Araxis.


Most languages fortan and I beleive Pascal, do not allow for pointesr to be variables, therfore they do no need that, in C and C++ a pointer are just a simple variables and that is the thing
that, for the most part makes C and C++ to be at disavatage with other languages.
Using const on Pointer make then even
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Official Pascal-Header (SDK 2.0)

Postby Sascha Willems » Wed Apr 13, 2011 8:47 am

I updated my headers to revision #1. I forgot to change parameters for some of the contact process related functions from 2.32 to 2.33 :
Code: Select all
  Changes on 12.04.2011 by Sascha Willems (SW)
   + Fixed paramters for NewtonMaterialGetContactForce
   + Fixed paramters for NewtonMaterialGetContactPositionAndNormal
   + Fixed paramters for NewtonMaterialGetContactTangentDirections

The download url stays the same (http://www.saschawillems.de/download/ne ... 3_beta.zip).

Note that due to the many changes made by Julio in 2.33 (adding contsts etc.) it's a bit hard to do a diff for updating my headers, so there may still be some functions that have wrong paramters or declarations, but for now most of the things seem to work as supposed. If you encounter any problems with the header that may be caused by wrong declarations, please drop me a line.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 17 guests

cron