Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/sequenceNode.h

Go to the documentation of this file.
00001 // Filename: sequenceNode.h
00002 // Created by:  drose (06Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef SEQUENCENODE_H
00020 #define SEQUENCENODE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "selectiveChildNode.h"
00025 #include "clockObject.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : SequenceNode
00029 // Description : A node that automatically cycles through rendering
00030 //               each one of its children according to its frame rate.
00031 ////////////////////////////////////////////////////////////////////
00032 class EXPCL_PANDA SequenceNode : public SelectiveChildNode {
00033 PUBLISHED:
00034   INLINE SequenceNode(float cycle_rate, const string &name);
00035 
00036 public:
00037   SequenceNode(const SequenceNode &copy);
00038 
00039   virtual PandaNode *make_copy() const;
00040   virtual bool safe_to_combine() const;
00041 
00042   virtual bool has_cull_callback() const;
00043   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00044   virtual bool has_single_child_visibility() const;
00045 
00046 PUBLISHED:
00047   INLINE void set_cycle_rate(float cycle_rate);
00048   INLINE float get_cycle_rate() const;
00049 
00050   INLINE void set_visible_child(int index);
00051   virtual int get_visible_child() const;
00052 
00053 private:
00054   INLINE float calc_frame(float now) const;
00055   INLINE float calc_frame() const;
00056 
00057   class EXPCL_PANDA CData : public CycleData {
00058   public:
00059     INLINE CData();
00060     INLINE CData(const CData &copy);
00061     virtual CycleData *make_copy() const;
00062     virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
00063     virtual void fillin(DatagramIterator &scan, BamReader *manager);
00064 
00065     float _cycle_rate;
00066     float _frame_offset;
00067     float _start_time;
00068   };
00069 
00070   PipelineCycler<CData> _cycler;
00071   typedef CycleDataReader<CData> CDReader;
00072   typedef CycleDataWriter<CData> CDWriter;
00073 
00074 public:
00075   static void register_with_read_factory();
00076   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00077 
00078 protected:
00079   static TypedWritable *make_from_bam(const FactoryParams &params);
00080   void fillin(DatagramIterator &scan, BamReader *manager);
00081 
00082 public:
00083   static TypeHandle get_class_type() {
00084     return _type_handle;
00085   }
00086   static void init_type() {
00087     SelectiveChildNode::init_type();
00088     register_type(_type_handle, "SequenceNode",
00089                   SelectiveChildNode::get_class_type());
00090   }
00091   virtual TypeHandle get_type() const {
00092     return get_class_type();
00093   }
00094   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00095 
00096 private:
00097   static TypeHandle _type_handle;
00098 };
00099 
00100 #include "sequenceNode.I"
00101 
00102 #endif

Generated on Fri May 2 00:42:22 2003 for Panda by doxygen1.3