class RED::IResourceManager
This interface gives access to the resource manager's properties. More...
#include <REDIResourceManager.h>
Inherits: IREDObject.
Public functions:
virtual const RED::State & | BeginState ( ) = 0 |
virtual RED_RC | Cleanup ( const RED::Vector< RED::Object * > & iScope, const RED::Vector< RED::Object * > & iNotMe, const RED::State & iState ) = 0 |
virtual RED_RC | CleanupAllLayerIDs ( const RED::State & iState ) = 0 |
virtual RED_RC | CleanupFonts ( const RED::Vector< RED::Object * > & iScope, const RED::Vector< RED::Object * > & iNotMe, const RED::State & iState ) = 0 |
virtual RED_RC | CleanupImages ( const RED::Vector< RED::Object * > & iScope, const RED::Vector< RED::Object * > & iNotMe, const RED::State & iState ) = 0 |
virtual RED_RC | CleanupMaterials ( const RED::Vector< RED::Object * > & iScope, const RED::Vector< RED::Object * > & iNotMe, const RED::State & iState ) = 0 |
virtual RED_RC | CloneImage ( RED::Object *& oImageClone, RED::Object * iSource, const RED::State & iState ) = 0 |
virtual RED_RC | CloneMaterial ( RED::Object *& oMaterial, RED::Object * iSource, const RED::State & iState, bool iImageCopy = false, bool iTinyImageCopy = true ) = 0 |
virtual RED_RC | ClusterMemoryTest ( void ** oInvalidAddress ) = 0 |
virtual RED_RC | CreateColorFontMaterial ( RED::Object *& oMaterial, const RED::Color & iColor, const RED::State & iState ) = 0 |
virtual RED_RC | CreateColorMaterial ( RED::Object *& oMaterial, const RED::Color & iColor, const RED::State & iState ) = 0 |
virtual RED_RC | CreateFont ( RED::Object *& oFont, const RED::State & iState ) = 0 |
virtual RED_RC | CreateImage2D ( RED::Object *& oImage2D, const RED::State & iState ) = 0 |
virtual RED_RC | CreateImage3D ( RED::Object *& oImage3D, const RED::State & iState ) = 0 |
virtual RED_RC | CreateImageComposite ( RED::Object *& oImageComp, const RED::State & iState ) = 0 |
virtual RED_RC | CreateImageCube ( RED::Object *& oImageCube, const RED::State & iState ) = 0 |
virtual RED_RC | CreateImageReadback ( RED::Object *& oImageReadback, const RED::State & iState ) = 0 |
virtual RED_RC | CreateMaterial ( RED::Object *& oMaterial, const RED::State & iState ) = 0 |
virtual RED_RC | CreateParametrizationMaterial ( RED::Object *& oMaterial, RED::MESH_CHANNEL iParameterChannel, const RED::Color & iColor, float iLineWidth, int iStippleFactor, unsigned short iStipplePattern, bool iSmooth, const RED::State & iState ) = 0 |
virtual RED_RC | CreateTexturedFontMaterial ( RED::Object *& oMaterial, const RED::Color & iColor, const RED::State & iState ) = 0 |
virtual RED_RC | DeleteAllFonts ( const RED::State & iState ) = 0 |
virtual RED_RC | DeleteAllImages ( const RED::State & iState ) = 0 |
virtual RED_RC | DeleteAllMaterials ( const RED::State & iState ) = 0 |
virtual RED_RC | DeleteFont ( RED::Object * ioFont, const RED::State & iState ) = 0 |
virtual RED_RC | DeleteImage ( RED::Object * iImage, const RED::State & iState ) = 0 |
virtual RED_RC | DeleteMaterial ( RED::Object * ioMaterial, const RED::State & iState ) = 0 |
virtual RED_RC | EndState ( ) = 0 |
virtual RED::Object * | FindFont ( unsigned int iFontID, int iStateNumber = -1 ) const = 0 |
virtual RED::Object * | FindImage ( unsigned int iImageID, int iStateNumber = -1 ) const = 0 |
virtual RED::Object * | FindMaterial ( unsigned int iMaterialID, int iStateNumber = -1 ) = 0 |
virtual RED::Object * | FindMaterial ( const RED::String & iMaterialLabel, int iStateNumber = -1 ) = 0 |
virtual RED_RC | FindMaterials ( RED::Vector< RED::Object * > & oMaterials, unsigned int iMaterialID, int iStateNumber = -1 ) = 0 |
virtual RED_RC | FindMaterials ( RED::Vector< RED::Object * > & oMaterials, const RED::String & iMaterialID, int iStateNumber = -1 ) = 0 |
virtual RED_RC | GetAllSystemFonts ( RED::Vector< RED::String > & oFontList ) const = 0 |
virtual void | GetBatchSyncCallback ( RED::BATCH_SYNC_CALLBACK & oCallback, void *& oUserData ) const = 0 |
virtual RED::Object * | GetDataManager ( ) = 0 |
virtual RED::REDSDK_ERROR_CALLBACK | GetErrorCallback ( ) const = 0 |
virtual void * | GetErrorCallbackUserData ( ) const = 0 |
virtual const RED::String & | GetErrorFilePath ( ) const = 0 |
virtual const RED::Vector< RED::Object * > & | GetFontList ( int iStateNumber = -1 ) const = 0 |
virtual const RED::Vector< RED::Object * > & | GetImageList ( int iStateNumber = -1 ) const = 0 |
virtual void | GetInterruptCallback ( RED::INTERRUPT_CALLBACK & oCallback, void *& oUserData ) const = 0 |
virtual RED::Object * | GetMaterialController ( const RED::Object * iMaterial ) const = 0 |
virtual const RED::Vector< RED::Object * > & | GetMaterialList ( int iStateNumber = -1 ) const = 0 |
virtual int | GetNumberOfProcessors ( ) const = 0 |
virtual RED::OPENGL_BUFFER_CALLBACK | GetOpenGLBufferCallback ( ) const = 0 |
virtual void * | GetOpenGLBufferCallbackUserData ( ) const = 0 |
virtual RED::OPENGL_MATERIAL_CALLBACK | GetOpenGLMaterialCallback ( ) const = 0 |
virtual void * | GetOpenGLMaterialCallbackUserData ( ) const = 0 |
virtual RED::OPENGL_VIEWPOINT_CALLBACK | GetOpenGLViewpointCallback ( ) const = 0 |
virtual void * | GetOpenGLViewpointCallbackUserData ( ) const = 0 |
virtual RED::HARDWARE_PLATFORM | GetPlatform ( ) const = 0 |
virtual RED_RC | GetShader ( const RED::String *& oShaderString, const RED::ShaderProgramID & iShaderID ) = 0 |
virtual void | GetShadingCallback ( RED::SOFT_SHADER_CALLBACK & oCallback, void *& oUserData, const RED::String & iLabel ) const = 0 |
virtual const RED::State & | GetState ( ) const = 0 |
virtual RED_RC | GetWindowList ( RED::Vector< RED::Object * > & oWindowList, int iStateNumber = -1 ) const = 0 |
virtual bool | IsAliveImagesCheck ( ) const = 0 |
virtual bool | IsShadingCallbackRegistered ( const RED::String & iLabel ) const = 0 |
virtual bool | IsSynchronizationLock ( ) const = 0 |
virtual RED_RC | LoadShaderFromString ( RED::ShaderProgramID & oShaderID, const RED::String & iShaderProgram ) = 0 |
virtual RED_RC | RegisterMaterialController ( RED::Object * iMaterialController ) = 0 |
virtual RED_RC | RegisterShadingCallback ( const RED::String & iLabel, RED::SOFT_SHADER_CALLBACK iCallback, void * iUserData ) = 0 |
virtual void | SetAliveImagesCheck ( bool iOnOff ) = 0 |
virtual void | SetBatchSyncCallback ( RED::BATCH_SYNC_CALLBACK iCallback, void * iUserData ) = 0 |
virtual RED_RC | SetErrorCallback ( RED::REDSDK_ERROR_CALLBACK iCallback, void * iUserData ) = 0 |
virtual RED_RC | SetErrorFilePath ( const RED::String & iFilePath ) = 0 |
virtual void | SetInterruptCallback ( RED::INTERRUPT_CALLBACK iCallback, void * iUserData ) = 0 |
virtual void | SetOpenGLBufferCallback ( RED::OPENGL_BUFFER_CALLBACK iCallback, void * iUserData ) = 0 |
virtual void | SetOpenGLMaterialCallback ( RED::OPENGL_MATERIAL_CALLBACK iCallback, void * iUserData ) = 0 |
virtual void | SetOpenGLViewpointCallback ( RED::OPENGL_VIEWPOINT_CALLBACK iCallback, void * iUserData ) = 0 |
virtual RED_RC | SetPlatform ( RED::HARDWARE_PLATFORM iPlatformId ) = 0 |
virtual void | SetSynchronizationLock ( bool iOnOff ) = 0 |
virtual RED_RC | UnregisterMaterialController ( const RED::Object * iMaterial ) = 0 |
virtual RED_RC | UnRegisterShadingCallback ( const RED::String & iLabel ) = 0 |
Public static functions:
static RED::CID | GetClassID ( ) |
Detailed description:
This interface gives access to the resource manager's properties.
The resource manager is the base class of a visualization cluster. It offers services for a wide range of tasks:
- It encapsulates the state management API.
- It's a pool of graphical resources (materials, shaders, images, fonts).
- It provides an access to the data manager (RED::IDataManager) for all file operations and animation controls.
- It controls the hardware platform for the program execution. See the RED::IResourceManager::SetPlatform method for details on runtime platform management by the engine.
A single instance of resource manager is needed to run an application. A resource manager is linked with windows that contains viewpoints that themselves contain scene graphs made of shapes objects. All resources used by these shapes must be managed by the resource manager.
The resource manager should be created at the application startup, before any other graphic operation. Specifically, the resource manager may tune the graphic card driver options, and this must occur before any graphics is started in the application.
State management is defined by transactions that are comprised between RED::IResourceManager::BeginState / RED::IResourceManager::EndState calls:
RED::IWindow *iwindow = ...;
RED::IResourceManager *iresmgr = ...;
const RED::State &state = iresmgr->BeginState();
// Perform changes to cluster data, using:
// - state for read-write access,
// - state.GetNumber() for read-only access.
iresmgr->EndState();
// Draw the data in the state defined by the completed transaction:
iwindow->FrameDrawing();
Objects in the REDsdk are either state sensitive or not. State sensitive objects use a RED::State class instance for all read-write access to their contents and a transaction number (the current one or a past one) for all read-only access to their contents.
Read-write operations are authorized on a single thread. Read-only operations are authorized on any thread. The read-write thread may be the window rendering thread or another thread.
Read-write operations are not authorized outside of a transaction. The RED_WORKFLOW_ERROR return code value punishes erroneous accesses.
Image operations are particular because images are not state managed objects. The engine does not have transaction versions of image contents, due to the possible huge size of these data. Therefore:
- GPU image operations must occur on the rendering thread to avoid rendering conflicts and to avoid stalling the rendering pipeline.
- CPU image operations can't occur while the software ray-tracer is processing a scene.
- Hybrid operations are subject to the two limitations mentioned above.
- Image creation can be performed anytime from the edition thread, while in transaction.
- Image destruction can't occur while the software ray-tracer is processing a scene, and it must occur on the rendering thread.
The resource manager is created with a started transaction, so that the IResourceManager::GetState returns a valid transaction since the startup of the cluster definition. Redundant calls to IResourceManager::BeginState are ignored. The first transaction should be closed before a call to RED::IWindow::FrameDrawing, otherwise there won't be anything to draw.
Functions documentation
public static RED::CID RED::IResourceManager::GetClassID | ( | ) |
public virtual const RED::State & RED::IResourceManager::BeginState | ( | ) = 0 |
Generates a new transaction (or frame) identifier.
This method creates a RED::State object that must be used for all changes in REDsdk. It uniquely identifies the transaction (or frame) being defined (see RED::State::GetNumber to get the transaction number). The transaction defines a begin / end interval. Any change that occur between a call to RED::IResourceManager::BeginState and RED::IResourceManager::EndState is recorded as being part of that transaction. All methods actually modifying the engine contents are using a RED::State instance as the last method parameter.
Note that if a transaction has already been started, this method returns the current transaction.
From this call up to RED::IResourceManager::EndState, all calls that perform modifications on the rendered data in the engine should occur on the same thread.
The resource manager is created with a started transaction, so there's no need for call to RED::IResourceManager::BeginState call upon startup, before the first draw. However, a transaction must be closed before the first draw.
See Transaction management for details on transactions.
Returns:
public virtual RED_RC RED::IResourceManager::Cleanup | ( | const RED::Vector< RED::Object * > & | iScope, |
const RED::Vector< RED::Object * > & | iNotMe, | ||
const RED::State & | iState | ||
) | = 0 |
General resource manager shared resources cleanup.
This method calls the cleanup tool for materials, images and fonts, without any exclusion list. Therefore, anyone useless is deleted. The method takes care of cleaning materials before images so that we don't waste memory.
The iNotMe list indicates a list of objects that must not be removed. That way it's possible to clean objects but to keep some specific instances that are needed later for other purposes, but that could be unused at the time of the call.\
The method must be called on the rendering thread during a valid transaction as it may destroy images.
Parameters:
iScope: | If set to a non empty list, it indicates the set of objects that must be considered by the call. Let this vector empty to clean the whole contents of the resource manager. |
iNotMe: | Exclusion list. When set to a non empty list, all objects in it are kept alive. |
iState: | Current transaction parameter. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CleanupAllLayerIDs | ( | const RED::State & | iState | ) = 0 |
Clears all known layer identifiers for the cluster.
This method must be carefully used as it'll destroy all IDs known for all layers in the cluster. Therefore, after use, an existing RED::LayerSet object won't be valid anymore, as it's existing layer mask won't correspond to anything valid for the cluster.
After the call, new layers that are declared will re-use existing layer bits positions that could have been used before by other layers.
The method automatically removes all layersets for all shapes instances connected to cameras that are inserted in cluster windows. However, it can't clear layersets of shapes that are not connected to a cluster connected camera.
Parameters:
iState: | Current transaction parameter. |
Returns:
public virtual RED_RC RED::IResourceManager::CleanupFonts | ( | const RED::Vector< RED::Object * > & | iScope, |
const RED::Vector< RED::Object * > & | iNotMe, | ||
const RED::State & | iState | ||
) | = 0 |
Font list cleanup tool.
This method is used to delete all fonts that are no longer in use within the cluster. A fotn is considered useless if there's no shape object that is using it AND that is connected to a viewpoint.
The method won't catch fonts of shapes that are not in a scene graph connected to a viewpoint.
All fonts of the resource manager are checked, unless the 'iScope' list is filled with a list of objects to handle. If 'iScope' is not empty, then only objects in it will be searched for cleanup.
The 'iNotMe' list indicates a list of objects that must not be removed. That way it's possible to clean fonts but to keep some specific instances that are needed later for other purposes, but that could be unused at the time of the call.
Due to state management, effective destruction of cleaned resources only occur at the closing of the transaction after this one.
Parameters:
iScope: | If set to a non empty list, it indicates the set of objects that must be considered by the call. Let this vector empty to clean the whole contents of the resource manager. |
iNotMe: | Exclusion list. When set to a non empty list, all objects in it are kept alive. |
iState: | Current transaction parameter. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CleanupImages | ( | const RED::Vector< RED::Object * > & | iScope, |
const RED::Vector< RED::Object * > & | iNotMe, | ||
const RED::State & | iState | ||
) | = 0 |
Image list cleanup tool.
This method is used to delete all images that are no longer in use within the cluster. An image is considered useless if there's no material using it.
All images of the resource manager are checked, unless the 'iScope' list is filled with a list of objects to handle. If 'iScope' is not empty, then only objects in it will be searched for cleanup.
The 'iNotMe' list indicates a list of objects that must not be removed. That way it's possible to clean images but to keep some specific instances that are needed later for other purposes, but that could be unused at the time of the call.
This method calls RED::IResourceManager::DeleteImage, and is subject to the same calling restrictions.
Parameters:
iScope: | If set to a non empty list, it indicates the set of objects that must be considered by the call. Let this vector empty to clean the whole contents of the resource manager. |
iNotMe: | Exclusion list. When set to a non empty list, all objects in it are kept alive. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_WORKFLOW_ERROR if the operation occurs outside of a transaction,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CleanupMaterials | ( | const RED::Vector< RED::Object * > & | iScope, |
const RED::Vector< RED::Object * > & | iNotMe, | ||
const RED::State & | iState | ||
) | = 0 |
Material list cleanup tool.
This method is used to delete all materials that are no longer in use within the cluster. A material is considered useless if there's no shape object that is using it AND that is connected to a viewpoint.
The method won't catch materials of shapes that are not in a scene graph connected to a viewpoint.
Shared resources used by the freed materials (images, fonts, programs) are not deleted by this call. See the corresponding cleanup calls to perform the dedicated operations.
All materials of the resource manager are checked, unless the 'iScope' list is filled with a list of objects to handle. If 'iScope' is not empty, then only objects in it will be searched for cleanup.
The 'iNotMe' list indicates a list of objects that must not be removed. That way it's possible to clean materials but to keep some specific instances that are needed later for other purposes, but that could be unused at the time of the call.
Due to state management, effective destruction of cleaned resources only occur at the closing of the transaction after this one.
Parameters:
iScope: | If set to a non empty list, it indicates the set of objects that must be considered by the call. Let this vector empty to clean the whole contents of the resource manager. |
iNotMe: | Exclusion list. When set to a non empty list, all objects in it are kept alive. |
iState: | Current transaction parameter. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CloneImage | ( | RED::Object *& | oImageClone, |
RED::Object * | iSource, | ||
const RED::State & | iState | ||
) | = 0 |
Creates a duplicate copy of the specified source image.
This method creates a full copy of the 'iSource' image. All parameters of the image are duplicated, including all pixel arrays, both in hardware and software operating environments.
Note that the local pixel storage of 'iSource' is used and overriden during the operation, so any former pixel data stored in the image local storage will be lost.
A built-in render image of a VRL can't be cloned. See RED::IViewpointRenderList::GetRenderImage for details. Another render image should be created using RED::IImage2D::SetRenderImage instead.
See also Duplicating an image.
Parameters:
oImageClone: | Image copy created by the method. |
iSource: | Source image to be copied. 'iSource' local storage will be overriden. |
iState: | The current transaction parameter. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_SCG_INVALID_IMAGE_ADDRESS if 'iSource' is not a valid cluster image,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_DRV_ALLOC_FAILURE if a GPU memory allocation has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CloneMaterial | ( | RED::Object *& | oMaterial, |
RED::Object * | iSource, | ||
const RED::State & | iState, | ||
bool | iImageCopy = false, | ||
bool | iTinyImageCopy = true | ||
) | = 0 |
Clones a material instance.
This method performs a clone of a given iSource Material. The created clone has all shaders and all rendering configurations duplicated. Depending on the value of iImageCopy and iTinyImageCopy, all images that are pointed to by oMaterial can either be copies of all images in iSource or can be shared images.
Note that if an image is shared by several parameters in iSource, the copy of that image will be shared by the same set of cloned parameters in oMaterial if iImageCopy (or iTinyImageCopy depending on the image size) is true. If iImageCopy (or iTinyImageCopy) is false, then the same image address will be shared by both sets of parameters in iSource and in oMaterial.
iImageCopy refers to images whose pixel size is above 1 in at least one dimension, iTinyImageCopy refers to images whose pixel size is exactly 1 in all dimensions. Tiny images are often used in textured shader constructions, where if a shader uses at least one texture, all its parameters are set to textures.
Note that all local storages of all images that are cloned are overriden during the operation. Therefore, any data stored in any duplicated image storage will be lost.
See also Using the realistic material.
Parameters:
oMaterial: | Address of the cloned material object. |
iSource: | Material source to clone. |
iImageCopy: | If true, we do copy all images whose pixel size is greater than 1x1 in iSource and set these copies to be used by oMaterial. If false, all images in iSource are also pointed to by oMaterial. |
iTinyImageCopy: | If true, we do copy all images whose pixel size is exactly 1x1 in iSource and set these copies to be used by oMaterial. If false, all tiny images in iSource are also pointed to by oMaterial. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_SCG_INVALID_IMAGE_ADDRESS if iSource has a shader using an invalid texture,
RED_FAIL if iSource has a shader parameter of the image kind pointing to an object which is not an image. RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::ClusterMemoryTest | ( | void ** | oInvalidAddress | ) = 0 |
Tests the entire cluster memory.
This method tests the existence of every object inside the cluster. All windows, viewpoints, materials, shaders, images, etc... addresses are verified. The test will stop on the first invalid address found.
The method only works if the RED::MemoryLeakTracker has been enabled before the resource manager creation. If this is not the case, then the method will return RED_WORKFLOW_ERROR.
Parameters:
oInvalidAddress: | Returned set to an invalid address if an error occurs during the cluster test. |
Returns:
RED_BAD_PARAM if oInvalidAddress is not a valid address. RED_WORKFLOW_ERROR if the memory leak tracker is not active or has not been activated before the resource manager creation,
RED_FAIL if an invalid address has been found inside the cluster.
public virtual RED_RC RED::IResourceManager::CreateColorFontMaterial | ( | RED::Object *& | oMaterial, |
const RED::Color & | iColor, | ||
const RED::State & | iState | ||
) | = 0 |
Constant color material for fonts.
This method creates a material set with a constant color suitable to render RED::FNT_TRIANGLE fonts. RED::FNT_TRIANGLE fonts don't support high definition matrices and therefore can't be rendered using built-in shaders.
See also Geometry layers.
Parameters:
oMaterial: | Returned created material. |
iColor: | Creation color. |
iState: | Current transaction. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateColorMaterial | ( | RED::Object *& | oMaterial, |
const RED::Color & | iColor, | ||
const RED::State & | iState | ||
) | = 0 |
Constant color material.
This method creates a material set with a constant color, in a RED::RenderShaderSolid. The shader is in the RED::MTL_PRELIT rendering pass.
See also Geometry layers.
Parameters:
oMaterial: | Returned created material. |
iColor: | Creation color. |
iState: | Current transaction. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateFont | ( | RED::Object *& | oFont, |
const RED::State & | iState | ||
) | = 0 |
Creates a font object instance.
The created font must be specified before it can be used within a CID_REDTextShape (see RED::ITextShape) instance for the rendering.

