Panda3D
animChannelScalarTable.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 animChannelScalarTable.h
10  * @author drose
11  * @date 1999-02-22
12  */
13 
14 #ifndef ANIMCHANNELSCALARTABLE_H
15 #define ANIMCHANNELSCALARTABLE_H
16 
17 #include "pandabase.h"
18 
19 #include "animChannel.h"
20 
21 #include "pointerToArray.h"
22 #include "pta_stdfloat.h"
23 
24 /**
25  * An animation channel that issues a scalar each frame, read from a table
26  * such as might have been read from an egg file.
27  */
28 class EXPCL_PANDA_CHAN AnimChannelScalarTable : public AnimChannelScalar {
29 protected:
32 
33 PUBLISHED:
34  AnimChannelScalarTable(AnimGroup *parent, const std::string &name);
35 
36 public:
37  virtual bool has_changed(int last_frame, double last_frac,
38  int this_frame, double this_frac);
39  virtual void get_value(int frame, PN_stdfloat &value);
40 
41 PUBLISHED:
42  void set_table(const CPTA_stdfloat &table);
43  INLINE CPTA_stdfloat get_table() const;
44 
45  INLINE bool has_table() const;
46  INLINE void clear_table();
47 
48  MAKE_PROPERTY2(table, has_table, get_table, set_table, clear_table);
49 
50 public:
51  virtual void write(std::ostream &out, int indent_level) const;
52 
53 protected:
54  virtual AnimGroup *make_copy(AnimGroup *parent) const;
55 
56 protected:
57  CPTA_stdfloat _table;
58 
59 public:
60  static void register_with_read_factory();
61  virtual void write_datagram(BamWriter* manager, Datagram &me);
62 
63  static TypedWritable *make_AnimChannelScalarTable(const FactoryParams &params);
64 
65 protected:
66  void fillin(DatagramIterator& scan, BamReader* manager);
67 
68 public:
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  static TypeHandle get_class_type() {
74  return _type_handle;
75  }
76  static void init_type() {
77  AnimChannelScalar::init_type();
78  register_type(_type_handle, "AnimChannelScalarTable",
79  AnimChannelScalar::get_class_type());
80  }
81 
82 private:
83  static TypeHandle _type_handle;
84 };
85 
86 #include "animChannelScalarTable.I"
87 
88 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
An animation channel that issues a scalar each frame, read from a table such as might have been read ...
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
virtual void write(std::ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
Definition: animGroup.cxx:192
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition: animGroup.cxx:308
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
Similar to PointerToArray, except that its contents may not be modified.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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(),...
Definition: register_type.I:22