Panda3D
|
00001 // Filename: vertexSlider.h 00002 // Created by: drose (28Mar05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef VERTEXSLIDER_H 00016 #define VERTEXSLIDER_H 00017 00018 #include "pandabase.h" 00019 #include "typedWritableReferenceCount.h" 00020 #include "internalName.h" 00021 #include "updateSeq.h" 00022 #include "pset.h" 00023 #include "cycleData.h" 00024 #include "cycleDataReader.h" 00025 #include "cycleDataWriter.h" 00026 #include "pipelineCycler.h" 00027 00028 class SliderTable; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : VertexSlider 00032 // Description : This is an abstract base class that retains some 00033 // slider value, which is a linear value that typically 00034 // ranges from 0.0 to 1.0, and is used to control the 00035 // animation of morphs (blend shapes). 00036 // 00037 // It is similar to VertexTransform, which keeps a full 00038 // 4x4 transform matrix, but the VertexSlider only keeps 00039 // a single float value. 00040 //////////////////////////////////////////////////////////////////// 00041 class EXPCL_PANDA_GOBJ VertexSlider : public TypedWritableReferenceCount { 00042 PUBLISHED: 00043 VertexSlider(const InternalName *name); 00044 virtual ~VertexSlider(); 00045 00046 INLINE const InternalName *get_name() const; 00047 00048 virtual PN_stdfloat get_slider() const=0; 00049 INLINE UpdateSeq get_modified(Thread *current_thread) const; 00050 00051 virtual void output(ostream &out) const; 00052 virtual void write(ostream &out, int indent_level) const; 00053 00054 protected: 00055 void mark_modified(Thread *current_thread); 00056 00057 protected: 00058 CPT(InternalName) _name; 00059 00060 private: 00061 typedef pset<SliderTable *> Tables; 00062 Tables _tables; 00063 00064 // This is the data that must be cycled between pipeline stages. 00065 class EXPCL_PANDA_GOBJ CData : public CycleData { 00066 public: 00067 INLINE CData(); 00068 INLINE CData(const CData ©); 00069 virtual CycleData *make_copy() const; 00070 virtual void write_datagram(BamWriter *manager, Datagram &dg) const; 00071 virtual int complete_pointers(TypedWritable **plist, BamReader *manager); 00072 virtual void fillin(DatagramIterator &scan, BamReader *manager); 00073 virtual TypeHandle get_parent_type() const { 00074 return VertexSlider::get_class_type(); 00075 } 00076 00077 UpdateSeq _modified; 00078 }; 00079 00080 PipelineCycler<CData> _cycler; 00081 typedef CycleDataReader<CData> CDReader; 00082 typedef CycleDataWriter<CData> CDWriter; 00083 00084 public: 00085 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00086 00087 protected: 00088 void fillin(DatagramIterator &scan, BamReader *manager); 00089 00090 public: 00091 static TypeHandle get_class_type() { 00092 return _type_handle; 00093 } 00094 static void init_type() { 00095 TypedWritableReferenceCount::init_type(); 00096 register_type(_type_handle, "VertexSlider", 00097 TypedWritableReferenceCount::get_class_type()); 00098 } 00099 virtual TypeHandle get_type() const { 00100 return get_class_type(); 00101 } 00102 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00103 00104 private: 00105 static TypeHandle _type_handle; 00106 00107 friend class SliderTable; 00108 }; 00109 00110 INLINE ostream &operator << (ostream &out, const VertexSlider &obj); 00111 00112 #include "vertexSlider.I" 00113 00114 #endif