1 // Created on: 2013-09-20
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 #ifndef _Graphic3d_ShaderObject_HeaderFile
17 #define _Graphic3d_ShaderObject_HeaderFile
19 #include <OSD_Path.hxx>
21 #include <Graphic3d_TypeOfShaderObject.hxx>
23 //! Forward declaration
24 class Handle(Graphic3d_ShaderObject);
26 //! This class is responsible for managing shader objects.
27 class Graphic3d_ShaderObject : public Standard_Transient
31 //! Creates new shader object of specified type.
32 Standard_EXPORT Graphic3d_ShaderObject (const Graphic3d_TypeOfShaderObject theType);
36 //! Releases resources of shader object.
37 Standard_EXPORT virtual ~Graphic3d_ShaderObject();
39 //! Checks if the shader object is valid or not.
40 Standard_EXPORT virtual Standard_Boolean IsDone() const;
42 //! Returns the full path to the shader source.
43 const OSD_Path& Path() const { return myPath; }
45 //! Returns the source code of the shader object.
46 const TCollection_AsciiString& Source() const { return mySource; }
48 //! Returns type of the shader object.
49 Graphic3d_TypeOfShaderObject Type() const { return myType; }
51 //! Returns unique ID used to manage resource in graphic driver.
52 const TCollection_AsciiString& GetId() const { return myID; }
54 //! Creates new shader object from specified file.
55 Standard_EXPORT static Handle(Graphic3d_ShaderObject) CreateFromFile (const Graphic3d_TypeOfShaderObject theType,
56 const TCollection_AsciiString& thePath);
58 //! Creates new shader object from specified source.
59 Standard_EXPORT static Handle(Graphic3d_ShaderObject) CreateFromSource (const Graphic3d_TypeOfShaderObject theType,
60 const TCollection_AsciiString& theSource);
64 DEFINE_STANDARD_RTTI (Graphic3d_ShaderObject)
68 TCollection_AsciiString myID; //!< the ID of shader object
69 TCollection_AsciiString mySource; //!< the source code of shader object
70 OSD_Path myPath; //!< the path to shader source (may be empty)
74 //! The type of shader object.
75 Graphic3d_TypeOfShaderObject myType;
78 DEFINE_STANDARD_HANDLE (Graphic3d_ShaderObject, Standard_Transient)