Class TNodeGeneralTexture

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TNodeGeneralTexture = class(TVRMLNode)

Description

Common texture node for all VRML versions.

Hierarchy

Overview

Fields

Protected FTextureUsedFullUrl: string;

Methods

Protected function LoadTextureImage(out CacheUsed: boolean): TImage; virtual; abstract;
Public constructor Create(const ANodeName: string; const AWWWBasePath: string); override;
Public destructor Destroy; override;
Public function TextureImage: TImage;
Public function IsTextureImage: boolean;
Public function TextureDescription: string; virtual; abstract;
Public function RepeatS: boolean; virtual; abstract;
Public function RepeatT: boolean; virtual; abstract;

Properties

Public property IsTextureLoaded: boolean read FIsTextureLoaded write SetIsTextureLoaded;
Public property ImagesCache: TImagesCache read FImagesCache write FImagesCache;
Public property TextureUsedFullUrl: string read FTextureUsedFullUrl;

Description

Fields

Protected FTextureUsedFullUrl: string;
 

Methods

Protected function LoadTextureImage(out CacheUsed: boolean): TImage; virtual; abstract;

This loads actual image. It must return newly created TImage instance if texture could be loaded, or nil if no texture could be loaded. 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.

You can use VRMLNonFatalError inside, so we're prepared that this may even exit with exception (since VRMLNonFatalError can raise exception).

You have to return TRGBImage or TAlphaImage here, see TextureImage docs.

Set CacheUsed to True if you loaded the image using ImagesCache.

Also, set FTextureUsedFullUrl here.

Public constructor Create(const ANodeName: string; const AWWWBasePath: string); override;
 
Public destructor Destroy; override;
 
Public function TextureImage: TImage;

Texture image, inline or loaded from URL. First call to TextureImage will automatically load the texture, so in simple situations you really don't need to do anything. Just use TextureImage when you want, and things will just work.

Be sure to set ImagesCache before loading the texture. TODO: allow ImagesCache to be Nil.

This is never Nil. If the texture is not available for any reason, it's indicated by TextureImage.IsNull. IsTextureImage is a shortcut for "not TextureImage.IsNull" (so note that calling IsTextureImage also may cause texture load).

IsTextureLoaded says whether the texture is 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 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 TNodeTexture instance loaded but you know that you will not need TextureImage 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 separate IsTextureLoaded and IsTextureImage state means that if the texture loading will fail (e.g. "texture file foo.png does not exist"), it will be reported to VRMLNonFatalError only once, not at every TextureImage call. This is obviously important if you use VRMLNonFatalError to report warnings for user.

TextureImage class is always in (TRGBImage, TAlphaImage) simply because only these formats are accepted by KambiGLUtils. TODO: this is not nice, we do not want any OpenGL dependency in this unit, even such "ideological" one.

Public function IsTextureImage: boolean;
 
Public function TextureDescription: string; virtual; abstract;

Krotki opis tego jak zdefiniowana jest tekstura. none jesli nie zdefiniowana, jakie jest filename, jakie jest inline. NIE okresla jak i jaka tekstura jest zaladowana.

Public function RepeatS: boolean; virtual; abstract;
 
Public function RepeatT: boolean; virtual; abstract;
 

Properties

Public property IsTextureLoaded: boolean read FIsTextureLoaded write SetIsTextureLoaded;
 
Public property ImagesCache: TImagesCache read FImagesCache write FImagesCache;
 
Public property TextureUsedFullUrl: string read FTextureUsedFullUrl;

Once the image is loaded, this is set to the URL that was used to load this image, or '' if no URL was used. No URL was used may mean that no image was valid, or inlined image was used.

This is always a full, expanded (i.e. not relative) URL.


Generated by PasDoc 0.10.0 on 2008-02-25 00:00:42