Panda3D
Loading...
Searching...
No Matches
linearNoiseForce.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 linearNoiseForce.h
10 * @author charles
11 * @date 2000-06-13
12 */
13
14#ifndef LINEARNOISEFORCE_H
15#define LINEARNOISEFORCE_H
16
17#include "pandabase.h"
18#include "linearRandomForce.h"
19#include "configVariableInt.h"
20
21/**
22 * Repeating noise force vector.
23 */
24class EXPCL_PANDA_PHYSICS LinearNoiseForce : public LinearRandomForce {
25PUBLISHED:
26 explicit LinearNoiseForce(PN_stdfloat a = 1.0f, bool m = false);
28 virtual ~LinearNoiseForce();
29
30 virtual void output(std::ostream &out) const;
31 virtual void write(std::ostream &out, int indent=0) const;
32
33public:
34 static ConfigVariableInt _random_seed;
35 static void init_noise_tables();
36
37private:
38 static unsigned char _prn_table[256];
39 static LVector3 _gradient_table[256];
40 static bool _initialized;
41
42 INLINE PN_stdfloat cubic_step(const PN_stdfloat x) const;
43 INLINE LVector3 vlerp(const PN_stdfloat t, const LVector3& v0, const LVector3& v1) const;
44
45 INLINE unsigned char get_prn_entry(const LPoint3& point) const;
46 INLINE unsigned char get_prn_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z) const;
47
48 INLINE LVector3& get_lattice_entry(const LPoint3& point);
49 INLINE LVector3& get_lattice_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z);
50
51 INLINE unsigned char prn_lookup(int index) const;
52
53 virtual LVector3 get_child_vector(const PhysicsObject *po);
54 virtual LinearForce *make_copy();
55
56public:
57 static TypeHandle get_class_type() {
58 return _type_handle;
59 }
60 static void init_type() {
61 LinearRandomForce::init_type();
62 register_type(_type_handle, "LinearNoiseForce",
63 LinearRandomForce::get_class_type());
64 }
65 virtual TypeHandle get_type() const {
66 return get_class_type();
67 }
68 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69
70private:
71 static TypeHandle _type_handle;
72};
73
74#include "linearNoiseForce.I"
75
76#endif // LINEARNOISEFORCE_H
This is a convenience class to specialize ConfigVariable as an integer type.
A force that acts on a PhysicsObject by way of an Integrator.
Definition linearForce.h:23
Repeating noise force vector.
Pure virtual, parent to noiseForce and jitterForce.
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>.
A body on which physics will be applied.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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(),...