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 JernejL » Thu Nov 19, 2009 5:26 pm

Stucuk wrote:
Delfi wrote:for example @array of PNewtonMesh can point to one thing and @array of PNewtonMesh[0] can be on a totally different location.


I have used both of your examples in things before and its never caused any problems. Both have pointed perfectly.


I had a TON of problems related to this when the array is a dynamic array, @array returned me a pointer in front of actual data, likely to some sort of internal structure and @array[0, 0] returned me again a different pointer, to the correct data.
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 Stucuk » Fri Nov 20, 2009 12:52 am

I have uploaded the current Delphi 2.11 header (Since 2.11 is likley to change its classed as a WIP).
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 Dec 29, 2009 10:21 am

Just carying over the discussion from my other thread I thought it would be better to discuss this here. I found a wrong declaration in the header, and since I've been away for some time now I don't know if it's really the fault of the header, as it says it's for 2.11 and I've been testing it with 2.15.

Just for the records, here is the wrong declaration, missing one callback :
Code: Select all
function  NewtonConstraintCreateUserJoint(const NewtonWorld : PNewtonWorld; MaxDOF : Integer; Callback : PNewtonUserBilateralCallBack;
                                         const ChildBody: PNewtonBody; const parentBody: PNewtonBody): PNewtonJoint;
                                          cdecl; external{$IFDEF __GPC__}name 'NewtonConstraintCreateUserJoint'{$ELSE}NewtonDLL{$ENDIF __GPC__};

and this is how it should look like :
Code: Select all
function  NewtonConstraintCreateUserJoint(const NewtonWorld : PNewtonWorld; MaxDOF : Integer; Callback : PNewtonUserBilateralCallBack;
                                          GetInfo : PNewtonUserBilateralGetInfoCallBack; const ChildBody: PNewtonBody; const parentBody: PNewtonBody): PNewtonJoint;
                                          cdecl; external{$IFDEF __GPC__}name 'NewtonConstraintCreateUserJoint'{$ELSE}NewtonDLL{$ENDIF __GPC__};


But since I didn't had the time to do any coding work during the past months (and still dont' have much time at all) it seems that Stu is now updating the header. So if you're willing, I'd like to contribute my changes (will have a look at the header during the next days when I get the time) and will link from my homepage (where the old header is located) to the page with your headers. Would that be an acceptable option for you?
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 » Tue Dec 29, 2009 12:13 pm

Its an error in the header. There are several changes between 2.11 and 2.15 which are not in the header. There is also proberly more errors. One thing to note is that i havn't touched the joint library, some else did the conversion and i haven't updated it. I have sent you FTP login details to the Newton section of my site, so you can upload changes there, or just ignore it.

Ultimately however you want to handle updates is upto you(I still see it as your "baby").
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby JernejL » Tue Dec 29, 2009 2:07 pm

My header based on sury's for 1.53 is without this error as it was incremently updated for each beta release, maybe you can diff the the funcs with mine and detect more errors like that:
http://mathpudding.com/temp/Newton.pas
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 Sascha Willems » Tue Dec 29, 2009 2:11 pm

Thanks for the offer Delfi, but I already uploaded current headers for 2.15 based on Stucuk's. I've compared the new functions directly with the C++ headers and corrected some minor mistakes. The headers can be downloaded here.

Here is my changelog :
Code: Select all
+ Updated to 2.15 Beta
   - NewtonIslandUpdate - Added parameter "world"
   - NewtonDestroyBodyByExeciveForce - Added const for parameter "contact"
   - NewtonCollisionDestructor - Added parameter "World"
   - NewtonBodyIterator - Added parameter "userData"
   - NewtonJointIterator - Added parameter "userData"
   - NewtonWorldForEachJointDo - Added parameter "userData"
   - NewtonWorldForEachBodyInAABBDo - Added parameter "userData"
   - NewtonMeshCreate - Added parameter "world"
   - NewtonMeshCreatePlane - Added parameter "world", renamed "textureMatrix" to "textureMatrix0" and added parameter "textureMatrix1"
   - NewtonMeshCalculateOOBB - Changed dataytpe for "matrix" from Float to PFloat     
+ Updated joint library to 2.15 Beta
   - Added HingeGetJointAngle
   - Added HingeGetPinAxis
   - Added HingeCalculateJointOmega     


I hope it's OK to publish them on my page too, as a lot of people navigate to it in order to get the current headers.
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 » Tue Dec 29, 2009 9:04 pm

