Open CASCADE Technology  7.5.0.beta
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Graphic3d_TextureRoot Class Reference

This is the texture root class enable the dialog with the GraphicDriver allows the loading of texture. More...

#include <Graphic3d_TextureRoot.hxx>

Inheritance diagram for Graphic3d_TextureRoot:
Inheritance graph
[legend]

Public Member Functions

 ~Graphic3d_TextureRoot ()
 Destructor. More...
 
virtual Standard_Boolean IsDone () const
 Checks if a texture class is valid or not. More...
 
const OSD_PathPath () const
 Returns the full path of the defined texture. It could be empty path if GetImage() is overridden to load image not from file. More...
 
Graphic3d_TypeOfTexture Type () const
 
const TCollection_AsciiStringGetId () const
 This ID will be used to manage resource in graphic driver. More...
 
Standard_Size Revision () const
 Return image revision. More...
 
void UpdateRevision ()
 Update image revision. Can be used for signaling changes in the texture source (e.g. file update, pixmap update) without re-creating texture source itself (since unique id should be never modified). More...
 
virtual Handle< Image_CompressedPixMapGetCompressedImage (const Handle< Image_SupportedFormats > &theSupported)
 This method will be called by graphic driver each time when texture resource should be created. It is called in front of GetImage() for uploading compressed image formats natively supported by GPU. More...
 
virtual Handle< Image_PixMapGetImage (const Handle< Image_SupportedFormats > &theSupported)
 This method will be called by graphic driver each time when texture resource should be created. Default constructors allow defining the texture source as path to texture image or directly as pixmap. If the source is defined as path, then the image will be dynamically loaded when this method is called (and no copy will be preserved in this class instance). Inheritors may dynamically generate the image. Notice, image data should be in Bottom-Up order (see Image_PixMap::IsTopDown())! More...
 
const Handle< Graphic3d_TextureParams > & GetParams () const
 
Standard_Boolean IsColorMap () const
 Return flag indicating color nature of values within the texture; TRUE by default. More...
 
void SetColorMap (Standard_Boolean theIsColor)
 Set flag indicating color nature of values within the texture. More...
 
Standard_Boolean IsTopDown () const
 Returns whether row's memory layout is top-down. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Static Public Member Functions

static TCollection_AsciiString TexturesFolder ()
 The path to textures determined from CSF_MDTVTexturesDirectory or CASROOT environment variables. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Protected Member Functions

 Graphic3d_TextureRoot (const TCollection_AsciiString &theFileName, const Graphic3d_TypeOfTexture theType)
 Creates a texture from a file Warning: Note that if <FileName> is NULL the texture must be realized using LoadTexture(image) method. More...
 
 Graphic3d_TextureRoot (const Handle< Image_PixMap > &thePixmap, const Graphic3d_TypeOfTexture theType)
 Creates a texture from pixmap. Please note that the implementation expects the image data to be in Bottom-Up order (see Image_PixMap::IsTopDown()). More...
 
void generateId ()
 Unconditionally generate new texture id. Should be called only within constructor. More...
 
virtual Handle< Image_PixMapGetImage () const
 Method for supporting old API; another GetImage() method should be implemented instead. More...
 

Static Protected Member Functions

static void convertToCompatible (const Handle< Image_SupportedFormats > &theSupported, const Handle< Image_PixMap > &theImage)
 Try converting image to compatible format. More...
 

Protected Attributes

Handle< Graphic3d_TextureParamsmyParams
 associated texture parameters More...
 
TCollection_AsciiString myTexId
 unique identifier of this resource (for sharing graphic resource); should never be modified outside constructor More...
 
Handle< Image_PixMapmyPixMap
 image pixmap - as one of the ways for defining the texture source More...
 
OSD_Path myPath
 image file path - as one of the ways for defining the texture source More...
 
Standard_Size myRevision
 image revision - for signaling changes in the texture source (e.g. file update, pixmap update) More...
 
Graphic3d_TypeOfTexture myType
 texture type More...
 
Standard_Boolean myIsColorMap
 flag indicating color nature of values within the texture More...
 
Standard_Boolean myIsTopDown
 Stores rows's memory layout. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 

Detailed Description

This is the texture root class enable the dialog with the GraphicDriver allows the loading of texture.

Constructor & Destructor Documentation

◆ ~Graphic3d_TextureRoot()

Graphic3d_TextureRoot::~Graphic3d_TextureRoot ( )

Destructor.

◆ Graphic3d_TextureRoot() [1/2]

Graphic3d_TextureRoot::Graphic3d_TextureRoot ( const TCollection_AsciiString theFileName,
const Graphic3d_TypeOfTexture  theType 
)
protected

Creates a texture from a file Warning: Note that if <FileName> is NULL the texture must be realized using LoadTexture(image) method.

◆ Graphic3d_TextureRoot() [2/2]

Graphic3d_TextureRoot::Graphic3d_TextureRoot ( const Handle< Image_PixMap > &  thePixmap,
const Graphic3d_TypeOfTexture  theType 
)
protected

Creates a texture from pixmap. Please note that the implementation expects the image data to be in Bottom-Up order (see Image_PixMap::IsTopDown()).

Member Function Documentation

◆ convertToCompatible()

static void Graphic3d_TextureRoot::convertToCompatible ( const Handle< Image_SupportedFormats > &  theSupported,
const Handle< Image_PixMap > &  theImage 
)
staticprotected

Try converting image to compatible format.

◆ generateId()

void Graphic3d_TextureRoot::generateId ( )
protected

Unconditionally generate new texture id. Should be called only within constructor.