Task: Creating a font
A font is a shared resource in REDsdk. It must be created directly from the cluster's resource manager:
// Create the font using the resource manager and retrieve its font interface:
RED::Object* font;
RC_TEST( iresmgr->CreateFont( font, iresmgr->GetState() ) );
RED::IFont* ifont = font->As< RED::IFont >();
Then, the font MUST be configured before it can be used for the rendering. If a font is not configured, then REDsdk rendering methods will return an error:
// Setup minimal font parameters for the display:
RC_TEST( ifont->SetType( RED::FNT_SYSTEM, iresmgr->GetState() ) );
RC_TEST( ifont->SetRenderMode( RED::FNT_TRIANGLE, iresmgr->GetState() ) );
RC_TEST( ifont->SetTypeFaceName( "Arial", iresmgr->GetState() ) );
RC_TEST( ifont->SetCharSet( RED::FNT_ANSI_CHARSET, iresmgr->GetState() ) );
RC_TEST( ifont->SetSize( 0.0f, 80.0f, iresmgr->GetState() ) );
Parameters:
oFont: | Created font object. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if an internal allocation did fail,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateImage2D | ( | RED::Object *& | oImage2D, |
const RED::State & | iState | ||
) | = 0 |
Creates a new 2D image instance.
Creates a new 2D bitmap image instance. At least one window must have been created before calling this method. Images can be created from any thread that is the unique edition thread, assuming that the engine has a valid transaction being opened.

