Panda3D

Loading...
Searching...
No Matches
linearDistanceForce.h
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 linearDistanceForce.h
10 * @author charles
11 * @date 2000-06-21
12 */
13
14#ifndef LINEARDISTANCEFORCE_H
15#define LINEARDISTANCEFORCE_H
16
17#include "linearForce.h"
18
19 class BamReader;
20
21/**
22 * Pure virtual class for sinks and sources
23 */
24 class EXPCL_PANDA_PHYSICS LinearDistanceForce : public LinearForce {
25PUBLISHED:
26 enum FalloffType {
27 FT_ONE_OVER_R,
28 FT_ONE_OVER_R_SQUARED,
29 FT_ONE_OVER_R_CUBED
30 };
31
32 INLINE void set_radius(PN_stdfloat r);
33 INLINE void set_falloff_type(FalloffType ft);
34 INLINE void set_force_center(const LPoint3& p);
35
36 INLINE PN_stdfloat get_radius() const;
37 INLINE FalloffType get_falloff_type() const;
38 INLINE LPoint3 get_force_center() const;
39
40 INLINE PN_stdfloat get_scalar_term() const;
41
42 virtual void output(std::ostream &out) const;
43 virtual void write(std::ostream &out, int indent=0) const;
44
45 private:
46 LPoint3 _force_center;
47
48 FalloffType _falloff;
49 PN_stdfloat _radius;
50
51 virtual LinearForce *make_copy() = 0;
52 virtual LVector3 get_child_vector(const PhysicsObject *po) = 0;
53
54 protected:
55 LinearDistanceForce(const LPoint3& p, FalloffType ft, PN_stdfloat r, PN_stdfloat a,
56 bool m);
57 LinearDistanceForce(const LinearDistanceForce &copy);
58 virtual ~LinearDistanceForce();
59
60 public:
61 static TypeHandle get_class_type() {
62 return _type_handle;
63 }
64 static void init_type() {
65 LinearForce::init_type();
66 register_type(_type_handle, "LinearDistanceForce",
67 LinearForce::get_class_type());
68 }
69 virtual TypeHandle get_type() const {
70 return get_class_type();
71 }
72 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
73
74 private:
75 static TypeHandle _type_handle;
76};
77
78#include "linearDistanceForce.I"
79
80#endif // LINEARDISTANCEFORCE_H
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
LinearDistanceForce::set_force_center
void set_force_center(const LPoint3 &p)
set the force center
Definition linearDistanceForce.I:34
LinearDistanceForce::set_radius
void set_radius(PN_stdfloat r)
set the radius
Definition linearDistanceForce.I:26
LinearDistanceForce::set_falloff_type
void set_falloff_type(FalloffType ft)
falloff_type encapsulating wrap
Definition linearDistanceForce.I:18
LinearDistanceForce::get_radius
PN_stdfloat get_radius() const
radius query
Definition linearDistanceForce.I:50
LinearDistanceForce::get_falloff_type
FalloffType get_falloff_type() const
falloff_type query
Definition linearDistanceForce.I:42
LinearDistanceForce::get_scalar_term
PN_stdfloat get_scalar_term() const
calculate the term based on falloff
Definition linearDistanceForce.I:66
LinearDistanceForce::get_force_center
LPoint3 get_force_center() const
force_center query
Definition linearDistanceForce.I:58
LinearForce::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition linearForce.cxx:95
LinearForce::output
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition linearForce.cxx:85
PhysicsObject
A body on which physics will be applied.
Definition physicsObject.h:27
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
linearDistanceForce.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
linearForce.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22