00001 // Filename: colorScaleAttrib.h 00002 // Created by: drose (14Mar02) 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 COLORSCALEATTRIB_H 00020 #define COLORSCALEATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 #include "luse.h" 00026 00027 class FactoryParams; 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : ColorScaleAttrib 00031 // Description : Applies a scale to colors in the scene graph and on 00032 // vertices. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDA ColorScaleAttrib : public RenderAttrib { 00035 private: 00036 INLINE ColorScaleAttrib(const LVecBase4f &scale); 00037 00038 PUBLISHED: 00039 static CPT(RenderAttrib) make(const LVecBase4f &scale); 00040 00041 INLINE const LVecBase4f &get_scale() const; 00042 00043 public: 00044 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00045 virtual void output(ostream &out) const; 00046 00047 protected: 00048 virtual int compare_to_impl(const RenderAttrib *other) const; 00049 virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const; 00050 virtual CPT(RenderAttrib) invert_compose_impl(const RenderAttrib *other) const; 00051 virtual RenderAttrib *make_default_impl() const; 00052 00053 private: 00054 LVecBase4f _scale; 00055 00056 public: 00057 static void register_with_read_factory(); 00058 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00059 00060 protected: 00061 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00062 void fillin(DatagramIterator &scan, BamReader *manager); 00063 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 RenderAttrib::init_type(); 00070 register_type(_type_handle, "ColorScaleAttrib", 00071 RenderAttrib::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00077 00078 private: 00079 static TypeHandle _type_handle; 00080 }; 00081 00082 #include "colorScaleAttrib.I" 00083 00084 #endif 00085