Pointer to matrix

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Pointer to matrix

Postby zak » Fri Sep 12, 2014 4:46 am

If my mesh use the same matrix as the physics body i am forced to create a matrix for the mesh and copy the body mesh every frame with transform callback.
Is it possible to have a const float* NewtonBodyGetMatrixPointer() so
- no matrix duplication
- no callback transform call and coping overhead
zak
 
Posts: 87
Joined: Mon Dec 06, 2004 9:30 am

Re: Pointer to matrix

Postby Julio Jerez » Fri Sep 12, 2014 5:47 am

no, getting pointers to internal data is a really bad programing practice.
copying a matrix is no really a big deal.

plus the physics representation of the matrix as the visual matrix is in fact rare.
most engine separate physics simulation rate form graphics rate and interpolate between then, so they are decoupled.

believe me it may sound like a good optimization, but it comes with lots of problems and after all is not really a big game.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Pointer to matrix

Postby pHySiQuE » Fri Sep 12, 2014 11:57 am

Just declare a float array:
float mat[16];

Easy.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Pointer to matrix

Postby manny » Fri Sep 12, 2014 3:19 pm

locking this.

btw, it's always a good idea to keep your object data local and tightly packed or you will have guaranteed cache misses.
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron