// Aqsis // Copyright 1997 - 2001, Paul C. Gregory // // Contact: pgregory@aqsis.org // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares the classes and support structures for handling parameters attached to GPrims. \author Paul C. Gregory (pgregory@aqsis.org) */ //? Is .h included already? #ifndef PARAMETERS_H_INCLUDED #define PARAMETERS_H_INCLUDED 1 #include #include "aqsis.h" #include "isurface.h" #include "ishaderdata.h" #include "bilinear.h" #include START_NAMESPACE( Aqsis ) //---------------------------------------------------------------------- /** \class CqParameter * Class storing a parameter with a name and value. */ class CqParameter { public: CqParameter( const char* strName, TqInt Count = 1 ); CqParameter( const CqParameter& From ); virtual ~CqParameter(); /** Pure virtual, clone function, which only creates a new parameter with matching type, no data. * \return A pointer to a new parameter with the same type. */ virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const = 0; /** Pure virtual, duplicate function. * \return A pointer to a new parameter with the same name and value. */ virtual CqParameter* Clone() const = 0; /** Pure virtual, get value class. * \return Class as an EqVariableClass. */ virtual EqVariableClass Class() const = 0; /** Pure virtual, get value type. * \return Type as an EqVariableType. */ virtual EqVariableType Type() const = 0; /** Pure virtual, set value size, not array, but varying/vertex size. */ virtual void SetSize( TqInt size ) = 0; /** Pure virtual, get value size, not array, but varying/vertex size. */ virtual TqUint Size() const = 0; /** Pure virtual, clear value contents. */ virtual void Clear() = 0; /** \attention * The subdivide functions perform common splitting and interpolation on primitive variables * they are only of use if the variable is a bilinear quad (the most common kind) * any other type of splitting or interpolation must be performed by the surface which * instantiates special types (i.e. polygons). */ /** Subdivide the value in the u direction, place one half in this and the other in the specified parameter. * \param pResult1 Pointer to the parameter class to hold the first half of the split. * \param pResult2 Pointer to the parameter class to hold the first half of the split. * \param u Boolean indicating whether to split in the u direction, false indicates split in v. * \param pSurface Pointer to the surface which this paramter belongs, used if the surface has special handling of parameter splitting. */ virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) {} /** Pure virtual, dice the value into a grid using appropriate interpolation for the class. * \param u Integer dice count for the u direction. * \param v Integer dice count for the v direction. * \param pResult Pointer to storage for the result. * \param pSurface Pointer to the surface we are processing used for vertex class variables to perform natural interpolation. */ virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) = 0; virtual void CopyToShaderVariable( IqShaderData* pResult ) = 0; /** Pure virtual, dice a single array element of the value into a grid using appropriate interpolation for the class. * \param u Integer dice count for the u direction. * \param v Integer dice count for the v direction. * \param pResult Pointer to storage for the result. * \param pSurface Pointer to the surface we are processing used for vertex class variables to perform natural interpolation. */ virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) = 0; /** Pure virtual, set an indexed value from another parameter (must be the same type). * \param pFrom Pointer to parameter to get values from. * \param idxTarget Index of value to set, * \param idxSource Index of value to get, */ virtual void SetValue( CqParameter* pFrom, TqInt idxTarget, TqInt idxSource ) = 0; /** Get a reference to the parameter name. */ const CqString& strName() const { return ( m_strName ); } const TqUlong hash() const { return m_hash; } /** Get the array size. */ TqInt Count() const { return ( m_Count ); } protected: CqString m_strName; ///< String name of the parameter. TqInt m_Count; ///< Array size of value. TqUlong m_hash; } ; //---------------------------------------------------------------------- /** \class CqParameterTyped * Parameter templatised by its value type. */ template class CqParameterTyped : public CqParameter { public: CqParameterTyped( const char* strName, TqInt Count = 1 ) : CqParameter( strName, Count ) {} CqParameterTyped( const CqParameterTyped& From ) : CqParameter( From ) {} virtual ~CqParameterTyped() {} /** Get a pointer to the value (presumes uniform). */ virtual const T* pValue() const = 0; /** Get a pointer to the value (presumes uniform). */ virtual T* pValue() = 0; /** Get a pointer to the value at the specified index, if uniform index is ignored. */ virtual const T* pValue( const TqInt Index ) const = 0; /** Get a pointer to the value at the specified index, if uniform index is ignored. */ virtual T* pValue( const TqInt Index ) = 0; virtual void SetValue( CqParameter* pFrom, TqInt idxTarget, TqInt idxSource ) { assert( pFrom->Type() == this->Type() ); CqParameterTyped* pFromTyped = static_cast*>( pFrom ); *pValue( idxTarget ) = *pFromTyped->pValue( idxSource ); } protected: }; //---------------------------------------------------------------------- /** \class CqParameterTypedVarying * Parameter with a varying type, templatised by value type and type id. */ template class CqParameterTypedVarying : public CqParameterTyped { public: CqParameterTypedVarying( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) { m_aValues.resize( 1 ); } CqParameterTypedVarying( const CqParameterTypedVarying& From ) : CqParameterTyped( From ) { *this = From; } virtual ~CqParameterTypedVarying() {} // Overrridden from CqParameter virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedVarying( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedVarying( *this ) ); } virtual EqVariableClass Class() const { return ( class_varying ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) { m_aValues.resize( size ); } virtual TqUint Size() const { return ( m_aValues.size() ); } virtual void Clear() { m_aValues.clear(); } virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) { assert( pResult1->Type() == this->Type() && pResult1->Type() == this->Type() && pResult1->Class() == this->Class() && pResult1->Class() == this->Class() ); CqParameterTypedVarying* pTResult1 = static_cast*>( pResult1 ); CqParameterTypedVarying* pTResult2 = static_cast*>( pResult2 ); pTResult1->SetSize( 4 ); pTResult2->SetSize( 4 ); // Check if a valid 4 point quad, do nothing if not. if ( m_aValues.size() == 4 ) { if ( u ) { pTResult2->pValue( 1 ) [ 0 ] = pValue( 1 ) [ 0 ]; pTResult2->pValue( 3 ) [ 0 ] = pValue( 3 ) [ 0 ]; pTResult1->pValue( 1 ) [ 0 ] = pTResult2->pValue( 0 ) [ 0 ] = static_cast( ( pValue( 0 ) [ 0 ] + pValue( 1 ) [ 0 ] ) * 0.5 ); pTResult1->pValue( 3 ) [ 0 ] = pTResult2->pValue( 2 ) [ 0 ] = static_cast( ( pValue( 2 ) [ 0 ] + pValue( 3 ) [ 0 ] ) * 0.5 ); } else { pTResult2->pValue( 2 ) [ 0 ] = pValue( 2 ) [ 0 ]; pTResult2->pValue( 3 ) [ 0 ] = pValue( 3 ) [ 0 ]; pTResult1->pValue( 2 ) [ 0 ] = pTResult2->pValue( 0 ) [ 0 ] = static_cast( ( pValue( 0 ) [ 0 ] + pValue( 2 ) [ 0 ] ) * 0.5 ); pTResult1->pValue( 3 ) [ 0 ] = pTResult2->pValue( 1 ) [ 0 ] = static_cast( ( pValue( 1 ) [ 0 ] + pValue( 3 ) [ 0 ] ) * 0.5 ); } } } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ); virtual void CopyToShaderVariable( IqShaderData* pResult ); virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { assert( TqFalse ); return; } // Overridden from CqParameterTyped virtual const T* pValue() const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue() { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual const T* pValue( const TqInt Index ) const { assert( Index < static_cast( m_aValues.size() ) ); return ( &m_aValues[ Index ] ); } virtual T* pValue( const TqInt Index ) { assert( Index < static_cast( m_aValues.size() ) ); return ( &m_aValues[ Index ] ); } /** Assignment operator */ CqParameterTypedVarying& operator=( const CqParameterTypedVarying& From ) { TqInt size = From.m_aValues.size(); m_aValues.resize( size ); for ( TqUint j = 0; j < (TqUint) size; j++ ) { m_aValues[ j ] = From.m_aValues[ j ]; } return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedVarying( strName, Count ) ); } private: std::vector m_aValues; ///< Vector of values, one per varying index. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedUniform * Parameter with a uniform type, templatised by value type and type id. */ template class CqParameterTypedUniform : public CqParameterTyped { public: CqParameterTypedUniform( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) { m_aValues.resize( 1 ); } CqParameterTypedUniform( const CqParameterTypedUniform& From ) : CqParameterTyped( From ) { *this = From; } virtual ~CqParameterTypedUniform() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedUniform( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedUniform( *this ) ); } virtual EqVariableClass Class() const { return ( class_uniform ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) { m_aValues.resize( size ); } virtual TqUint Size() const { return ( m_aValues.size() ); } virtual void Clear() { m_aValues.clear(); } virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) { assert( pResult1->Type() == this->Type() && pResult1->Type() == this->Type() && pResult1->Class() == Class() && pResult1->Class() == Class() ); CqParameterTypedUniform* pTResult1 = static_cast*>( pResult1 ); CqParameterTypedUniform* pTResult2 = static_cast*>( pResult2 ); ( *pTResult1 ) = ( *pTResult2 ) = ( *this ); } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. // Also note that the only time a Uniform value is diced is when it is on a single element, i.e. the patchmesh // has been split into isngle patches, or the polymesh has been split into polys. TqUint i; TqUint max = MAX( (TqUint)u * (TqUint)v, pResult->Size() ); for ( i = 0; i < max; i++ ) pResult->SetValue( m_aValues[ 0 ], i ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. // Also note that the only time a Uniform value is diced is when it is on a single element, i.e. the patchmesh // has been split into isngle patches, or the polymesh has been split into polys. TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max; i++ ) pResult->SetValue( m_aValues[ 0 ], i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { assert( TqFalse ); return; } // Overridden from CqParameterTyped virtual const T* pValue() const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue() { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual const T* pValue( const TqInt Index ) const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ Index ] ); } virtual T* pValue( const TqInt Index ) { assert( 0 < m_aValues.size() ); return ( &m_aValues[ Index ] ); } /** Assignment operator. */ CqParameterTypedUniform& operator=( const CqParameterTypedUniform& From ) { m_aValues.resize( From.m_aValues.size() ); for ( TqUint j = 0; j < m_aValues.size(); j++ ) { m_aValues[ j ] = From.m_aValues[ j ]; } return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedUniform( strName, Count ) ); } private: std::vector m_aValues; ///< Vector of values, one per uniform index. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedConstant * Parameter with a constant type, templatised by value type and type id. */ template class CqParameterTypedConstant : public CqParameterTyped { public: CqParameterTypedConstant( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) {} CqParameterTypedConstant( const CqParameterTypedConstant& From ) : CqParameterTyped( From ) { m_Value = From.m_Value; } virtual ~CqParameterTypedConstant() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedConstant( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedConstant( *this ) ); } virtual EqVariableClass Class() const { return ( class_constant ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) {} virtual TqUint Size() const { return ( 1 ); } virtual void Clear() {} virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) { assert( pResult1->Type() == this->Type() && pResult1->Type() == this->Type() && pResult1->Class() == this->Class() && pResult1->Class() == this->Class() ); CqParameterTypedConstant* pTResult1 = static_cast*>( pResult1 ); CqParameterTypedConstant* pTResult2 = static_cast*>( pResult2 ); ( *pTResult1 ) = ( *pTResult2 ) = ( *this ); } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = MAX( (TqUint) u * (TqUint) v, pResult->Size() ); for ( i = 0; i < max ; i++ ) pResult->SetValue( m_Value, i ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max ; i++ ) pResult->SetValue( m_Value, i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { assert( TqFalse ); return; } // Overridden from CqParameterTyped virtual const T* pValue() const { return ( &m_Value ); } virtual T* pValue() { return ( &m_Value ); } virtual const T* pValue( const TqInt Index ) const { return ( &m_Value ); } virtual T* pValue( const TqInt Index ) { return ( &m_Value ); } /** Assignment operator. */ CqParameterTypedConstant& operator=( const CqParameterTypedConstant& From ) { m_Value = From.m_Value; return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedConstant( strName, Count ) ); } private: T m_Value; ///< Single constant value. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedVertex * Parameter with a vertex type, templatised by value type and type id. */ template class CqParameterTypedVertex : public CqParameterTypedVarying { public: CqParameterTypedVertex( const char* strName, TqInt Count = 1 ) : CqParameterTypedVarying( strName, Count ) {} CqParameterTypedVertex( const CqParameterTypedVertex& From ) : CqParameterTypedVarying( From ) {} virtual ~CqParameterTypedVertex() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedVertex( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedVertex( *this ) ); } virtual EqVariableClass Class() const { return ( class_vertex ); } virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) { assert( pResult1->Type() == this->Type() && pResult1->Type() == this->Type() && pResult1->Class() == this->Class() && pResult1->Class() == this->Class() ); pSurface->NaturalSubdivide( this, pResult1, pResult2, u ); } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); assert( NULL != pSurface ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. pSurface->NaturalDice( this, u, v, pResult ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { assert( pResult->Type() == this->Type() ); TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max ; i++ ) pResult->SetValue( this->pValue(i)[0], i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { assert( TqFalse ); return; } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedVertex( strName, Count ) ); } private: }; //---------------------------------------------------------------------- /** \class CqParameterTypedFaceVarying * Parameter with a vertex type, templatised by value type and type id. */ template class CqParameterTypedFaceVarying : public CqParameterTypedVarying { public: CqParameterTypedFaceVarying( const char* strName, TqInt Count = 1 ) : CqParameterTypedVarying( strName, Count ) {} CqParameterTypedFaceVarying( const CqParameterTypedVertex& From ) : CqParameterTypedVarying( From ) {} virtual ~CqParameterTypedFaceVarying() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedFaceVarying( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedFaceVarying( *this ) ); } virtual EqVariableClass Class() const { return ( class_facevarying ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedFaceVarying( strName, Count ) ); } private: }; //---------------------------------------------------------------------- /** \class CqParameterTypedFaceVertex * Parameter with a vertex type, templatised by value type and type id. */ template class CqParameterTypedFaceVertex : public CqParameterTypedVertex { public: CqParameterTypedFaceVertex( const char* strName, TqInt Count = 1 ) : CqParameterTypedVertex( strName, Count ) {} CqParameterTypedFaceVertex( const CqParameterTypedVertex& From ) : CqParameterTypedVertex( From ) {} virtual ~CqParameterTypedFaceVertex() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedFaceVertex( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedFaceVertex( *this ) ); } virtual EqVariableClass Class() const { return ( class_facevertex ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedFaceVertex( strName, Count ) ); } private: }; //---------------------------------------------------------------------- /** \class CqParameterTypedVaryingArray * Parameter with a varying array type, templatised by value type and type id. */ template class CqParameterTypedVaryingArray : public CqParameterTyped { public: CqParameterTypedVaryingArray( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) { m_aValues.resize( 1, std::vector(Count) ); } CqParameterTypedVaryingArray( const CqParameterTypedVaryingArray& From ) : CqParameterTyped( From ) { *this = From; } virtual ~CqParameterTypedVaryingArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedVaryingArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedVaryingArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_varying ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) { m_aValues.resize( size, std::vector< T >(this->m_Count) ); } virtual TqUint Size() const { return ( m_aValues.size() ); } virtual void Clear() { m_aValues.clear(); } virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) { assert( pResult1->Type() == this->Type() && pResult1->Type() == this->Type() && pResult1->Class() == Class() && pResult1->Class() == Class() ); CqParameterTypedVaryingArray* pTResult1 = static_cast*>( pResult1 ); CqParameterTypedVaryingArray* pTResult2 = static_cast*>( pResult2 ); pTResult1->SetSize( 4 ); pTResult2->SetSize( 4 ); // Check if a valid 4 point quad, do nothing if not. if ( m_aValues.size() == 4 ) { if ( u ) { TqInt index; for( index = this->Count()-1; index >= 0; index-- ) { pTResult2->pValue( 1 ) [ index ] = pValue( 1 ) [ index ]; pTResult2->pValue( 3 ) [ index ] = pValue( 3 ) [ index ]; pTResult1->pValue( 1 ) [ index ] = pTResult2->pValue( 0 ) [ index ] = static_cast( ( pValue( 0 ) [ index ] + pValue( 1 ) [ index ] ) * 0.5 ); pTResult1->pValue( 3 ) [ index ] = pTResult2->pValue( 2 ) [ index ] = static_cast( ( pValue( 2 ) [ index ] + pValue( 3 ) [ index ] ) * 0.5 ); } } else { TqInt index; for( index = this->Count()-1; index >= 0; index-- ) { pTResult2->pValue( 2 ) [ index ] = pValue( 2 ) [ index ]; pTResult2->pValue( 3 ) [ index ] = pValue( 3 ) [ index ]; pTResult1->pValue( 2 ) [ index ] = pTResult2->pValue( 0 ) [ index ] = static_cast( ( pValue( 0 ) [ index ] + pValue( 2 ) [ index ] ) * 0.5 ); pTResult1->pValue( 3 ) [ index ] = pTResult2->pValue( 1 ) [ index ] = static_cast( ( pValue( 1 ) [ index ] + pValue( 3 ) [ index ] ) * 0.5 ); } } } } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ); virtual void CopyToShaderVariable( IqShaderData* pResult ); virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ); // Overridden from CqParameterTyped virtual const T* pValue() const { assert( 0 < m_aValues.size() ); assert( 0 < m_aValues[0].size() ); return ( &m_aValues[ 0 ][ 0 ] ); } virtual T* pValue() { assert( 0 < m_aValues.size() ); assert( 0 < m_aValues[0].size() ); return ( &m_aValues[ 0 ][ 0 ] ); } virtual const T* pValue( const TqInt Index ) const { assert( Index < static_cast( m_aValues.size() ) ); assert( 0 < m_aValues[0].size() ); return ( &m_aValues[ Index ][ 0 ] ); } virtual T* pValue( const TqInt Index ) { assert( Index < static_cast( m_aValues.size() ) ); assert( 0 < m_aValues[0].size() ); return ( &m_aValues[ Index ][ 0 ] ); } virtual void SetValue( CqParameter* pFrom, TqInt idxTarget, TqInt idxSource ) { assert( pFrom->Type() == this->Type() ); assert( pFrom->Count() == this->Count() ); CqParameterTyped* pFromTyped = static_cast*>( pFrom ); TqInt index; T* pTargetValues = pValue( idxTarget ); T* pSourceValues = pFromTyped->pValue( idxSource ); for( index = 0; index < this->Count(); index++ ) pTargetValues[ index ] = pSourceValues[ index ]; } /** Assignment operator. */ CqParameterTypedVaryingArray& operator=( const CqParameterTypedVaryingArray& From ) { m_aValues.resize( From.m_aValues.size(), std::vector(From.Count()) ); this->m_Count = From.m_Count; TqUint j; for ( j = 0; j < m_aValues.size(); j++ ) { TqUint i; for ( i = 0; i < (TqUint) this->m_Count; i++ ) m_aValues[ j ][ i ] = From.m_aValues[ j ][ i ]; } return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedVaryingArray( strName, Count ) ); } private: std::vector > m_aValues; ///< Array of varying values. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedUniformArray * Parameter with a uniform array type, templatised by value type and type id. */ template class CqParameterTypedUniformArray : public CqParameterTyped { public: CqParameterTypedUniformArray( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) { m_aValues.resize( Count ); } CqParameterTypedUniformArray( const CqParameterTypedUniformArray& From ) : CqParameterTyped( From ) { m_aValues.resize( From.m_Count ); TqUint i; for ( i = 0; i < (TqUint)From.m_Count; i++ ) m_aValues[ i ] = From.m_aValues[ i ]; } virtual ~CqParameterTypedUniformArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedUniformArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedUniformArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_uniform ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) {} virtual TqUint Size() const { return ( 1 ); } virtual void Clear() {} virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) {} virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqInt j; TqUint max = ( MAX( (TqUint)u * (TqUint) v, pResult->Size() ) ); for ( i = 0; i < max; ++i ) for( j = 0; j < this->Count(); ++j ) pResult->SetValue( pValue( 0 ) [ j ], i ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max; i++ ) pResult->SetValue( pValue( 0 ) [ 0 ], i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); assert( this->Count() > ArrayIndex ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = ( MAX( (TqUint)u * (TqUint) v, pResult->Size() ) ); for ( i = 0; i < max; i++ ) pResult->SetValue( pValue( 0 ) [ ArrayIndex ], i ); } // Overridden from CqParameterTyped virtual const T* pValue() const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue() { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual const T* pValue( const TqInt Index ) const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue( const TqInt Index ) { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } /** Assignment operator. */ CqParameterTypedUniformArray& operator=( const CqParameterTypedUniformArray& From ) { m_aValues.resize( From.m_aValues.size() ); TqInt i2 = 0; for (typename std::vector::iterator i = From.m_aValues.begin(); i != From.m_aValues.end(); i++, i2++ ) m_aValues[ i2 ] = ( *i ); return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedUniformArray( strName, Count ) ); } private: std::vector m_aValues; ///< Array of uniform values. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedConstantArray * Parameter with a constant array type, templatised by value type and type id. */ template class CqParameterTypedConstantArray : public CqParameterTyped { public: CqParameterTypedConstantArray( const char* strName, TqInt Count = 1 ) : CqParameterTyped( strName, Count ) { m_aValues.resize( Count ); } CqParameterTypedConstantArray( const CqParameterTypedConstantArray& From ) : CqParameterTyped( From ) { m_aValues.resize( From.m_Count ); TqInt i; for ( i = 0; i < From.m_Count; i++ ) m_aValues[ i ] = From.m_aValues[ i ]; } virtual ~CqParameterTypedConstantArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedConstantArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedConstantArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_constant ); } virtual EqVariableType Type() const { return ( I ); } virtual void SetSize( TqInt size ) {} virtual TqUint Size() const { return ( 1 ); } virtual void Clear() {} virtual void Subdivide( CqParameter* pResult1, CqParameter* pResult2, TqBool u, IqSurface* pSurface = 0 ) {} virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqInt j; TqUint max = ( MAX( (TqUint) u * (TqUint) v, pResult->Size() ) ); for ( i = 0; i < max; ++i ) for( j = 0; j < this->Count(); ++j ) pResult->SetValue( pValue( 0 ) [ j ], i ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max; i++ ) pResult->SetValue( pValue( 0 ) [ 0 ], i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { // Just promote the constant value to varying by duplication. assert( pResult->Type() == this->Type() ); assert( this->Count() > ArrayIndex ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = ( MAX( (TqUint) u * (TqUint) v, pResult->Size() ) ); for ( i = 0; i < max; i++ ) pResult->SetValue( pValue( 0 ) [ ArrayIndex ], i ); } // Overridden from CqParameterTyped virtual const T* pValue() const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue() { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual const T* pValue( const TqInt Index ) const { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } virtual T* pValue( const TqInt Index ) { assert( 0 < m_aValues.size() ); return ( &m_aValues[ 0 ] ); } /** Assignment operator. */ CqParameterTypedConstantArray& operator=( const CqParameterTypedUniformArray& From ) { m_aValues.resize( From.m_aValues.size() ); TqInt i2 = 0; for ( typename std::vector::iterator i = From.m_aValues.being(); i != From.m_aValues.end(); i++, i2++ ) m_aValues[ i2 ] = ( *i ); return ( *this ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedConstantArray( strName, Count ) ); } private: std::vector m_aValues; ///< Array of uniform values. } ; //---------------------------------------------------------------------- /** \class CqParameterTypedVertexArray * Parameter with a vertex array type, templatised by value type and type id. */ template class CqParameterTypedVertexArray : public CqParameterTypedVaryingArray { public: CqParameterTypedVertexArray( const char* strName, TqInt Count ) : CqParameterTypedVaryingArray( strName, Count ) {} CqParameterTypedVertexArray( const CqParameterTypedVertexArray& From ) : CqParameterTypedVaryingArray( From ) {} virtual ~CqParameterTypedVertexArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedVertexArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedVertexArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_vertex ); } virtual void Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0 ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); assert( NULL != pSurface ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. pSurface->NaturalDice( this, u, v, pResult ); } virtual void CopyToShaderVariable( IqShaderData* pResult ) { // Just promote the uniform value to varying by duplication. assert( pResult->Type() == this->Type() ); // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqUint i; TqUint max = pResult->Size(); for ( i = 0; i < max; i++ ) pResult->SetValue( this->pValue( 0 ) [ 0 ], i ); } virtual void DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface = 0, TqInt ArrayIndex = 0 ) { /// \note: Need to work out how to do this... return; } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedVertexArray( strName, Count ) ); } private: }; //---------------------------------------------------------------------- /** \class CqParameterTypedFaceVaryingArray * Parameter with a facevarying array type, templatised by value type and type id. */ template class CqParameterTypedFaceVaryingArray : public CqParameterTypedVaryingArray { public: CqParameterTypedFaceVaryingArray( const char* strName, TqInt Count = 1 ) : CqParameterTypedVaryingArray( strName, Count ) {} virtual ~CqParameterTypedFaceVaryingArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedFaceVaryingArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedFaceVaryingArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_facevarying ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedFaceVaryingArray( strName, Count ) ); } private: }; //---------------------------------------------------------------------- /** \class CqParameterTypedFaceVertexArray * Parameter with a facevertex array type, templatised by value type and type id. */ template class CqParameterTypedFaceVertexArray : public CqParameterTypedVertexArray { public: CqParameterTypedFaceVertexArray( const char* strName, TqInt Count = 1 ) : CqParameterTypedVertexArray( strName, Count ) {} virtual ~CqParameterTypedFaceVertexArray() {} virtual CqParameter* CloneType( const char* Name, TqInt Count = 1 ) const { return ( new CqParameterTypedFaceVertexArray( Name, Count ) ); } virtual CqParameter* Clone() const { return ( new CqParameterTypedFaceVertexArray( *this ) ); } virtual EqVariableClass Class() const { return ( class_facevertex ); } /** Static constructor, to allow type free parameter construction. * \param strName Character pointer to new parameter name. * \param Count Integer array size. */ static CqParameter* Create( const char* strName, TqInt Count = 1 ) { return ( new CqParameterTypedFaceVertexArray( strName, Count ) ); } private: }; /** Dice the value into a grid using bilinear interpolation. * \param u Integer dice count for the u direction. * \param v Integer dice count for the v direction. * \param pResult Pointer to storage for the result. * \param pSurface Pointer to the surface to which this parameter belongs. Used if the surface type has special handling for parameter dicing. */ template void CqParameterTypedVarying::Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface ) { T res; SLT* pResData; pResult->GetValuePtr( pResData ); assert( NULL != pResData ); // Check if a valid 4 point quad, do nothing if not. if ( m_aValues.size() >= 4 ) { // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqFloat diu = 1.0 / u; TqFloat div = 1.0 / v; TqInt iv; for ( iv = 0; iv <= v; iv++ ) { TqInt iu; for ( iu = 0; iu <= u; iu++ ) { res = BilinearEvaluate( pValue( 0 ) [ 0 ], pValue( 1 ) [ 0 ], pValue( 2 ) [ 0 ], pValue( 3 ) [ 0 ], iu * diu, iv * div ); ( *pResData++ ) = res; } } } else { TqInt iv; res = pValue( 0 ) [ 0 ]; for ( iv = 0; iv <= v; iv++ ) { TqInt iu; for ( iu = 0; iu <= u; iu++ ) ( *pResData++ ) = res; } } } template void CqParameterTypedVarying::CopyToShaderVariable( IqShaderData* pResult ) { SLT* pResData; pResult->GetValuePtr( pResData ); assert( NULL != pResData ); TqUint iu; for ( iu = 0; iu <= pResult->Size(); iu++ ) ( *pResData++ ) = pValue(iu)[0]; } /** Dice the value into a grid using bilinear interpolation. * \param u Integer dice count for the u direction. * \param v Integer dice count for the v direction. * \param pResult Pointer to storage for the result. * \param pSurface Pointer to the surface to which this parameter belongs. Used if the surface type has special handling for parameter dicing. */ template void CqParameterTypedVaryingArray::Dice( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface ) { assert( pResult->Type() == this->Type() ); assert( pResult->Class() == class_varying ); assert( pResult->Size() == m_aValues.size() ); T res; std::vector pResData(this->Count()); TqInt arrayIndex; for(arrayIndex = 0; arrayIndex < this->Count(); arrayIndex++) pResult->ArrayEntry(arrayIndex)->GetValuePtr( pResData[arrayIndex] ); // Check if a valid 4 point quad, do nothing if not. if ( m_aValues.size() == 4 ) { // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqFloat diu = 1.0 / u; TqFloat div = 1.0 / v; TqInt iv; for ( iv = 0; iv <= v; iv++ ) { TqInt iu; for ( iu = 0; iu <= u; iu++ ) { for( arrayIndex = 0; arrayIndex < this->Count(); arrayIndex++ ) { res = BilinearEvaluate( pValue( 0 ) [ arrayIndex ], pValue( 1 ) [ arrayIndex ], pValue( 2 ) [ arrayIndex ], pValue( 3 ) [ arrayIndex ], iu * diu, iv * div ); ( *(pResData[arrayIndex])++ ) = res; } } } } } template void CqParameterTypedVaryingArray::CopyToShaderVariable( IqShaderData* pResult ) { SLT* pResData; pResult->GetValuePtr( pResData ); assert( NULL != pResData ); TqUint iu; for ( iu = 0; iu <= pResult->Size(); iu++ ) ( *pResData++ ) = pValue(iu)[0]; } /** Dice the value into a grid using bilinear interpolation. * \param u Integer dice count for the u direction. * \param v Integer dice count for the v direction. * \param pResult Pointer to storage for the result. * \param pSurface Pointer to the surface to which this parameter belongs. Used if the surface type has special handling for parameter dicing. */ template void CqParameterTypedVaryingArray::DiceOne( TqInt u, TqInt v, IqShaderData* pResult, IqSurface* pSurface, TqInt ArrayIndex ) { assert( pResult->Type() == this->Type() ); assert( pResult->Class() == class_varying ); assert( this->Count() > ArrayIndex ); T res; SLT* pResData; pResult->GetValuePtr( pResData ); assert( NULL != pResData ); // Check if a valid 4 point quad, do nothing if not. if ( m_aValues.size() == 4 ) { // Note it is assumed that the variable has been // initialised to the correct size prior to calling. TqFloat diu = 1.0 / u; TqFloat div = 1.0 / v; TqInt iv; for ( iv = 0; iv <= v; iv++ ) { TqInt iu; for ( iu = 0; iu <= u; iu++ ) { res = BilinearEvaluate( pValue( 0 ) [ ArrayIndex ], pValue( 1 ) [ ArrayIndex ], pValue( 2 ) [ ArrayIndex ], pValue( 3 ) [ ArrayIndex ], iu * diu, iv * div ); ( *pResData++ ) = res; } } } } //---------------------------------------------------------------------- /** \class CqNamedParameterList */ class CqNamedParameterList { public: CqNamedParameterList( const char* strName ) : m_strName( strName ) { m_hash = CqString::hash( strName ); } CqNamedParameterList( const CqNamedParameterList& From ); ~CqNamedParameterList() { for ( std::vector::iterator i = m_aParameters.begin(); i != m_aParameters.end(); i++ ) delete( ( *i ) ); } #ifdef _DEBUG CqString className() const { return CqString("CqNamedParameterList"); } #endif /** Get a refernece to the option name. * \return A constant CqString reference. */ const CqString& strName() const { return ( m_strName ); } /** Add a new name/value pair to this option/attribute. * \param pParameter Pointer to a CqParameter containing the name/value pair. */ void AddParameter( const CqParameter* pParameter ) { for ( std::vector::iterator i = m_aParameters.begin(); i != m_aParameters.end(); i++ ) { if ( ( *i ) ->hash() == pParameter->hash() ) { delete( *i ); ( *i ) = const_cast( pParameter ); return ; } } // If not append it. m_aParameters.push_back( const_cast( pParameter ) ); } /** Get a read only pointer to a named parameter. * \param strName Character pointer pointing to zero terminated parameter name. * \return A pointer to a CqParameter or 0 if not found. */ const CqParameter* pParameter( const char* strName ) const { TqUlong hash = CqString::hash( strName ); for ( std::vector::const_iterator i = m_aParameters.begin(); i != m_aParameters.end(); i++ ) if ( ( *i ) ->hash() == hash ) return ( *i ); return ( 0 ); } /** Get a pointer to a named parameter. * \param strName Character pointer pointing to zero terminated parameter name. * \return A pointer to a CqParameter or 0 if not found. */ CqParameter* pParameter( const char* strName ) { TqUlong hash = CqString::hash( strName ); for ( std::vector::iterator i = m_aParameters.begin(); i != m_aParameters.end(); i++ ) if ( ( *i ) ->hash() == hash ) return ( *i ); return ( 0 ); } TqUlong hash() { return m_hash; } private: CqString m_strName; ///< The name of this parameter list. std::vector m_aParameters; ///< A vector of name/value parameters. TqUlong m_hash; } ; /////////////////////////////////////////////////////////////////////////////// typedef CqParameterTyped CqFloatParameter; typedef boost::shared_ptr CqFloatParameterPtr; typedef CqParameterTyped CqIntParameter; typedef boost::shared_ptr CqIntParameterPtr; typedef CqParameterTyped CqPointParameter; typedef boost::shared_ptr CqPointParameterPtr; typedef CqParameterTyped CqStringParameter; typedef boost::shared_ptr CqStringParameterPtr; typedef CqParameterTyped CqColorParameter; typedef boost::shared_ptr CqColorParameterPtr; typedef CqParameterTyped CqHPointParameter; typedef boost::shared_ptr CqHPointParameterPtr; typedef CqParameterTyped CqNormalParameter; typedef boost::shared_ptr CqNormalParameterPtr; typedef CqParameterTyped CqVectorParameter; typedef boost::shared_ptr CqVectorParameterPtr; typedef CqParameterTyped CqMatrixParameter; typedef boost::shared_ptr CqMatrixParameterPtr; // Typedefs for the constants typedef CqParameterTypedConstant CqFloatConstantParameter; typedef boost::shared_ptr CqFloatConstantParameterPtr; typedef CqParameterTypedConstant CqIntConstantParameter; typedef boost::shared_ptr CqIntConstantParameterPtr; typedef CqParameterTypedConstant CqPointConstantParameter; typedef boost::shared_ptr CqPointConstantParameterPtr; typedef CqParameterTypedConstant CqStringConstantParameter; typedef boost::shared_ptr CqStringConstantParameterPtr; typedef CqParameterTypedConstant CqColorConstantParameter; typedef boost::shared_ptr CqColorConstantParameterPtr; typedef CqParameterTypedConstant CqHPointConstantParameter; typedef boost::shared_ptr CqHPointConstantParameterPtr; typedef CqParameterTypedConstant CqNormalConstantParameter; typedef boost::shared_ptr CqNormalConstantParameterPtr; typedef CqParameterTypedConstant CqVectorConstantParameter; typedef boost::shared_ptr CqVectorConstantParameterPtr; typedef CqParameterTypedConstant CqMatrixConstantParameter; typedef boost::shared_ptr CqMatrixConstantParameterPtr; // Uniforms typedef CqParameterTypedUniform CqFloatUniformParameter; typedef boost::shared_ptr CqFloatUniformParameterPtr; typedef CqParameterTypedUniform CqIntUniformParameter; typedef boost::shared_ptr CqIntUniformParameterPtr; typedef CqParameterTypedUniform CqPointUniformParameter; typedef boost::shared_ptr CqPointUniformParameterPtr; typedef CqParameterTypedUniform CqStringUniformParameter; typedef boost::shared_ptr CqStringUniformParameterPtr; typedef CqParameterTypedUniform CqColorUniformParameter; typedef boost::shared_ptr CqColorUniformParameterPtr; typedef CqParameterTypedUniform CqHPointUniformParameter; typedef boost::shared_ptr CqHPointUniformParameterPtr; typedef CqParameterTypedUniform CqNormalUniformParameter; typedef boost::shared_ptr CqNormalUniformParameterPtr; typedef CqParameterTypedUniform CqVectorUniformParameter; typedef boost::shared_ptr CqVectorUniformParameterPtr; typedef CqParameterTypedUniform CqMatrixUniformParameter; typedef boost::shared_ptr CqMatrixUniformParameterPtr; // Typedefs for Varying typedef CqParameterTypedVarying CqFloatVaryingParameter; typedef boost::shared_ptr CqFloatVaryingParameterPtr; typedef CqParameterTypedVarying CqIntVaryingParameter; typedef boost::shared_ptr CqIntVaryingParameterPtr; typedef CqParameterTypedVarying CqPointVaryingParameter; typedef boost::shared_ptr CqPointVaryingParameterPtr; typedef CqParameterTypedVarying CqStringVaryingParameter; typedef boost::shared_ptr CqStringVaryingParameterPtr; typedef CqParameterTypedVarying CqColorVaryingParameter; typedef boost::shared_ptr CqColorVaryingParameterPtr; typedef CqParameterTypedVarying CqHPointVaryingParameter; typedef boost::shared_ptr CqHPointVaryingParameterPtr; typedef CqParameterTypedVarying CqNormalVaryingParameter; typedef boost::shared_ptr CqNormalVaryingParameterPtr; typedef CqParameterTypedVarying CqVectorVaryingParameter; typedef boost::shared_ptr CqVectorVaryingParameterPtr; typedef CqParameterTypedVarying CqMatrixVaryingParameter; typedef boost::shared_ptr CqMatrixVaryingParameterPtr; // Vertex typedef CqParameterTypedVertex CqFloatVertexParameter; typedef boost::shared_ptr CqFloatVertexParameterPtr; typedef CqParameterTypedVertex CqIntVertexParameter; typedef boost::shared_ptr CqIntVertexParameterPtr; typedef CqParameterTypedVertex CqPointVertexParameter; typedef boost::shared_ptr CqPointVertexParameterPtr; typedef CqParameterTypedVertex CqStringVertexParameter; typedef boost::shared_ptr CqStringVertexParameterPtr; typedef CqParameterTypedVertex CqColorVertexParameter; typedef boost::shared_ptr CqColorVertexParameterPtr; typedef CqParameterTypedVertex CqHPointVertexParameter; typedef boost::shared_ptr CqHPointVertexParameterPtr; typedef CqParameterTypedVertex CqNormalVertexParameter; typedef boost::shared_ptr CqNormalVertexParameterPtr; typedef CqParameterTypedVertex CqVectorVertexParameter; typedef boost::shared_ptr CqVectorVertexParameterPtr; typedef CqParameterTypedVertex CqMatrixVertexParameter; typedef boost::shared_ptr CqMatrixVertexParameterPtr; // FaceVarying typedef CqParameterTypedFaceVarying CqFloatFaceVaryingParameter; typedef boost::shared_ptr CqFloatFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqIntFaceVaryingParameter; typedef boost::shared_ptr CqIntFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqPointFaceVaryingParameter; typedef boost::shared_ptr CqPointFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqStringFaceVaryingParameter; typedef boost::shared_ptr CqStringFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqColorFaceVaryingParameter; typedef boost::shared_ptr CqColorFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqHPointFaceVaryingParameter; typedef boost::shared_ptr CqHPointFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqNormalFaceVaryingParameter; typedef boost::shared_ptr CqNormalFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqVectorFaceVaryingParameter; typedef boost::shared_ptr CqVectorFaceVaryingParameterPtr; typedef CqParameterTypedFaceVarying CqMatrixFaceVaryingParameter; typedef boost::shared_ptr CqMatrixFaceVaryingParameterPtr; // Constant Array typedef CqParameterTypedConstantArray CqFloatConstantArrayParameter; typedef boost::shared_ptr CqFloatConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqIntConstantArrayParameter; typedef boost::shared_ptr CqIntConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqPointConstantArrayParameter; typedef boost::shared_ptr CqPointConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqStringConstantArrayParameter; typedef boost::shared_ptr CqStringConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqColorConstantArrayParameter; typedef boost::shared_ptr CqColorConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqHPointConstantArrayParameter; typedef boost::shared_ptr CqHPointConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqNormalConstantArrayParameter; typedef boost::shared_ptr CqNormalConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqVectorConstantArrayParameter; typedef boost::shared_ptr CqVectorConstantArrayParameterPtr; typedef CqParameterTypedConstantArray CqMatrixConstantArrayParameter; typedef boost::shared_ptr CqMatrixConstantArrayParameterPtr; // Uniform array typedef CqParameterTypedUniformArray CqFloatUniformArrayParameter; typedef boost::shared_ptr CqFloatUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqIntUniformArrayParameter; typedef boost::shared_ptr CqIntUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqPointUniformArrayParameter; typedef boost::shared_ptr CqPointUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqStringUniformArrayParameter; typedef boost::shared_ptr CqStringUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqColorUniformArrayParameter; typedef boost::shared_ptr CqColorUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqHPointUniformArrayParameter; typedef boost::shared_ptr CqHPointUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqNormalUniformArrayParameter; typedef boost::shared_ptr CqNormalUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqVectorUniformArrayParameter; typedef boost::shared_ptr CqVectorUniformArrayParameterPtr; typedef CqParameterTypedUniformArray CqMatrixUniformArrayParameter; typedef boost::shared_ptr CqMatrixUniformArrayParameterPtr; // Varying array typedef CqParameterTypedVaryingArray CqFloatVaryingArrayParameter; typedef boost::shared_ptr CqFloatVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqIntVaryingArrayParameter; typedef boost::shared_ptr CqIntVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqPointVaryingArrayParameter; typedef boost::shared_ptr CqPointVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqStringVaryingArrayParameter; typedef boost::shared_ptr CqStringVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqColorVaryingArrayParameter; typedef boost::shared_ptr CqColorVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqHPointVaryingArrayParameter; typedef boost::shared_ptr CqHPointVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqNormalVaryingArrayParameter; typedef boost::shared_ptr CqNormalVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqVectorVaryingArrayParameter; typedef boost::shared_ptr CqVectorVaryingArrayParameterPtr; typedef CqParameterTypedVaryingArray CqMatrixVaryingArrayParameter; typedef boost::shared_ptr CqMatrixVaryingArrayParameterPtr; // Vertex array typedef CqParameterTypedVertexArray CqFloatVertexArrayParameter; typedef boost::shared_ptr CqFloatVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqIntVertexArrayParameter; typedef boost::shared_ptr CqIntVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqPointVertexArrayParameter; typedef boost::shared_ptr CqPointVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqStringVertexArrayParameter; typedef boost::shared_ptr CqStringVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqColorVertexArrayParameter; typedef boost::shared_ptr CqColorVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqHPointVertexArrayParameter; typedef boost::shared_ptr CqHPointVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqNormalVertexArrayParameter; typedef boost::shared_ptr CqNormalVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqVectorVertexArrayParameter; typedef boost::shared_ptr CqVectorVertexArrayParameterPtr; typedef CqParameterTypedVertexArray CqMatrixVertexArrayParameter; typedef boost::shared_ptr CqMatrixVertexArrayParameterPtr; // FaceVarying array typedef CqParameterTypedFaceVaryingArray CqFloatFaceVaryingArrayParameter; typedef boost::shared_ptr CqFloatFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqIntFaceVaryingArrayParameter; typedef boost::shared_ptr CqIntFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqPointFaceVaryingArrayParameter; typedef boost::shared_ptr CqPointFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqStringFaceVaryingArrayParameter; typedef boost::shared_ptr CqStringFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqColorFaceVaryingArrayParameter; typedef boost::shared_ptr CqColorFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqHPointFaceVaryingArrayParameter; typedef boost::shared_ptr CqHPointFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqNormalFaceVaryingArrayParameter; typedef boost::shared_ptr CqNormalFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqVectorFaceVaryingArrayParameter; typedef boost::shared_ptr CqVectorFaceVaryingArrayParameterPtr; typedef CqParameterTypedFaceVaryingArray CqMatrixFaceVaryingArrayParameter; typedef boost::shared_ptr CqMatrixFaceVaryingArrayParameterPtr; /////////////////////////////////////////////////////////////////////////////// extern CqParameter* ( *gVariableCreateFuncsConstant[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsUniform[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsVarying[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsVertex[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsFaceVarying[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsFaceVertex[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsConstantArray[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsUniformArray[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsVaryingArray[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsVertexArray[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsFaceVaryingArray[] ) ( const char* strName, TqInt Count ); extern CqParameter* ( *gVariableCreateFuncsFaceVertexArray[] ) ( const char* strName, TqInt Count ); //----------------------------------------------------------------------- END_NAMESPACE( Aqsis ) #endif // !PARAMETERS_H_INCLUDED