Logo Search packages:      
Sourcecode: blender version File versions  Download package

void btHeightfieldTerrainShape::initialize ( int  heightStickWidth,
int  heightStickLength,
void *  heightfieldData,
btScalar  heightScale,
btScalar  minHeight,
btScalar  maxHeight,
int  upAxis,
PHY_ScalarType  heightDataType,
bool  flipQuadEdges 
) [protected]

protected initialization

Handles the work of constructors so that public constructors can be backwards-compatible without a lot of copy/paste.

Definition at line 55 of file btHeightfieldTerrainShape.cpp.

References m_heightStickWidth.

Referenced by btHeightfieldTerrainShape().

{
      // validation
      btAssert(heightStickWidth > 1 && "bad width");
      btAssert(heightStickLength > 1 && "bad length");
      btAssert(heightfieldData && "null heightfield data");
      // btAssert(heightScale) -- do we care?  Trust caller here
      btAssert(minHeight <= maxHeight && "bad min/max height");
      btAssert(upAxis >= 0 && upAxis < 3 &&
          "bad upAxis--should be in range [0,2]");
      btAssert(hdt != PHY_UCHAR || hdt != PHY_FLOAT || hdt != PHY_SHORT &&
          "Bad height data type enum");

      // initialize member variables
      m_shapeType = TERRAIN_SHAPE_PROXYTYPE;
      m_heightStickWidth = heightStickWidth;
      m_heightStickLength = heightStickLength;
      m_minHeight = minHeight;
      m_maxHeight = maxHeight;
      m_width = (btScalar) (heightStickWidth - 1);
      m_length = (btScalar) (heightStickLength - 1);
      m_heightScale = heightScale;
      m_heightfieldDataUnknown = heightfieldData;
      m_heightDataType = hdt;
      m_flipQuadEdges = flipQuadEdges;
      m_useDiamondSubdivision = false;
      m_upAxis = upAxis;
      m_localScaling.setValue(btScalar(1.), btScalar(1.), btScalar(1.));

      // determine min/max axis-aligned bounding box (aabb) values
      switch (m_upAxis)
      {
      case 0:
            {
                  m_localAabbMin.setValue(m_minHeight, 0, 0);
                  m_localAabbMax.setValue(m_maxHeight, m_width, m_length);
                  break;
            }
      case 1:
            {
                  m_localAabbMin.setValue(0, m_minHeight, 0);
                  m_localAabbMax.setValue(m_width, m_maxHeight, m_length);
                  break;
            };
      case 2:
            {
                  m_localAabbMin.setValue(0, 0, m_minHeight);
                  m_localAabbMax.setValue(m_width, m_length, m_maxHeight);
                  break;
            }
      default:
            {
                  //need to get valid m_upAxis
                  btAssert(0 && "Bad m_upAxis");
            }
      }

      // remember origin (defined as exact middle of aabb)
      m_localOrigin = btScalar(0.5) * (m_localAabbMin + m_localAabbMax);
}


Generated by  Doxygen 1.6.0   Back to index