arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

texTrans.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////
00002 // 6/28/02      Aaron Lefohn    Scientific Computing and Imaging Institute
00003 // School of Computing          University of Utah
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 #ifndef GLIFT_TEX_TRANSFORM_H
00020 #define GLIFT_TEX_TRANSFORM_H
00021 
00022 #include "../util/coordTrans.h"
00023 #include "texCoordGen.h"
00024 #include <mathGutz.h>
00025 #include <arrayGutz.h>
00026 #include <vector>
00027 
00028 namespace glift {
00029 
00030 class TexTrans;
00031 typedef std::vector<TexTrans>           VecTexTrans;
00032 typedef std::vector<TexTrans*>          VecTexTransP;
00033 typedef std::vector<VecTexTrans>        VecVecTexTrans;
00034 typedef std::vector<VecTexTransP>       VecVecTexTransP;
00035 
00036 
00037 /////////////////////////////////////////////////////////////////////////
00038 ///
00039 /// TexTrans - Encapsulation of a scale/bias linear transform on raw
00040 ///                   texture coordinates.
00041 ///     
00042 ///     - The default constructor makes the identity transform.
00043 /// 
00044 //////////////////////////////////////////////////////////////////////
00045 class TexTrans : public TexCoordGen
00046 {
00047 public:
00048    TexTrans();                                  /// Identity transform on texUnit = 0
00049    TexTrans( uint texUnit );    /// Identity transform on 'texUnits'
00050    TexTrans( uint texUnit, const gutz::vec2f& bias,  bool relBias=false );
00051    TexTrans( uint texUnit, const gutz::vec3f& bias,  bool relBias=false );
00052    TexTrans( uint texUnit, const gutz::mat4f& mat,   bool relScale=false, bool relTrans=false );
00053    TexTrans( uint texUnit, const gutz::vec3f& scale, const gutz::vec3f& bias,   bool relScale, bool relBias );
00054 
00055    uint  texUnit() const { return m_texUnit; }
00056 
00057    /// Apply transform to all coords specified in 'rawTexCoords'
00058    /// Divide scale and/or bias transform by 'primScale' if requested.
00059    virtual gutz::arrayo2f operator()( const gutz::arrayw2f& rawTexCoords, const gutz::vec3f& primScale );
00060 
00061 private:
00062    uint         m_texUnit;
00063    CoordTrans   m_transform;
00064 
00065    virtual gutz::arrayo2f operator()() { return gutz::arrayw2f(); } //Dissallow default call.
00066 };
00067 
00068 } /// End of namespace glift
00069 
00070 #endif

Send questions, comments, and bug reports to:
jmk