1 // Created on: 2013-09-25
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // =======================================================================
18 // purpose : Returns variable value casted to specified type
19 // =======================================================================
20 template <class T> inline
21 T& Graphic3d_ValueInterface::As()
23 Graphic3d_UniformValue<T>* aPtr = dynamic_cast<Graphic3d_UniformValue<T>*> (this);
27 // =======================================================================
29 // purpose : Returns variable value casted to specified type
30 // =======================================================================
31 template <class T> inline
32 const T& Graphic3d_ValueInterface::As() const
34 const Graphic3d_UniformValue<T>* aPtr = dynamic_cast<const Graphic3d_UniformValue<T>*> (this);
38 // =======================================================================
40 // purpose : Returns unique identifier of value type
41 // =======================================================================
42 template <class T> inline
43 Standard_Size Graphic3d_UniformValue<T>::TypeID() const
45 return Graphic3d_UniformValueTypeID<T>::ID;
48 // =======================================================================
50 // purpose : Creates initialized shader variable
51 // =======================================================================
52 template<class T> inline
53 Graphic3d_ShaderVariable* Graphic3d_ShaderVariable::Create (const TCollection_AsciiString& theName,
56 Graphic3d_ShaderVariable* theVariable = new Graphic3d_ShaderVariable (theName);
57 theVariable->myValue = new Graphic3d_UniformValue<T> (theValue);