Task: Creating a 2D image
RED::Object* image_2d;
// Create the image.
RC_TEST( iresmgr->CreateImage2D( image_2d, iresmgr->GetState() ) );
RED::IImage2D* i2d = image_2d->As< RED::IImage2D >();
// Let the engine to allocate the image 1024 x 1024 (POTD) pixels array for us.
RC_TEST( i2d->SetLocalPixels( NULL, RED::FMT_RGB, 1024, 1024 ) );
unsigned char* pixels = i2d->GetLocalPixels();
for( int y = 0; y < 1024; ++y )
for( int x = 0; x < 1024; ++x )
// Fill in the texture...
// Set the texture content to the renderer.
RC_TEST( i2d->SetPixels( RED::TGT_TEX_2D, iresmgr->GetState() ) );
This code sample creates a 2D image, uses REDsdk to allocate a local pixel array in the image and uploads the contents of this local pixel array in the engine (therefore on the GPU if REDsdk uses GPU rendering, and in CPU memory is REDsdk uses software rendering). The local pixel array remains. It can be deleted if not needed anymore using RED::IImage2D::ClearLocalPixels.
Parameters:
oImage2D: | Address of the created 2D image. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_INIT_FAILED if no window has ever been created yet,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateImage3D | ( | RED::Object *& | oImage3D, |
const RED::State & | iState | ||
) | = 0 |
Creates a new 3D image instance.
Creates a new volume image instance. At least one window must have been created before calling this method. Images can be created from any thread that is the unique edition thread, assuming that the engine has a valid transaction being opened.

