Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
Physical Class Reference

Defines a set of physically modeled attributes. More...

#include "physical.h"

Inheritance diagram for Physical:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase ParticleSystem

Public Types

typedef pvector< PT(AngularForce)> AngularForceVector
 
typedef pvector< PT(LinearForce)> LinearForceVector
 

Public Member Functions

 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. More...
 
 Physical (const Physical &copy)
 copy constructor (note- does deep copy of pn's) but does NOT attach itself to its template's physicsmanager. More...
 
virtual ~Physical ()
 destructor More...
 
void add_angular_force (AngularForce *f)
 Adds an angular force to the force list. More...
 
void add_linear_force (LinearForce *f)
 Adds a linear force to the force list. More...
 
void add_physics_object (PhysicsObject *po)
 Adds an object to the physics object vector. More...
 
void clear_angular_forces ()
 Erases the angular force list. More...
 
void clear_linear_forces ()
 Erases the linear force list. More...
 
void clear_physics_objects ()
 Erases the object list. More...
 
virtual TypeHandle force_init_type ()
 
const AngularForceVectorget_angular_forces () const
 
const LinearForceVectorget_linear_forces () const
 
int get_num_angular_forces () const
 
int get_num_linear_forces () const
 
const PhysicsObject::Vectorget_object_vector () const
 
const PhysicsObjectCollection get_objects () const
 
PhysicsObjectget_phys_body () const
 
PhysicalNodeget_physical_node () const
 
NodePath get_physical_node_path () const
 
PhysicsManagerget_physics_manager () const
 
virtual TypeHandle get_type () const
 
PN_stdfloat get_viscosity () const
 Get the local viscosity. More...
 
virtual void output (std::ostream &out=std::cout) const
 Write a string representation of this instance to <out>. More...
 
 PT (LinearForce) get_linear_force(int index) const
 
 PT (AngularForce) get_angular_force(int index) const
 
void remove_angular_force (AngularForce *f)
 removes an angular force from the force list More...
 
void remove_linear_force (LinearForce *f)
 removes a linear force from the force list More...
 
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>. More...
 
virtual void write_angular_forces (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_linear_forces (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_physics_objects (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
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. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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. More...
 
- Static Public Member Functions inherited from ReferenceCount
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
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Friends

class PhysicalNode
 
class PhysicsManager
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Physical() [1/2]

Physical::Physical ( int  total_objects = 1,
bool  pre_alloc = false 
)
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 35 of file physical.cxx.

References add_physics_object().

◆ Physical() [2/2]

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 60 of file physical.cxx.

◆ ~Physical()

Physical::~Physical ( )
virtual

destructor

Definition at line 99 of file physical.cxx.

References PhysicsManager::remove_physical().

Member Function Documentation

◆ add_angular_force()

void Physical::add_angular_force ( AngularForce f)
inline

Adds an angular force to the force list.

Definition at line 55 of file physical.I.

◆ add_linear_force()

void Physical::add_linear_force ( LinearForce f)
inline

Adds a linear force to the force list.

Definition at line 47 of file physical.I.

◆ add_physics_object()

void Physical::add_physics_object ( PhysicsObject po)
inline

Adds an object to the physics object vector.

Definition at line 97 of file physical.I.

Referenced by Physical().

◆ clear_angular_forces()

void Physical::clear_angular_forces ( )
inline

Erases the angular force list.

Definition at line 29 of file physical.I.

◆ clear_linear_forces()

void Physical::clear_linear_forces ( )
inline

Erases the linear force list.

Definition at line 20 of file physical.I.

◆ clear_physics_objects()

void Physical::clear_physics_objects ( )
inline

Erases the object list.

Definition at line 38 of file physical.I.

Referenced by ParticleSystem::ParticleSystem().

◆ get_viscosity()

PN_stdfloat Physical::get_viscosity ( ) const
inline

Get the local viscosity.

Definition at line 203 of file physical.I.

◆ output()

void Physical::output ( std::ostream &  out = std::cout) const
virtual

Write a string representation of this instance to <out>.

Reimplemented in ParticleSystem.

Definition at line 129 of file physical.cxx.

◆ remove_angular_force()

void Physical::remove_angular_force ( AngularForce f)
inline

removes an angular force from the force list

Definition at line 81 of file physical.I.

◆ remove_linear_force()

void Physical::remove_linear_force ( LinearForce f)
inline

removes a linear force from the force list

Definition at line 63 of file physical.I.

◆ write()

void Physical::write ( std::ostream &  out = std::cout,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Reimplemented in ParticleSystem.

Definition at line 187 of file physical.cxx.

References indent(), PhysicsObject::write(), write_angular_forces(), write_linear_forces(), and write_physics_objects().

Referenced by ParticleSystem::write().

◆ write_angular_forces()

void Physical::write_angular_forces ( std::ostream &  out = std::cout,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Definition at line 171 of file physical.cxx.

References indent().

Referenced by write().

◆ write_linear_forces()

void Physical::write_linear_forces ( std::ostream &  out = std::cout,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Definition at line 155 of file physical.cxx.

References indent().

Referenced by write().

◆ write_physics_objects()

void Physical::write_physics_objects ( std::ostream &  out = std::cout,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Definition at line 139 of file physical.cxx.

References indent().

Referenced by write().


The documentation for this class was generated from the following files: