00001 // Filename: texMatrixAttrib.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 TEXMATRIXATTRIB_H 00020 #define TEXMATRIXATTRIB_H 00021 00022 #include "pandabase.h" 00023 00024 #include "renderAttrib.h" 00025 #include "luse.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : TexMatrixAttrib 00029 // Description : Applies a transform matrix to UV's before they are 00030 // rendered. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDA TexMatrixAttrib : public RenderAttrib { 00033 private: 00034 INLINE TexMatrixAttrib(const LMatrix4f &mat); 00035 00036 PUBLISHED: 00037 static CPT(RenderAttrib) make(const LMatrix4f &mat); 00038 00039 INLINE const LMatrix4f &get_mat() const; 00040 00041 public: 00042 virtual void issue(GraphicsStateGuardianBase *gsg) const; 00043 virtual void output(ostream &out) const; 00044 00045 protected: 00046 virtual int compare_to_impl(const RenderAttrib *other) const; 00047 virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const; 00048 virtual CPT(RenderAttrib) invert_compose_impl(const RenderAttrib *other) const; 00049 virtual RenderAttrib *make_default_impl() const; 00050 00051 private: 00052 LMatrix4f _mat; 00053 00054 public: 00055 static void register_with_read_factory(); 00056 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00057 00058 protected: 00059 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00060 void fillin(DatagramIterator &scan, BamReader *manager); 00061 00062 public: 00063 static TypeHandle get_class_type() { 00064 return _type_handle; 00065 } 00066 static void init_type() { 00067 RenderAttrib::init_type(); 00068 register_type(_type_handle, "TexMatrixAttrib", 00069 RenderAttrib::get_class_type()); 00070 } 00071 virtual TypeHandle get_type() const { 00072 return get_class_type(); 00073 } 00074 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00075 00076 private: 00077 static TypeHandle _type_handle; 00078 }; 00079 00080 #include "texMatrixAttrib.I" 00081 00082 #endif 00083