19 TypeHandle PhysxForceFieldShapeGroup::_type_handle;
24 void PhysxForceFieldShapeGroup::
25 link(NxForceFieldShapeGroup *groupPtr) {
29 _ptr->userData =
this;
35 scene->_ffgroups.add(
this);
38 NxU32 nShapes = _ptr->getNbShapes();
39 _ptr->resetShapesIterator();
40 for (NxU32 i=0; i < nShapes; i++) {
41 NxForceFieldShape *shapePtr = _ptr->getNextShape();
43 shape->link(shapePtr);
50 void PhysxForceFieldShapeGroup::
54 NxU32 nShapes = _ptr->getNbShapes();
55 _ptr->resetShapesIterator();
56 for (NxU32 i=0; i < nShapes; i++) {
57 NxForceFieldShape *shapePtr = _ptr->getNextShape();
63 _ptr->userData =
nullptr;
64 _error_type = ET_released;
67 scene->_ffgroups.remove(
this);
76 nassertv(_error_type == ET_ok);
79 _ptr->getScene().releaseForceFieldShapeGroup(*_ptr);
89 nassertr(_error_type == ET_ok,
nullptr);
90 return (
PhysxScene *)(_ptr->getScene().userData);
100 nassertr(_error_type == ET_ok,
nullptr);
102 if (_ptr->getForceField() ==
nullptr) {
116 nassertv(_error_type == ET_ok);
117 _ptr->saveToDesc(groupDesc._desc);
127 nassertv(_error_type == ET_ok);
129 _name = name ? name :
"";
130 _ptr->setName(_name.c_str());
139 nassertr(_error_type == ET_ok,
"");
140 return _ptr->getName();
146 unsigned int PhysxForceFieldShapeGroup::
147 get_num_shapes()
const {
149 nassertr(_error_type == ET_ok, -1);
151 return _ptr->getNbShapes();
160 nassertr(_error_type == ET_ok,
nullptr);
161 nassertr(desc.is_valid(),
nullptr);
164 nassertr(shape,
nullptr);
166 NxForceFieldShape *shapePtr = _ptr->createShape(*desc.ptr());
167 nassertr(shapePtr,
nullptr);
169 shape->link(shapePtr);
180 nassertr(_error_type == ET_ok,
nullptr);
181 nassertr_always(idx < _ptr->getNbShapes(),
nullptr);
183 NxForceFieldShape *shapePtr;
184 NxU32 nShapes = _ptr->getNbShapes();
186 _ptr->resetShapesIterator();
187 for (NxU32 i=0; i <= idx; i++) {
188 shapePtr = _ptr->getNextShape();
Abstract base class for descriptors for force field shapes descriptors.
PhysxScene * get_scene() const
Returns the scene that owns this force field shape group.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A scene is a collection of bodies, constraints, and effectors which can interact.
Abstract base class for force field shapes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PhysxForceFieldShape * create_shape(PhysxForceFieldShapeDesc &desc)
Creates a force field shape and adds it to the group.
PhysxForceField * get_force_field() const
Returns the force field of this group if this is an include group.
void save_to_desc(PhysxForceFieldShapeGroupDesc &groupDesc) const
Saves the state of the force field shape group object to a descriptor.
const char * get_name() const
Returns the name string.
void release()
Releases the force field shape.
TypeHandle is the identifier used to differentiate C++ class types.
void set_name(const char *name)
Sets a name string for the object that can be retrieved with get_name().
get_shape
Returns the i-th shape in the force field group.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.