Castle Game Engine: X3DNodes: Class TAbstractTexture2DNode

# Class TAbstractTexture2DNode
Description | Hierarchy | Fields | Methods | Properties
## Unit X3DNodes ## Declaration `type TAbstractTexture2DNode = class(TAbstractTextureNode)` ## Description VRML/X3D texture that is 2D and is loaded (from file or some other stream). For X3D, this descends from X3DTextureNode and is an ancestor for X3DTexture2DNode, so X3D hierarchy is nicely preserved. ## Hierarchy TPersistent TNonRefCountedInterfacedPersistent TX3DFileItem TX3DNode TAbstractNode TAbstractAppearanceChildNode TAbstractTextureNode TAbstractTexture2DNode ## Overview ### Fields
| `FTextureUsedFullUrl: string;`
### Methods
| `function AlphaChannelData: TAlphaChannel; override;`
| `procedure LoadTextureData(out WasCacheUsed: boolean); virtual;`
| `function GetRepeatS: boolean; virtual; abstract;`
| `function GetRepeatT: boolean; virtual; abstract;`
| `procedure SetRepeatS(const Value: boolean); virtual; abstract;`
| `procedure SetRepeatT(const Value: boolean); virtual; abstract;`
| `procedure CreateNode; override;`
| `destructor Destroy; override;`
| `function TextureImage: TEncodedImage;`
| `function IsTextureImage: boolean;`
| `function TextureDDS: TDDSImage;`
| `function TextureVideo: TVideo;`
| `function IsTextureVideo: boolean;`
| `function TextureProperties: TTexturePropertiesNode; virtual;`
### Properties
| `property IsTextureLoaded: boolean read FIsTextureLoaded write SetIsTextureLoaded;`
| `property RepeatS: boolean read GetRepeatS write SetRepeatS;`
| `property RepeatT: boolean read GetRepeatT write SetRepeatT;`
| `property TextureUsedFullUrl: string read FTextureUsedFullUrl;`
## Description ### Fields
| `FTextureUsedFullUrl: string;`
### Methods
| `function AlphaChannelData: TAlphaChannel; override;`
| `procedure LoadTextureData(out WasCacheUsed: boolean); virtual;`
Loads texture data (image or video file). It should set either FTextureImage or FTextureVideo to something non-nil (don't care here about the previous value of these fields — it's for sure `Nil`). If FTextureImage is set, you can also set FTextureDDS. If you leave them as `Nil`, this means that loading failed (and OnWarning didn't cause an exception). You should also set FAlphaChannelData. You do not care in this method about things like IsImageLoaded — this method should just always, unconditionally, make everything it can do to load texture data from file(s). You can use OnWarning inside, so we're prepared that this may even exit with exception (since OnWarning can raise exception). If you set FTextureImage, you have to set it to something returned by LoadTextureImage. See TextureImage docs. Set WasCacheUsed here. `True` means you loaded the data using Cache. For FTextureVideo, it's Cache property should also be set to our Cache, this happens automatically in Video_IncReference. Also, set FTextureUsedFullUrl here. In this class, this simply produces OnWarning with "not implemented" message and returns `Nil`. It's not declared as abstract, because there may be classes descending from this, and we want to at least be able to parse them and then ignore (while not overriden abstract method would cause simple crashes).
| `function GetRepeatS: boolean; virtual; abstract;`
| `function GetRepeatT: boolean; virtual; abstract;`
| `procedure SetRepeatS(const Value: boolean); virtual; abstract;`
| `procedure SetRepeatT(const Value: boolean); virtual; abstract;`
| `procedure CreateNode; override;`
| `destructor Destroy; override;`
| `function TextureImage: TEncodedImage;`
`TextureImage`, TextureDDS and TextureVideo contain actual texture data. `TextureImage` may come from inline VRML texture or could be loaded from file (including from some URL), this doesn't concern you here. Calls to `TextureImage`, TextureVideo, IsTextureImage, IsTextureVideo, TextureDDS will automatically load the data, so in simple situations you really don't need to do anything. Just check and use them when you want, and things will just work. See IsTextureLoaded for more control about loading / unloading. Note that either one of `TextureImage` or TextureVideo may be `Nil`, if the other one is loaded. Or when loading failed (warning will be reported by OnWarning). IsTextureImage checks that `TextureImage` is non-nil (so it's successfully loaded) and additionally that texture size is not zero. Similar for IsTextureVideo. `TextureImage` may have any class allowed by LoadTextureImage.
| `function IsTextureImage: boolean;`
| `function TextureDDS: TDDSImage;`
| `function TextureVideo: TVideo;`
| `function IsTextureVideo: boolean;`
| `function TextureProperties: TTexturePropertiesNode; virtual;`
Returns `TextureProperties` node, if this node has some "`textureProperties`" field and it specifies `TextureProperties` node. Otherwise returns `Nil`.
### Properties
| `property IsTextureLoaded: boolean read FIsTextureLoaded write SetIsTextureLoaded;`
Is the texture data already loaded. Since the texture will be loaded automatically, you're usually not interested in this property. You can read it to e.g. predict if next TextureImage / TextureVideo call may take a long time. (You know that if `IsTextureLoaded` = `True` then TextureImage just returns ready image instantly). You can also set `IsTextureLoaded`. Setting to `True` means that you request the texture to be loaded now, if it's not loaded already. Setting to `False` may be useful if you want to release resources (e.g. when you want to keep TTextureNode instance loaded but you know that you will not need TextureImage / TextureDDS / TextureVideo anymore). You can also set it to `False` and then back to `True` if you want to request reloading the texture from URL (e.g. if you suspect that the URL contents changed). Note that `IsTextureLoaded` is set to `True`, even if actual loading failed. You still have to check afterwards IsTextureImage and IsTextureVideo to know if loading was actually successfull. This is deliberate — it means that each call to TextureImage etc. will not unnecessarily read the disk (or even connect to internet) when the file does not exist. Also, the loading errors reported by OnWarning will not be repeated — they will occur only once, when `IsTextureLoaded` changes from `False` to `True`.
| `property RepeatS: boolean read GetRepeatS write SetRepeatS;`
Whether the texture `repeats` or clamps in given direction. Getting or setting this is the most comfortable way to change underlying node fields, setting this automatically does all necessary (sends events etc., see TVRMLField.Send).
| `property RepeatT: boolean read GetRepeatT write SetRepeatT;`
| `property TextureUsedFullUrl: string read FTextureUsedFullUrl;`
Once the texture data (image or video) is loaded, this is set to the URL that was used to load, or '' if no URL was used. "No URL was used" may mean that no URL was valid, or inlined image was used. This is always a full, expanded (i.e. not relative) URL. In case of data: URLs, this doesn't contain actual data (it would be too long then, and `TextureUsedFullUrl` is mainly for showing to the user), it's cutted.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:15