ShMIPFilter.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2006 Serious Hack Inc.
00004 // 
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHMIPFILTER_HPP
00021 #define SHMIPFILTER_HPP
00022 
00023 namespace SH {
00024 
00030 template<typename T, bool interpolated=true>
00031 class ShMIPFilter : public T {
00032 public:
00033   ShMIPFilter()
00034     : T()
00035   {
00036     if (interpolated) {
00037       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_LINEAR);
00038     } else {
00039       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_NEAREST);
00040     }
00041   }
00042   ShMIPFilter(int width)
00043     : T(width)
00044   {
00045     if (interpolated) {
00046       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_LINEAR);
00047     } else {
00048       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_NEAREST);
00049     }
00050   }
00051   ShMIPFilter(int width, int height)
00052     : T(width, height)
00053   {
00054     if (interpolated) {
00055       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_LINEAR);
00056     } else {
00057       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_NEAREST);
00058     }
00059   }
00060   ShMIPFilter(int width, int height, int depth)
00061     : T(width, height, depth)
00062   {
00063     if (interpolated) {
00064       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_LINEAR);
00065     } else {
00066       this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_MIPMAP_NEAREST);
00067     }
00068   }
00069 
00070   typedef typename T::return_type return_type;
00071   
00072 };
00073 
00077 template<typename T>
00078 class ShNoMIPFilter : public T {
00079 public:
00080   ShNoMIPFilter()
00081     : T()
00082   {
00083     this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_NONE);
00084   }
00085   ShNoMIPFilter(int width)
00086     : T(width)
00087   {
00088     this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_NONE);
00089   }
00090   ShNoMIPFilter(int width, int height)
00091     : T(width, height)
00092   {
00093     this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_NONE);
00094   }
00095   ShNoMIPFilter(int width, int height, int depth)
00096     : T(width, height, depth)
00097   {
00098     this->m_node->traits().filtering(ShTextureTraits::SH_FILTER_NONE);
00099   }
00100 
00101   typedef typename T::return_type return_type;
00102   
00103 };
00104 
00105 }
00106 
00107 #endif

Generated on Thu Feb 16 14:51:36 2006 for Sh by  doxygen 1.4.6