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
25 //! This class is responsible for managing shader objects.
26 class Graphic3d_ShaderObject : public Standard_Transient
30 //! Creates new shader object of specified type.
31 Standard_EXPORT Graphic3d_ShaderObject (const Graphic3d_TypeOfShaderObject theType);
35 //! Releases resources of shader object.
36 Standard_EXPORT virtual ~Graphic3d_ShaderObject();
38 //! Checks if the shader object is valid or not.
39 Standard_EXPORT virtual Standard_Boolean IsDone() const;
41 //! Returns the full path to the shader source.
42 const OSD_Path& Path() const { return myPath; }
44 //! Returns the source code of the shader object.
45 const TCollection_AsciiString& Source() const { return mySource; }
47 //! Returns type of the shader object.
48 Graphic3d_TypeOfShaderObject Type() const { return myType; }
50 //! Returns unique ID used to manage resource in graphic driver.
51 const TCollection_AsciiString& GetId() const { return myID; }
53 //! Creates new shader object from specified file.
54 Standard_EXPORT static Handle(Graphic3d_ShaderObject) CreateFromFile (const Graphic3d_TypeOfShaderObject theType,
55 const TCollection_AsciiString& thePath);
57 //! Creates new shader object from specified source.
58 Standard_EXPORT static Handle(Graphic3d_ShaderObject) CreateFromSource (const Graphic3d_TypeOfShaderObject theType,
59 const TCollection_AsciiString& theSource);
63 DEFINE_STANDARD_RTTIEXT(Graphic3d_ShaderObject,Standard_Transient)
67 TCollection_AsciiString myID; //!< the ID of shader object
68 TCollection_AsciiString mySource; //!< the source code of shader object
69 OSD_Path myPath; //!< the path to shader source (may be empty)
73 //! The type of shader object.
74 Graphic3d_TypeOfShaderObject myType;
77 DEFINE_STANDARD_HANDLE (Graphic3d_ShaderObject, Standard_Transient)