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

texCoordPerturb.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////
00002 // 6/26/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 #if !defined(AFX_FRAGMENTSHADER_H__BD1A3C75_D5A6_4D83_B2C9_F29380C64FB3__INCLUDED_)
00020 #define AFX_FRAGMENTSHADER_H__BD1A3C75_D5A6_4D83_B2C9_F29380C64FB3__INCLUDED_
00021 
00022 #if _MSC_VER > 1000
00023 #pragma once
00024 #endif // _MSC_VER > 1000
00025 
00026 
00027 #include "../core/gliftObject.h"
00028 #include "texConst.h"
00029 #include "texTrans.h"
00030 #include "../util/gliftDecl.h"
00031 #include <mathGutz.h>
00032 #include <arrayGutz.h>
00033 
00034 #include <string>
00035 #include <vector>
00036 
00037 namespace glift {
00038 
00039 class TexCoordPerturb;
00040 typedef std::vector<gutz::vec3f>          Vecvec3f;
00041 typedef std::vector<bool>                         VecBool;
00042 typedef std::vector<TexCoordPerturb>  VecTexPerturb;
00043 typedef std::vector<TexCoordPerturb*> VecTexPerturbP;
00044 
00045 /////////////////////////////////////////////////////////////////////////
00046 ///
00047 /// TexCoordPerturb: Definition of texture coord transforms and constants 
00048 ///                                 that accompany a programmable pixel and vertex shader.
00049 ///
00050 /// - 'numTexUnits' specifies the number of texture units for which texture
00051 ///   coordinates should be generated.
00052 /// - The constructors ensure that any texture unit can only have one 
00053 ///   transform and one constant applied per channel of each unit.
00054 /// - The constructors ensure that the texture unit specified by a transform
00055 ///   or constant is less than 'numTexUnits'.
00056 /// - If 'numTexUnits' is larger than the max number of perturbs specified,
00057 ///   "no-op" perturbations will be created that do not perturb the texture
00058 ///   coordinates, but still generate coords for that texture unit.
00059 ///   
00060 ///////////////////////////////////////////////////////////////////////
00061 
00062 class _export_ TexCoordPerturb : public GliftObject
00063 {
00064 public:
00065    TexCoordPerturb( uint numTexUnits, const VecTexConst& vecTexConst=VecTexConst() );
00066    TexCoordPerturb( uint numTexUnits, const VecTexTrans& vecTexTrans, const VecTexConst& vecTexConst=VecTexConst() );
00067 
00068    /// Generate appropriate texture coordinates, taking into account 
00069    /// multiTexturing, texCoordTransforms, and texture contants
00070    virtual MultiTexCoord* genTexCoords( const gutz::arrayw2f& rawTexCoord, const gutz::vec3f& primScale );
00071 
00072    int numTexUnits() const {return m_texTrans.size();}
00073 
00074 private:
00075    VecVecTexTrans m_texTrans;
00076    VecVecTexConst m_texConst;
00077 
00078    void initTexTrans( uint numTexUnits, const VecTexTrans& texTransform );
00079    void initTexConst( uint numTexUnits, const VecTexConst& texConst );
00080    void checkTexUnitMin( uint numTexUnits );
00081    void checkTexUnit( const char* callingFuncName, const char* inputVecName,
00082       uint texUnit, uint vecIndex, uint maxTexUnits );
00083 
00084 };
00085 
00086 } /// End of namespace glift
00087 
00088 #endif /// !defined(AFX_FRAGMENTSHADER_H__BD1A3C75_D5A6_4D83_B2C9_F29380C64FB3__INCLUDED_)

Send questions, comments, and bug reports to:
jmk