Panda3D
 All Classes Functions Variables Enumerations
bulletHeightfieldShape.I
1 // Filename: bulletHeightfieldShape.I
2 // Created by: enn0x (05Feb10)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: BulletHeightfieldShape::Destructor
17 // Access: Published
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE BulletHeightfieldShape::
21 ~BulletHeightfieldShape() {
22 
23  delete _shape;
24  delete _data;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: BulletHeightfieldShape::Copy Constructor
29 // Access: Published
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 INLINE BulletHeightfieldShape::
33 BulletHeightfieldShape(const BulletHeightfieldShape &copy) :
34  _shape(copy._shape),
35  _num_rows(copy._num_rows),
36  _num_cols(copy._num_cols) {
37 
38  _data = new float[_num_rows * _num_cols];
39  memcpy(_data, copy._data, _num_rows * _num_cols * sizeof(float));
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: BulletHeightfieldShape::Copy Assignment Operator
44 // Access: Published
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 INLINE void BulletHeightfieldShape::
48 operator = (const BulletHeightfieldShape &copy) {
49 
50  _shape = copy._shape;
51  _num_rows = copy._num_rows;
52  _num_cols = copy._num_cols;
53 
54  _data = new float[_num_rows * _num_cols];
55  memcpy(_data, copy._data, _num_rows * _num_cols * sizeof(float));
56 }
57