1
////---------------------------------------------------------------------
2
//// Associated header file: VARDEF.H
3
//// Class definition file: VARDEF.CPP
5
//// Author: Paul C. Gregory
6
//// Creation date: 22/07/99
7
////---------------------------------------------------------------------
9
//? Is .h included already?
10
#ifndef VARDEF_H_INCLUDED
11
#define VARDEF_H_INCLUDED 1
20
START_NAMESPACE( Aqsis )
26
///----------------------------------------------------------------------
28
/// Class storing information about variables.
31
class CqVarDef : public IqVarDef
43
CqVarDef( const CqVarDef& from );
44
CqVarDef( TqInt Type, const char* strName, TqInt Length = 0, TqInt ReadOnly = 0 ) :
50
m_ArrayLength( Length ),
55
// Overridden from IqVarDef
56
virtual const IqParseNode* pInitialiser() const;
57
virtual IqParseNode* pInitialiser();
58
virtual TqInt Type() const
62
virtual const char* strName() const
64
return ( m_strName.c_str() );
66
virtual void IncUseCount()
70
virtual TqInt UseCount() const
72
return ( m_UseCount );
74
virtual TqInt ArrayLength() const
76
return ( m_ArrayLength );
78
virtual TqBool fExtern() const
82
virtual SqVarRef vrExtern() const
84
return ( m_vrExtern );
86
virtual void SetParam( TqBool fParam = TqTrue )
88
m_Type = ( m_Type & ~Type_Param ) | ( fParam ? Type_Param : 0 );
90
virtual void SetOutput( TqBool fOutput = TqTrue )
92
m_Type = ( m_Type & ~Type_Output ) | ( fOutput ? Type_Output : 0 );
94
virtual void SetDefaultStorage( TqInt Storage )
96
// If no storage has been explicitly specified, default to the
98
if ( ( m_Type & Storage_Mask ) == 0 )
99
m_Type = ( m_Type | ( Storage & Storage_Mask ) );
103
CqVarDef& operator=( const CqVarDef& from );
105
void SetType( const TqInt Type )
109
CqParseNode* pDefValue()
111
return ( m_pDefValue );
113
void SetpDefValue( CqParseNode* pDefValue )
115
m_pDefValue = pDefValue;
117
void SetExtern( TqBool f, SqVarRef vrExtern )
120
m_vrExtern = vrExtern;
122
TqBool ReadOnly( EqShaderType type )
124
return( ( m_ReadOnly & (1<<type) ) != 0 );
127
static TqBool FindVariable( const char* strName, SqVarRef& Ref );
128
static CqVarDef* GetVariablePtr( const SqVarRef& Ref );
129
static TqInt AddVariable( CqVarDef& Def );
136
CqParseNode* m_pDefValue;
142
extern std::vector<CqVarDef> gLocalVars;
143
extern CqVarDef gStandardVars[];
145
//-----------------------------------------------------------------------
147
END_NAMESPACE( Aqsis )
149
#endif // !VARDEF_H_INCLUDED