00001 // Filename: spheretexHighlighter.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 SPHERETEXHIGHLIGHTER_H 00019 #define SPHERETEXHIGHLIGHTER_H 00020 // 00021 //////////////////////////////////////////////////////////////////// 00022 // Includes 00023 //////////////////////////////////////////////////////////////////// 00024 #include <pandabase.h> 00025 00026 #include "shader.h" 00027 #include "spheretexShader.h" 00028 00029 #include "pt_Node.h" 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Defines 00033 //////////////////////////////////////////////////////////////////// 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Class : SpheretexHighlighter 00037 // Description : Creates a highlight texture from a given light and 00038 // projects this onto the receiving object 00039 //////////////////////////////////////////////////////////////////// 00040 class EXPCL_SHADER SpheretexHighlighter : public FrustumShader 00041 { 00042 public: 00043 00044 SpheretexHighlighter(int size = 128); 00045 00046 virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state, 00047 const AllTransitionsWrapper &net_trans, 00048 GraphicsStateGuardian *gsg); 00049 virtual void apply(Node *node, const AllAttributesWrapper &init_state, 00050 const AllTransitionsWrapper &net_trans, 00051 GraphicsStateGuardian *gsg); 00052 00053 // MPG - should we make this check for powers of 2? 00054 INLINE void set_size(int size) { _size = size; } 00055 INLINE int get_size(void) { return _size; } 00056 //Override base class shader's set_priority to allow 00057 //us to set the priority of the contained projtex_shader at 00058 //the same time 00059 virtual void set_priority(int priority); 00060 virtual void set_multipass(bool on); 00061 00062 protected: 00063 00064 SpheretexShader _spheretex_shader; 00065 int _size; 00066 00067 public: 00068 00069 static TypeHandle get_class_type() { 00070 return _type_handle; 00071 } 00072 static void init_type() { 00073 FrustumShader::init_type(); 00074 register_type(_type_handle, "SpheretexHighlighter", 00075 FrustumShader::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 00084 static TypeHandle _type_handle; 00085 }; 00086 00087 #endif