Panda3D
Loading...
Searching...
No Matches
linearVectorForce.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 linearVectorForce.h
10 * @author charles
11 * @date 2000-06-13
12 */
13
14#ifndef LINEARVECTORFORCE_H
15#define LINEARVECTORFORCE_H
16
17#include "linearForce.h"
18
19/**
20 * Simple directed vector force. Suitable for gravity, non-turbulent wind,
21 * etc...
22 */
23class EXPCL_PANDA_PHYSICS LinearVectorForce : public LinearForce {
24PUBLISHED:
25 explicit LinearVectorForce(const LVector3& vec, PN_stdfloat a = 1.0f, bool mass = false);
26 explicit LinearVectorForce(PN_stdfloat x = 0.0f, PN_stdfloat y = 0.0f, PN_stdfloat z = 0.0f,
27 PN_stdfloat a = 1.0f, bool mass = false);
29 virtual ~LinearVectorForce();
30
31 INLINE void set_vector(const LVector3& v);
32 INLINE void set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
33
34 INLINE LVector3 get_local_vector() const;
35
36 virtual void output(std::ostream &out) const;
37 virtual void write(std::ostream &out, int indent=0) const;
38
39public:
40 INLINE LinearVectorForce& operator += (const LinearVectorForce &other);
41
42private:
43 LVector3 _fvec;
44
45 virtual LinearForce *make_copy();
46 virtual LVector3 get_child_vector(const PhysicsObject *po);
47
48public:
49 static TypeHandle get_class_type() {
50 return _type_handle;
51 }
52 static void init_type() {
53 LinearForce::init_type();
54 register_type(_type_handle, "LinearVectorForce",
55 LinearForce::get_class_type());
56 }
57 virtual TypeHandle get_type() const {
58 return get_class_type();
59 }
60 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
61
62private:
63 static TypeHandle _type_handle;
64};
65
66#include "linearVectorForce.I"
67
68#endif // LINEARVECTORFORCE_H
A force that acts on a PhysicsObject by way of an Integrator.
Definition linearForce.h:23
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Simple directed vector force.
A body on which physics will be applied.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...