Panda3D

fogAttrib.h

00001 // Filename: fogAttrib.h
00002 // Created by:  drose (14Mar02)
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 FOGATTRIB_H
00016 #define FOGATTRIB_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "renderAttrib.h"
00021 #include "fog.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : FogAttrib
00025 // Description : Applies a Fog to the geometry at and below this node.
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDA_PGRAPH FogAttrib : public RenderAttrib {
00028 private:
00029   INLINE FogAttrib();
00030 
00031 PUBLISHED:
00032   static CPT(RenderAttrib) make(Fog *fog);
00033   static CPT(RenderAttrib) make_off();
00034   static CPT(RenderAttrib) make_default();
00035 
00036   INLINE bool is_off() const;
00037   INLINE Fog *get_fog() const;
00038 
00039 public:
00040   virtual void output(ostream &out) const;
00041 
00042 protected:
00043   virtual int compare_to_impl(const RenderAttrib *other) const;
00044   virtual size_t get_hash_impl() const;
00045   virtual CPT(RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const;
00046 
00047 private:
00048   PT(Fog) _fog;
00049 
00050 PUBLISHED:
00051   static int get_class_slot() {
00052     return _attrib_slot;
00053   }
00054   virtual int get_slot() const {
00055     return get_class_slot();
00056   }
00057 
00058 public:
00059   static void register_with_read_factory();
00060   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00061   virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
00062 
00063 protected:
00064   static TypedWritable *make_from_bam(const FactoryParams &params);
00065   void fillin(DatagramIterator &scan, BamReader *manager);
00066   
00067 public:
00068   static TypeHandle get_class_type() {
00069     return _type_handle;
00070   }
00071   static void init_type() {
00072     RenderAttrib::init_type();
00073     register_type(_type_handle, "FogAttrib",
00074                   RenderAttrib::get_class_type());
00075     _attrib_slot = register_slot(_type_handle, 100, make_default);
00076   }
00077   virtual TypeHandle get_type() const {
00078     return get_class_type();
00079   }
00080   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00081 
00082 private:
00083   static TypeHandle _type_handle;
00084   static int _attrib_slot;
00085 };
00086 
00087 #include "fogAttrib.I"
00088 
00089 #endif
00090 
 All Classes Functions Variables Enumerations