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 */
28 template<class SwitchType>
29 class AnimChannelFixed : public AnimChannel<SwitchType> {
30 public:
31 typedef typename AnimChannel<SwitchType>::ValueType ValueType;
32
33 protected:
34 INLINE AnimChannelFixed(AnimGroup *parent, const AnimChannelFixed<SwitchType> &copy);
35
36 public:
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
47 public:
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() {
56 AnimChannel<SwitchType>::init_type();
57 register_type(_type_handle, SwitchType::get_fixed_channel_type_name(),
58 AnimChannel<SwitchType>::get_class_type());
59 }
60
61 private:
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
animChannelFixed.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
animChannel.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AnimChannelFixed
This template class is a special kind of AnimChannel that always returns just one fixed value.
Definition animChannelFixed.h:29
AnimChannelFixed::output
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
Definition animChannelFixed.I:66
AnimChannelFixed::has_changed
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().
Definition animChannelFixed.I:46
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
pandabase.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