0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / Graphic3d / Graphic3d_ShaderObject.hxx
CommitLineData
30f0ad28 1// Created on: 2013-09-20
2// Created by: Denis BOGOLEPOV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
30f0ad28 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
30f0ad28 6//
d5f74e42 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
973c2be1 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.
30f0ad28 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
30f0ad28 15
16#ifndef _Graphic3d_ShaderObject_HeaderFile
17#define _Graphic3d_ShaderObject_HeaderFile
18
19#include <OSD_Path.hxx>
20
21#include <Graphic3d_TypeOfShaderObject.hxx>
494782f6 22
23//! Forward declaration
30f0ad28 24
25//! This class is responsible for managing shader objects.
26class Graphic3d_ShaderObject : public Standard_Transient
27{
28private:
29
30 //! Creates new shader object of specified type.
31 Standard_EXPORT Graphic3d_ShaderObject (const Graphic3d_TypeOfShaderObject theType);
32
33public:
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
61public:
62
92efcf78 63 DEFINE_STANDARD_RTTIEXT(Graphic3d_ShaderObject,Standard_Transient)
30f0ad28 64
65protected:
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
71private:
72
73 //! The type of shader object.
74 Graphic3d_TypeOfShaderObject myType;
75};
76
494782f6 77DEFINE_STANDARD_HANDLE (Graphic3d_ShaderObject, Standard_Transient)
78
30f0ad28 79#endif