1 -- Created on: 1997-07-28
2 -- Created by: Pierre CHALAMET
3 -- Copyright (c) 1997-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
21 deferred class TextureRoot from Graphic3d
23 inherits TShared from MMgt
25 ---Purpose: This is the texture root class enable the dialog with the GraphicDriver allows the loading of texture.
29 TextureParams from Graphic3d,
30 TypeOfTexture from Graphic3d,
32 PixMap_Handle from Image,
34 AsciiString from TCollection
38 Initialize (theFileName : AsciiString from TCollection;
39 theType : TypeOfTexture from Graphic3d);
40 ---Purpose: Creates a texture from a file
41 -- Warning: Note that if <FileName> is NULL the texture must be realized
42 -- using LoadTexture(image) method.
51 IsDone (me) returns Boolean from Standard
54 ---Purpose: Checks if a texture class is valid or not.
55 -- @return true if the construction of the class is correct
57 Path (me) returns Path from OSD;
60 -- Returns the full path of the defined texture.
61 -- It could be empty path if GetImage() is overridden to load image not from file.
62 ---C++: return const &
64 Type (me) returns TypeOfTexture from Graphic3d;
66 ---Purpose: @return the texture type.
68 GetId (me) returns AsciiString from TCollection;
71 -- This ID will be used to manage resource in graphic driver.
73 -- Default implementation generates unique ID although inheritors may re-initialize it.
75 -- Multiple Graphic3d_TextureRoot instancies with same ID
76 -- will be treated as single texture with different parameters
77 -- to optimize memory usage though this will be more natural
78 -- to use same instance of Graphic3d_TextureRoot when possible.
80 -- Notice that inheritor may set this ID to empty string.
81 -- In this case independent graphical resource will be created
82 -- for each instance of Graphic3d_AspectFillArea3d where texture will be used.
84 -- @return texture identifier.
86 GetImage (me) returns PixMap_Handle from Image
90 -- This method will be called by graphic driver each time when texture resource should be created.
91 -- Default implementation will dynamically load image from specified path within this method
92 -- (and no copy will be preserved in this class instance).
93 -- Inheritors may dynamically generate the image or return cached instance.
94 -- @return the image for texture.
96 GetParams (me) returns TextureParams from Graphic3d;
98 ---Purpose: @return low-level texture parameters
99 ---C++: return const &
101 TexturesFolder (myclass) returns AsciiString from TCollection;
104 -- The path to textures determined from CSF_MDTVTexturesDirectory or CASROOT environment variables.
105 -- @return the root folder with default textures.
109 myParams : TextureParams from Graphic3d is protected;
110 myTexId : AsciiString from TCollection is protected;
111 myPath : Path from OSD is protected;
112 myType : TypeOfTexture from Graphic3d;