15 #include "bulletHeightfieldShape.h"
17 TypeHandle BulletHeightfieldShape::_type_handle;
24 BulletHeightfieldShape::
25 BulletHeightfieldShape(
const PNMImage &image, PN_stdfloat max_height, BulletUpAxis up) {
30 _data =
new float[_num_rows * _num_cols];
32 for (
int row=0; row < _num_rows; row++) {
33 for (
int column=0; column < _num_cols; column++) {
34 _data[_num_cols * row + column] =
35 max_height * image.
get_bright(column, _num_cols - row - 1);
39 _shape =
new btHeightfieldTerrainShape(_num_rows,
45 _shape->setUserPointer(
this);
53 btCollisionShape *BulletHeightfieldShape::
64 void BulletHeightfieldShape::
65 set_use_diamond_subdivision(
bool flag) {
67 return _shape->setUseDiamondSubdivision(flag);
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
float get_bright(int x, int y) const
Returns the linear brightness of the given xel, as a linearized float in the range 0...
TypeHandle is the identifier used to differentiate C++ class types.