Uploaded to my site. As long as you inform me when you have updated it (So i can mirror your updated files) i don't mind. If your wondering why i separated the types from the main newton include it was due to the fact that i use a wrapper i made, so needed a way to get the types without getting the newton functions included. If you want to integrate the files back into one file feel free.
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 » Thu Dec 31, 2009 6:12 am

Just a quick note that 2.16 does not contain any changes in the C-Header, so the pascal headers for 2.15 didn't need an update.
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 Sascha Willems » Thu Dec 31, 2009 7:09 am

Sorry for another posting, but I uploaded a new version of the header package. I reverted back to the old single-file approach, making it easier to migrate old projects (moved the data types back into the header). And I also found out that the NewtonImport_JointLibrary.pas was still pointing to the Newton.dll instead to the JointLibrary.dll, so I also fixed that mistake.
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 Dec 31, 2009 9:48 pm

Uploaded to FME's Newton bit. I modified the readme. Available isn't spelt right (I think it was my mistake). Updated First Post.

P.S In my opinion as long as a post is made at least 30 minutes apart it doesn't fall under the "Double Posting" rules. Anyway, your a mod, so you can do what you like :P .
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Official Pascal-Header (SDK 2.0)

Postby Julio Jerez » Thu Dec 31, 2009 11:21 pm

Hi Sascha,
the last 2.16 containg changes for the joint library only. I added some improvemen to the Plays joint to make it more stable.
if yo uare using the C inteface it will not affect anithing, but it does nee to use the newer DLL and lib.
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 Executor » Thu Mar 04, 2010 4:19 am

Error in pas header 2.15/2.16. In pas file:

Code: Select all
procedure NewtonMeshGetVertexStreams(const mesh : PNewtonMesh; vertexStrideInByte : int; vertex : PFloat; normalStrideInByte : int; normal : PFloat; uvStrideInByte : int; uv : PFloat); cdecl; external{$IFDEF __GPC__}name 'NewtonMeshGetVertexStreams'{$ELSE}NewtonDLL{$ENDIF __GPC__};

procedure NewtonMeshGetIndirectVertexStreams(const mesh : PNewtonMesh; vertexStrideInByte : int; vertex : PFloat; vertexIndices : PInt; vertexCount : PInt; normalStrideInByte : int; normal : PFloat; normalIndices : PInt; normalCount : PInt; uvStrideInByte : int; uv : PFloat; uvIndices : PInt; uvCount : PInt); cdecl; external{$IFDEF __GPC__}name 'NewtonMeshGetIndirectVertexStreams'{$ELSE}NewtonDLL{$ENDIF __GPC__};


In newton.h:

Code: Select all
   NEWTON_API void NewtonMeshGetVertexStreams (const NewtonMesh *mesh,
                                    int vertexStrideInByte, dFloat* vertex,
                                    int normalStrideInByte, dFloat* normal,
                                    int uvStrideInByte0, dFloat* uv0,
                                    int uvStrideInByte1, dFloat* uv1);
   NEWTON_API void NewtonMeshGetIndirectVertexStreams(const NewtonMesh *mesh,
                                          int vertexStrideInByte, dFloat* vertex, int* vertexIndices, int* vertexCount,
                                          int normalStrideInByte, dFloat* normal, int* normalIndices, int* normalCount,
                                          int uvStrideInByte0, dFloat* uv0, int* uvIndices0, int* uvCount0,
                                          int uvStrideInByte1, dFloat* uv1, int* uvIndices1, int* uvCount1);


No uv1 in pas file.
Executor
 
Posts: 25
Joined: Fri Sep 04, 2009 7:01 am

Re: Official Pascal-Header (SDK 2.0)

Postby Stucuk » Thu Mar 04, 2010 11:26 am

Updated the header.
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 » Thu Mar 04, 2010 11:40 am

Same over here, thanks for reporting this mistake.
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 Igroman » Tue May 25, 2010 2:57 pm

Hi, please see the procedure NewtonCollisionForEachPolygonDo, there is an incorrect name in the ad defayne __GPC__
Code: Select all
procedure NewtonCollisionForEachPolygonDo (const collision : PNewtonCollision; const matrix : PFloat; callback : NewtonCollisionIterator; UserData : Pointer);cdecl; external{$IFDEF __GPC__}name 'NewtonReleaseCollision'{$ELSE}NewtonDLL{$ENDIF __GPC__};

--NewtonReleaseCollision ??

Sorry for bad English:)
User avatar
Igroman
 
Posts: 1
Joined: Tue Sep 09, 2008 2:20 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron