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

panda/src/pgraph/directionalLight.h

Go to the documentation of this file.
00001 // Filename: directionalLight.h
00002 // Created by:  mike (09Jan97)
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 DIRECTIONALLIGHT_H
00020 #define DIRECTIONALLIGHT_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "lightNode.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : DirectionalLight
00028 // Description : A light shining from infinitely far away in a
00029 //               particular direction, like sunlight.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDA DirectionalLight : public LightNode {
00032 PUBLISHED:
00033   DirectionalLight(const string &name);
00034 
00035 protected:
00036   DirectionalLight(const DirectionalLight &copy);
00037 
00038 public:
00039   virtual PandaNode *make_copy() const;
00040   virtual void xform(const LMatrix4f &mat);
00041   virtual void write(ostream &out, int indent_level) const;
00042 
00043 PUBLISHED:
00044   INLINE const Colorf &get_specular_color() const;
00045   INLINE void set_specular_color(const Colorf &color);
00046   
00047   INLINE const LPoint3f &get_point() const;
00048   INLINE void set_point(const LPoint3f &point);
00049   
00050   INLINE const LVector3f &get_direction() const;
00051   INLINE void set_direction(const LVector3f &direction);
00052   
00053 public:
00054   virtual void bind(GraphicsStateGuardianBase *gsg, int light_id);
00055 
00056 private:
00057   // This is the data that must be cycled between pipeline stages.
00058   class EXPCL_PANDA CData : public CycleData {
00059   public:
00060     INLINE CData();
00061     INLINE CData(const CData &copy);
00062     virtual CycleData *make_copy() const;
00063     virtual void write_datagram(BamWriter *manager, Datagram &dg) const;
00064     virtual void fillin(DatagramIterator &scan, BamReader *manager);
00065 
00066     Colorf _specular_color;
00067     LPoint3f _point;
00068     LVector3f _direction;
00069   };
00070 
00071   PipelineCycler<CData> _cycler;
00072   typedef CycleDataReader<CData> CDReader;
00073   typedef CycleDataWriter<CData> CDWriter;
00074 
00075 public:
00076   static void register_with_read_factory();
00077   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00078 
00079 protected:
00080   static TypedWritable *make_from_bam(const FactoryParams &params);
00081   void fillin(DatagramIterator &scan, BamReader *manager);
00082 
00083 public:
00084   static TypeHandle get_class_type() {
00085     return _type_handle;
00086   }
00087   static void init_type() {
00088     LightNode::init_type();
00089     register_type(_type_handle, "DirectionalLight",
00090                   LightNode::get_class_type());
00091   }
00092   virtual TypeHandle get_type() const {
00093     return get_class_type();
00094   }
00095   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00096 
00097 private:
00098   static TypeHandle _type_handle;
00099 };
00100 
00101 INLINE ostream &operator << (ostream &out, const DirectionalLight &light) {
00102   light.output(out);
00103   return out;
00104 }
00105 
00106 #include "directionalLight.I"
00107 
00108 #endif

Generated on Fri May 2 00:41:35 2003 for Panda by doxygen1.3