LightsprintSDK 2021.08.08
rr::RRMaterials Class Reference

#include <RRMaterial.h>

Inheritance diagram for rr::RRMaterials:
rr::RRVector< RRMaterial * >

Public Types

typedef RRMaterialsLoader(const RRString &filename, RRFileLocator *textureLocator, bool *aborting)
 
typedef bool Saver(const RRMaterials *materials, const RRString &filename)
 

Public Member Functions

bool save (const RRString &filename) const
 
- Public Member Functions inherited from rr::RRVector< RRMaterial * >
 RRVector ()
 
 RRVector (const RRVector &a)
 
RRVectoroperator= (const RRVector &a)
 
void resize (unsigned newSize, RRMaterial * initial=RRMaterial *())
 
void push_back (RRMaterial * a)
 
void pop_back ()
 
void erase (RRMaterial * *e)
 
size_t size () const
 
RRMaterial * & operator[] (unsigned i)
 
const RRMaterial * & operator[] (unsigned i) const
 
void clear ()
 
RRMaterial * * begin ()
 
const RRMaterial * * begin () const
 
RRMaterial * * end ()
 
const RRMaterial * * end () const
 
void insert (RRMaterial * *_where, const RRMaterial * *_first, const RRMaterial * *_last)
 
bool operator== (const RRVector< RRMaterial * > &a) const
 
bool operator!= (const RRVector< RRMaterial * > &a) const
 
 ~RRVector ()
 

Static Public Member Functions

static RRMaterialsload (const RRString &filename, RRFileLocator *textureLocator)
 
static void registerLoader (const char *extensions, Loader *loader)
 
static void registerSaver (const char *extensions, Saver *saver)
 
static const char * getSupportedLoaderExtensions ()
 
static const char * getSupportedSaverExtensions ()
 

Additional Inherited Members

- Protected Attributes inherited from rr::RRVector< RRMaterial * >
RRMaterial * * c
 
unsigned numAllocated
 
unsigned numUsed
 

Detailed Description

Material library, collection of materials.

Material collection that can be loaded or saved to disk. Individual materials are not owned by collection, they are not deleted in destructor.

Member Typedef Documentation

◆ Loader

typedef RRMaterials * rr::RRMaterials::Loader(const RRString &filename, RRFileLocator *textureLocator, bool *aborting)

Template of custom material loader.

◆ Saver

typedef bool rr::RRMaterials::Saver(const RRMaterials *materials, const RRString &filename)

Template of custom material saver.

Member Function Documentation

◆ load()

static RRMaterials * rr::RRMaterials::load ( const RRString filename,
RRFileLocator textureLocator 
)
static

Loads materials from file, returns true on success.

◆ save()

bool rr::RRMaterials::save ( const RRString filename) const

Saves materials to file, returns true on success.

◆ registerLoader()

static void rr::RRMaterials::registerLoader ( const char *  extensions,
Loader loader 
)
static

Registers material loader so it can be used by RRMaterial::load().

Extensions are case insensitive, in "*.rrmaterial;*.mtl" format.

Several loaders are implemented in LightsprintIO library, rr_io::registerIO() will register all of them for you (by calling this function several times).

Multiple loaders may be registered, even for the same extension. If first loader fails to load scene, second one is tried etc.

◆ registerSaver()

static void rr::RRMaterials::registerSaver ( const char *  extensions,
Saver saver 
)
static

Similar to registerLoader().

◆ getSupportedLoaderExtensions()

static const char * rr::RRMaterials::getSupportedLoaderExtensions ( )
static

Returns list of supported loader extensions in "*.rrmaterial;*.mtl" format.

All extensions of registered loaders are returned in one static string, don't free() it. nullptr is returned if no loaders were registered.

◆ getSupportedSaverExtensions()

static const char * rr::RRMaterials::getSupportedSaverExtensions ( )
static

Returns list of supported saver extensions in "*.rrmaterial;*.mtl" format.

All extensions of registered savers are returned in one static string, don't free() it. nullptr is returned if no savers were registered.