Panda3D

Loading...
Searching...
No Matches
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"
18#include "typedWritableReferenceCount.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 {
38PUBLISHED:
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:
60 typedef pset<SliderTable *> Tables;
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
109INLINE std::ostream &operator << (std::ostream &out, const VertexSlider &obj);
110
111#include "vertexSlider.I"
112
113#endif
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
CycleData
A single page of data maintained by a PipelineCycler.
Definition cycleData.h:50
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition datagramIterator.h:30
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
InternalName
Encodes a string name in a hash table, mapping it to a pointer.
Definition internalName.h:38
SliderTable
Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might d...
Definition sliderTable.h:37
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
Thread::get_current_thread
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition thread.h:109
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
TypedWritable::fillin
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...
Definition typedWritable.cxx:103
TypedWritable::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition typedWritable.cxx:54
TypedWritable::complete_pointers
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().
Definition typedWritable.cxx:81
UpdateSeq
This is a sequence number that increments monotonically.
Definition updateSeq.h:37
VertexSlider
This is an abstract base class that retains some slider value, which is a linear value that typically...
Definition vertexSlider.h:37
VertexSlider::get_modified
get_modified
Returns a sequence number that's guaranteed to change at least every time the value reported by get_s...
Definition vertexSlider.h:48
VertexSlider::get_name
get_name
Returns the name of this particular slider.
Definition vertexSlider.h:43
plist
This is our own Panda specialization on the default STL list.
Definition plist.h:35
cycleDataReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleDataWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
internalName.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pipelineCycler.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pset.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
typedWritableReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
updateSeq.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
vertexSlider.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.