◆ GetCompressedImage()

virtual Handle< Image_CompressedPixMap > Graphic3d_TextureRoot::GetCompressedImage ( const Handle< Image_SupportedFormats > &  theSupported)
virtual

This method will be called by graphic driver each time when texture resource should be created. It is called in front of GetImage() for uploading compressed image formats natively supported by GPU.

Parameters
theSupported[in] the list of supported compressed texture formats; returning image in unsupported format will result in texture upload failure
Returns
compressed pixmap or NULL if image is not in supported compressed format

Reimplemented in XCAFPrs_Texture.

◆ GetId()

const TCollection_AsciiString& Graphic3d_TextureRoot::GetId ( ) const
inline

This ID will be used to manage resource in graphic driver.

Default implementation generates unique ID within constructor; inheritors may re-initialize it within their constructor, but should never modify it afterwards.

Multiple Graphic3d_TextureRoot instances with same ID will be treated as single texture with different parameters to optimize memory usage though this will be more natural to use same instance of Graphic3d_TextureRoot when possible.

If this ID is set to empty string by inheritor, then independent graphical resource will be created for each instance of Graphic3d_AspectFillArea3d where texture will be used.

Returns
texture identifier.

◆ GetImage() [1/2]

virtual Handle< Image_PixMap > Graphic3d_TextureRoot::GetImage ( const Handle< Image_SupportedFormats > &  theSupported)
virtual

This method will be called by graphic driver each time when texture resource should be created. Default constructors allow defining the texture source as path to texture image or directly as pixmap. If the source is defined as path, then the image will be dynamically loaded when this method is called (and no copy will be preserved in this class instance). Inheritors may dynamically generate the image. Notice, image data should be in Bottom-Up order (see Image_PixMap::IsTopDown())!

Returns
the image for texture.

Reimplemented in Graphic3d_CubeMapSeparate, XCAFPrs_Texture, and Graphic3d_MediaTexture.

◆ GetImage() [2/2]

virtual Handle< Image_PixMap > Graphic3d_TextureRoot::GetImage ( ) const
inlineprotectedvirtual

Method for supporting old API; another GetImage() method should be implemented instead.

◆ GetParams()

const Handle< Graphic3d_TextureParams >& Graphic3d_TextureRoot::GetParams ( ) const
inline
Returns
low-level texture parameters

◆ IsColorMap()

Standard_Boolean Graphic3d_TextureRoot::IsColorMap ( ) const
inline

Return flag indicating color nature of values within the texture; TRUE by default.

This flag will be used to interpret 8-bit per channel RGB(A) images as sRGB(A) textures with implicit linearizion of color components. Has no effect on images with floating point values (always considered linearized).

When set to FALSE, such images will be interpreted as textures will be linear component values, which is useful for RGB(A) textures defining non-color properties (like Normalmap/Metalness/Roughness).

◆ IsDone()

virtual Standard_Boolean Graphic3d_TextureRoot::IsDone ( ) const
virtual

Checks if a texture class is valid or not.

Returns
true if the construction of the class is correct

Reimplemented in Graphic3d_CubeMapSeparate.

◆ IsTopDown()

Standard_Boolean Graphic3d_TextureRoot::IsTopDown ( ) const
inline

Returns whether row's memory layout is top-down.

◆ Path()

const OSD_Path& Graphic3d_TextureRoot::Path ( ) const
inline

Returns the full path of the defined texture. It could be empty path if GetImage() is overridden to load image not from file.

◆ Revision()

Standard_Size Graphic3d_TextureRoot::Revision ( ) const
inline

Return image revision.

◆ SetColorMap()

void Graphic3d_TextureRoot::SetColorMap ( Standard_Boolean  theIsColor)
inline

Set flag indicating color nature of values within the texture.

◆ TexturesFolder()

static TCollection_AsciiString Graphic3d_TextureRoot::TexturesFolder ( )
static

The path to textures determined from CSF_MDTVTexturesDirectory or CASROOT environment variables.

Returns
the root folder with default textures.

◆ Type()

Graphic3d_TypeOfTexture Graphic3d_TextureRoot::Type ( ) const
inline
Returns
the texture type.

◆ UpdateRevision()

void Graphic3d_TextureRoot::UpdateRevision ( )
inline

Update image revision. Can be used for signaling changes in the texture source (e.g. file update, pixmap update) without re-creating texture source itself (since unique id should be never modified).

Field Documentation

◆ myIsColorMap

Standard_Boolean Graphic3d_TextureRoot::myIsColorMap
protected

flag indicating color nature of values within the texture

◆ myIsTopDown

Standard_Boolean Graphic3d_TextureRoot::myIsTopDown
protected

Stores rows's memory layout.

◆ myParams

Handle< Graphic3d_TextureParams > Graphic3d_TextureRoot::myParams
protected

associated texture parameters

◆ myPath

OSD_Path Graphic3d_TextureRoot::myPath
protected

image file path - as one of the ways for defining the texture source

◆ myPixMap

Handle< Image_PixMap > Graphic3d_TextureRoot::myPixMap
protected

image pixmap - as one of the ways for defining the texture source

◆ myRevision

Standard_Size Graphic3d_TextureRoot::myRevision
protected

image revision - for signaling changes in the texture source (e.g. file update, pixmap update)

◆ myTexId

TCollection_AsciiString Graphic3d_TextureRoot::myTexId
protected

unique identifier of this resource (for sharing graphic resource); should never be modified outside constructor

◆ myType

Graphic3d_TypeOfTexture Graphic3d_TextureRoot::myType
protected

texture type


The documentation for this class was generated from the following file: