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