Task: Creating a 3D image
RED::Object* image_3d;
// Create the image.
RC_TEST( iresmgr->CreateImage3D( image_3d, iresmgr->GetState() ) );
RED::IImage3D* i3d = image_3d->As< RED::IImage3D >();
// Let the engine to allocate the image 256x256x256 pixels array for us.
RC_TEST( i3d->SetLocalPixels( NULL, RED::FMT_RGB, 256, 256, 256 ) );
unsigned char* pixels = i3d->GetLocalPixels();
for( int z = 0; z < 256; ++z )
for( int y = 0; y < 256; ++y )
for( int x = 0; x < 256; ++x )
// Fill in the texture...
// Set the texture content to the renderer.
RC_TEST( i3d->SetPixels( RED::TGT_TEX_3D, iresmgr->GetState() ) );
This code sample creates a 3D image, uses REDsdk to allocate a local pixel array in the image and uploads the contents of this local pixel array in the engine (therefore on the GPU if REDsdk uses GPU rendering, and in CPU memory is REDsdk uses software rendering). The local pixel array remains. It can be deleted if not needed anymore using RED::IImage3D::ClearLocalPixels.
Parameters:
oImage3D: | Address of the created 3D image. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_INIT_FAILED if no window has ever been created yet,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateImageComposite | ( | RED::Object *& | oImageComp, |
const RED::State & | iState | ||
) | = 0 |
Creates a new composite image instance.
Creates a new composite image instance. At least one window must have been created before calling this method. Images can be created from any thread that is the unique edition thread, assuming that the engine has a valid transaction being opened.
See also Setup a composite image.
Parameters:
oImageComp: | Address of the created composite image. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_INIT_FAILED if no window has ever been created yet,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateImageCube | ( | RED::Object *& | oImageCube, |
const RED::State & | iState | ||
) | = 0 |
Creates a new cube image instance.
Creates a new cube image instance. At least one window must have been created before calling this method. Images can be created from any thread that is the unique edition thread, assuming that the engine has a valid transaction being opened.

