00001 // Filename: projtexShader.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 #ifndef PROJTEXSHADER_H 00019 #define PROJTEXSHADER_H 00020 // 00021 //////////////////////////////////////////////////////////////////// 00022 // Includes 00023 //////////////////////////////////////////////////////////////////// 00024 #include <pandabase.h> 00025 00026 #include "shader.h" 00027 #include <texture.h> 00028 #include <colorBlendProperty.h> 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Defines 00032 //////////////////////////////////////////////////////////////////// 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : ProjtexShader 00036 // Description : 00037 //////////////////////////////////////////////////////////////////// 00038 class EXPCL_SHADER ProjtexShader : public FrustumShader 00039 { 00040 public: 00041 00042 ProjtexShader(Texture* texture = NULL, 00043 ColorBlendProperty::Mode mode = ColorBlendProperty::M_multiply); 00044 ~ProjtexShader() { } 00045 00046 virtual void config(void); 00047 virtual void apply(Node *node, const AllAttributesWrapper &init_state, 00048 const AllTransitionsWrapper &net_trans, 00049 GraphicsStateGuardian *gsg); 00050 00051 INLINE void set_texture(Texture* texture) { 00052 _texture = texture; 00053 make_dirty(); 00054 } 00055 00056 INLINE Texture* get_texture(void) { return _texture; } 00057 00058 protected: 00059 00060 PT(Texture) _texture; 00061 ColorBlendProperty::Mode _blend; 00062 00063 public: 00064 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 FrustumShader::init_type(); 00070 register_type(_type_handle, "ProjtexShader", 00071 FrustumShader::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 00080 static TypeHandle _type_handle; 00081 }; 00082 00083 #endif