98e6c6d1 |
1 | // Created by: Kirill GAVRILOV |
2 | // Copyright (c) 2019 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef _Graphic3d_MediaTexture_HeaderFile |
16 | #define _Graphic3d_MediaTexture_HeaderFile |
17 | |
18 | #include <Graphic3d_Texture2D.hxx> |
19 | #include <NCollection_DefineAlloc.hxx> |
20 | #include <NCollection_Shared.hxx> |
21 | #include <Standard_Mutex.hxx> |
22 | |
23 | class Media_Frame; |
24 | typedef NCollection_Shared<Standard_Mutex> Media_HMutex; |
25 | |
26 | //! Texture adapter for Media_Frame. |
27 | class Graphic3d_MediaTexture : public Graphic3d_Texture2D |
28 | { |
29 | DEFINE_STANDARD_RTTIEXT(Graphic3d_MediaTexture, Graphic3d_Texture2D) |
30 | public: |
31 | |
32 | //! Main constructor. |
33 | Standard_EXPORT Graphic3d_MediaTexture (const Handle(Media_HMutex)& theMutex, |
34 | Standard_Integer thePlane = -1); |
35 | |
36 | //! Image reader. |
faff3767 |
37 | Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE; |
98e6c6d1 |
38 | |
39 | //! Return the frame. |
40 | const Handle(Media_Frame)& Frame() const { return myFrame; } |
41 | |
42 | //! Set the frame. |
43 | void SetFrame (const Handle(Media_Frame)& theFrame) { myFrame = theFrame; } |
44 | |
45 | //! Regenerate a new texture id |
46 | void GenerateNewId() { generateId(); } |
47 | |
48 | protected: |
49 | |
50 | mutable Handle(Media_HMutex) myMutex; |
51 | Handle(Media_Frame) myFrame; |
52 | Standard_Integer myPlane; |
53 | mutable Handle(Image_PixMap) myPixMapWrapper; |
54 | |
55 | }; |
56 | |
57 | #endif // _Graphic3d_MediaTexture_HeaderFile |