Panda3D
physxForceFieldShapeGroupDesc.cxx
1 // Filename: physxForceFieldShapeGroupDesc.cxx
2 // Created by: enn0x (11Nov09)
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 #include "physxForceFieldShapeGroupDesc.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: PhysxForceFieldShapeGroupDesc::add_shape
19 // Access: Published
20 // Description: Adds a shape to the list of force field shapes
21 // composing this shape group.
22 ////////////////////////////////////////////////////////////////////
25 
26  _desc.shapes.push_back(desc.ptr());
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: PhysxForceFieldShapeGroupDesc::set_name
31 // Access: Published
32 // Description: Sets the optional debug name for the force field
33 // shape group.
34 ////////////////////////////////////////////////////////////////////
36 set_name(const char *name) {
37 
38  _name = name ? name : "";
39  _desc.name = _name.c_str();
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: PhysxForceFieldShapeGroupDesc::get_name
44 // Access: Published
45 // Description: Returns the optional debug name for this force
46 // field shape group.
47 ////////////////////////////////////////////////////////////////////
49 get_name() const {
50 
51  return _desc.name;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: PhysxForceFieldShapeGroupDesc::set_flag
56 // Access: Published
57 // Description: Raise or lower individual force field shape group
58 // flags.
59 ////////////////////////////////////////////////////////////////////
61 set_flag(const PhysxForceFieldShapeGroupFlag flag, bool value) {
62 
63  if (value == true) {
64  _desc.flags |= flag;
65  }
66  else {
67  _desc.flags &= ~(flag);
68  }
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: PhysxForceFieldShapeGroupDesc::get_flag
73 // Access: Published
74 // Description: Returns the specified force field shape group
75 // flag.
76 ////////////////////////////////////////////////////////////////////
78 get_flag(const PhysxForceFieldShapeGroupFlag flag) const {
79 
80  return (_desc.flags & flag) ? true : false;
81 }
82 
Abstract base class for descriptors for force field shapes descriptors.
const char * get_name() const
Returns the optional debug name for this force field shape group.
void add_shape(PhysxForceFieldShapeDesc &desc)
Adds a shape to the list of force field shapes composing this shape group.
void set_name(const char *name)
Sets the optional debug name for the force field shape group.
bool get_flag(PhysxForceFieldShapeGroupFlag flag) const
Returns the specified force field shape group flag.
void set_flag(PhysxForceFieldShapeGroupFlag flag, bool value)
Raise or lower individual force field shape group flags.