Panda3D
 All Classes Functions Variables Enumerations
userVertexSlider.h
00001 // Filename: userVertexSlider.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 USERVERTEXSLIDER_H
00016 #define USERVERTEXSLIDER_H
00017 
00018 #include "pandabase.h"
00019 #include "vertexSlider.h"
00020 #include "cycleData.h"
00021 #include "cycleDataReader.h"
00022 #include "cycleDataWriter.h"
00023 #include "pipelineCycler.h"
00024 
00025 class FactoryParams;
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : UserVertexSlider
00029 // Description : This is a specialization on VertexSlider that
00030 //               allows the user to specify any arbitrary slider
00031 //               valie he likes.  This is rarely used except for
00032 //               testing.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA_GOBJ UserVertexSlider : public VertexSlider {
00035 PUBLISHED:
00036   UserVertexSlider(const string &name);
00037   UserVertexSlider(const InternalName *name);
00038 
00039   INLINE void set_slider(PN_stdfloat slider);
00040   virtual PN_stdfloat get_slider() const;
00041 
00042 private:
00043   // This is the data that must be cycled between pipeline stages.
00044   class EXPCL_PANDA_GOBJ CData : public CycleData {
00045   public:
00046     INLINE CData();
00047     INLINE CData(const CData &copy);
00048     virtual CycleData *make_copy() const;
00049     virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
00050     virtual void fillin(DatagramIterator &scan, BamReader *manager);
00051     virtual TypeHandle get_parent_type() const {
00052       return UserVertexSlider::get_class_type();
00053     }
00054 
00055     PN_stdfloat _slider;
00056   };
00057 
00058   PipelineCycler<CData> _cycler;
00059   typedef CycleDataReader<CData> CDReader;
00060   typedef CycleDataWriter<CData> CDWriter;
00061 
00062 public:
00063   static void register_with_read_factory();
00064   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00065 
00066 protected:
00067   static TypedWritable *make_from_bam(const FactoryParams &params);
00068   void fillin(DatagramIterator &scan, BamReader *manager);
00069 
00070 public:
00071   static TypeHandle get_class_type() {
00072     return _type_handle;
00073   }
00074   static void init_type() {
00075     VertexSlider::init_type();
00076     register_type(_type_handle, "UserVertexSlider",
00077                   VertexSlider::get_class_type());
00078   }
00079   virtual TypeHandle get_type() const {
00080     return get_class_type();
00081   }
00082   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00083 
00084 private:
00085   static TypeHandle _type_handle;
00086 };
00087 
00088 #include "userVertexSlider.I"
00089 
00090 #endif
 All Classes Functions Variables Enumerations