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

multiTex.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////
00002 // 6/6/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_MULTITEXTURE_H__08131322_9A92_4E75_BA9D_F79170DBF348__INCLUDED_)
00020 #define AFX_MULTITEXTURE_H__08131322_9A92_4E75_BA9D_F79170DBF348__INCLUDED_
00021 
00022 #if _MSC_VER > 1000
00023 #pragma once
00024 #endif // _MSC_VER > 1000
00025 
00026 #include "singleTex.h"
00027 
00028 namespace glift {
00029 
00030 /////////////////////////////////////////////////////////////////////////
00031 ///
00032 /// multiTexture.h: - Container class for multitexturing
00033 ///                                - Pass in vector of SingleTex ptrs and an optional
00034 ///                                  vector of MultiTexUnitState objects to set the 
00035 ///                                  texture unit state for each texUnit.
00036 ///                                  
00037 ///                                  TODO: 1) Should this be vector of MultiTexUnitState 
00038 ///                                        pointers instead of objects?
00039 ///                                        
00040 ///                                        2) VecMultiTexUState is a HORRIBLE name!!
00041 ///
00042 ///////////////////////////////////////////////////////////////////////
00043 class _export_ MultiTex : public Texture  
00044 {
00045 public:
00046    MultiTex( const VecTexP& vecTex, 
00047       const VecMultiTexUState& vecTexUnitState = VecMultiTexUState() );
00048 
00049    MultiTex( const MultiTex& rhs );
00050    MultiTex& operator=( const MultiTex& rhs );
00051    virtual ~MultiTex();
00052 
00053    virtual int numTexUnits() const               { return m_texPtr.size();      }
00054    int numTexUnitStates() const          { return m_texUnitState.size(); }
00055 
00056    /// Get/Set individual textures
00057    SingleTex*&   operator[](int i)               { return m_texPtr[i];          }
00058    const SingleTex* operator[](int i) const { return m_texPtr[i];               }
00059 
00060    /// Get/Set individual textureUnit states
00061    MultiTexUState&        texUnitState( int i )           { return m_texUnitState[i]; }
00062    const MultiTexUState& texUnitState( int i ) const { return m_texUnitState[i]; }
00063 
00064    /// Set all textures and/or texUnitStates 
00065    void reset( const VecTexP& vecTexP,                                          /// Set new texture and optionally new TexUnitState
00066       const VecMultiTexUState& vecTexUnitState = VecMultiTexUState() );
00067    void reset( const VecMultiTexUState& vecTexUnitState); /// Set new TexUnitState
00068 
00069 protected:
00070    virtual void bindDef();
00071    virtual void releaseDef();
00072 
00073 private:
00074    VecTexP                              m_texPtr;               /// Vector of SingleTex pointers
00075    VecMultiTexUState    m_texUnitState; /// Vector of MultiTexUState objs
00076 
00077    void initMembers( const VecTexP& vecTexPtr, const VecMultiTexUState& vecTexUState );
00078 };
00079 
00080 } /// End of namespace glift
00081 
00082 #endif /// !defined(AFX_MULTITEXTURE_H__08131322_9A92_4E75_BA9D_F79170DBF348__INCLUDED_)

Send questions, comments, and bug reports to:
jmk