SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MaterialManager Class Reference
Inheritance diagram for MaterialManager:
Inheritance graph
[legend]

Public Member Functions

 ~MaterialManager ()
 Frees all allocated data structures.
 
void loadMaterial ()
 
MaterialgetMaterialFor (video::ITexture *t, scene::IMeshBuffer *mb)
 
MaterialgetMaterialFor (video::ITexture *t, video::E_MATERIAL_TYPE material_type)
 
MaterialgetMaterialFor (video::ITexture *t)
 
MaterialgetMaterialSPM (std::string lay_one_tex_lc, std::string lay_two_tex_lc, const std::string &def_shader_name="solid")
 
void setAllMaterialFlags (video::ITexture *t, scene::IMeshBuffer *mb)
 Searches for the material in the given texture, and calls a function in the material to set the irrlicht material flags. More...
 
void setAllUntexturedMaterialFlags (scene::IMeshBuffer *mb)
 
int addEntity (Material *m)
 
MaterialgetMaterial (const std::string &t, bool is_full_path=false, bool make_permanent=false, bool complain_if_not_found=true, bool strip_path=true, bool install=true)
 Returns the material of a given name, if it doesn't exist, it is loaded. More...
 
void addSharedMaterial (const std::string &filename, bool deprecated=false)
 
bool pushTempMaterial (const std::string &filename, bool deprecated=false)
 
bool pushTempMaterial (const XMLNode *root, const std::string &filename, bool deprecated=false)
 
void popTempMaterial ()
 
void makeMaterialsPermanent ()
 Makes all materials permanent. More...
 
bool hasMaterial (const std::string &fname)
 
void unloadAllTextures ()
 
MaterialgetDefaultSPMaterial (const std::string &shader_name, const std::string &layer_one_lc="", bool full_path=false)
 
MaterialgetLatestMaterial ()
 

Private Member Functions

void parseMaterialFile (const std::string &filename)
 

Private Attributes

int m_shared_material_index
 
std::vector< Material * > m_materials
 
std::map< std::string, Material * > m_default_sp_materials
 

Member Function Documentation

◆ getMaterial()

Material * MaterialManager::getMaterial ( const std::string &  fname,
bool  is_full_path = false,
bool  make_permanent = false,
bool  complain_if_not_found = true,
bool  strip_path = true,
bool  install = true 
)

Returns the material of a given name, if it doesn't exist, it is loaded.

Materials that are just loaded are not permanent, and so get deleted after a race (this is used to load temporary, track specific materials). To make material permanent, make_permanent must be set to true. This is used for the powerup_manager, since not all icons for the powerups are listed in the materials.dat file, causing the missing ones to be temporary only (and then get deleted after one race, causing the powerup_manager to have invalid pointers.

Parameters
fnameName of the material.
is_full_pathTrue if the name includes the path (defaults to false)
make_permanentTrue if this material should be kept in memory (defaults to false)

◆ makeMaterialsPermanent()

void MaterialManager::makeMaterialsPermanent ( )

Makes all materials permanent.

Used for overworld.

◆ setAllMaterialFlags()

void MaterialManager::setAllMaterialFlags ( video::ITexture *  t,
scene::IMeshBuffer *  mb 
)

Searches for the material in the given texture, and calls a function in the material to set the irrlicht material flags.

Parameters
tPointer to the texture.
mbPointer to the mesh buffer.

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