Task: Creating a cube image
RED::Object* image_cube;
// Create the image.
RC_TEST( iresmgr->CreateImageCube( image_cube, iresmgr->GetState() ) );
RED::IImageCube* icube = image_cube->As< RED::IImageCube >();
for( int face = 0; face < 6; ++face )
{
// Set the content of each cube face.
RC_TEST( icube->SetFacePixels( face, face_pixels[face], 512, RED::FMT_RGB, iresmgr->GetState() ) );
}
Here, we assume that we have a valid pixel array in 'face_pixels[face]', for each of the 6 faces of the cube to process.
Parameters:
oImageCube: | Address of the created REDImageCube. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_INIT_FAILED if no window has ever been created yet,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateImageReadback | ( | RED::Object *& | oImageReadback, |
const RED::State & | iState | ||
) | = 0 |
Creates a new readback image instance.
Creates a new composite image instance. At least one window must have been created before calling this method. Images can be created from any thread that is the unique edition thread, assuming that the engine has a valid transaction being opened.
Parameters:
oImageReadback: | Address of the created REDImageReadback. |
iState: | The current transaction. |
Returns:
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_INIT_FAILED if no window has ever been created yet,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateMaterial | ( | RED::Object *& | oMaterial, |
const RED::State & | iState | ||
) | = 0 |
Creates a new REDMaterial instance.
This method instantiates a new material object. That material can be set as the material of a given shape instance using RED::IShape::SetMaterial.
See also Hello world!.
Parameters:
oMaterial: | Pointer to the created material object. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_ALLOC_FAILURE if an internal allocation did fail,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateParametrizationMaterial | ( | RED::Object *& | oMaterial, |
RED::MESH_CHANNEL | iParameterChannel, | ||
const RED::Color & | iColor, | ||
float | iLineWidth, | ||
int | iStippleFactor, | ||
unsigned short | iStipplePattern, | ||
bool | iSmooth, | ||
const RED::State & | iState | ||
) | = 0 |
Creates a material for the display of dashed lines after a parametrization.
A special material is required to display the results of a call to RED::ILineShape::Parametrize. This method creates the material with the requested setup to do so. Specifically, it discards connectivity strip segments that are requested to draw the strip geometry into one single part.
See the RED::ILineShape::Parametrize method for all details. The 'iParameterChannel' should be set to the geometrical channel used to store the results of the parametrization. Then, the material is set to render lines with a stipple pattern ( 'iStippleFactor' and 'iStipplePattern' ) as they can be specified in a RED::StateShader, and may apply line smoothing (and blending) based on 'iSmooth'.
The created material has disabled batching capabilities (RED::IMaterial::SetBatchMode) so that different shapes can use it.
See also Generating vector graphics.
Parameters:
oMaterial: | The created material. |
iParameterChannel: | The channel that contains the parametrization of the strip to draw. |
iColor: | The material's color. |
iLineWidth: | Line thickness. |
iStippleFactor: | The repeating factor of the stipple pattern. |
iStipplePattern: | The stipple pattern. If the value of the pattern is set to 0xffff, a continuous line is rendered without stipple pattern. |
iSmooth: | Enable line smoothing on / off. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::CreateTexturedFontMaterial | ( | RED::Object *& | oMaterial, |
const RED::Color & | iColor, | ||
const RED::State & | iState | ||
) | = 0 |
Helper to create a complete textured font material.
Creates a complete material for the rendering of textured fonts. A state shader is set in the RED::MTL_PRELIT to do an ADDITIVE blending of the RED::RenderShaderText that follows after. The rendering uses the provided 'iColor'. The shader uses the linear alpha interpolation mode.
See also Displaying texts.
Parameters:
oMaterial: | Returned created material. |
iColor: | Creation color. |
iState: | Current transaction. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation failed,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::DeleteAllFonts | ( | const RED::State & | iState | ) = 0 |
Deletes all font objects instances.
Deletes all fonts stored by the resource manager. It's the caller's responsibility to ensure that these fonts are no longer used by any shape in any scene graph of the cluster.
Parameters:
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if an invalid address was provided to the method,
RED_WORKFLOW_ERROR if the deletion occurs outside of a transaction,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::DeleteAllImages | ( | const RED::State & | iState | ) = 0 |
Deletes all images from the resource manager.
This is the caller's responsibility to ensure that no more image are used by any material used in the cluster at the time of the operation.
Image destruction is immediate. Image may be still referenced in the previous transaction list of images stored by the resource manager. It's the responsibility of the caller to make sure that these images are not used anymore.
Image destruction should only occur from the rendering thread and it can't happen while the software ray-tracer is rendering a scene.
Parameters:
iState: | The current transaction. |
Returns:
RED_WORKFLOW_ERROR if the deletion has occurred outside of a transaction,
RED_WORKFLOW_ERROR if a software traced image is in progress,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::DeleteAllMaterials | ( | const RED::State & | iState | ) = 0 |
Deletes all the materials from the resource manager.
Parameters:
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_WORKFLOW_ERROR if the deletion occurs outside of a transaction,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::DeleteFont | ( | RED::Object * | ioFont, |
const RED::State & | iState | ||
) | = 0 |
Deletes a font object instance.
Deletes all fonts stored by the resource manager. It's the caller's responsibility to ensure that that font is no longer used by any shape in any scene graph of the cluster.
Parameters:
ioFont: | Font object address to be deleted. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if an invalid address was provided to the method,
RED_WORKFLOW_ERROR if the deletion occurs outside of a transaction,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::DeleteImage | ( | RED::Object * | iImage, |
const RED::State & | iState | ||
) | = 0 |
Deletes an image from the resource manager.
This is the caller's responsibility to ensure that this image is no longer used by any material or viewpoint parameter or instance callback used in the cluster at the time of the operation.
On calling this method a search for remaining usages of the image is made, which can take a bit of time in large clusters. In that case, the RED::IResourceManager::SetAliveImagesCheck method can be used to enable / disable the usage search. If the image is found to be still used, RED_SCG_IMAGE_STILL_IN_USE is returned and the REDsdk error callback will provide the address of the object holding the image (viewpoint, material). The image will not be released.
Image destruction is immediate. The image may be still referenced in the previous transaction list of images stored by the resource manager. It's the responsibility of the caller to make sure that this image is not used anymore.
Image destruction should only occur from the rendering thread and it can't happen while the software ray-tracer is rendering a scene.
See also Creating and destroying images.
Parameters:
iImage: | Image address to be deleted. |
iState: | The current transaction. |
Returns:
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_WORKFLOW_ERROR is a software tracer image is being processed,
RED_SCG_IMAGE_STILL_IN_USE is iImage is still used somewhere,
RED_FAIL if the object is not an image.
public virtual RED_RC RED::IResourceManager::DeleteMaterial | ( | RED::Object * | ioMaterial, |
const RED::State & | iState | ||
) | = 0 |
Deletes a material from the resource manager.
This method deletes a material from the resource manager. The caller should ensure that this material is no longer used by any shape of any scene graph in the cluster. If the material has a controller that is associated to it, the controller is unregistered from the material and destroyed by the call.
See also Creating and destroying materials.
Parameters:
ioMaterial: | Material pointer to the class to delete. |
iState: | Current transaction parameter. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_WORKFLOW_ERROR if the deletion occurs outside of a transaction,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::EndState | ( | ) = 0 |
Indicates the end of a transaction.
This method terminates the transaction initiated earlier on by RED::IResourceManager::BeginState. From now on, all changes to perform on engine data must occur using another transaction, that is to be initiated again by a call to RED::IResourceManager::BeginState.
The next draw method will render the most recent finished transaction. This is the transaction number defined by the last call to RED::IResourceManager::EndState. Note that at least one first transaction must be finished to before calling a rendering method on the RED::IWindow.
Calling this method several times has no effect. The first call closes the current transaction and all subsequent calls are ignored.
This method flushes all the pending orders that have been defined during the transaction. It destroys all objects that have been sent to the RED::Factory::DeleteInstance, and performs the update of the entire engine data cluster for the rendering.
This method should not be called if no window has been created yet. As REDsdk is a hybrid CPU / GPU rendering engine, it may need to do OpenGL operations during the EndState call. Before it can proceed with any OpenGL operation, it needs a window that provides the necessary informations to setup the link with the OpenGL layer of the hosting system.
See Transaction management for details on transactions.
Returns:
RED_ALLOC_FAILURE if an internal memory allocation has failed,
RED_INIT_FAILED if we have no window created yet. Due to possible GPU updates, REDsdk needs a window to be created before any transaction can be closed,
Any other return code issued from modified objects.
public virtual RED::Object * RED::IResourceManager::FindFont | ( | unsigned int | iFontID, |
int | iStateNumber = -1 | ||
) | const = 0 |
Finds a font instance by its ID.
Parameters:
iFontID: | Identifier of the font to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED::Object * RED::IResourceManager::FindImage | ( | unsigned int | iImageID, |
int | iStateNumber = -1 | ||
) | const = 0 |
Searches an image by its id.
Performs a search of the image by the provided iImageID. The first image occurrence found with that ID is returned.
Parameters:
iImageID: | Identifier of the image to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED::Object * RED::IResourceManager::FindMaterial | ( | unsigned int | iMaterialID, |
int | iStateNumber = -1 | ||
) | = 0 |
Search a material by its id.
Performs a search of the material by the provided iMaterialID. The first material occurrence with this ID is returned.
See also Cutting geometries: a practical example.
Parameters:
iMaterialID: | Identifier of the material to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED::Object * RED::IResourceManager::FindMaterial | ( | const RED::String & | iMaterialLabel, |
int | iStateNumber = -1 | ||
) | = 0 |
Search a material by its label.
This is a helper which calls FindMaterial( iMaterialLabel.ToID(), iStateNumber ).
See also Cutting geometries: a practical example.
Parameters:
iMaterialLabel: | Label of the material to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED_RC RED::IResourceManager::FindMaterials | ( | RED::Vector< RED::Object * > & | oMaterials, |
unsigned int | iMaterialID, | ||
int | iStateNumber = -1 | ||
) | = 0 |
Searches all materials with a given id.
Searches all materials having the iMaterialID id.
Parameters:
oMaterials: | A vector filled with all materials found. |
iMaterialID: | Identifier of the material to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED_RC RED::IResourceManager::FindMaterials | ( | RED::Vector< RED::Object * > & | oMaterials, |
const RED::String & | iMaterialID, | ||
int | iStateNumber = -1 | ||
) | = 0 |
Searches all materials with a given label.
This is a helper which calls FindMaterials( oMaterials, iMaterialLabel.ToID(), iStateNumber ).
Parameters:
oMaterials: | A vector filled with all materials found. |
iMaterialID: | Identifier of the material to look for. |
iStateNumber: | Queried transaction number. |
Returns:
public virtual RED_RC RED::IResourceManager::GetAllSystemFonts | ( | RED::Vector< RED::String > & | oFontList | ) const = 0 |
Enumerates all available system fonts.
This method enumerates all fonts available in the system. Returned fonts are identified by their full typeface string. At least a window must have been created for this call to work.
Parameters:
oFontList: | List of available fonts. |
Returns:
RED_INIT_FAILED if we have no valid window in the cluster,
RED_ALLOC_FAILURE if an internal allocation did fail,
RED_FAIL otherwise.
public virtual void RED::IResourceManager::GetBatchSyncCallback | ( | RED::BATCH_SYNC_CALLBACK & | oCallback, |
void *& | oUserData | ||
) | const = 0 |
Returns the batch sync callback parameters currently set.
Parameters:
oCallback: | The address of the callback being set if any. |
oUserData: | The user data associated to the callback. |
public virtual RED::Object * RED::IResourceManager::GetDataManager | ( | ) = 0 |
Retrieves the cluster's data manager instance.
This method returns the data manager object instance that is associated to this cluster. The data manager is used for all context based animations for loaded files.
The returned data manager implements the RED::IDataManager interface.
Returns:
NULL if its memory allocation has failed.
public virtual RED::REDSDK_ERROR_CALLBACK RED::IResourceManager::GetErrorCallback | ( | ) const = 0 |
Returns:
public virtual void * RED::IResourceManager::GetErrorCallbackUserData | ( | ) const = 0 |
Returns:
public virtual const RED::String & RED::IResourceManager::GetErrorFilePath | ( | ) const = 0 |
Returns:
public virtual const RED::Vector< RED::Object * > & RED::IResourceManager::GetFontList | ( | int | iStateNumber = -1 | ) const = 0 |
Returns the list of fonts.
The returned list is not reliable if fonts are created or deleted while it's in use.
Parameters:
iStateNumber: | Queried transaction number. |
Returns:
public virtual const RED::Vector< RED::Object * > & RED::IResourceManager::GetImageList | ( | int | iStateNumber = -1 | ) const = 0 |
Returns the list of images stored by the resource manager.
Please note that the returned list is not reliable if images are created or deleted while it's in use, as the returned vector is a pointer to the class' internal image list.
Parameters:
iStateNumber: | Queried transaction number. |
Returns:
public virtual void RED::IResourceManager::GetInterruptCallback | ( | RED::INTERRUPT_CALLBACK & | oCallback, |
void *& | oUserData | ||
) | const = 0 |
Returns the current user interruption callback.
Parameters:
oCallback: | The address of the callback being set if any. |
oUserData: | The user data associated to the callback. |
public virtual RED::Object * RED::IResourceManager::GetMaterialController | ( | const RED::Object * | iMaterial | ) const = 0 |
Gets a material controller for a given material.
The returned object implements the RED::IMaterialController interface.
See also Using the realistic material.
Parameters:
iMaterial: | pointer to the material. |
Returns:
public virtual const RED::Vector< RED::Object * > & RED::IResourceManager::GetMaterialList | ( | int | iStateNumber = -1 | ) const = 0 |
Returns the list of materials.
The returned list is not reliable if materials are created or deleted while it's in use.
Parameters:
iStateNumber: | Queried transaction number. |
Returns:
public virtual int RED::IResourceManager::GetNumberOfProcessors | ( | ) const = 0 |
Returns the number of CPU cores on the system.
This method returns the number of CPU cores available on the system.
See also Generating vector graphics.
Returns:
public virtual RED::OPENGL_BUFFER_CALLBACK RED::IResourceManager::GetOpenGLBufferCallback | ( | ) const = 0 |
Returns:
public virtual void * RED::IResourceManager::GetOpenGLBufferCallbackUserData | ( | ) const = 0 |
Returns:
public virtual RED::OPENGL_MATERIAL_CALLBACK RED::IResourceManager::GetOpenGLMaterialCallback | ( | ) const = 0 |
Returns:
public virtual void * RED::IResourceManager::GetOpenGLMaterialCallbackUserData | ( | ) const = 0 |
Returns:
public virtual RED::OPENGL_VIEWPOINT_CALLBACK RED::IResourceManager::GetOpenGLViewpointCallback | ( | ) const = 0 |
Returns:
public virtual void * RED::IResourceManager::GetOpenGLViewpointCallbackUserData | ( | ) const = 0 |
Returns:
public virtual RED::HARDWARE_PLATFORM RED::IResourceManager::GetPlatform | ( | ) const = 0 |
Gets the runtime platform identifier.
Returns the identifier of the runtime platform identifier. See the RED::HARDWARE_PLATFORM enum for the list of all platform identifiers.
Unless specified by RED::IResourceManager::SetPlatform, the runtime platform is defined by the chipset revision of the computer running the application.
For example, if the program is running on a ATI Radeon 9800 Pro, the returned runtime platform should be RED_HW_ATI_R300.
Note that the runtime platform is defined after the first window creation. Before that, the method will return RED_HW_GENERIC.
See Hardware platforms for details on this topic.
Returns:
public virtual RED_RC RED::IResourceManager::GetShader | ( | const RED::String *& | oShaderString, |
const RED::ShaderProgramID & | iShaderID | ||
) | = 0 |
Gets the shader program string.
This method returns the program associated to a given iShaderID shader ID.
Parameters:
oShaderString: | Returned shader program when found, NULL otherwise. This string address directly points into the resource manager program storage, so please don't delete it! |
iShaderID: | Shader identifier. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_FAIL otherwise.
public virtual void RED::IResourceManager::GetShadingCallback | ( | RED::SOFT_SHADER_CALLBACK & | oCallback, |
void *& | oUserData, | ||
const RED::String & | iLabel | ||
) | const = 0 |
Gets a registered shading callback from its label.
Parameters:
oCallback: | pointer to the callback registered with the provided label on sucess, NULL otherwise. |
oUserData: | pointer to the custom user data on sucess, NULL otherwise. |
iLabel | registration label of the shading callback. |
public virtual const RED::State & RED::IResourceManager::GetState | ( | ) const = 0 |
Gets the current state transaction object.
This method can be queried anytime to figure out the current status of the cluster versus transactions.
If we're in a BeginState/EndState transaction, the method returns the current state, that is also retrieved by the RED::IResourceManager::BeginState method. If we are not in a transaction, the method returns an invalid state, whose mode is set to RED::TRANSACTION_OUT.
See Transaction management for details on transactions.
Returns:
public virtual RED_RC RED::IResourceManager::GetWindowList | ( | RED::Vector< RED::Object * > & | oWindowList, |
int | iStateNumber = -1 | ||
) | const = 0 |
Gets the list of windows we have in the cluster.
Parameters:
oWindowList: | A vector filled with all addresses of all windows that exist at that time in the cluster. |
iStateNumber: | Queried transaction number. |
Returns:
RED_BAD_PARAM if the method received an invalid parameter,
RED_ALLOC_FAILURE if an internal allocation did fail,
RED_FAIL otherwise.
public virtual bool RED::IResourceManager::IsAliveImagesCheck | ( | ) const = 0 |
Returns:
public virtual bool RED::IResourceManager::IsShadingCallbackRegistered | ( | const RED::String & | iLabel | ) const = 0 |
Checks if a custom shading callback has already been registered for the given label.
Parameters:
iLabel: | label of the custom callback. |
Returns:
public virtual bool RED::IResourceManager::IsSynchronizationLock | ( | ) const = 0 |
Returns:
public virtual RED_RC RED::IResourceManager::LoadShaderFromString | ( | RED::ShaderProgramID & | oShaderID, |
const RED::String & | iShaderProgram | ||
) | = 0 |
Loads a shader program from a character string.
This method loads the shader from the iShaderProgram contents. The method returns an identifier in oShaderId that can be used to access to the loaded byte buffer, using RED::IResourceManager::GetShader.
Theis method can be used to load ARB programs or GLSL programs under OpenGL.
See also Cartoon shading.
Parameters:
oShaderID: | Shader identifier to rely on for this shader. This identifier value will remain valid until the resource manager's destruction. |
iShaderProgram: | Shader program string. |
Returns:
RED_ALLOC_FAILURE if an internal memory allocation did fail,
RED_FAIL when an unexpected error occurred.
public virtual RED_RC RED::IResourceManager::RegisterMaterialController | ( | RED::Object * | iMaterialController | ) = 0 |
Registers a material controller.
The given controller will be registered for the material it points to (the one passed at the controller creation). If the material has already a controller registered for, the passed controller will be ignored and nothing will be done by the call. You must previously ensure that the material has no controller registered for (by using GetMaterialController and optionally UnregisterMaterialController).
Parameters:
iMaterialController: | pointer to the material controller. |
Returns:
RED_BAD_PARAM if the parameter is NULL or does not implement the required interface,
RED_ALLOC_FAILURE on memory allocation error,
RED_FAIL otherwise.
public virtual RED_RC RED::IResourceManager::RegisterShadingCallback | ( | const RED::String & | iLabel, |
RED::SOFT_SHADER_CALLBACK | iCallback, | ||
void * | iUserData | ||
) | = 0 |
Registers a custom shading callback.
If a different callback has already been registered for the given label, RED_FAIL is returned.
See also Cartoon shading.
Parameters:
iLabel: | label of the custom callback. This is the label passed to the RED::ShaderString::SoftShaderStart method. |
iCallback: | pointer to the shading callback. |
iUserData: | optional custom user data. |
Returns:
RED_ALLOC_FAILURE on a memory allocation error,
RED_OK on success.
public virtual void RED::IResourceManager::SetAliveImagesCheck | ( | bool | iOnOff | ) = 0 |
Turn on or off live image checking within REDsdk.
This method can be called to turn on or off live image checking in REDsdk. When enabled, all images used in materials or by controllers are checked whenever possible for existence (e.g. are these image addresses part of RED::IResourceManager::GetImageList?).
Unless your application is performance critical, there's no need to turn live image checking off. The extra cost is in the millisecond range and proportional to the number of material changes that occur per frame.
Default alive image checking is disabled.
An image address which is found invalid triggers a RED_SCG_INVALID_IMAGE_ADDRESS error code.
Parameters:
iOnOff: | Set to false to turn off live image checking. |
public virtual void RED::IResourceManager::SetBatchSyncCallback | ( | RED::BATCH_SYNC_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
Setups a callback to flag the end of GPU data synchronization.
See the RED::BATCH_SYNC_CALLBACK details for explanations on the batch synchronization callback.
Parameters:
iCallback: | The callback address. |
iUserData: | User data argument to the callback. |
public virtual RED_RC RED::IResourceManager::SetErrorCallback | ( | RED::REDSDK_ERROR_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
public virtual RED_RC RED::IResourceManager::SetErrorFilePath | ( | const RED::String & | iFilePath | ) = 0 |
Sets the path of the REDsdk error file.
Defines the complete filepath of the "redsdk_error.txt" file which can be produced by REDsdk whenever an error occurs. See Error tracking for details on detailed error handling within REDsdk. If the folder does not exist, no error file will be written by REDsdk. The default error filepath is the current directory: ".".
Parameters:
iFilePath: | The complete filepath to the folder in which the error file will be written to. Example: "C:/Users/Bob/log". |
Returns:
public virtual void RED::IResourceManager::SetInterruptCallback | ( | RED::INTERRUPT_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
Sets the user defined interruption callback.
The engine calls the interrupt callback on a regular basis during the rendering of a frame. This can be used to stop a frame whenever the user does not want it to finish.
Parameters:
iCallback: | Pointer to the user defined callback. |
iUserData: | User data argument to the callback. |
public virtual void RED::IResourceManager::SetOpenGLBufferCallback | ( | RED::OPENGL_BUFFER_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
Setup an OpenGL buffer callback.
Parameters:
iCallback: | The callback. Set it to NULL to remove any previous callback. |
iUserData: | User data pointer. |
public virtual void RED::IResourceManager::SetOpenGLMaterialCallback | ( | RED::OPENGL_MATERIAL_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
Setup an OpenGL material callback.
Parameters:
iCallback: | The callback. Set it to NULL to remove any previous callback. |
iUserData: | User data pointer. |
public virtual void RED::IResourceManager::SetOpenGLViewpointCallback | ( | RED::OPENGL_VIEWPOINT_CALLBACK | iCallback, |
void * | iUserData | ||
) | = 0 |
Setup an OpenGL viewpoint callback.
Parameters:
iCallback: | The callback. Set it to NULL to remove any previous callback. |
iUserData: | User data pointer. |
public virtual RED_RC RED::IResourceManager::SetPlatform | ( | RED::HARDWARE_PLATFORM | iPlatformId | ) = 0 |
Selects the platform identifier for this application.
RED::Shader objects are able to register shaders per platform. A platform may be a chipset revision or an user tag. It's used to choose the programs and parameters that'll be used by the shader at runtime for the rendering.
For example, a shader may use a given pixel shader on a NVIDIA hardware and another one on ATI hardware. It may use a set of parameters for a given user tag and another one for another tag. If we think to a game or to a game like application, we could set a "graphic quality" setting, and choose the tag value based on the user's input.
The engine has a runtime platform, which is set to the identifier of the GPU chipset used by the application, unless it's changed by this method.
The engine uses a platform tree to parse shader configurations for a version of data that matches the runtime platform requirements.
If the runtime platform is any of the RED::HW_NVIDIA_<chipset> values, then if the shader has no configuration for this platform, the engine will look for a RED::HW_NVIDIA_GENERIC version of the shader. Then, if this research fails, it'll look for a RED::HW_GENERIC version of the shader. Finally if this fails, there'll be nothing rendered for this shader.
The same applies to any RED::HW_ATI_<chipset> platform that goes to RED::HW_ATI_GENERIC before going to RED::HW_GENERIC and to any RED::HW_INTEL_<chipset> that goes to RED::HW_INTEL_GENERIC before going to RED::HW_GENERIC.
The same rule also applies to all RED::HW_USER_<number> platforms and to the RED::HW_USER_GENERIC platform.
See RED::HARDWARE_PLATFORM for the list of all available platform identifiers.
The platform can't be chosen after the startup of the first transaction.
See Hardware platforms for details on this topic.
Parameters:
iPlatformId: | Platform identifier that'll be used by the application. |
Returns:
RED_BAD_PARAM if the method has received an invalid parameter,
RED_WORKFLOW_ERROR if the operation was performed too late.
public virtual void RED::IResourceManager::SetSynchronizationLock | ( | bool | iOnOff | ) = 0 |
Turn on or off the synchronization lock.
This method can be used to disarm the internal synchronization lock used to prevent concurrent accesses to occur while using REDsdk in a multi-threaded environment with reader & writer threads. This method should be called once at the application startup. Turning off the synchronization lock can improve REDsdk edition performance a bit in performance critical applications.
Parameters:
iOnOff: | true (default) to turn on the synchronization lock, false to disable it. |
public virtual RED_RC RED::IResourceManager::UnregisterMaterialController | ( | const RED::Object * | iMaterial | ) = 0 |
public virtual RED_RC RED::IResourceManager::UnRegisterShadingCallback | ( | const RED::String & | iLabel | ) = 0 |