Updating btHeightfieldTerrainShape

tomva
Posts: 13
Joined: Tue Jul 08, 2008 6:06 am

Updating btHeightfieldTerrainShape

Post by tomva »

Hello all-

I'd like to make some updates to the btHeightfieldTerrainShape object. Mainly:
- support for short (it has unsigned char and float support right now)
- support for heightfields with a non-zero minimum

That last one (heightfields with a non-zero minimum) is a killer.

Should I submit a diff? (I'm using bullet-2.69 right now).

Thanks-

-Thomas
tomva
Posts: 13
Joined: Tue Jul 08, 2008 6:06 am

Re: Updating btHeightfieldTerrainShape

Post by tomva »

Hello all (particularly the code maintainers)-

I've updated btHeightfieldTerrainShape, and I've been testing it somewhat.

Main changes:
- support for short data type (along with float and unsigned char)
- explicit heightScale value (rather than scaling based on maxHeight)
- support for a minHeight (does not assume minHeight = 0)
- updated JavaDoc comments

The addition of heightScale was required once I introduced minHeight: otherwise there was no intuitive way to scale the integer data type height values.

The result is possibly more efficient (avoids one per-grid-point division). But mainly it allows for a new data type and finer control over heightfield height scaling and limits.

I took care to keep the existing constructor backwards-compatible, and added a new constructor with the new features.

If there is someplace to submit the diff please let me know.

-Thomas
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Updating btHeightfieldTerrainShape

Post by Erwin Coumans »

That sounds good.

Can you please create an issue in the Bullet Google Code issue tracker and attach the patch? We'll try to include it for upcoming Bullet 2.70 release.

Thanks a lot for the contribution!
Erwin
tomva
Posts: 13
Joined: Tue Jul 08, 2008 6:06 am

Re: Updating btHeightfieldTerrainShape

Post by tomva »

I've submitted the diff: http://code.google.com/p/bullet/issues/detail?id=63

I couldn't see how to submit an Enhancement, or change the type once created. So it shows up as a Defect. Sorry about that.

Definitely let me know if there are any code and/or style changes you recommend.
tomva
Posts: 13
Joined: Tue Jul 08, 2008 6:06 am

Re: Updating btHeightfieldTerrainShape

Post by tomva »

I re-submitted the diff.

It includes the updates (and bugfixes) for btHeightfieldTerrainShape, as well as a TerrainDemo.
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: Updating btHeightfieldTerrainShape

Post by mickey »

Hi

Does anyone know where I can download the terrain demo?

Thanks