Panda3D

Loading...
Searching...
No Matches
physxSphereForceFieldShape.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxSphereForceFieldShape.cxx
10 * @author enn0x
11 * @date 2009-11-15
12 */
13
14#include "physxSphereForceFieldShape.h"
15#include "physxSphereForceFieldShapeDesc.h"
16
17 TypeHandle PhysxSphereForceFieldShape::_type_handle;
18
19/**
20 *
21 */
22 void PhysxSphereForceFieldShape::
23link(NxForceFieldShape *shapePtr) {
24
25 _ptr = shapePtr->isSphere();
26 _ptr->userData = this;
27 _error_type = ET_ok;
28
29 set_name(shapePtr->getName());
30
31 PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
32 group->_shapes.add(this);
33}
34
35/**
36 *
37 */
38 void PhysxSphereForceFieldShape::
39unlink() {
40
41 _ptr->userData = nullptr;
42 _error_type = ET_released;
43
44 PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
45 group->_shapes.remove(this);
46}
47
48/**
49 * Saves the state of the shape object to a descriptor.
50 */
51 void PhysxSphereForceFieldShape::
52 save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const {
53
54 nassertv(_error_type == ET_ok);
55 _ptr->saveToDesc(shapeDesc._desc);
56}
57
58/**
59 * Sets the sphere radius.
60 */
61 void PhysxSphereForceFieldShape::
62 set_radius(float radius) {
63
64 nassertv(_error_type == ET_ok);
65 _ptr->setRadius(radius);
66}
67
68/**
69 * Returns the radius of the sphere.
70 */
71 float PhysxSphereForceFieldShape::
72 get_radius() const {
73
74 nassertr(_error_type == ET_ok, 0.0f);
75 return _ptr->getRadius();
76}
PhysxForceFieldShape::set_name
void set_name(const char *name)
Sets a name string for this object.
Definition physxForceFieldShape.cxx:93
PhysxSphereForceFieldShapeDesc
A descriptor for a sphere force field shape.
Definition physxSphereForceFieldShapeDesc.h:25
PhysxSphereForceFieldShape::get_radius
float get_radius() const
Returns the radius of the sphere.
Definition physxSphereForceFieldShape.cxx:72
PhysxSphereForceFieldShape::save_to_desc
void save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const
Saves the state of the shape object to a descriptor.
Definition physxSphereForceFieldShape.cxx:52
PhysxSphereForceFieldShape::set_radius
void set_radius(float radius)
Sets the sphere radius.
Definition physxSphereForceFieldShape.cxx:62
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
physxSphereForceFieldShapeDesc.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxSphereForceFieldShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.