00001 // Filename: textureApplyAttrib.h 00002 // Created by: drose (04Mar02) 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 TEXTUREAPPLYATTRIB_H 00020 #define TEXTUREAPPLYATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : TextureApplyAttrib 00028 // Description : Specifies how textures are applied; specifically, how 00029 // texture color modifies geometry color. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDA TextureApplyAttrib : public RenderAttrib { 00032 PUBLISHED: 00033 enum Mode { 00034 M_modulate, 00035 M_decal, 00036 M_blend, 00037 M_replace, 00038 M_add 00039 }; 00040 00041 private: 00042 INLINE TextureApplyAttrib(Mode mode = M_modulate); 00043 00044 PUBLISHED: 00045 static CPT(RenderAttrib) make(Mode mode); 00046 00047 INLINE Mode get_mode() const; 00048 00049 public: 00050 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00051 virtual void output(ostream &out) const; 00052 00053 protected: 00054 virtual int compare_to_impl(const RenderAttrib *other) const; 00055 virtual RenderAttrib *make_default_impl() const; 00056 00057 private: 00058 Mode _mode; 00059 00060 public: 00061 static void register_with_read_factory(); 00062 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00063 00064 protected: 00065 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00066 void fillin(DatagramIterator &scan, BamReader *manager); 00067 00068 public: 00069 static TypeHandle get_class_type() { 00070 return _type_handle; 00071 } 00072 static void init_type() { 00073 RenderAttrib::init_type(); 00074 register_type(_type_handle, "TextureApplyAttrib", 00075 RenderAttrib::get_class_type()); 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 }; 00085 00086 #include "textureApplyAttrib.I" 00087 00088 #endif 00089