Panda3D
Loading...
Searching...
No Matches
animChannelFixed.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 animChannelFixed.h
10 * @author drose
11 * @date 1999-02-24
12 */
13
14#ifndef ANIMCHANNELFIXED_H
15#define ANIMCHANNELFIXED_H
16
17#include "pandabase.h"
18
19#include "animChannel.h"
20
21
22/**
23 * This template class is a special kind of AnimChannel that always returns
24 * just one fixed value. It is a special channel, in that it need not be
25 * assigned within a hierarchy. It may stand alone, so that it may be created
26 * on-the-fly for parts that need default anims to bind against.
27 */
28template<class SwitchType>
29class AnimChannelFixed : public AnimChannel<SwitchType> {
30public:
31 typedef typename AnimChannel<SwitchType>::ValueType ValueType;
32
33protected:
34 INLINE AnimChannelFixed(AnimGroup *parent, const AnimChannelFixed<SwitchType> &copy);
35
36public:
37 INLINE AnimChannelFixed(const std::string &name, const ValueType &value);
38
39 virtual bool has_changed(int last_frame, double last_frac,
40 int this_frame, double this_frac);
41 virtual void get_value(int frame, ValueType &value);
42
43 virtual void output(std::ostream &out) const;
44
45 ValueType _value;
46
47public:
48 virtual TypeHandle get_type() const {
49 return get_class_type();
50 }
51 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
52 static TypeHandle get_class_type() {
53 return _type_handle;
54 }
55 static void init_type() {
57 register_type(_type_handle, SwitchType::get_fixed_channel_type_name(),
59 }
60
61private:
62 static TypeHandle _type_handle;
63};
64
65EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_CHAN, EXPTP_PANDA_CHAN, AnimChannelFixed<ACMatrixSwitchType>);
66EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_CHAN, EXPTP_PANDA_CHAN, AnimChannelFixed<ACScalarSwitchType>);
67
68#include "animChannelFixed.I"
69
70#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This template class is a special kind of AnimChannel that always returns just one fixed value.
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().
This template class is the parent class for all kinds of AnimChannels that return different values.
Definition animChannel.h:28
This is the base class for AnimChannel and AnimBundle.
Definition animGroup.h:33
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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(),...