Panda3D
|
Defines a set of physically modeled attributes. More...
#include "physical.h"
Public Types | |
typedef pvector< PT(AngularForce)> | AngularForceVector |
typedef pvector< PT(LinearForce)> | LinearForceVector |
Public Member Functions | |
Physical (const Physical ©) | |
copy constructor (note- does deep copy of pn's) but does NOT attach itself to its template's physicsmanager. | |
Physical (int total_objects=1, bool pre_alloc=false) | |
Default Constructor The idea here is that most physicals will NOT be collections of sets (i.e. | |
virtual | ~Physical () |
destructor | |
void | add_angular_force (AngularForce *f) |
Adds an angular force to the force list. | |
void | add_linear_force (LinearForce *f) |
Adds a linear force to the force list. | |
void | add_physics_object (PhysicsObject *po) |
Adds an object to the physics object vector. | |
void | clear_angular_forces () |
Erases the angular force list. | |
void | clear_linear_forces () |
Erases the linear force list. | |
void | clear_physics_objects () |
Erases the object list. | |
virtual TypeHandle | force_init_type () |
const AngularForceVector & | get_angular_forces () const |
const LinearForceVector & | get_linear_forces () const |
int | get_num_angular_forces () const |
int | get_num_linear_forces () const |
const PhysicsObject::Vector & | get_object_vector () const |
const PhysicsObjectCollection | get_objects () const |
PhysicsObject * | get_phys_body () const |
PhysicalNode * | get_physical_node () const |
NodePath | get_physical_node_path () const |
PhysicsManager * | get_physics_manager () const |
virtual TypeHandle | get_type () const |
PN_stdfloat | get_viscosity () const |
virtual void | output (std::ostream &out=std::cout) const |
Write a string representation of this instance to <out>. | |
PT (AngularForce) get_angular_force(int index) const | |
PT (LinearForce) get_linear_force(int index) const | |
void | remove_angular_force (AngularForce *f) |
removes an angular force from the force list | |
void | remove_linear_force (LinearForce *f) |
removes a linear force from the force list | |
void | set_viscosity (PN_stdfloat viscosity) |
virtual void | write (std::ostream &out=std::cout, int indent=0) const |
Write a string representation of this instance to <out>. | |
virtual void | write_angular_forces (std::ostream &out=std::cout, int indent=0) const |
Write a string representation of this instance to <out>. | |
virtual void | write_linear_forces (std::ostream &out=std::cout, int indent=0) const |
Write a string representation of this instance to <out>. | |
virtual void | write_physics_objects (std::ostream &out=std::cout, int indent=0) const |
Write a string representation of this instance to <out>. | |
![]() | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
![]() | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
TypedObject & | operator= (const TypedObject ©)=default |
![]() | |
void | operator delete (void *, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
![]() | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | ref () const |
Explicitly increments the reference count. | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
bool | unref_if_one () const |
Atomically decreases the reference count of this object if it is one. | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
Public Attributes | |
get_angular_force | |
get_linear_force | |
get_num_angular_forces | |
get_num_linear_forces | |
get_objects | |
get_viscosity | |
Get the local viscosity. | |
![]() | |
get_type | |
![]() | |
get_ref_count | |
Returns the current reference count. | |
Friends | |
class | PhysicalNode |
class | PhysicsManager |
Defines a set of physically modeled attributes.
If you want physics applied to your class, derive it from this.
Definition at line 37 of file physical.h.
typedef pvector<PT(AngularForce)> Physical::AngularForceVector |
Definition at line 41 of file physical.h.
typedef pvector<PT(LinearForce)> Physical::LinearForceVector |
Definition at line 40 of file physical.h.
|
explicit |
Default Constructor The idea here is that most physicals will NOT be collections of sets (i.e.
particle systems and whatever else). Because of this, the default constructor, unless otherwise specified, will automatically allocate and initialize one PhysicalObject. This makes it easier for high-level work.
pre-alloc is ONLY for multiple-object physicals, and if true, fills the physics_object vector with dead nodes, pre-allocating for the speed end of the speed-vs-overhead deal.
Definition at line 34 of file physical.cxx.
References add_physics_object().
Physical::Physical | ( | const Physical & | copy | ) |
copy constructor (note- does deep copy of pn's) but does NOT attach itself to its template's physicsmanager.
Definition at line 59 of file physical.cxx.
|
virtual |
destructor
Definition at line 98 of file physical.cxx.
References PhysicsManager::remove_physical().
|
inline |
Adds an angular force to the force list.
Definition at line 54 of file physical.I.
|
inline |
Adds a linear force to the force list.
Definition at line 46 of file physical.I.
|
inline |
Adds an object to the physics object vector.
Definition at line 96 of file physical.I.
Referenced by Physical().
|
inline |
Erases the angular force list.
Definition at line 28 of file physical.I.
|
inline |
Erases the linear force list.
Definition at line 19 of file physical.I.
|
inline |
Erases the object list.
Definition at line 37 of file physical.I.
Referenced by ParticleSystem::ParticleSystem().
|
inlinevirtual |
Reimplemented from TypedReferenceCount.
Definition at line 127 of file physical.h.
|
inline |
Definition at line 152 of file physical.I.
|
inlinestatic |
Definition at line 116 of file physical.h.
|
inline |
Definition at line 144 of file physical.I.
|
inline |
Definition at line 136 of file physical.I.
|
inline |
Definition at line 112 of file physical.I.
|
inline |
Definition at line 120 of file physical.I.
|
inline |
Definition at line 128 of file physical.I.
|
inline |
Definition at line 104 of file physical.I.
|
inlinevirtual |
Reimplemented from TypedReferenceCount.
Definition at line 124 of file physical.h.
|
inlinestatic |
Definition at line 119 of file physical.h.
|
virtual |
Write a string representation of this instance to <out>.
Reimplemented in ParticleSystem.
Definition at line 128 of file physical.cxx.
|
inline |
removes an angular force from the force list
Definition at line 80 of file physical.I.
|
inline |
removes a linear force from the force list
Definition at line 62 of file physical.I.
|
virtual |
Write a string representation of this instance to <out>.
Reimplemented in ParticleSystem.
Definition at line 186 of file physical.cxx.
References indent(), PhysicsObject::write(), write_angular_forces(), write_linear_forces(), and write_physics_objects().
Referenced by ParticleSystem::write().
|
virtual |
Write a string representation of this instance to <out>.
Definition at line 170 of file physical.cxx.
References indent().
Referenced by write().
|
virtual |
Write a string representation of this instance to <out>.
Definition at line 154 of file physical.cxx.
References indent().
Referenced by write().
|
virtual |
Write a string representation of this instance to <out>.
Definition at line 138 of file physical.cxx.
References indent().
Referenced by write().
|
friend |
Definition at line 95 of file physical.h.
|
friend |
Definition at line 94 of file physical.h.
Physical::get_angular_force |
Definition at line 70 of file physical.h.
Physical::get_linear_force |
Definition at line 66 of file physical.h.
Physical::get_num_angular_forces |
Definition at line 70 of file physical.h.
|
inline |
Definition at line 66 of file physical.h.
const PhysicsObjectCollection Physical::get_objects |
Definition at line 78 of file physical.h.
|
inline |
Get the local viscosity.
Definition at line 75 of file physical.h.