Panda3D
vertexSlider.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 vertexSlider.h
10  * @author drose
11  * @date 2005-03-28
12  */
13 
14 #ifndef VERTEXSLIDER_H
15 #define VERTEXSLIDER_H
16 
17 #include "pandabase.h"
19 #include "internalName.h"
20 #include "updateSeq.h"
21 #include "pset.h"
22 #include "cycleData.h"
23 #include "cycleDataReader.h"
24 #include "cycleDataWriter.h"
25 #include "pipelineCycler.h"
26 
27 class SliderTable;
28 
29 /**
30  * This is an abstract base class that retains some slider value, which is a
31  * linear value that typically ranges from 0.0 to 1.0, and is used to control
32  * the animation of morphs (blend shapes).
33  *
34  * It is similar to VertexTransform, which keeps a full 4x4 transform matrix,
35  * but the VertexSlider only keeps a single float value.
36  */
37 class EXPCL_PANDA_GOBJ VertexSlider : public TypedWritableReferenceCount {
38 PUBLISHED:
39  explicit VertexSlider(const InternalName *name);
40  virtual ~VertexSlider();
41 
42  INLINE const InternalName *get_name() const;
43  MAKE_PROPERTY(name, get_name);
44 
45  virtual PN_stdfloat get_slider() const=0;
46  INLINE UpdateSeq get_modified(Thread *current_thread = Thread::get_current_thread()) const;
47  MAKE_PROPERTY(slider, get_slider);
48  MAKE_PROPERTY(modified, get_modified);
49 
50  virtual void output(std::ostream &out) const;
51  virtual void write(std::ostream &out, int indent_level) const;
52 
53 protected:
54  void mark_modified(Thread *current_thread);
55 
56 protected:
57  CPT(InternalName) _name;
58 
59 private:
61  Tables _tables;
62 
63  // This is the data that must be cycled between pipeline stages.
64  class EXPCL_PANDA_GOBJ CData : public CycleData {
65  public:
66  INLINE CData();
67  INLINE CData(const CData &copy);
68  virtual CycleData *make_copy() const;
69  virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
70  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
71  virtual void fillin(DatagramIterator &scan, BamReader *manager);
72  virtual TypeHandle get_parent_type() const {
73  return VertexSlider::get_class_type();
74  }
75 
76  UpdateSeq _modified;
77  };
78 
79  PipelineCycler<CData> _cycler;
80  typedef CycleDataReader<CData> CDReader;
81  typedef CycleDataWriter<CData> CDWriter;
82 
83 public:
84  virtual void write_datagram(BamWriter *manager, Datagram &dg);
85 
86 protected:
87  void fillin(DatagramIterator &scan, BamReader *manager);
88 
89 public:
90  static TypeHandle get_class_type() {
91  return _type_handle;
92  }
93  static void init_type() {
94  TypedWritableReferenceCount::init_type();
95  register_type(_type_handle, "VertexSlider",
96  TypedWritableReferenceCount::get_class_type());
97  }
98  virtual TypeHandle get_type() const {
99  return get_class_type();
100  }
101  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
102 
103 private:
104  static TypeHandle _type_handle;
105 
106  friend class SliderTable;
107 };
108 
109 INLINE std::ostream &operator << (std::ostream &out, const VertexSlider &obj);
110 
111 #include "vertexSlider.I"
112 
113 #endif
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
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
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
Encodes a string name in a hash table, mapping it to a pointer.
Definition: internalName.h:38
Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might d...
Definition: sliderTable.h:37
A thread; that is, a lightweight process.
Definition: thread.h:46
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition: thread.h:109
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is a sequence number that increments monotonically.
Definition: updateSeq.h:37
This is an abstract base class that retains some slider value, which is a linear value that typically...
Definition: vertexSlider.h:37
This is our own Panda specialization on the default STL list.
Definition: plist.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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.