Panda3D
 All Classes Functions Variables Enumerations
fadeLodNode.h
00001 // Filename: fadeLodNode.h
00002 // Created by:  sshodhan (14Jun04)
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 FADELODNODE_H
00016 #define FADELODNODE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "lodNode.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : FadeLODNode
00024 // Description : A Level-of-Detail node with alpha based switching.
00025 ////////////////////////////////////////////////////////////////////
00026 class EXPCL_PANDA_PGRAPHNODES FadeLODNode : public LODNode {
00027 PUBLISHED:
00028   FadeLODNode(const string &name);
00029 
00030 protected:
00031   FadeLODNode(const FadeLODNode &copy);
00032 public:
00033   virtual PandaNode *make_copy() const;
00034   virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00035   virtual void output(ostream &out) const;
00036 
00037 PUBLISHED:
00038   INLINE void set_fade_time(PN_stdfloat t);
00039   INLINE PN_stdfloat get_fade_time() const;
00040 
00041   void set_fade_bin(const string &name, int draw_order);
00042   INLINE const string &get_fade_bin_name() const;
00043   INLINE int get_fade_bin_draw_order() const;
00044 
00045   void set_fade_state_override(int override);
00046   INLINE int get_fade_state_override() const;
00047 
00048 private:
00049   CPT(RenderState) get_fade_1_old_state();
00050   CPT(RenderState) get_fade_1_new_state(PN_stdfloat in_alpha);
00051   CPT(RenderState) get_fade_2_old_state(PN_stdfloat out_alpha);
00052   CPT(RenderState) get_fade_2_new_state();
00053 
00054 private:
00055   PN_stdfloat _fade_time;
00056   string _fade_bin_name;
00057   int _fade_bin_draw_order;
00058   int _fade_state_override;
00059 
00060   CPT(RenderState) _fade_1_new_state;
00061   CPT(RenderState) _fade_1_old_state;
00062   CPT(RenderState) _fade_2_new_state;
00063   CPT(RenderState) _fade_2_old_state;
00064   
00065 public:
00066   static void register_with_read_factory();
00067   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00068 
00069 protected:
00070   static TypedWritable *make_from_bam(const FactoryParams &params);
00071   void fillin(DatagramIterator &scan, BamReader *manager);
00072 
00073 public:
00074   static TypeHandle get_class_type() {
00075     return _type_handle;
00076   }
00077   static void init_type() {
00078     LODNode::init_type();
00079     register_type(_type_handle, "FadeLODNode",
00080                   LODNode::get_class_type());
00081   }
00082   virtual TypeHandle get_type() const {
00083     return get_class_type();
00084   }
00085   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00086 
00087 private:
00088   static TypeHandle _type_handle;
00089 };
00090 
00091 #include "fadeLodNode.I"
00092 
00093 #endif
 All Classes Functions Variables Enumerations