dd47a61775b33807d79cad3d042ac2486091575b
[occt.git] / src / Graphic3d / Graphic3d_TextureRoot.cdl
1 -- Created on: 1997-07-28
2 -- Created by: Pierre CHALAMET
3 -- Copyright (c) 1997-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 deferred class TextureRoot from Graphic3d
18
19 inherits TShared from MMgt
20
21   ---Purpose: This is the texture root class enable the dialog with the GraphicDriver allows the loading of texture.
22
23 uses
24
25   TextureParams from Graphic3d,
26   TypeOfTexture from Graphic3d,
27   PixMap        from Image,
28   PixMap_Handle from Image,
29   Path          from OSD,
30   AsciiString   from TCollection
31
32 is
33
34   Initialize (theFileName : AsciiString from TCollection;
35               theType     : TypeOfTexture from Graphic3d);
36   ---Purpose: Creates a texture from a file
37   --  Warning: Note that if <FileName> is NULL the texture must be realized
38   -- using LoadTexture(image) method.
39
40   Destroy (me);
41   ---C++ : alias ~
42
43   --
44   -- public methods
45   --
46
47   IsDone (me) returns Boolean from Standard
48   is virtual;
49   ---Level:   public
50   ---Purpose: Checks if a texture class is valid or not.
51   -- @return true if the construction of the class is correct
52
53   Path (me) returns Path from OSD;
54   ---Level:   public
55   ---Purpose:
56   -- Returns the full path of the defined texture.
57   -- It could be empty path if GetImage() is overridden to load image not from file.
58   ---C++: return const &
59
60   Type (me) returns TypeOfTexture from Graphic3d;
61   ---Level:   public
62   ---Purpose: @return the texture type.
63
64   GetId (me) returns AsciiString from TCollection;
65   ---Level:   advanced
66   ---Purpose:
67   -- This ID will be used to manage resource in graphic driver.
68   -- .
69   -- Default implementation generates unique ID although inheritors may re-initialize it.
70   -- .
71   -- Multiple Graphic3d_TextureRoot instancies with same ID
72   -- will be treated as single texture with different parameters
73   -- to optimize memory usage though this will be more natural
74   -- to use same instance of Graphic3d_TextureRoot when possible.
75   -- .
76   -- Notice that inheritor may set this ID to empty string.
77   -- In this case independent graphical resource will be created
78   -- for each instance of Graphic3d_AspectFillArea3d where texture will be used.
79   -- .
80   -- @return texture identifier.
81   ---C++: return const &
82
83   GetImage (me) returns PixMap_Handle from Image
84   is virtual;
85   ---Level   : Public
86   ---Purpose :
87   -- This method will be called by graphic driver each time when texture resource should be created.
88   -- Default implementation will dynamically load image from specified path within this method
89   -- (and no copy will be preserved in this class instance).
90   -- Inheritors may dynamically generate the image or return cached instance.
91   -- Notice, image data should be in Bottom-Up order (see Image_PixMap::IsTopDown())!
92   -- @return the image for texture.
93
94   GetParams (me) returns TextureParams from Graphic3d;
95   ---Level: public
96   ---Purpose: @return low-level texture parameters
97   ---C++: return const &
98
99   TexturesFolder (myclass) returns AsciiString from TCollection;
100   ---Level   : Public
101   ---Purpose :
102   -- The path to textures determined from CSF_MDTVTexturesDirectory or CASROOT environment variables.
103   -- @return the root folder with default textures.
104
105 fields
106
107   myParams : TextureParams from Graphic3d is protected;
108   myTexId  : AsciiString from TCollection is protected;
109   myPath   : Path from OSD is protected;
110   myType   : TypeOfTexture from Graphic3d;
111
112 end TextureRoot;