Voxel Engine?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Voxel Engine?

Postby Carli » Mon Mar 01, 2010 2:09 pm

???????

i'm talking about that the free pascal header has a wrong pointer datatype - that has nothing to do with a floating point exception!!!!
i changed the header so that it works and if someone wants to update the official headers, too, he can do it.

back to topic: if anyone wants to see the result just watch this:
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby kallaspriit » Mon Mar 01, 2010 3:58 pm

The collisions and behavior looks somewhat wrong, are you sure you have correct inertias and everything?
kallaspriit
 
Posts: 216
Joined: Sun Aug 14, 2005 6:31 pm

Re: Voxel Engine?

Postby Carli » Mon Mar 01, 2010 4:27 pm

I'm using convex hulls and for convex hulls, i don't know any formulas to compute inertia.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby JernejL » Mon Mar 01, 2010 5:54 pm

NewtonConvexCollisionCalculateInertialMatrix does ;)

The shapes here i'm seeing are voxels using a user mesh? it looks nice, what's the memory usage / world size limit on that?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Voxel Engine?

Postby Julio Jerez » Mon Mar 01, 2010 6:17 pm

wow this is very intriging.
are you making convex on the flight?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Voxel Engine?

Postby Carli » Tue Mar 02, 2010 6:25 am

yes.

i'm using the naive idea that every voxel is a convex hull of 8 points and each 8x8x8 voxels are joined into one compound collision. (and 8x8x8 blocks are updated together)

the total memory of the engine is 12.5 MB in the GUI and about 50 MB while playing

In my older experiments, the auto inertia calculation failed, but now it looks pretty good.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby Stucuk » Tue Mar 02, 2010 8:54 am

Carli wrote:i'm talking about that the free pascal header has a wrong pointer datatype - that has nothing to do with a floating point exception!!!!
i changed the header so that it works and if someone wants to update the official headers, too, he can do it.


By Free Pascal Header do you mean This(Its not a "Free Pascal Header" but a Pascal Header(Difference is that its designed for both Delphi and Free Pascal)? I don't see whats different between your version and the official version except that your doing Bla = ^Pointer; PBla = ^Bla; where PBla should just be the same data type as Bla and that your removing the array.

Maybe we could set the current header into a repository for that everyone can add fixes or updates and I even can have the latest version of it as a subrepos of my project. (i'm using mercurial hg version control)


That would be over the top in my oppinion. For a project, version control may be needed. But for a header, there wouldn't be any benefit. You can just run a Diff program manualy to see what the changes were.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Voxel Engine?

Postby Carli » Tue Mar 02, 2010 1:04 pm

Stucuk wrote:By Free Pascal Header do you mean This(Its not a "Free Pascal Header" but a Pascal Header(Difference is that its designed for both Delphi and Free Pascal)? I don't see whats different between your version and the official version except that your doing Bla = ^Pointer; PBla = ^Bla; where PBla should just be the same data type as Bla and that your removing the array.


There is even the array that causes the error:
Code: Select all
type
  TCollisionPrimitiveArray = array of PNewtonCollision;

function NewtonCreateCompoundCollision( const newtonWorld : PNewtonWorld; count : int;
                                        const collisionPrimitiveArray : TcollisionPrimitiveArray; shapeID : Int ) : PNewtonCollision; cdecl; external{$IFDEF __GPC__}name 'NewtonCreateCompoundCollision'{$ELSE}NewtonDLL{$ENDIF __GPC__};


Just replace the "array of PNewtonCollision" through a "^PNewtonCollision", then it will work with FPC 2.4.0, too.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby Stucuk » Tue Mar 02, 2010 1:15 pm

How is that an error? Also as i keep saying how does doing ^PNewtonCollision help? PNewtonCollision is already set to ^Pointer, so doing ^ to the PNewtonCollision will not be any different than using the PNewtonCollision. People have used Free Pascal with the header without getting errors, so it sounds to me just like you havn't got the right compiler options set.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Voxel Engine?

Postby Carli » Tue Mar 02, 2010 5:37 pm

What's the problem?

you can even cast a "array of PNewtonCollision" into a "^PNewtonCollision" with the @ operator but it's an eyesore if some things do not work in objfpc mode.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby Stucuk » Wed Mar 03, 2010 9:35 am

Things should be uniform, while i know not everything in the header is(Since some of the code that came from the 1.53 version was never modified like the one you mention). Any changes should be the same as whats done in other parts of the header. PNewtonCollision should be used in favor over arrays rather than ^PNewtonCollision which is considered a different type.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Voxel Engine?

Postby Carli » Wed Mar 03, 2010 12:13 pm

But C++ arrays are pointers to the first element of the array.

forget it, i have my own working newton header using PPNewtonCollision instead of the crashing "array of"
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Voxel Engine?

Postby JernejL » Wed Mar 03, 2010 2:01 pm

Carli wrote:But C++ arrays are pointers to the first element of the array.

forget it, i have my own working newton header using PPNewtonCollision instead of the crashing "array of"


Code: Select all
    function  NewtonCreateCompoundCollision (const newtonWorld: PNewtonWorld; count: integer;
               const collisionPrimitiveArray: array of PNewtonCollision; shapeid: integer): PNewtonCollision; cdecl; external newtondll;


I swear that array of there works with fpc 2.2.4 on win32, i'm using it myself in my game and it works properly with compoundarray[0] or directly compoundarray, the array is constant length, but if you use dynamic you need to use [0].
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Voxel Engine?

Postby Julio Jerez » Wed Mar 03, 2010 10:17 pm

Umm people can not delete their post?
can we fix that Delfi?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Voxel Engine?

Postby Carli » Thu Mar 04, 2010 4:36 am

Delfi wrote:I swear that array of there works with fpc 2.2.4 on win32, i'm using it myself in my game and it works properly with compoundarray[0] or directly compoundarray, the array is constant length, but if you use dynamic you need to use [0].


And I say that it does not work with FPC 2.4.0 on win32 and linux64. I'm using it myself in my game and the "array of" crashes because of:

http://wiki.freepascal.org/User_Changes_2.4.0

maybe i could try "packed array of".
[Edit:]even does not work.

Just use PPNewtonCollision, there should be no disadvantages of using C-Like arrays as a parameter!
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron