0031511: Point Cloud Rendering, Volume Rendering - reuse Graphic3d_CullingTool
[occt.git] / src / Graphic3d / Graphic3d_ShaderObject.hxx
1 // Created on: 2013-09-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Graphic3d_ShaderObject_HeaderFile
17 #define _Graphic3d_ShaderObject_HeaderFile
18
19 #include <OSD_Path.hxx>
20
21 #include <Graphic3d_TypeOfShaderObject.hxx>
22
23 //! Forward declaration
24
25 //! This class is responsible for managing shader objects.
26 class Graphic3d_ShaderObject : public Standard_Transient
27 {
28 private:
29
30   //! Creates new shader object of specified type.
31   Standard_EXPORT Graphic3d_ShaderObject (const Graphic3d_TypeOfShaderObject theType);
32
33 public:
34
35   //! Releases resources of shader object. 
36   Standard_EXPORT virtual ~Graphic3d_ShaderObject();
37   
38   //! Checks if the shader object is valid or not.
39   Standard_EXPORT virtual Standard_Boolean IsDone() const;
40   
41   //! Returns the full path to the shader source.
42   const OSD_Path& Path() const { return myPath; }
43
44   //! Returns the source code of the shader object.
45   const TCollection_AsciiString& Source() const { return mySource; }
46
47   //! Returns type of the shader object.
48   Graphic3d_TypeOfShaderObject Type() const { return myType; }
49   
50   //! Returns unique ID used to manage resource in graphic driver.
51   const TCollection_AsciiString& GetId() const { return myID; }
52
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);
56
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);
60
61 public:
62
63   DEFINE_STANDARD_RTTIEXT(Graphic3d_ShaderObject,Standard_Transient)
64
65 protected:
66
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)
70
71 private:
72   
73   //! The type of shader object.
74   Graphic3d_TypeOfShaderObject myType;
75 };
76
77 DEFINE_STANDARD_HANDLE (Graphic3d_ShaderObject, Standard_Transient)
78
79 #endif